Skip to content

Commit

Permalink
changed dependency to [franks42/seesaw "1.4.2-SNAPSHOT"], which inclu…
Browse files Browse the repository at this point in the history
…des the seesaw.clipboard and seesaw.rsyntaxtextarea

changed clipboard and rsyntaxtextarea interactions to conform to seesaw
pushed new 1.3.0-SNAPSHOT to clojars for testing
  • Loading branch information
franks42 committed May 8, 2012
1 parent 9bb4398 commit 76b00d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 49 deletions.
11 changes: 3 additions & 8 deletions pom.xml
Expand Up @@ -17,7 +17,7 @@
<scm> <scm>
<connection>scm:git:git://github.com/franks42/clj-ns-browser.git</connection> <connection>scm:git:git://github.com/franks42/clj-ns-browser.git</connection>
<developerConnection>scm:git:ssh://git@github.com/franks42/clj-ns-browser.git</developerConnection> <developerConnection>scm:git:ssh://git@github.com/franks42/clj-ns-browser.git</developerConnection>
<tag>c8706573f5dd282e0e81f0c34379c9c80a9fa1da</tag> <tag>9bb4398b63e1165b5c0dc41be6c37895a185345d</tag>
<url>https://github.com/franks42/clj-ns-browser</url> <url>https://github.com/franks42/clj-ns-browser</url>
</scm> </scm>
<build> <build>
Expand Down Expand Up @@ -63,9 +63,9 @@
<version>1.3.0</version> <version>1.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>seesaw</groupId> <groupId>franks42</groupId>
<artifactId>seesaw</artifactId> <artifactId>seesaw</artifactId>
<version>1.4.1</version> <version>1.4.2-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.clojure</groupId> <groupId>org.clojure</groupId>
Expand Down Expand Up @@ -98,11 +98,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.fife.ui</groupId>
<artifactId>rsyntaxtextarea</artifactId>
<version>2.0.3</version>
</dependency>
<dependency> <dependency>
<groupId>org.thnetos</groupId> <groupId>org.thnetos</groupId>
<artifactId>cd-client</artifactId> <artifactId>cd-client</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Expand Up @@ -4,13 +4,13 @@
:license {:name "Eclipse Public License" :license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"} :url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.3.0"] :dependencies [[org.clojure/clojure "1.3.0"]
[seesaw "1.4.1"] [franks42/seesaw "1.4.2-SNAPSHOT"]
[org.clojure/tools.namespace "0.1.2"] [org.clojure/tools.namespace "0.1.2"]
[clj-info "0.2.3"] [clj-info "0.2.3"]
[hiccup "0.3.8"] [hiccup "0.3.8"]
[org.clojure/tools.trace "0.7.3"] [org.clojure/tools.trace "0.7.3"]
[clojure-complete "0.2.1" :exclusions [org.clojure/clojure]] [clojure-complete "0.2.1" :exclusions [org.clojure/clojure]]
[org.fife.ui/rsyntaxtextarea "2.0.3"] ;;[org.fife.ui/rsyntaxtextarea "2.0.3"]
[org.thnetos/cd-client "0.3.4"]] [org.thnetos/cd-client "0.3.4"]]
:dev-dependencies [[lein-marginalia "0.6.0"] :dev-dependencies [[lein-marginalia "0.6.0"]
;[franks42/debug-repl "0.3.1-FS"] ;[franks42/debug-repl "0.3.1-FS"]
Expand Down
13 changes: 7 additions & 6 deletions src/clj_ns_browser/browser.clj
Expand Up @@ -10,6 +10,7 @@
(:require [seesaw.selector] (:require [seesaw.selector]
[seesaw.dnd] [seesaw.dnd]
[seesaw.bind :as b] [seesaw.bind :as b]
[seesaw.rsyntax]
[clojure.java.browse] [clojure.java.browse]
[clojure.java.shell] [clojure.java.shell]
[clojure.java.io] [clojure.java.io]
Expand All @@ -18,6 +19,7 @@
[clj-info.doc2map :as d2m] [clj-info.doc2map :as d2m]
[clj-ns-browser.inspector] [clj-ns-browser.inspector]
[seesaw.meta] [seesaw.meta]
[seesaw.clipboard]
[clojure.java.javadoc] [clojure.java.javadoc]
[cd-client.core] [cd-client.core]
[clojure.tools.trace]) [clojure.tools.trace])
Expand Down Expand Up @@ -433,14 +435,14 @@
(let [id (partial select-id (to-root e))] (let [id (partial select-id (to-root e))]
(if-let [s (selection (id :doc-ta))] (if-let [s (selection (id :doc-ta))]
(let [fqn (subs (config (id :doc-ta) :text) (first s) (second s))] (let [fqn (subs (config (id :doc-ta) :text) (first s) (second s))]
(set-clip! fqn)) (seesaw.clipboard/contents! fqn))
(if-let [fqn (config (id :doc-tf) :text)] (if-let [fqn (config (id :doc-tf) :text)]
(set-clip! fqn))))))) (seesaw.clipboard/contents! fqn)))))))


(add-app-action :fqn-from-clipboard-action (add-app-action :fqn-from-clipboard-action
(action :name "Paste - FQN from clipboard" (action :name "Paste - FQN from clipboard"
:key "menu V" :key "menu V"
:handler (fn [e] (if-let [fqn (get-clip)] (invoke-soon (browser-with-fqn *ns* fqn (to-root e))))))) :handler (fn [e] (if-let [fqn (seesaw.clipboard/contents)] (invoke-soon (browser-with-fqn *ns* fqn (to-root e)))))))


(add-app-action :fqn-from-selection-action (add-app-action :fqn-from-selection-action
(action :name "FQN from selection" (action :name "FQN from selection"
Expand Down Expand Up @@ -961,9 +963,8 @@
(b/transform (fn [o] (b/transform (fn [o]
(when (= (.getName (type (id :doc-ta))) "org.fife.ui.rsyntaxtextarea.RSyntaxTextArea") (when (= (.getName (type (id :doc-ta))) "org.fife.ui.rsyntaxtextarea.RSyntaxTextArea")
(if (or (= "Source" o) (= "Examples" o) (= "Meta" o)) (if (or (= "Source" o) (= "Examples" o) (= "Meta" o))
(.setSyntaxEditingStyle (id :doc-ta) org.fife.ui.rsyntaxtextarea.SyntaxConstants/SYNTAX_STYLE_CLOJURE) (config! (id :doc-ta) :syntax :clojure)
;; (.setSyntaxEditingStyle (id :doc-ta) org.fife.ui.rsyntaxtextarea.SyntaxConstants/SYNTAX_STYLE_CLOJURE)))))) (config! (id :doc-ta) :syntax :none))))))
(.setSyntaxEditingStyle (id :doc-ta) org.fife.ui.rsyntaxtextarea.SyntaxConstants/SYNTAX_STYLE_NONE))))))
;; ;;
;; bring up browser with url ;; bring up browser with url
(b/bind (b/bind
Expand Down
33 changes: 0 additions & 33 deletions src/clj_ns_browser/utils.clj
Expand Up @@ -295,39 +295,6 @@
"")) ""))




;; following three clipboard-related functions copied from lib.sfd.clip-utils of
;; https://github.com/francoisdevlin/devlinsf-clojure-utils/
;; library seems a little abandoned, but the following functions just work.
;; Kudos to Sean Devlin.

(defn- get-sys-clip
"A helper fn to get the clipboard object"
[]
(. (java.awt.Toolkit/getDefaultToolkit) getSystemClipboard))

(defn get-clip
"Get the contents of the clipboard. Currently only supports text."
[]
(let [clipboard (get-sys-clip)]
(if clipboard
(let [contents (. clipboard getContents nil)]
(cond
(nil? contents) nil
(not (. contents isDataFlavorSupported java.awt.datatransfer.DataFlavor/stringFlavor)) nil
true (. contents getTransferData java.awt.datatransfer.DataFlavor/stringFlavor))))))

(defn set-clip!
"Set the contents of the clipboard. Currently only supports text."
[input-string]
(if input-string
(let [clipboard (get-sys-clip)]
(if clipboard
(do
(let [selection (java.awt.datatransfer.StringSelection. input-string)]
(. clipboard setContents selection nil))
input-string)))))


;; functions to collect different (filtered/sub-) lists of vars, classes, special-forms, etc. ;; functions to collect different (filtered/sub-) lists of vars, classes, special-forms, etc.


(defn ns-special-forms (defn ns-special-forms
Expand Down

0 comments on commit 76b00d0

Please sign in to comment.