|
From: <caw...@us...> - 2007-09-24 14:10:14
|
Revision: 3220
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3220&view=rev
Author: cawilliams
Date: 2007-09-24 07:10:11 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
add findGem static method
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java 2007-09-24 14:08:28 UTC (rev 3219)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java 2007-09-24 14:10:11 UTC (rev 3220)
@@ -11,6 +11,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
@@ -20,6 +21,7 @@
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.framework.BundleContext;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.core.RubyModelManager.EclipsePreferencesListener;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
@@ -27,6 +29,7 @@
import com.aptana.rdt.core.gems.GemListener;
import com.aptana.rdt.core.gems.IGemManager;
import com.aptana.rdt.internal.core.gems.GemManager;
+import com.aptana.rdt.launching.IGemRuntime;
/**
* The activator class controls the plug-in life cycle
@@ -414,4 +417,17 @@
public IGemManager getGemManager() {
return GemManager.getInstance();
}
+
+ public static IPath findGem(String string) {
+ IGemManager gemManager = getDefault().getGemManager();
+ if (gemManager == null) return null;
+ IPath path = gemManager.getGemPath(string);
+ if (path == null) return null;
+ IPath resPath = new Path(IGemRuntime.GEMLIB_VARIABLE);
+ IPath rubyLibPath = RubyCore.getResolvedVariablePath(resPath);
+ for (int k= rubyLibPath.segmentCount(); k < path.segmentCount(); k++) {
+ resPath= resPath.append(path.segment(k));
+ }
+ return resPath;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|