|
From: <caw...@us...> - 2007-07-12 18:52:25
|
Revision: 2760
http://svn.sourceforge.net/rubyeclipse/?rev=2760&view=rev
Author: cawilliams
Date: 2007-07-12 11:52:21 -0700 (Thu, 12 Jul 2007)
Log Message:
-----------
add actual code that does the forced indexing via a search
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-07-12 18:51:48 UTC (rev 2759)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-07-12 18:52:21 UTC (rev 2760)
@@ -47,6 +47,14 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.rubypeople.rdt.core.search.IRubySearchConstants;
+import org.rubypeople.rdt.core.search.SearchEngine;
+import org.rubypeople.rdt.core.search.SearchMatch;
+import org.rubypeople.rdt.core.search.SearchParticipant;
+import org.rubypeople.rdt.core.search.SearchPattern;
+import org.rubypeople.rdt.core.search.SearchRequestor;
import org.rubypeople.rdt.internal.core.BatchOperation;
import org.rubypeople.rdt.internal.core.DefaultWorkingCopyOwner;
import org.rubypeople.rdt.internal.core.LoadpathAttribute;
@@ -276,6 +284,8 @@
public static final String USER_LIBRARY_CONTAINER_ID= "org.rubypeople.rdt.USER_LIBRARY"; //$NON-NLS-1$
private static final boolean VERBOSE = false;
+
+ private RubyProjectListener fProjectListener;
public RubyCore() {
super();
@@ -303,8 +313,9 @@
public void start(BundleContext context) throws Exception {
super.start(context);
RubyModelManager.getRubyModelManager().startup();
-
- ResourcesPlugin.getWorkspace().addResourceChangeListener(new RubyProjectListener(), IResourceChangeEvent.POST_CHANGE);
+
+ fProjectListener = new RubyProjectListener();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(fProjectListener, IResourceChangeEvent.POST_CHANGE);
}
/*
@@ -315,6 +326,7 @@
*/
public void stop(BundleContext context) throws Exception {
try {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(fProjectListener);
RubyModelManager.getRubyModelManager().shutdown();
} finally {
// ensure we call super.stop as the last thing
@@ -1437,4 +1449,24 @@
}
}
}
+
+
+ public static void forceIndexing() {
+ SearchEngine engine = new SearchEngine();
+ SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
+ SearchPattern pattern = SearchPattern.createPattern(IRubyElement.TYPE, "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
+ SearchRequestor requestor = new SearchRequestor() {
+
+ @Override
+ public void acceptSearchMatch(SearchMatch match) throws CoreException {
+ // do nothing
+ }
+
+ };
+ try {
+ engine.search(pattern, participants, SearchEngine.createWorkspaceScope(), requestor, null);
+ } catch (CoreException e) {
+ // ignore
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|