Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(ns lein-script-test
(:require [ccw.util.eclipse :as e]))
(defn greet [context]
(e/info-dialog "Hello world"
"This popup provided to you from a user script"))
;; these two def* build the fragment using the provided symbol and the current ns
(defcommand greeter
:command-name "Greetings from CCW"
:category "org.eclipse.ui.category.window")
(defhandler handler-factory :for greeter
[context] (ccw.util.GenericHandler. #'greet))
(defmacro defcommand [name & {:as opts}]
`(do
(def ~name (merge
{:element-id ~(str *ns* "/" (ns-name name))}
~opts))
(set! *fragment*
(update-in [:commands]
(fnil conj []) ~name))))
(defmacro defhandler [name command & body]
`(do
(defn ~name ~@body)
(set! *fragment*
(update-in [:handlers]
(fnil conj [])
{:contribution-URI
~(str "bundleclass://ccw.core/clojure/"
(ns-name *ns*) "/" name)
:command (:element-id ~command)}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.