Permalink
Browse files

Nerge

  • Loading branch information...
2 parents 7db6cb4 + d59a7cf commit 534df8aa04b9ae33ccc880ecd147d922dfe2d95b @EricThorsen committed Aug 26, 2010
View
@@ -16,4 +16,4 @@ __MACOSX
*.war
build/*
*.tmproj
-
+*~
@@ -14,7 +14,6 @@
<version>1.5</version>
</parent> -->
<properties>
- <clojure.version>1.1.0</clojure.version>
<clojure.snapshot.tag></clojure.snapshot.tag>
<clojure.contrib.snapshot.tag></clojure.contrib.snapshot.tag>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -24,7 +23,7 @@
<enclojure.version.release>1.4</enclojure.version.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <clojure.version>1.1.0</clojure.version>
+ <clojure.version>1.2.0</clojure.version>
<templates.basedir>${basdir}../../../templates</templates.basedir>
<project.templates.source>${templates.basedir}/netbeans/ProjectTemplates</project.templates.source>
<project.templates.dest></project.templates.dest>
@@ -61,6 +60,23 @@
</repositories>
<dependencies>
<dependency>
+ <groupId>swank-clojure</groupId>
+ <artifactId>swank-clojure</artifactId>
+ <version>1.2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>${clojure.version}</version>
@@ -489,9 +505,9 @@
<version>RELEASE69</version>
</dependency>
<dependency>
- <groupId>org.jdesktop</groupId>
- <artifactId>beansbinding</artifactId>
- <version>1.2.1</version>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-jdesktop-beansbinding</artifactId>
+ <version>RELEASE691</version>
</dependency>
</dependencies>
@@ -824,21 +840,3 @@
</profile>
</profiles>
</project>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -44,10 +44,10 @@
(defn encode-html [s]
(let [reader (StringReader. s)]
(loop [c (.read reader) buf (StringBuffer.)]
+ (if (= -1 c)
+ (str buf)
(let [cc (char c)]
- (if (= -1 c)
- (str buf)
- (recur (.read reader)
+ (recur (.read reader)
(.append buf
(if (or (> c 127) (#{\" \< \> \&} cc))
(str "&#" c ";")
@@ -153,7 +153,7 @@
(if (pos? clsi) (subs full-classname (inc clsi)) full-classname)))
(def -sym-cache-val-keys-
- #{:super :package :symbols :access :orgname :lib :ext :source :source-file :orgname})
+ #{:super :package :symbols :access :orgname :lib :ext :source :source-file})
(defn- all-string-keys?
[m]
@@ -37,10 +37,16 @@
[data-object]
(let [f (-> data-object .getPrimaryEntry .getFile)]
(logger/info "data-object-listener updating file " f)
- (file-mapping/refresh-completion-cache-data (FileUtil/toFile f))
- ; This needs to be called explicitly here only the first time.
+ (try
+ (file-mapping/refresh-completion-cache-data (FileUtil/toFile f))
+ (logger/info "data-object-listener completion info refreshed " f)
+ ; This needs to be called explicitly here only the first time.
; On first load the navigator window gets called before the symbols are loaded
- (symbol-caching/get-nav-data-for (FileUtil/toFile f))))
+ (symbol-caching/get-nav-data-for (FileUtil/toFile f))
+ (logger/info "data-object-listener symbol caching updated " f)
+ (catch Throwable t
+ (logger/error "Exception refreshing completion cache for file {}, error {}"
+ (str f) (.getMessage t))))))
(defmulti data-obj-event
(fn [event data-obj]
@@ -63,3 +69,4 @@
(propertyChange [#^PropertyChangeEvent e]
(logger/info "data-object-listener {}" (bean e))
(data-obj-event (bean e) obj))))
+
@@ -28,7 +28,11 @@
private IFn _contextChanged = null;
private IFn _openFileFn = (IFn)RT.var("org.enclojure.ide.nb.editor.utils"
,"open-editor-file");
- private IFn _getDataForFileFn =
+
+ private Var _checkNewContextFn =
+ RT.var("org.enclojure.ide.navigator.views.navigator-panel",
+ "new-context");
+ private IFn _getDataForFileFn =
(IFn)RT.var("org.enclojure.ide.nb.editor.completion.symbol-caching"
, "get-nav-data-for");
@@ -100,40 +104,41 @@ public Lookup getLookup () {
/************* non - public part ************/
private void setNewContent (Collection newData) {
-// Node[] activatedNodes = TopComponent.getRegistry().getActivatedNodes();
-// if(activatedNodes != null && activatedNodes.length > 0)
-// {
-// EditorCookie ec = activatedNodes[0].getLookup().lookup(EditorCookie.class);
-// if(ec != null)
-// {
-// Document document = ec.getDocument();
-// DataObject dataObject = NbEditorUtilities.getDataObject(document);
-// if(dataObject != null)
-// {
-// FileObject fileObject = (FileObject) dataObject.files().toArray()[0];
-// int i;
-// i = 100;
-// }
-// }
-// }
-
- for(Object object : newData.toArray())
- {
- if(object instanceof FileObject)
- {
- FileObject fileObject = (FileObject)object;
- File file = FileUtil.toFile(fileObject);
- try {
-
- if (_contextChanged != null)
- {
- Object sampleData = _getDataForFileFn.invoke(file);
- _contextChanged.invoke(sampleData);
+ try {
+ // Node[] activatedNodes = TopComponent.getRegistry().getActivatedNodes();
+ // if(activatedNodes != null && activatedNodes.length > 0)
+ // {
+ // EditorCookie ec = activatedNodes[0].getLookup().lookup(EditorCookie.class);
+ // if(ec != null)
+ // {
+ // Document document = ec.getDocument();
+ // DataObject dataObject = NbEditorUtilities.getDataObject(document);
+ // if(dataObject != null)
+ // {
+ // FileObject fileObject = (FileObject) dataObject.files().toArray()[0];
+ // int i;
+ // i = 100;
+ // }
+ // }
+ // }
+// for (Object object : newData.toArray()) {
+// if (object instanceof FileObject) {
+// FileObject fileObject = (FileObject) object;
+// File file = FileUtil.toFile(fileObject);
+ try {
+ FileObject f = (FileObject) ((IFn) _checkNewContextFn).invoke(newData);
+ File file = FileUtil.toFile(f);
+ if (_contextChanged != null) {
+ Object sampleData = _getDataForFileFn.invoke(file);
+ _contextChanged.invoke(sampleData);
+ }
+ } catch (Exception ex) {
+ Exceptions.printStackTrace(ex);
}
- } catch (Exception ex) {
- Exceptions.printStackTrace(ex);
- }
- }
+// }
+// }
+ } catch (Exception ex) {
+ Exceptions.printStackTrace(ex);
}
}
@@ -58,7 +58,6 @@ public void restored() {
requireFn.invoke(Symbol.create("org.enclojure.repl.main"));
setupTrackingFn.invoke();
-
requireFn.invoke(Symbol.create("org.enclojure.ide.nb.editor.utils"));
//requireFn.invoke(Symbol.create("org.enclojure.repl.repl-manager-ui"));
@@ -44,6 +44,11 @@
<artifactId>org-openide-util-lookup</artifactId>
<version>RELEASE69</version>
</dependency>
+ <dependency>
+ <groupId>org.netbeans.api</groupId>
+ <artifactId>org-jdesktop-beansbinding</artifactId>
+ <version>RELEASE691</version>
+ </dependency>
</dependencies>
</project>
@@ -81,20 +81,23 @@
; :arglists (get-arglists form 3)))
(defn skip-to-next-form [#^CharCountingPushbackReader is]
- (let [c (char (.read #^CharCountingPushbackReader is))]
- (if (or (= c \newline)
- (= c \,)
- (= c \space))
- (recur #^CharCountingPushbackReader is)
- (.unread #^CharCountingPushbackReader is (int c)))))
-
- ; (catch Throwable t
- ; (println "Could not parse the " (inc (count forms))
- ; " form in " additional-attribs " form:";
- ; form " error:" (.getMessage t)))))
-
+ (let [v (.read #^CharCountingPushbackReader is)]
+ (if (not= v -1)
+ (let [c (char v)]
+ (if (or (= c \newline)
+ (= c \,)
+ (= c \space))
+ (recur #^CharCountingPushbackReader is)
+ (.unread #^CharCountingPushbackReader is (int c))))
+ v)))
+
(def #^{:private true} EOF (Object.))
+(defn safe-hash-map [& keyvals]
+ (reduce (fn [m [k v]]
+ (assoc m k v)) {}
+ (partition 2 keyvals)))
+
(defn readable-form?
[]
(try
@@ -129,7 +132,7 @@
(logger/error
"pull-forms: could not parse form attribs= "
additional-attribs))))
- form-map (when parsed-form (apply hash-map parsed-form))
+ form-map (when parsed-form (apply safe-hash-map parsed-form))
is-ns? (= (:type form-map) :namespace)
names (if is-ns? (swap! def-ns
(fn [_] (:name form-map)))
@@ -143,7 +146,7 @@
(:name form-map))
(ns-resolve names (:name form-map)))]
(merge additional-attribs form-map
- (apply hash-map
+ (apply safe-hash-map
:namespace names
:form form
:line (inc (:line pos-info))
@@ -179,7 +182,8 @@
(merge additional-attribs
{:symbols
(pull-forms istream additional-attribs)}))
-
+
+
(defn oi []
(org.enclojure.ide.CharCountingPushbackReader.
(java.io.InputStreamReader.
@@ -297,5 +301,3 @@
))
(catch Throwable t
(publish-stack-trace t)))))
-
-
@@ -22,9 +22,7 @@
[clojure.set :as set]
[org.enclojure.ide.navigator.parser :as parser]
[org.enclojure.commons.c-slf4j :as logger]
- )
- (:import (java.util.logging Level)))
-
+ ))
; setup logging
(logger/ensure-logger)
;(def sample-ns-record
@@ -266,6 +266,7 @@
[root (sort-by sort-fn leaves)])))
(defn tree-model-3 [symbols sort-fn]
+ (logger/info "In tree-model " (apply str (interpose "," (keys symbols))))
(let [tree (symbols-to-tree symbols sort-fn)]
(proxy [TreeModel] []
(getRoot []
@@ -346,8 +347,17 @@
mypanel
BorderLayout/CENTER))
(fn [data]
- (swap! data-ref (fn [_] data))
- (.setModel jtree (tree-model-3 data -default-sort-)))))
+ (logger/info "Context changed {}" data)
+ (when data
+ (swap! data-ref (fn [_] data))
+ (.setModel jtree (tree-model-3 data -default-sort-))))))
+
+(def obj (atom nil))
+
+(defn new-context [context]
+ (swap! obj (fn [_] context))
+ (logger/info "Got new context {} str {}" (class context) (str context))
+ (.getPrimaryFile (first context)))
(defn navigator
[title data]
@@ -24,7 +24,8 @@ public int getLineNumber(){
public int read() throws IOException{
int c = super.read();
- ++counter;
+ if(c!=-1)
+ ++counter;
return c;
}
@@ -1,38 +0,0 @@
-package org.enclojure;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testApp()
- {
- assertTrue( true );
- }
-}
Oops, something went wrong.

0 comments on commit 534df8a

Please sign in to comment.