[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-cvs
Subject:    [ jEdit-CVS ] plugins/RubyPlugin/src/org/jedit/ruby/cache ParentToImmediateMethods.java,1.2,1.3 Pare
From:       Robert McKinnon <robmckinnon () users ! sourceforge ! net>
Date:       2005-10-29 19:07:20
Message-ID: E1EVw33-00052c-VO () mail ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/jedit/plugins/RubyPlugin/src/org/jedit/ruby/cache
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22196/org/jedit/ruby/cache

Modified Files:
	ParentToImmediateMethods.java ParentToMethods.java 
	RubyCache.java RubyProjectViewerListener.java 
Log Message:
changed code to use new jruby parser; fixed various parsing problems

Index: ParentToImmediateMethods.java
===================================================================
RCS file: /cvsroot/jedit/plugins/RubyPlugin/src/org/jedit/ruby/cache/ParentToImmediateMethods.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ParentToImmediateMethods.java	12 Oct 2005 07:31:06 -0000	1.2
+++ ParentToImmediateMethods.java	29 Oct 2005 19:07:18 -0000	1.3
@@ -55,7 +55,7 @@
     }
 
     /**
-     * Note: Have to add methods separately because there
+     * Note: Have to addMembers methods separately because there
      * may be some classes defined across more than one file.
      */
     final void add(ParentMember member) {

Index: RubyCache.java
===================================================================
RCS file: /cvsroot/jedit/plugins/RubyPlugin/src/org/jedit/ruby/cache/RubyCache.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- RubyCache.java	12 Oct 2005 07:31:06 -0000	1.11
+++ RubyCache.java	29 Oct 2005 19:07:18 -0000	1.12
@@ -29,16 +29,23 @@
  */
 public final class RubyCache {
 
-    private static final RubyCache instance = new RubyCache();
+    private static RubyCache instance;
 
     private final NameToMethods nameToMethods;
     private final NameToParents nameToParents;
     private final MethodToParents methodToParents;
     private final ParentToMethods parentToMethods;
     private final ParentToImmediateMethods parentToImmediateMethods;
-
     private final Map pathToMembers;
 
+    public static synchronized void resetCache() {
+        instance = new RubyCache();
+    }
+
+    public static synchronized RubyCache instance() {
+        return instance;
+    }
+
     private RubyCache() {
         nameToMethods = new NameToMethods();
         nameToParents = new NameToParents();
@@ -50,26 +57,14 @@
         parentToMethods.setNameToParents(nameToParents);
     }
 
-    public static RubyCache instance() {
-        return instance;
-    }
-
-    public final synchronized void clear() {
-        pathToMembers.clear();
-        methodToParents.clear();
-        parentToMethods.clear();
-        parentToImmediateMethods.clear();
-        nameToMethods.clear();
-    }
-
-    public final synchronized void add(String text, String path) {
+    public final synchronized void addMembers(String text, String path) {
         RubyMembers members = RubyParser.getMembers(text, path, null, true);
-        add(members, path);
+        addMembers(members, path);
     }
 
-    public final synchronized void add(RubyMembers members, String path) {
+    public final synchronized void addMembers(RubyMembers members, String path) {
         if (!members.containsErrors()) {
-            add(path, members);
+            add(members, path);
         }
     }
 
@@ -119,8 +114,8 @@
         }
     }
 
-    private void add(String path, RubyMembers members) {
-        parentToMethods.reset();
+    private void add(RubyMembers members, String path) {
+        parentToMethods.resetAllMethodsList();
         pathToMembers.put(path, members);
         members.visitMembers(new MemberVisitorAdapter() {
             public void handleModule(Module module) {

Index: ParentToMethods.java
===================================================================
RCS file: /cvsroot/jedit/plugins/RubyPlugin/src/org/jedit/ruby/cache/ParentToMethods.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ParentToMethods.java	12 Oct 2005 07:31:06 -0000	1.6
+++ ParentToMethods.java	29 Oct 2005 19:07:18 -0000	1.7
@@ -61,7 +61,7 @@
     }
 
     /**
-     * Note: Have to add methods separately because there
+     * Note: Have to addMembers methods separately because there
      * may be some classes defined across more than one file.
      */
     final void add(ParentMember member) {
@@ -103,7 +103,7 @@
         return allMethods;
     }
 
-    final void reset() {
+    final void resetAllMethodsList() {
         allMethods = null;
     }
 }

Index: RubyProjectViewerListener.java
===================================================================
RCS file: /cvsroot/jedit/plugins/RubyPlugin/src/org/jedit/ruby/cache/RubyProjectViewerListener.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- RubyProjectViewerListener.java	12 Oct 2005 07:31:06 -0000	1.3
+++ RubyProjectViewerListener.java	29 Oct 2005 19:07:18 -0000	1.4
@@ -61,7 +61,7 @@
     public final void groupRemoved(ProjectViewerEvent event) {
         VPTGroup group = (VPTGroup) event.getSource();
         RubyPlugin.log("group removed: " + group, getClass());
-        RubyCache.instance().clear();
+        RubyCache.resetCache();
         reparse(event.getProject());
     }
 
@@ -100,7 +100,7 @@
         if (RubyPlugin.isRubyFile(file)) {
             String text = RubyPlugin.readFile(file);
             if (text != null) {
-                RubyCache.instance().add(text, path);
+                RubyCache.instance().addMembers(text, path);
             }
         }
     }



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic