-
-
Save casperc/e1fe946a9c2fc9a05cbb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns lein-headless | |
(:require [ccw.e4.dsl :refer [defcommand defhandler defkeybinding]] | |
[ccw.e4.model :refer [context-key]]) | |
(:import [ccw.launching ClojureLaunchShortcut])) | |
(defn run | |
"Try to start a Leiningen Project. If focus is on a ClojureEditor, then first | |
try to launch from the editor project, else try to launch from the selection." | |
[context] | |
(let [editor (context-key context org.eclipse.ui.IEditorPart)] | |
(cond | |
(instance? ccw.editors.clojure.ClojureEditor editor) | |
(future | |
(-> (ClojureLaunchShortcut.) | |
(.launch editor nil))) | |
:else | |
(future | |
(-> (ClojureLaunchShortcut.) | |
(.launch (context-key context :active-selection) nil)))))) | |
(defcommand run-lein-headless "RUN as Leiningen Project") | |
(defhandler run-lein-headless run) | |
(defkeybinding run-lein-headless "Alt+L P") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment