You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: <mir...@us...> - 2007-09-28 08:23:53
|
Revision: 3222
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3222&view=rev
Author: mirkostocker
Date: 2007-09-28 01:23:44 -0700 (Fri, 28 Sep 2007)
Log Message:
-----------
Remove the @Override annotation (I don't see which method it should override).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchableTester.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchableTester.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchableTester.java 2007-09-24 15:10:31 UTC (rev 3221)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchableTester.java 2007-09-28 08:23:44 UTC (rev 3222)
@@ -36,7 +36,6 @@
*/
private static final String PROPERTY_PROJECT_NATURE = "hasProjectNature"; //$NON-NLS-1$
- @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (PROPERTY_IS_CONTAINER.equals(property)) {
if (receiver instanceof IAdaptable) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-24 15:10:33
|
Revision: 3221
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3221&view=rev
Author: cawilliams
Date: 2007-09-24 08:10:31 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
fix handling resource deltas for added/removed resources whose eventual src folder root is equivalent to project.
(Basically if you add/remove an HTML file in app/views/layouts, now it will update the Ruby Explorer view properly).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java 2007-09-24 14:10:11 UTC (rev 3220)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java 2007-09-24 15:10:31 UTC (rev 3221)
@@ -432,7 +432,7 @@
IRubyElementDelta[] affectedChildren= delta.getAffectedChildren();
if (affectedChildren.length > 1) {
// a package fragment might become non empty refresh from the parent
- if (element instanceof ISourceFolder) {
+ if (element instanceof ISourceFolder) {
IRubyElement parent= (IRubyElement)internalGetParent(element);
// 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View
// avoid posting a refresh to an unvisible parent
@@ -532,16 +532,28 @@
// this could be optimized by handling all the added children in the parent
if ((status & IResourceDelta.REMOVED) != 0) {
if (parent instanceof ISourceFolder) {
+ Object grandparent= internalGetParent(parent);
+ // if grandparent is src folder root that is equal to project, refresh project
+ if (grandparent instanceof ISourceFolderRoot && ((ISourceFolderRoot)grandparent).getResource().equals(((ISourceFolderRoot)grandparent).getRubyProject().getProject())) {
+ parent = grandparent;
+ grandparent = internalGetParent(parent);
+ }
// refresh one level above to deal with empty package filtering properly
- postRefresh(internalGetParent(parent), PARENT, parent);
+ postRefresh(grandparent, PARENT, parent);
return true;
} else
postRemove(resource);
}
if ((status & IResourceDelta.ADDED) != 0) {
if (parent instanceof ISourceFolder) {
+ Object grandparent= internalGetParent(parent);
+ // if grandparent is src folder root that is equal to project, refresh project
+ if (grandparent instanceof ISourceFolderRoot && ((ISourceFolderRoot)grandparent).getResource().equals(((ISourceFolderRoot)grandparent).getRubyProject().getProject())) {
+ parent = grandparent;
+ grandparent = internalGetParent(parent);
+ }
// refresh one level above to deal with empty package filtering properly
- postRefresh(internalGetParent(parent), PARENT, parent);
+ postRefresh(grandparent, PARENT, parent);
return true;
} else
postAdd(parent, resource);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <caw...@us...> - 2007-09-24 14:08:32
|
Revision: 3219
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3219&view=rev
Author: cawilliams
Date: 2007-09-24 07:08:28 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
allow loading remote gems job to be cancelled
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-09-20 22:48:45 UTC (rev 3218)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-09-24 14:08:28 UTC (rev 3219)
@@ -43,7 +43,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.rubypeople.rdt.internal.launching.StandardVMType;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstall;
import org.rubypeople.rdt.launching.IVMInstallChangedListener;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-20 22:48:47
|
Revision: 3218
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3218&view=rev
Author: cawilliams
Date: 2007-09-20 15:48:45 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
port fixes from Aptana SVN repo over to old RDT repo
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java 2007-09-20 22:45:27 UTC (rev 3217)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java 2007-09-20 22:48:45 UTC (rev 3218)
@@ -175,13 +175,8 @@
ArrayList topLevelElements= new ArrayList(elements.length);
for (int i= 0; i < elements.length; i++) {
IRubyElement iRubyElement= elements[i];
- if (iRubyElement instanceof ISourceFolder && (((ISourceFolder)iRubyElement).isDefaultPackage())) {
- Object[] children = ((ISourceFolder)iRubyElement).getRubyScripts();
- for (int j = 0; j < children.length; j++) {
- topLevelElements.add(children[j]);
- }
- //if the name of the SourceFolder is the top level package it will contain no "/" separators
- } else if (iRubyElement instanceof ISourceFolder && (iRubyElement.getElementName().indexOf(File.separatorChar)==-1) && !(((ISourceFolder)iRubyElement).isDefaultPackage()) ) {
+ // for default src folder, grab it's scripts (unless it's part of project as src folder root)
+ if (iRubyElement instanceof ISourceFolder && (iRubyElement.getElementName().indexOf(File.separatorChar)==-1) && !(((ISourceFolder)iRubyElement).isDefaultPackage()) ) {
topLevelElements.add(iRubyElement);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-20 22:45:28
|
Revision: 3217
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3217&view=rev
Author: cawilliams
Date: 2007-09-20 15:45:27 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
port fixes from Aptana SVN repo over to old RDT repo
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-09-20 22:45:23 UTC (rev 3216)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-09-20 22:45:27 UTC (rev 3217)
@@ -663,8 +663,8 @@
}
public void initialize() {
- scheduleLoadingRemoteGems();
- scheduleLoadingLocalGems();
+ scheduleLoadingLocalGems();
+ scheduleLoadingRemoteGems();
}
private void scheduleLoadingLocalGems() {
@@ -673,10 +673,8 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
-// if (gems.isEmpty()) {
- gems = loadLocalGems();
- storeGemCache(gems, getConfigFile(LOCAL_GEMS_CACHE_FILE));
-// }
+ gems = loadLocalGems();
+ storeGemCache(gems, getConfigFile(LOCAL_GEMS_CACHE_FILE));
isInitialized = true;
synchronized (listeners) {
for (GemListener listener : new ArrayList<GemListener>(listeners)) {
@@ -705,12 +703,10 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
-// if (remoteGems.isEmpty()) {
- remoteGems = loadRemoteGems();
- storeGemCache(remoteGems,
+ remoteGems = loadRemoteGems();
+ storeGemCache(remoteGems,
getConfigFile(REMOTE_GEMS_CACHE_FILE));
- remoteGems = makeLogical(remoteGems);
-// }
+ remoteGems = makeLogical(remoteGems);
} catch (Exception e) {
AptanaRDTPlugin.log(e);
return Status.CANCEL_STATUS;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-20 22:45:24
|
Revision: 3216
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3216&view=rev
Author: cawilliams
Date: 2007-09-20 15:45:23 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
port fixes from Aptana SVN repo over to old RDT repo
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessingState.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessingState.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessingState.java 2007-09-20 22:45:17 UTC (rev 3215)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessingState.java 2007-09-20 22:45:23 UTC (rev 3216)
@@ -540,4 +540,69 @@
}
}
}
+
+ public void addPreResourceChangedListener(IResourceChangeListener listener,
+ int eventMask) {
+ for (int i = 0; i < this.preResourceChangeListenerCount; i++) {
+ if (this.preResourceChangeListeners[i].equals(listener)) {
+ this.preResourceChangeEventMasks[i] |= eventMask;
+ return;
+ }
+ }
+ // may need to grow, no need to clone, since iterators will have cached
+ // original arrays and max boundary and we only add to the end.
+ int length;
+ if ((length = this.preResourceChangeListeners.length) == this.preResourceChangeListenerCount) {
+ System
+ .arraycopy(
+ this.preResourceChangeListeners,
+ 0,
+ this.preResourceChangeListeners = new IResourceChangeListener[length * 2],
+ 0, length);
+ System.arraycopy(this.preResourceChangeEventMasks, 0,
+ this.preResourceChangeEventMasks = new int[length * 2], 0,
+ length);
+ }
+ this.preResourceChangeListeners[this.preResourceChangeListenerCount] = listener;
+ this.preResourceChangeEventMasks[this.preResourceChangeListenerCount] = eventMask;
+ this.preResourceChangeListenerCount++;
+ }
+
+ public void removePreResourceChangedListener(
+ IResourceChangeListener listener) {
+
+ for (int i = 0; i < this.preResourceChangeListenerCount; i++) {
+
+ if (this.preResourceChangeListeners[i].equals(listener)) {
+
+ // need to clone defensively since we might be in the middle of
+ // listener notifications (#fire)
+ int length = this.preResourceChangeListeners.length;
+ IResourceChangeListener[] newListeners = new IResourceChangeListener[length];
+ int[] newEventMasks = new int[length];
+ System.arraycopy(this.preResourceChangeListeners, 0,
+ newListeners, 0, i);
+ System.arraycopy(this.preResourceChangeEventMasks, 0,
+ newEventMasks, 0, i);
+
+ // copy trailing listeners
+ int trailingLength = this.preResourceChangeListenerCount - i
+ - 1;
+ if (trailingLength > 0) {
+ System.arraycopy(this.preResourceChangeListeners, i + 1,
+ newListeners, i, trailingLength);
+ System.arraycopy(this.preResourceChangeEventMasks, i + 1,
+ newEventMasks, i, trailingLength);
+ }
+
+ // update manager listener state (#fire need to iterate over
+ // original listeners through a local variable to hold onto
+ // the original ones)
+ this.preResourceChangeListeners = newListeners;
+ this.preResourceChangeEventMasks = newEventMasks;
+ this.preResourceChangeListenerCount--;
+ return;
+ }
+ }
+ }
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java 2007-09-20 22:45:17 UTC (rev 3215)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java 2007-09-20 22:45:23 UTC (rev 3216)
@@ -37,6 +37,7 @@
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.builder.RubyBuilder;
+import org.rubypeople.rdt.internal.core.hierarchy.TypeHierarchy;
import org.rubypeople.rdt.internal.core.search.indexing.IndexManager;
import org.rubypeople.rdt.internal.core.util.CharOperation;
import org.rubypeople.rdt.internal.core.util.Util;
@@ -431,8 +432,7 @@
stopDeltas();
checkProjectsBeingAddedOrRemoved(delta);
if (this.refreshedElements != null) {
- // TODO Actually update external references too
-// createExternalArchiveDelta(null);
+ createExternalArchiveDelta(null);
}
IRubyElementDelta translatedDelta = processResourceDelta(delta);
if (translatedDelta != null) {
@@ -447,7 +447,7 @@
listeners = this.state.elementChangedListeners;
listenerCount = this.state.elementChangedListenerCount;
}
-// notifyTypeHierarchies(listeners, listenerCount);
+ notifyTypeHierarchies(listeners, listenerCount);
fire(null, ElementChangedEvent.POST_CHANGE);
} finally {
// workaround for bug 15168 circular errors not reported
@@ -470,9 +470,8 @@
}
// this.processPostChange = false;
if(isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
- // FIXME Update the loadpath markers
updateLoadpathMarkers(delta, updates);
-// RubyBuilder.buildStarting();
+ RubyBuilder.buildStarting();
}
// does not fire any deltas
return;
@@ -480,6 +479,28 @@
}
}
+ private void notifyTypeHierarchies(IElementChangedListener[] listeners, int listenerCount) {
+ for (int i= 0; i < listenerCount; i++) {
+ final IElementChangedListener listener = listeners[i];
+ if (!(listener instanceof TypeHierarchy)) continue;
+
+ // wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
+ SafeRunner.run(new ISafeRunnable() {
+ public void handleException(Throwable exception) {
+ Util.log(exception, "Exception occurred in listener of Ruby element change notification"); //$NON-NLS-1$
+ }
+ public void run() throws Exception {
+ TypeHierarchy typeHierarchy = (TypeHierarchy)listener;
+ if (typeHierarchy.hasFineGrainChanges()) {
+ // case of changes in primary working copies
+ typeHierarchy.needsRefresh = true;
+ typeHierarchy.fireChange();
+ }
+ }
+ });
+ }
+ }
+
/*
* Update the .loadpath format, missing entries and cycle markers for the projects affected by the given delta.
*/
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java 2007-09-20 22:45:17 UTC (rev 3215)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java 2007-09-20 22:45:23 UTC (rev 3216)
@@ -172,4 +172,12 @@
// assume there were no problems
}
}
+
+ public static void buildStarting() {
+
+ }
+
+ public static void buildFinished() {
+
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-20 22:45:21
|
Revision: 3215
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3215&view=rev
Author: cawilliams
Date: 2007-09-20 15:45:17 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
port fixes from Aptana SVN repo over to old RDT repo
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/ExternalFileTypeInfo.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/ExternalFileTypeInfo.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/ExternalFileTypeInfo.java 2007-09-18 20:51:26 UTC (rev 3214)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/ExternalFileTypeInfo.java 2007-09-20 22:45:17 UTC (rev 3215)
@@ -131,10 +131,7 @@
}
public String getPath() {
- StringBuffer result= new StringBuffer(fPath);
-// result.append(IRubySearchScope.JAR_FILE_ENTRY_SEPARATOR);
- getElementPath(result);
- return result.toString();
+ return fPath;
}
public long getContainerTimestamp() {
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java 2007-09-18 20:51:26 UTC (rev 3214)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerContentProvider.java 2007-09-20 22:45:17 UTC (rev 3215)
@@ -369,6 +369,10 @@
// have to handle additions to them specially.
if (parent instanceof ISourceFolder) {
Object grandparent= internalGetParent(parent);
+ if (((ISourceFolder)parent).isDefaultPackage()) {
+ parent = grandparent;
+ grandparent = internalGetParent(parent);
+ }
// 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View
// avoid posting a refresh to an unvisible parent
if (parent.equals(fInput)) {
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java 2007-09-18 20:51:26 UTC (rev 3214)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/SourceFolderProvider.java 2007-09-20 22:45:17 UTC (rev 3215)
@@ -175,8 +175,13 @@
ArrayList topLevelElements= new ArrayList(elements.length);
for (int i= 0; i < elements.length; i++) {
IRubyElement iRubyElement= elements[i];
+ if (iRubyElement instanceof ISourceFolder && (((ISourceFolder)iRubyElement).isDefaultPackage())) {
+ Object[] children = ((ISourceFolder)iRubyElement).getRubyScripts();
+ for (int j = 0; j < children.length; j++) {
+ topLevelElements.add(children[j]);
+ }
//if the name of the SourceFolder is the top level package it will contain no "/" separators
- if (iRubyElement instanceof ISourceFolder && (iRubyElement.getElementName().indexOf(File.separatorChar)==-1) && !(((ISourceFolder)iRubyElement).isDefaultPackage()) ) {
+ } else if (iRubyElement instanceof ISourceFolder && (iRubyElement.getElementName().indexOf(File.separatorChar)==-1) && !(((ISourceFolder)iRubyElement).isDefaultPackage()) ) {
topLevelElements.add(iRubyElement);
}
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java 2007-09-18 20:51:26 UTC (rev 3214)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java 2007-09-20 22:45:17 UTC (rev 3215)
@@ -12,6 +12,7 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -198,7 +199,10 @@
for (int i = 0; i < fragments.length; i++) {
if (!(fragments[i] instanceof ISourceFolder)) continue;
ISourceFolder folder = (ISourceFolder) fragments[i];
- if (folder.isDefaultPackage()) continue;
+ if (folder.isDefaultPackage()) {
+ list.addAll(Arrays.asList(folder.getRubyScripts()));
+ continue;
+ }
String name = folder.getElementName();
int index = name.indexOf(File.separatorChar);
if (index == -1) list.add(folder);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 20:51:28
|
Revision: 3214
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3214&view=rev
Author: cawilliams
Date: 2007-09-18 13:51:26 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
Add ERB/RHTML files to build process!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IncrementalRdtCompiler.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/BuildContextCollector.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ERBBuildContext.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2007-09-18 19:36:34 UTC (rev 3213)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -1,9 +1,5 @@
package org.rubypeople.rdt.internal.core.builder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -26,8 +22,6 @@
}
protected abstract void removeMarkers(IMarkerManager markerManager);
- protected abstract List<IFile> getFilesToCompile() throws CoreException;
- protected abstract List getFilesToClear() throws CoreException;
public void compile(IProgressMonitor monitor) throws CoreException {
IRubyProject rubyProject = getRubyProject();
@@ -36,14 +30,13 @@
fParticipants[i].aboutToBuild(rubyProject);
}
BuildContext[] files = getBuildContexts();
- int filesToClear = getFilesToClear().size();
- int taskCount = (filesToClear) + (files.length * fParticipants.length);
+ int taskCount = files.length * (fParticipants.length + 1);
monitor.beginTask("Building " + project.getName() + "...", taskCount);
monitor.subTask("Removing Markers...");
removeMarkers(markerManager);
- monitor.worked(filesToClear);
+ monitor.worked(files.length);
monitor.subTask("Analyzing Files...");
compileFiles(files, monitor);
@@ -68,18 +61,9 @@
}
}
- private BuildContext[] getBuildContexts() throws CoreException {
- return getBuildContexts(getFilesToCompile());
- }
-
- private BuildContext[] getBuildContexts(List<IFile> list) {
- List<BuildContext> contexts = new ArrayList<BuildContext>();
- for (IFile file : list) {
- contexts.add(new BuildContext(file));
- }
- return contexts.toArray(new BuildContext[contexts.size()]);
- }
+ abstract protected BuildContext[] getBuildContexts() throws CoreException;
+
private IRubyProject getRubyProject() {
return RubyCore.create(project);
}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/BuildContextCollector.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/BuildContextCollector.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/BuildContextCollector.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -0,0 +1,85 @@
+package org.rubypeople.rdt.internal.core.builder;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceProxy;
+import org.eclipse.core.resources.IResourceProxyVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.IContentType;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.compiler.BuildContext;
+
+public class BuildContextCollector implements IResourceProxyVisitor {
+
+ private static final String RUBY_SOURCE_CONTENT_TYPE_ID = "org.rubypeople.rdt.core.rubySource";
+ private final List<BuildContext> files;
+ private HashSet<String> visitedLinks;
+
+ public BuildContextCollector(List<BuildContext> files) {
+ this.files = files;
+ this.visitedLinks = new HashSet<String>();
+ }
+
+ public boolean visit(IResourceProxy proxy) throws CoreException {
+ switch (proxy.getType()) {
+ case IResource.FILE:
+ if (org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(proxy.getName())) {
+ files.add(new BuildContext(getFile(proxy)));
+ return false;
+ }
+ if (isERB(proxy.getName())) {
+ files.add(new ERBBuildContext(getFile(proxy)));
+ return false;
+ }
+ IFile file = getFile(proxy);
+ if (isRubySourceContentType(file)) {
+ files.add(new BuildContext(file));
+ return false;
+ }
+
+ //
+ return false;
+ case IResource.FOLDER:
+ try { // Avoid recursive symlinks!
+ IPath path = proxy.requestResource().getLocation();
+ String unique = path.toFile().getCanonicalPath();
+ if (visitedLinks.contains(unique))
+ return false;
+ visitedLinks.add(unique);
+ } catch (IOException e) {
+ RubyCore.log(e);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private IFile getFile(IResourceProxy proxy) {
+ IResource resource;
+ resource = proxy.requestResource();
+ IFile file = (IFile) resource;
+ return file;
+ }
+
+ private boolean isERB(String name) {
+ return name.endsWith(".erb") || name.endsWith(".rhtml");
+ }
+
+ private boolean isRubySourceContentType(IFile file) throws CoreException {
+ IContentDescription contentDescription = file.getContentDescription();
+ if (contentDescription != null) {
+ IContentType type = contentDescription.getContentType();
+ if (type != null)
+ if (type.getId().equals(RUBY_SOURCE_CONTENT_TYPE_ID))
+ return true;
+ }
+ return false;
+ }
+
+}
Property changes on: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/BuildContextCollector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java 2007-09-18 19:36:34 UTC (rev 3213)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/CleanRdtCompiler.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -1,14 +1,16 @@
package org.rubypeople.rdt.internal.core.builder;
+import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.rubypeople.rdt.core.compiler.BuildContext;
public class CleanRdtCompiler extends AbstractRdtCompiler {
- private List<IFile> projectFiles;
+ private List<BuildContext> contexts;
public CleanRdtCompiler(IProject project) {
this(project, new MarkerManager());
@@ -22,20 +24,16 @@
markerManager.removeProblemsAndTasksFor(project);
}
- protected List<IFile> getFilesToClear() throws CoreException {
- return getFilesToCompile();
- }
-
- protected List<IFile> getFilesToCompile() throws CoreException {
- if (projectFiles == null) {
- analyzeFiles();
- }
- return projectFiles;
- }
-
private void analyzeFiles() throws CoreException {
- ProjectFileFinder finder = new ProjectFileFinder(project);
- projectFiles = finder.findFiles();
+ contexts = new ArrayList<BuildContext>();
+ project.accept(new BuildContextCollector(contexts), IResource.NONE);
}
+ @Override
+ protected BuildContext[] getBuildContexts() throws CoreException {
+ if (contexts == null) {
+ analyzeFiles();
+ }
+ return contexts.toArray(new BuildContext[contexts.size()]);
+ }
}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ERBBuildContext.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ERBBuildContext.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ERBBuildContext.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -0,0 +1,50 @@
+package org.rubypeople.rdt.internal.core.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.rubypeople.rdt.core.compiler.BuildContext;
+
+public class ERBBuildContext extends BuildContext {
+
+ public ERBBuildContext(IFile resource) {
+ super(resource);
+ }
+
+ /**
+ * Returns the contents of the compilation unit.
+ *
+ * @return the contents of the compilation unit
+ */
+ public char[] getContents() {
+ char[] contents = super.getContents();
+ // Strip to only ruby portions!
+ String stringContents = new String(contents);
+ List<String> code = new ArrayList<String>();
+ String[] pieces = stringContents.split("(<%%)|(%%>)|(<%=)|(<%#)|(<%)|(%>)");
+ for (int i = 0; i < pieces.length; i++) {
+ if ((i % 2) == 1) {
+ code.add(pieces[i]);
+ }
+ }
+ StringBuffer buffer = new StringBuffer();
+ int lastIndex = 0;
+ for (String string : code) {
+ int index = stringContents.indexOf(string);
+ String portion = stringContents.substring(lastIndex, index);
+ for (int j = 0; j < portion.length(); j++) {
+ char chr = portion.charAt(j);
+ if (Character.isWhitespace(chr)) {
+ buffer.append(chr);
+ } else {
+ buffer.append(' ');
+ }
+ }
+ buffer.append(string);
+ lastIndex = index + string.length();
+ }
+ return buffer.toString().toCharArray();
+ }
+
+}
Property changes on: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ERBBuildContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IncrementalRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IncrementalRdtCompiler.java 2007-09-18 19:36:34 UTC (rev 3213)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IncrementalRdtCompiler.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -10,12 +10,13 @@
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.runtime.CoreException;
+import org.rubypeople.rdt.core.compiler.BuildContext;
import org.rubypeople.rdt.internal.core.util.Util;
public class IncrementalRdtCompiler extends AbstractRdtCompiler {
- private List filesToCompile;
- private List filesToClear;
+ private List<BuildContext> contexts;
+ private List<IFile> filesToClear;
private final IResourceDelta rootDelta;
public IncrementalRdtCompiler(IProject project, IResourceDelta delta,
@@ -35,43 +36,47 @@
}
}
- protected List getFilesToCompile() throws CoreException {
- if (filesToCompile == null) {
- analyzeFiles();
- }
- return filesToCompile;
- }
-
private void analyzeFiles() throws CoreException {
- filesToClear = new ArrayList();
- filesToCompile = new ArrayList();
+ filesToClear = new ArrayList<IFile>();
+ contexts = new ArrayList<BuildContext>();
rootDelta.accept(new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
- if (isRubyFile(resource)) {
+ if (isRubyFile(resource) || isERBFile(resource)) {
if (delta.getKind() == IResourceDelta.REMOVED) {
- filesToClear.add(resource);
+ filesToClear.add((IFile)resource);
} else if (delta.getKind() == IResourceDelta.ADDED
|| delta.getKind() == IResourceDelta.CHANGED) {
- filesToCompile.add(resource);
+ filesToClear.add((IFile)resource);
+ if (isERBFile(resource)) {
+ contexts.add(new ERBBuildContext((IFile)resource));
+ } else {
+ contexts.add(new BuildContext((IFile)resource));
+ }
}
}
return true;
}
- private boolean isRubyFile(IResource resource) {
+ private boolean isERBFile(IResource resource) {
+ if (!(resource instanceof IFile))
+ return false;
+ String name = resource.getName();
+ return name.endsWith(".erb") || name.endsWith(".rhtml");
+ }
+
+ private boolean isRubyFile(IResource resource) {
return resource instanceof IFile && Util.isRubyLikeFileName(resource.getName());
}});
- filesToClear.addAll(filesToCompile);
}
@Override
- protected List getFilesToClear() throws CoreException {
- if (filesToClear == null) {
+ protected BuildContext[] getBuildContexts() throws CoreException {
+ if (contexts == null) {
analyzeFiles();
}
- return filesToClear;
+ return contexts.toArray(new BuildContext[contexts.size()]);
}
}
Deleted: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java 2007-09-18 19:36:34 UTC (rev 3213)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -1,40 +0,0 @@
-/*
- * Author: David Corbin
- *
- * Copyright (c) 2005 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse.
- * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use
- * RDT except in compliance with the License. For further information see
- * org.rubypeople.rdt/rdt.license.
- */
-
-
-package org.rubypeople.rdt.internal.core.builder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-public final class ProjectFileFinder implements IFileProvider {
- private final IProject project;
-
- public ProjectFileFinder(IProject project) {
- this.project = project;
- }
-
- public List<IFile> findFiles() throws CoreException {
- List<IFile> files = new ArrayList<IFile>();
- addAllSourceFiles(files);
- return files;
- }
-
- protected void addAllSourceFiles(final List<IFile> sourceFiles) throws CoreException {
- project.accept(new RubySourceFileCollectingVisitor(sourceFiles), IResource.NONE);
- }
-
-}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java 2007-09-18 19:36:34 UTC (rev 3213)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubySourceFileCollectingVisitor.java 2007-09-18 20:51:26 UTC (rev 3214)
@@ -1,81 +0,0 @@
-/*
- * Author: David Corbin
- *
- * Copyright (c) 2005 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse.
- * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use
- * RDT except in compliance with the License. For further information see
- * org.rubypeople.rdt/rdt.license.
- */
-
-package org.rubypeople.rdt.internal.core.builder;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-import org.rubypeople.rdt.core.RubyCore;
-
-public final class RubySourceFileCollectingVisitor implements IResourceProxyVisitor {
-
- private static final String RUBY_SOURCE_CONTENT_TYPE_ID = "org.rubypeople.rdt.core.rubySource";
- private final List<IFile> files;
- private HashSet<String> visitedLinks;
-
- public RubySourceFileCollectingVisitor(List<IFile> files) {
- this.files = files;
- this.visitedLinks = new HashSet<String>();
- }
-
- public boolean visit(IResourceProxy proxy) throws CoreException {
- IResource resource = null;
- switch (proxy.getType()) {
- case IResource.FILE:
- if (org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(proxy.getName())) {
- if (resource == null) resource = proxy.requestResource();
- files.add((IFile)resource);
- return false;
- }
- // Check for Ruby Source content type
- resource = proxy.requestResource();
- IFile file = (IFile) resource;
- IContentDescription contentDescription = file.getContentDescription();
- if (contentDescription != null) {
- IContentType type = contentDescription.getContentType();
- if (type != null)
- if (type.getId().equals(RUBY_SOURCE_CONTENT_TYPE_ID))
- files.add(file);
- }
- return false;
- case IResource.FOLDER:
- try { // Avoid recursive symlinks!
- IPath path = proxy.requestResource().getLocation();
- String unique = path.toFile().getCanonicalPath();
- if (visitedLinks.contains(unique))
- return false;
- visitedLinks.add(unique);
- } catch (IOException e) {
- RubyCore.log(e);
- return false;
- }
- }
- return true;
- }
-
- public boolean equals(Object obj) {
- return obj.getClass().equals(getClass());
- }
-
- public int hashCode() {
- return 0;
- }
-}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 19:36:37
|
Revision: 3213
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3213&view=rev
Author: cawilliams
Date: 2007-09-18 12:36:34 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
refresh external files as part of initialization
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-09-18 14:41:23 UTC (rev 3212)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-09-18 19:36:34 UTC (rev 3213)
@@ -52,10 +52,7 @@
import org.rubypeople.rdt.core.search.IRubySearchConstants;
import org.rubypeople.rdt.core.search.IRubySearchScope;
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.core.search.TypeNameRequestor;
import org.rubypeople.rdt.internal.core.BatchOperation;
import org.rubypeople.rdt.internal.core.DefaultWorkingCopyOwner;
@@ -1543,16 +1540,16 @@
throw e;
// else indexes were not ready: catch the exception so that jars are still refreshed
}
-// final RubyModel model = RubyModelManager.getRubyModelManager().getRubyModel();
-// // ensure external jars are refreshed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93668)
-// try {
-// model.refreshExternalArchives(
-// null/*refresh all projects*/,
-// monitor == null ? null : new SubProgressMonitor(monitor, 1) // 1% of the time is spent in jar refresh
-// );
-// } catch (RubyModelException e) {
-// // refreshing failed: ignore
-// }
+ final RubyModel model = RubyModelManager.getRubyModelManager().getRubyModel();
+ // ensure external jars are refreshed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93668)
+ try {
+ model.refreshExternalArchives(
+ null/*refresh all projects*/,
+ monitor == null ? null : new SubProgressMonitor(monitor, 1) // 1% of the time is spent in jar refresh
+ );
+ } catch (RubyModelException e) {
+ // refreshing failed: ignore
+ }
} finally {
if (monitor != null) monitor.done();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 14:41:24
|
Revision: 3212
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3212&view=rev
Author: cawilliams
Date: 2007-09-18 07:41:23 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
really fix #6052
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-09-18 14:20:56 UTC (rev 3211)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-09-18 14:41:23 UTC (rev 3212)
@@ -189,12 +189,12 @@
// TODO recover somehow by removing this chunk out of the fContents?
int start = se.getPosition().getStartOffset();
int length = fContents.length() - start;
- QueuedToken qtoken = new QueuedToken(new Token(RUBY_MULTI_LINE_COMMENT), start, length);
- if (fOffset == 0) { // If we never got to read in beginning contents
+ QueuedToken qtoken = new QueuedToken(new Token(RUBY_MULTI_LINE_COMMENT), start + origOffset, length);
+ if (fOffset == origOffset) { // If we never got to read in beginning contents
RubyPartitionScanner scanner = new RubyPartitionScanner();
- String possible = fContents.substring(0, se.getPosition().getStartOffset());
+ String possible = fContents.substring(0, start);
IDocument document = new Document(possible);
- scanner.setRange(document, 0, possible.length());
+ scanner.setRange(document, origOffset, possible.length());
IToken token;
while (!(token = scanner.nextToken()).isEOF()) {
push(new QueuedToken(token, scanner.getTokenOffset() + fOffset, scanner.getTokenLength()));
@@ -215,8 +215,10 @@
} catch (IOException e) {
RubyPlugin.log(e);
}
- if (!isEOF)
+ if (!isEOF) {
fLength = getOffset() - fOffset;
+ Assert.isTrue(fLength >= 0);
+ }
return returnValue;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 14:21:03
|
Revision: 3210
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3210&view=rev
Author: cawilliams
Date: 2007-09-18 07:20:52 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
add test and fix for #6052 - Ruby Editor goes crazy opening an unclosed multiline comment in middle of file
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-09-18 13:53:37 UTC (rev 3209)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-09-18 14:20:52 UTC (rev 3210)
@@ -190,13 +190,15 @@
int start = se.getPosition().getStartOffset();
int length = fContents.length() - start;
QueuedToken qtoken = new QueuedToken(new Token(RUBY_MULTI_LINE_COMMENT), start, length);
- RubyPartitionScanner scanner = new RubyPartitionScanner();
- String possible = fContents.substring(0, se.getPosition().getStartOffset());
- IDocument document = new Document(possible);
- scanner.setRange(document, 0, possible.length());
- IToken token;
- while (!(token = scanner.nextToken()).isEOF()) {
- push(new QueuedToken(token, scanner.getTokenOffset() + fOffset, scanner.getTokenLength()));
+ if (fOffset == 0) { // If we never got to read in beginning contents
+ RubyPartitionScanner scanner = new RubyPartitionScanner();
+ String possible = fContents.substring(0, se.getPosition().getStartOffset());
+ IDocument document = new Document(possible);
+ scanner.setRange(document, 0, possible.length());
+ IToken token;
+ while (!(token = scanner.nextToken()).isEOF()) {
+ push(new QueuedToken(token, scanner.getTokenOffset() + fOffset, scanner.getTokenLength()));
+ }
}
push(qtoken);
push(new QueuedToken(Token.EOF, start + length, 0));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 14:20:59
|
Revision: 3211
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3211&view=rev
Author: cawilliams
Date: 2007-09-18 07:20:56 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
add test and fix for #6052 - Ruby Editor goes crazy opening an unclosed multiline comment in middle of file
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-09-18 14:20:52 UTC (rev 3210)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-09-18 14:20:56 UTC (rev 3211)
@@ -43,6 +43,23 @@
"=ne", 0);
assert(true);
}
+
+ /**
+ * http://www.aptana.com/trac/ticket/6052
+ */
+ public void testBug6052() {
+ getContentType("# Use this class to maintain the decision process\n" +
+ "# To choose a next aprt of text etc.\n" +
+ "class Logic\n" +
+ "=begin\n" +
+ " def initialize\n" +
+ " end\n" +
+ "############################################################################################\n" +
+ " private\n" +
+ "############################################################################################ \n" +
+ "end", 0);
+ assert(true);
+ }
public void testPartitioningOfSingleLineComment() {
String source = "# This is a comment\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:53:38
|
Revision: 3209
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3209&view=rev
Author: cawilliams
Date: 2007-09-18 06:53:37 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
remove unused code
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyElementResourceMapping.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyElementResourceMapping.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyElementResourceMapping.java 2007-09-18 13:49:30 UTC (rev 3208)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/RubyElementResourceMapping.java 2007-09-18 13:53:37 UTC (rev 3209)
@@ -11,9 +11,7 @@
package org.rubypeople.rdt.internal.corext.util;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -257,41 +255,6 @@
}
}
- private static final class LogicalPackageResourceMapping extends ResourceMapping {
- private final ISourceFolder[] fFragments;
- private LogicalPackageResourceMapping(ISourceFolder[] fragments) {
- fFragments= fragments;
- }
- public Object getModelObject() {
- return fFragments;
- }
- public IProject[] getProjects() {
- Set result= new HashSet();
- for (int i= 0; i < fFragments.length; i++) {
- result.add(fFragments[i].getRubyProject().getProject());
- }
- return (IProject[])result.toArray(new IProject[result.size()]);
- }
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- List result= new ArrayList();
- if (context instanceof RemoteResourceMappingContext) {
- for (int i= 0; i < fFragments.length; i++) {
- result.add(new ResourceTraversal(
- new IResource[] {fFragments[i].getResource()}, IResource.DEPTH_ONE, 0));
- }
- } else {
- for (int i= 0; i < fFragments.length; i++) {
- result.add(new LocalPackageFragementTraversal(fFragments[i]));
- }
- }
- return (ResourceTraversal[])result.toArray(new ResourceTraversal[result.size()]);
- }
-
- public String getModelProviderId() {
- return RubyModelProvider.RUBY_MODEL_PROVIDER_ID;
- }
- }
-
public static ResourceMapping create(IRubyElement element) {
switch (element.getElementType()) {
case IRubyElement.TYPE:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:49:35
|
Revision: 3208
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3208&view=rev
Author: cawilliams
Date: 2007-09-18 06:49:30 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
add build action group to Ruby Explorer. Add missing string for build action. Add icon files for refresh action.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/refresh_nav.gif
trunk/org.rubypeople.rdt.ui/icons/full/elcl16/refresh_nav.gif
Added: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/refresh_nav.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/dlcl16/refresh_nav.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/refresh_nav.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/elcl16/refresh_nav.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-09-18 13:45:47 UTC (rev 3207)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-09-18 13:49:30 UTC (rev 3208)
@@ -13,6 +13,8 @@
OpenWithMenu_label=Open Wit&h
BuildPath_label=&Build Path
+BuildAction_label=&Build Project
+
OpenAction_label=&Open
OpenAction_tooltip=Open an Editor on the Selected Element
OpenAction_description=Open an editor on the selected element
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java 2007-09-18 13:45:47 UTC (rev 3207)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java 2007-09-18 13:49:30 UTC (rev 3208)
@@ -56,6 +56,7 @@
import org.rubypeople.rdt.internal.ui.workingsets.ViewActionGroup;
import org.rubypeople.rdt.internal.ui.workingsets.WorkingSetActionGroup;
import org.rubypeople.rdt.ui.IContextMenuConstants;
+import org.rubypeople.rdt.ui.actions.BuildActionGroup;
import org.rubypeople.rdt.ui.actions.CCPActionGroup;
import org.rubypeople.rdt.ui.actions.CustomFiltersActionGroup;
import org.rubypeople.rdt.ui.actions.NavigateActionGroup;
@@ -107,7 +108,7 @@
// new GenerateActionGroup(fPart),
// fRefactorActionGroup= new RefactorActionGroup(fPart),
// new ImportActionGroup(fPart),
-// new BuildActionGroup(fPart),
+ new BuildActionGroup(fPart),
new RubySearchActionGroup(fPart),
new ProjectActionGroup(fPart),
fViewActionGroup= new ViewActionGroup(fPart.getRootMode(), workingSetListener, site),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:45:50
|
Revision: 3207
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3207&view=rev
Author: cawilliams
Date: 2007-09-18 06:45:47 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
add new build action group, new strings for it, sub refresh action, and necessary core improvements to run the refresh
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModel.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModel.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModel.java 2007-09-18 13:45:40 UTC (rev 3206)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModel.java 2007-09-18 13:45:47 UTC (rev 3207)
@@ -6,6 +6,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IProgressMonitor;
/**
* @author cawilliams
@@ -80,4 +81,6 @@
* @since 2.1
*/
boolean contains(IResource resource);
+
+ void refreshExternalArchives(IRubyElement[] elements, IProgressMonitor monitor) throws RubyModelException;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java 2007-09-18 13:45:40 UTC (rev 3206)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java 2007-09-18 13:45:47 UTC (rev 3207)
@@ -20,6 +20,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.PerformanceStats;
import org.eclipse.core.runtime.SafeRunner;
@@ -113,6 +114,12 @@
}
}
+ private final static String EXTERNAL_JAR_ADDED = "external jar added"; //$NON-NLS-1$
+ private final static String EXTERNAL_JAR_CHANGED = "external jar changed"; //$NON-NLS-1$
+ private final static String EXTERNAL_JAR_REMOVED = "external jar removed"; //$NON-NLS-1$
+ private final static String EXTERNAL_JAR_UNCHANGED = "external jar unchanged"; //$NON-NLS-1$
+ private final static String INTERNAL_JAR_IGNORE = "internal jar ignore"; //$NON-NLS-1$
+
public static final int DEFAULT_CHANGE_EVENT = 0; // must not collide with
private final static int NON_RUBY_RESOURCE = -1;
// ElementChangedEvent
@@ -2028,4 +2035,241 @@
}
return true;
}
+
+ /*
+ * Check all external archive (referenced by given roots, projects or model) status and issue a corresponding root delta.
+ * Also triggers index updates
+ */
+ public void checkExternalArchiveChanges(IRubyElement[] elementsToRefresh, IProgressMonitor monitor) throws RubyModelException {
+ try {
+ for (int i = 0, length = elementsToRefresh.length; i < length; i++) {
+ this.addForRefresh(elementsToRefresh[i]);
+ }
+ boolean hasDelta = this.createExternalArchiveDelta(monitor);
+ if (monitor != null && monitor.isCanceled()) return;
+ if (hasDelta){
+ // force loadpath marker refresh of affected projects
+ RubyModel.flushExternalFileCache();
+
+ IRubyElementDelta[] projectDeltas = this.currentDelta.getAffectedChildren();
+ final int length = projectDeltas.length;
+ final IProject[] projectsToTouch = new IProject[length];
+ for (int i = 0; i < length; i++) {
+ IRubyElementDelta delta = projectDeltas[i];
+ RubyProject rubyProject = (RubyProject)delta.getElement();
+ rubyProject.getResolvedLoadpath(
+ true/*ignoreUnresolvedEntry*/,
+ true/*generateMarkerOnError*/,
+ false/*don't returnResolutionInProgress*/);
+ projectsToTouch[i] = rubyProject.getProject();
+ }
+
+ // no need to rebuild if external folders/files change
+// // touch the projects to force them to be recompiled while taking the workspace lock
+// // so that there is no concurrency with the Java builder
+// // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96575
+// IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+// public void run(IProgressMonitor progressMonitor) throws CoreException {
+// for (int i = 0; i < length; i++) {
+// IProject project = projectsToTouch[i];
+//
+// // touch to force a build of this project
+// if (RubyBuilder.DEBUG)
+// System.out.println("Touching project " + project.getName() + " due to external jar file change"); //$NON-NLS-1$ //$NON-NLS-2$
+// project.touch(progressMonitor);
+// }
+// }
+// };
+// try {
+// ResourcesPlugin.getWorkspace().run(runnable, monitor);
+// } catch (CoreException e) {
+// throw new RubyModelException(e);
+// }
+
+ if (this.currentDelta != null) { // if delta has not been fired while creating markers
+ this.fire(this.currentDelta, DEFAULT_CHANGE_EVENT);
+ }
+ }
+ } finally {
+ this.currentDelta = null;
+ if (monitor != null) monitor.done();
+ }
+ }
+
+ /*
+ * Check if external archives have changed and create the corresponding deltas.
+ * Returns whether at least on delta was created.
+ */
+ private boolean createExternalArchiveDelta(IProgressMonitor monitor) {
+
+ if (this.refreshedElements == null) return false;
+
+ HashMap externalArchivesStatus = new HashMap();
+ boolean hasDelta = false;
+
+ // find JARs to refresh
+ HashSet archivePathsToRefresh = new HashSet();
+ Iterator iterator = this.refreshedElements.iterator();
+ this.refreshedElements = null; // null out early to avoid concurrent modification exception (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63534)
+ while (iterator.hasNext()) {
+ IRubyElement element = (IRubyElement)iterator.next();
+ switch(element.getElementType()){
+ case IRubyElement.SOURCE_FOLDER_ROOT :
+ archivePathsToRefresh.add(element.getPath());
+ break;
+ case IRubyElement.RUBY_PROJECT :
+ RubyProject javaProject = (RubyProject) element;
+ if (!RubyProject.hasRubyNature(javaProject.getProject())) {
+ // project is not accessible or has lost its Ruby nature
+ break;
+ }
+ ILoadpathEntry[] classpath;
+ try {
+ classpath = javaProject.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
+ for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
+ if (classpath[j].getEntryKind() == ILoadpathEntry.CPE_LIBRARY){
+ archivePathsToRefresh.add(classpath[j].getPath());
+ }
+ }
+ } catch (RubyModelException e) {
+ // project doesn't exist -> ignore
+ }
+ break;
+ case IRubyElement.RUBY_MODEL :
+ Iterator projectNames = this.state.getOldRubyProjecNames().iterator();
+ while (projectNames.hasNext()) {
+ String projectName = (String) projectNames.next();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (!RubyProject.hasRubyNature(project)) {
+ // project is not accessible or has lost its Ruby nature
+ continue;
+ }
+ javaProject = (RubyProject) RubyCore.create(project);
+ try {
+ classpath = javaProject.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
+ } catch (RubyModelException e2) {
+ // project doesn't exist -> ignore
+ continue;
+ }
+ for (int k = 0, cpLength = classpath.length; k < cpLength; k++){
+ if (classpath[k].getEntryKind() == ILoadpathEntry.CPE_LIBRARY){
+ archivePathsToRefresh.add(classpath[k].getPath());
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ // perform refresh
+ Iterator projectNames = this.state.getOldRubyProjecNames().iterator();
+ IWorkspaceRoot wksRoot = ResourcesPlugin.getWorkspace().getRoot();
+ while (projectNames.hasNext()) {
+
+ if (monitor != null && monitor.isCanceled()) break;
+
+ String projectName = (String) projectNames.next();
+ IProject project = wksRoot.getProject(projectName);
+ if (!RubyProject.hasRubyNature(project)) {
+ // project is not accessible or has lost its Ruby nature
+ continue;
+ }
+ RubyProject javaProject = (RubyProject) RubyCore.create(project);
+ ILoadpathEntry[] entries;
+ try {
+ entries = javaProject.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
+ } catch (RubyModelException e1) {
+ // project does not exist -> ignore
+ continue;
+ }
+ for (int j = 0; j < entries.length; j++){
+ if (entries[j].getEntryKind() == ILoadpathEntry.CPE_LIBRARY) {
+
+ IPath entryPath = entries[j].getPath();
+
+ if (!archivePathsToRefresh.contains(entryPath)) continue; // not supposed to be refreshed
+
+ String status = (String)externalArchivesStatus.get(entryPath);
+ if (status == null){
+
+ // compute shared status
+ Object targetLibrary = RubyModel.getTarget(wksRoot, entryPath, true);
+
+ if (targetLibrary == null){ // missing JAR
+ if (this.state.getExternalLibTimeStamps().remove(entryPath) != null){
+ externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED);
+ // the jar was physically removed: remove the index
+ this.manager.indexManager.removeIndex(entryPath);
+ }
+
+ } else if (targetLibrary instanceof File){ // external JAR
+
+ File externalFile = (File)targetLibrary;
+
+ // check timestamp to figure if JAR has changed in some way
+ Long oldTimestamp =(Long) this.state.getExternalLibTimeStamps().get(entryPath);
+ long newTimeStamp = getTimeStamp(externalFile);
+ if (oldTimestamp != null){
+
+ if (newTimeStamp == 0){ // file doesn't exist
+ externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED);
+ this.state.getExternalLibTimeStamps().remove(entryPath);
+ // remove the index
+ this.manager.indexManager.removeIndex(entryPath);
+
+ } else if (oldTimestamp.longValue() != newTimeStamp){
+ externalArchivesStatus.put(entryPath, EXTERNAL_JAR_CHANGED);
+ this.state.getExternalLibTimeStamps().put(entryPath, new Long(newTimeStamp));
+ // first remove the index so that it is forced to be re-indexed
+ this.manager.indexManager.removeIndex(entryPath);
+ // then index the jar
+ this.manager.indexManager.indexLibrary(entryPath, project.getProject());
+ } else {
+ externalArchivesStatus.put(entryPath, EXTERNAL_JAR_UNCHANGED);
+ }
+ } else {
+ if (newTimeStamp == 0){ // jar still doesn't exist
+ externalArchivesStatus.put(entryPath, EXTERNAL_JAR_UNCHANGED);
+ } else {
+ externalArchivesStatus.put(entryPath, EXTERNAL_JAR_ADDED);
+ this.state.getExternalLibTimeStamps().put(entryPath, new Long(newTimeStamp));
+ // index the new jar
+ this.manager.indexManager.indexLibrary(entryPath, project.getProject());
+ }
+ }
+ } else { // internal JAR
+ externalArchivesStatus.put(entryPath, INTERNAL_JAR_IGNORE);
+ }
+ }
+ // according to computed status, generate a delta
+ status = (String)externalArchivesStatus.get(entryPath);
+ if (status != null){
+ if (status == EXTERNAL_JAR_ADDED){
+ SourceFolderRoot root = (SourceFolderRoot) javaProject.getSourceFolderRoot(entryPath.toString());
+ if (VERBOSE){
+ System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$
+ }
+ elementAdded(root, null, null);
+ hasDelta = true;
+ } else if (status == EXTERNAL_JAR_CHANGED) {
+ SourceFolderRoot root = (SourceFolderRoot) javaProject.getSourceFolderRoot(entryPath.toString());
+ if (VERBOSE){
+ System.out.println("- External JAR CHANGED, affecting root: "+root.getElementName()); //$NON-NLS-1$
+ }
+ contentChanged(root);
+ hasDelta = true;
+ } else if (status == EXTERNAL_JAR_REMOVED) {
+ SourceFolderRoot root = (SourceFolderRoot) javaProject.getSourceFolderRoot(entryPath.toString());
+ if (VERBOSE){
+ System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$
+ }
+ elementRemoved(root, null, null);
+ hasDelta = true;
+ }
+ }
+ }
+ }
+ }
+ return hasDelta;
+ }
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java 2007-09-18 13:45:40 UTC (rev 3206)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModel.java 2007-09-18 13:45:47 UTC (rev 3207)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.rubypeople.rdt.core.IOpenable;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyModel;
@@ -312,4 +313,13 @@
return true;
}
+ /**
+ * @see IRubyModel#refreshExternalArchives(IRubyElement[], IProgressMonitor)
+ */
+ public void refreshExternalArchives(IRubyElement[] elementsScope, IProgressMonitor monitor) throws RubyModelException {
+ if (elementsScope == null){
+ elementsScope = new IRubyElement[] { this };
+ }
+ RubyModelManager.getRubyModelManager().getDeltaProcessor().checkExternalArchiveChanges(elementsScope, monitor);
+ }
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-09-18 13:45:40 UTC (rev 3206)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-09-18 13:45:47 UTC (rev 3207)
@@ -167,7 +167,7 @@
*/
public DeltaProcessingState deltaState = new DeltaProcessingState();
- private IndexManager indexManager = null;
+ public IndexManager indexManager = null;
/**
* Unique handle onto the RubyModel
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:45:45
|
Revision: 3206
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3206&view=rev
Author: cawilliams
Date: 2007-09-18 06:45:40 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
add new build action group, new strings for it, sub refresh action, and necessary core improvements to run the refresh
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OccurrencesSearchGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyExplorerViewAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/BuildActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RefreshAction.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -81,7 +81,29 @@
public static String OpenTypeHierarchyAction_messages_unknown_import_decl;
public static String OpenTypeHierarchyAction_messages_no_types;
public static String OpenTypeHierarchyAction_messages_no_valid_ruby_element;
+
+ public static String SurroundWithBeginRescueAction_label;
+ public static String SurroundWithBeginRescueAction_error;
+ public static String SurroundWithBeginRescueAction_dialog_title;
+ public static String QuickMenuAction_menuTextWithShortcut;
+ public static String ShowInPackageViewAction_label;
+ public static String ShowInPackageViewAction_description;
+ public static String ShowInPackageViewAction_tooltip;
+ public static String ShowInPackageViewAction_error_message;
+ public static String ShowInPackageViewAction_dialog_title;
+ public static String OpenProjectAction_dialog_title;
+ public static String OpenProjectAction_dialog_message;
+ public static String OpenProjectAction_error_message;
+ public static String RefreshAction_label;
+ public static String RefreshAction_toolTip;
+ public static String RefreshAction_progressMessage;
+ public static String RefreshAction_error_title;
+ public static String RefreshAction_error_message;
+ public static String RefreshAction_locationDeleted_message;
+ public static String RefreshAction_locationDeleted_title;
+ public static String BuildAction_label;
+
static {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-09-18 13:45:40 UTC (rev 3206)
@@ -82,4 +82,19 @@
OpenTypeInHierarchyAction_tooltip=Open a Type in a Type Hierarchy
OpenTypeInHierarchyAction_dialogMessage=&Choose a type (? = any character, * = any string):
-OpenTypeInHierarchyAction_dialogTitle=Open Type in Hierarchy
\ No newline at end of file
+OpenTypeInHierarchyAction_dialogTitle=Open Type in Hierarchy
+
+SurroundWithBeginRescueAction_label=Surround with begin...rescue
+SurroundWithBeginRescueAction_error=Error occurred while surrounding code with begin..rescue block
+SurroundWithBeginRescueAction_dialog_title=Surround with begin...rescue
+
+# The first parameter is the menu text and the second parameter is the shortcut string
+QuickMenuAction_menuTextWithShortcut= {0}\t{1}
+
+RefreshAction_label= Re&fresh
+RefreshAction_toolTip= Refresh
+RefreshAction_progressMessage= Refreshing...
+RefreshAction_error_title= Refresh Problems
+RefreshAction_error_message= Problems occurred refreshing the selected resources.
+RefreshAction_locationDeleted_title= Project location has been deleted
+RefreshAction_locationDeleted_message= The location for project {0} ({1}) has been deleted.\n Delete {0} from the workspace?
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -1,27 +0,0 @@
-package org.rubypeople.rdt.ui.actions;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ActionMessages {
- private static final String BUNDLE_NAME = "org.rubypeople.rdt.ui.actions.ActionMessages"; //$NON-NLS-1$
-
- private ActionMessages() {}
-
- public static String SurroundWithBeginRescueAction_label;
- public static String SurroundWithBeginRescueAction_error;
- public static String SurroundWithBeginRescueAction_dialog_title;
-
- public static String QuickMenuAction_menuTextWithShortcut;
- public static String ShowInPackageViewAction_label;
- public static String ShowInPackageViewAction_description;
- public static String ShowInPackageViewAction_tooltip;
- public static String ShowInPackageViewAction_error_message;
- public static String ShowInPackageViewAction_dialog_title;
- public static String OpenProjectAction_dialog_title;
- public static String OpenProjectAction_dialog_message;
- public static String OpenProjectAction_error_message;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
- }
-}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties 2007-09-18 13:45:40 UTC (rev 3206)
@@ -1,6 +0,0 @@
-SurroundWithBeginRescueAction_label=Surround with begin...rescue
-SurroundWithBeginRescueAction_error=Error occurred while surrounding code with begin..rescue block
-SurroundWithBeginRescueAction_dialog_title=Surround with begin...rescue
-
-# The first parameter is the menu text and the second parameter is the shortcut string
-QuickMenuAction_menuTextWithShortcut= {0}\t{1}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/BuildActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/BuildActionGroup.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/BuildActionGroup.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.ui.actions;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.actions.BuildAction;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
+import org.rubypeople.rdt.ui.IContextMenuConstants;
+
+/**
+ * Contributes all build related actions to the context menu and installs handlers for the
+ * corresponding global menu actions.
+ *
+ * <p>
+ * This class may be instantiated; it is not intended to be subclassed.
+ * </p>
+ *
+ * @since 2.0
+ */
+public class BuildActionGroup extends ActionGroup {
+
+ private IWorkbenchSite fSite;
+
+ private BuildAction fBuildAction;
+ private RefreshAction fRefreshAction;
+
+ /**
+ * Creates a new <code>BuildActionGroup</code>. The group requires that
+ * the selection provided by the view part's selection provider is of type
+ * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
+ *
+ * @param part the view part that owns this action group
+ */
+ public BuildActionGroup(IViewPart part) {
+ fSite= part.getSite();
+ Shell shell= fSite.getShell();
+ ISelectionProvider provider= fSite.getSelectionProvider();
+
+ fBuildAction= new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
+ fBuildAction.setText(ActionMessages.BuildAction_label);
+ fBuildAction.setActionDefinitionId("org.eclipse.ui.project.buildProject"); //$NON-NLS-1$
+
+ fRefreshAction= new RefreshAction(fSite);
+ fRefreshAction.setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$
+
+ provider.addSelectionChangedListener(fBuildAction);
+ provider.addSelectionChangedListener(fRefreshAction);
+ }
+
+ /**
+ * Returns the refresh action managed by this group.
+ *
+ * @return the refresh action. If this group doesn't manage a refresh action
+ * <code>null</code> is returned
+ */
+ public IAction getRefreshAction() {
+ return fRefreshAction;
+ }
+
+ /* (non-Rubydoc)
+ * Method declared in ActionGroup
+ */
+ public void fillActionBars(IActionBars actionBar) {
+ super.fillActionBars(actionBar);
+ setGlobalActionHandlers(actionBar);
+ }
+
+ /* (non-Rubydoc)
+ * Method declared in ActionGroup
+ */
+ public void fillContextMenu(IMenuManager menu) {
+ ISelection selection= getContext().getSelection();
+ if (!ResourcesPlugin.getWorkspace().isAutoBuilding() && isBuildTarget(selection)) {
+ appendToGroup(menu, fBuildAction);
+ }
+ appendToGroup(menu, fRefreshAction);
+ super.fillContextMenu(menu);
+ }
+
+ /* (non-Rubydoc)
+ * Method declared in ActionGroup
+ */
+ public void dispose() {
+ ISelectionProvider provider= fSite.getSelectionProvider();
+ provider.removeSelectionChangedListener(fBuildAction);
+ provider.removeSelectionChangedListener(fRefreshAction);
+ super.dispose();
+ }
+
+ private void setGlobalActionHandlers(IActionBars actionBar) {
+ actionBar.setGlobalActionHandler(IDEActionFactory.BUILD_PROJECT.getId(), fBuildAction);
+ actionBar.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefreshAction);
+ }
+
+ private void appendToGroup(IMenuManager menu, IAction action) {
+ if (action.isEnabled())
+ menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, action);
+ }
+
+ private boolean isBuildTarget(ISelection s) {
+ if (!(s instanceof IStructuredSelection))
+ return false;
+ IStructuredSelection selection= (IStructuredSelection)s;
+ if (selection.size() != 1)
+ return false;
+ return selection.getFirstElement() instanceof IRubyProject;
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/BuildActionGroup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OccurrencesSearchGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OccurrencesSearchGroup.java 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OccurrencesSearchGroup.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -25,6 +25,7 @@
import org.eclipse.ui.keys.IBindingService;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.rubypeople.rdt.internal.corext.util.Messages;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
import org.rubypeople.rdt.internal.ui.search.SearchMessages;
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -34,6 +34,7 @@
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
import org.rubypeople.rdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
import org.rubypeople.rdt.ui.RubyElementLabelProvider;
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RefreshAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RefreshAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RefreshAction.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyModel;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.corext.util.Messages;
+import org.rubypeople.rdt.internal.corext.util.Resources;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPluginImages;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
+import org.rubypeople.rdt.internal.ui.actions.WorkbenchRunnableAdapter;
+import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
+
+/**
+ * Action for refreshing the workspace from the local file system for
+ * the selected resources and all of their descendants. This action
+ * also considers external folders managed by the Ruby Model.
+ * <p>
+ * Action is applicable to selections containing resources and Ruby
+ * elements down to compilation units.
+ *
+ * <p>
+ * This class may be instantiated; it is not intended to be subclassed.
+ * </p>
+ *
+ * @since 2.0
+ */
+public class RefreshAction extends SelectionDispatchAction {
+
+ /**
+ * Creates a new <code>RefreshAction</code>. The action requires
+ * that the selection provided by the site's selection provider is of type <code>
+ * org.eclipse.jface.viewers.IStructuredSelection</code>.
+ *
+ * @param site the site providing context information for this action
+ */
+ public RefreshAction(IWorkbenchSite site) {
+ super(site);
+ setText(ActionMessages.RefreshAction_label);
+ setToolTipText(ActionMessages.RefreshAction_toolTip);
+ RubyPluginImages.setLocalImageDescriptors(this, "refresh_nav.gif");//$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IRubyHelpContextIds.REFRESH_ACTION);
+ }
+
+ /* (non-Rubydoc)
+ * Method declared in SelectionDispatchAction
+ */
+ public void selectionChanged(IStructuredSelection selection) {
+ setEnabled(checkEnabled(selection));
+ }
+
+ private boolean checkEnabled(IStructuredSelection selection) {
+ if (selection.isEmpty())
+ return true;
+ for (Iterator iter= selection.iterator(); iter.hasNext();) {
+ Object element= iter.next();
+ if (element instanceof IWorkingSet) {
+ // don't inspect working sets any deeper.
+ } else if (element instanceof IAdaptable) {
+ IResource resource= (IResource)((IAdaptable)element).getAdapter(IResource.class);
+ if (resource == null)
+ return false;
+ if (resource.getType() == IResource.PROJECT && !((IProject)resource).isOpen())
+ return false;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* (non-Rubydoc)
+ * Method declared in SelectionDispatchAction
+ */
+ public void run(IStructuredSelection selection) {
+ final IResource[] resources= getResources(selection);
+ IWorkspaceRunnable operation= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask(ActionMessages.RefreshAction_progressMessage, resources.length * 2);
+ monitor.subTask(""); //$NON-NLS-1$
+ List javaElements= new ArrayList(5);
+ for (int r= 0; r < resources.length; r++) {
+ IResource resource= resources[r];
+ if (resource.getType() == IResource.PROJECT) {
+ checkLocationDeleted((IProject) resource);
+ } else if (resource.getType() == IResource.ROOT) {
+ IProject[] projects = ((IWorkspaceRoot)resource).getProjects();
+ for (int p = 0; p < projects.length; p++) {
+ checkLocationDeleted(projects[p]);
+ }
+ }
+ resource.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ IRubyElement jElement= RubyCore.create(resource);
+ if (jElement != null && jElement.exists())
+ javaElements.add(jElement);
+ }
+ IRubyModel model= RubyCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ model.refreshExternalArchives(
+ (IRubyElement[]) javaElements.toArray(new IRubyElement[javaElements.size()]),
+ new SubProgressMonitor(monitor, resources.length));
+ }
+ };
+
+ try {
+ PlatformUI.getWorkbench().getProgressService().run(true, true, new WorkbenchRunnableAdapter(operation));
+ } catch (InvocationTargetException e) {
+ ExceptionHandler.handle(e, getShell(),
+ ActionMessages.RefreshAction_error_title,
+ ActionMessages.RefreshAction_error_message);
+ } catch (InterruptedException e) {
+ // canceled
+ }
+ }
+
+ private IResource[] getResources(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ return new IResource[] {ResourcesPlugin.getWorkspace().getRoot()};
+ }
+
+ List result= new ArrayList(selection.size());
+ getResources(result, selection.toArray());
+
+ for (Iterator iter= result.iterator(); iter.hasNext();) {
+ IResource resource= (IResource) iter.next();
+ if (isDescendent(result, resource))
+ iter.remove();
+ }
+
+ return (IResource[]) result.toArray(new IResource[result.size()]);
+ }
+
+ private void getResources(List result, Object[] elements) {
+ for (int i= 0; i < elements.length; i++) {
+ Object element= elements[i];
+ // Must check working set before IAdaptable since WorkingSet
+ // implements IAdaptable
+ if (element instanceof IWorkingSet) {
+ getResources(result, ((IWorkingSet)element).getElements());
+ } else if (element instanceof IAdaptable) {
+ IResource resource= (IResource)((IAdaptable)element).getAdapter(IResource.class);
+ if (resource == null)
+ continue;
+ if (resource.getType() != IResource.PROJECT ||
+ (resource.getType() == IResource.PROJECT && ((IProject)resource).isOpen())) {
+ result.add(resource);
+ }
+ }
+ }
+ }
+
+ private boolean isDescendent(List candidates, IResource element) {
+ IResource parent= element.getParent();
+ while (parent != null) {
+ if (candidates.contains(parent))
+ return true;
+ parent= parent.getParent();
+ }
+ return false;
+ }
+
+ private void checkLocationDeleted(IProject project) throws CoreException {
+ if (!project.exists())
+ return;
+ URI location= project.getLocationURI();
+ if (location == null)
+ return;
+ IFileStore store= EFS.getStore(location);
+ if (!store.fetchInfo().exists()) {
+ final String message = Messages.format(
+ ActionMessages.RefreshAction_locationDeleted_message,
+ new Object[] { project.getName(), Resources.getLocationString(project) });
+ final boolean[] result= new boolean[1];
+ // Must prompt user in UI thread (we're in the operation thread here).
+ getShell().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ result[0]= MessageDialog.openQuestion(getShell(),
+ ActionMessages.RefreshAction_locationDeleted_title,
+ message);
+ }
+ });
+ if (result[0]) {
+ project.delete(true, true, null);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RefreshAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyExplorerViewAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyExplorerViewAction.java 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyExplorerViewAction.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -20,6 +20,7 @@
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
import org.rubypeople.rdt.internal.ui.actions.SelectionConverter;
import org.rubypeople.rdt.internal.ui.packageview.PackageExplorerPart;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java 2007-09-18 13:22:15 UTC (rev 3205)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java 2007-09-18 13:45:40 UTC (rev 3206)
@@ -22,6 +22,7 @@
import org.rubypeople.rdt.internal.corext.util.RubyModelUtil;
import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
import org.rubypeople.rdt.internal.ui.actions.SelectionConverter;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:22:18
|
Revision: 3205
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3205&view=rev
Author: cawilliams
Date: 2007-09-18 06:22:15 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
fix handling when non ruby resourcves in a source folder change. (Need to wipe cached array of resources and recompute)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java 2007-09-18 13:00:36 UTC (rev 3204)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java 2007-09-18 13:22:15 UTC (rev 3205)
@@ -795,28 +795,41 @@
private void nonRubyResourcesChanged(Openable element, IResourceDelta delta)
throws RubyModelException {
- // reset non-java resources if element was open
- if (element.isOpen()) {
- RubyElementInfo info = (RubyElementInfo) element.getElementInfo();
- switch (element.getElementType()) {
- case IRubyElement.RUBY_MODEL:
- ((RubyModelInfo) info).nonRubyResources = null;
- currentDelta().addResourceDelta(delta);
- return;
- case IRubyElement.RUBY_PROJECT:
- ((RubyProjectElementInfo) info).setNonRubyResources(null);
- break;
- }
- }
+ // reset non-ruby resources if element was open
+ if (element.isOpen()) {
+ RubyElementInfo info = (RubyElementInfo)element.getElementInfo();
+ switch (element.getElementType()) {
+ case IRubyElement.RUBY_MODEL :
+ ((RubyModelInfo) info).nonRubyResources = null;
+ currentDelta().addResourceDelta(delta);
+ return;
+ case IRubyElement.RUBY_PROJECT :
+ ((RubyProjectElementInfo) info).setNonRubyResources(null);
+
+ // if a package fragment root is the project, clear it too
+ RubyProject project = (RubyProject) element;
+ SourceFolderRoot projectRoot =
+ (SourceFolderRoot) project.getSourceFolderRoot(project.getProject());
+ if (projectRoot.isOpen()) {
+ ((SourceFolderRootInfo) projectRoot.getElementInfo()).setNonRubyResources(
+ null);
+ }
+ break;
+ case IRubyElement.SOURCE_FOLDER :
+ ((SourceFolderInfo) info).setNonRubyResources(null);
+ break;
+ case IRubyElement.SOURCE_FOLDER_ROOT :
+ ((SourceFolderRootInfo) info).setNonRubyResources(null);
+ }
+ }
- RubyElementDelta current = currentDelta();
- RubyElementDelta elementDelta = current.find(element);
- if (elementDelta == null) {
- // don't use find after creating the delta as it can be null (see
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=63434)
- elementDelta = current.changed(element, IRubyElementDelta.F_CONTENT);
- }
- elementDelta.addResourceDelta(delta);
+ RubyElementDelta current = currentDelta();
+ RubyElementDelta elementDelta = current.find(element);
+ if (elementDelta == null) {
+ // don't use find after creating the delta as it can be null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63434)
+ elementDelta = current.changed(element, IRubyElementDelta.F_CONTENT);
+ }
+ elementDelta.addResourceDelta(delta);
}
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:00:39
|
Revision: 3204
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3204&view=rev
Author: cawilliams
Date: 2007-09-18 06:00:36 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
add new strings for project action group
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-09-18 13:00:24 UTC (rev 3203)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-09-18 13:00:36 UTC (rev 3204)
@@ -62,6 +62,10 @@
NewWizardsActionGroup_new=Ne&w
+OpenProjectAction_dialog_title=Open Project
+OpenProjectAction_dialog_message=Select project(s) to be opened
+OpenProjectAction_error_message=Problems while opening projects
+
OpenTypeHierarchyAction_label=Ope&n Type Hierarchy
OpenTypeHierarchyAction_tooltip=Open a Type Hierarchy on the Selected Element
OpenTypeHierarchyAction_description=Open a type hierarchy on the selected element
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-18 13:00:27
|
Revision: 3203
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3203&view=rev
Author: cawilliams
Date: 2007-09-18 06:00:24 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
Add Project ActionGroup to Ruby Explorer - so we can close and open projects.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ProjectActionGroup.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java 2007-09-17 20:58:36 UTC (rev 3202)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/packageview/PackageExplorerActionGroup.java 2007-09-18 13:00:24 UTC (rev 3203)
@@ -59,6 +59,7 @@
import org.rubypeople.rdt.ui.actions.CCPActionGroup;
import org.rubypeople.rdt.ui.actions.CustomFiltersActionGroup;
import org.rubypeople.rdt.ui.actions.NavigateActionGroup;
+import org.rubypeople.rdt.ui.actions.ProjectActionGroup;
import org.rubypeople.rdt.ui.actions.RubySearchActionGroup;
class PackageExplorerActionGroup extends CompositeActionGroup {
@@ -108,7 +109,7 @@
// new ImportActionGroup(fPart),
// new BuildActionGroup(fPart),
new RubySearchActionGroup(fPart),
-// new ProjectActionGroup(fPart),
+ new ProjectActionGroup(fPart),
fViewActionGroup= new ViewActionGroup(fPart.getRootMode(), workingSetListener, site),
fCustomFiltersActionGroup= new CustomFiltersActionGroup(fPart, viewer),
// new LayoutActionGroup(fPart),
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2007-09-17 20:58:36 UTC (rev 3202)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2007-09-18 13:00:24 UTC (rev 3203)
@@ -17,6 +17,9 @@
public static String ShowInPackageViewAction_tooltip;
public static String ShowInPackageViewAction_error_message;
public static String ShowInPackageViewAction_dialog_title;
+ public static String OpenProjectAction_dialog_title;
+ public static String OpenProjectAction_dialog_message;
+ public static String OpenProjectAction_error_message;
static {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java 2007-09-18 13:00:24 UTC (rev 3203)
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.OpenResourceAction;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.WorkbenchRunnableAdapter;
+import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
+import org.rubypeople.rdt.ui.RubyElementLabelProvider;
+
+/**
+ * Action to open a closed project. Action either opens the closed projects
+ * provided by the structured selection or presents a dialog from which the
+ * user can select the projects to be opened.
+ *
+ * <p>
+ * This class may be instantiated; it is not intended to be subclassed.
+ * </p>
+ *
+ * @since 2.0
+ */
+public class OpenProjectAction extends SelectionDispatchAction implements IResourceChangeListener {
+
+ private static final int EMPTY_SELECTION= 1;
+ private static final int ELEMENT_SELECTION= 2;
+
+ private int fMode;
+ private OpenResourceAction fWorkbenchAction;
+
+ /**
+ * Creates a new <code>OpenProjectAction</code>. The action requires
+ * that the selection provided by the site's selection provider is of type <code>
+ * org.eclipse.jface.viewers.IStructuredSelection</code>.
+ *
+ * @param site the site providing context information for this action
+ */
+ public OpenProjectAction(IWorkbenchSite site) {
+ super(site);
+ fWorkbenchAction= new OpenResourceAction(site.getShell());
+ setText(fWorkbenchAction.getText());
+ setToolTipText(fWorkbenchAction.getToolTipText());
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IRubyHelpContextIds.OPEN_PROJECT_ACTION);
+ }
+
+ /*
+ * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ fWorkbenchAction.resourceChanged(event);
+ switch (fMode) {
+ case ELEMENT_SELECTION:
+ setEnabled(fWorkbenchAction.isEnabled());
+ break;
+ case EMPTY_SELECTION:
+ internalResourceChanged(event);
+ break;
+ }
+ }
+
+ private void internalResourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ if (delta != null) {
+ IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
+ for (int i = 0; i < projDeltas.length; ++i) {
+ IResourceDelta projDelta = projDeltas[i];
+ if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
+ setEnabled(hasCloseProjects());
+ return;
+ }
+ }
+ }
+ }
+
+ //---- normal selection -------------------------------------
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(ISelection selection) {
+ setEnabled(hasCloseProjects());
+ fMode= EMPTY_SELECTION;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.ISelection)
+ */
+ public void run(ISelection selection) {
+ internalRun();
+ }
+
+ //---- structured selection ---------------------------------------
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ setEnabled(hasCloseProjects());
+ fMode= EMPTY_SELECTION;
+ return;
+ }
+ fWorkbenchAction.selectionChanged(selection);
+ setEnabled(fWorkbenchAction.isEnabled());
+ fMode= ELEMENT_SELECTION;
+ }
+
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void run(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ internalRun();
+ return;
+ }
+ fWorkbenchAction.run();
+ }
+
+ private void internalRun() {
+ ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new RubyElementLabelProvider());
+ dialog.setTitle(ActionMessages.OpenProjectAction_dialog_title);
+ dialog.setMessage(ActionMessages.OpenProjectAction_dialog_message);
+ dialog.setElements(getClosedProjects());
+ dialog.setMultipleSelection(true);
+ int result= dialog.open();
+ if (result != Window.OK)
+ return;
+ final Object[] projects= dialog.getResult();
+ IWorkspaceRunnable runnable= createRunnable(projects);
+ try {
+ PlatformUI.getWorkbench().getProgressService().run(true, true, new WorkbenchRunnableAdapter(runnable));
+ } catch (InvocationTargetException e) {
+ ExceptionHandler.handle(e, getShell(),
+ ActionMessages.OpenProjectAction_dialog_title,
+ ActionMessages.OpenProjectAction_error_message);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ private IWorkspaceRunnable createRunnable(final Object[] projects) {
+ return new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", projects.length); //$NON-NLS-1$
+ MultiStatus errorStatus= null;
+ for (int i = 0; i < projects.length; i++) {
+ IProject project= (IProject)projects[i];
+ try {
+ project.open(new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ if (errorStatus == null)
+ errorStatus = new MultiStatus(RubyPlugin.getPluginId(), IStatus.ERROR, ActionMessages.OpenProjectAction_error_message, e);
+ errorStatus.merge(e.getStatus());
+ }
+ }
+ monitor.done();
+ if (errorStatus != null)
+ throw new CoreException(errorStatus);
+ }
+ };
+ }
+
+ private Object[] getClosedProjects() {
+ IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ List result= new ArrayList(5);
+ for (int i = 0; i < projects.length; i++) {
+ IProject project= projects[i];
+ if (!project.isOpen())
+ result.add(project);
+ }
+ return result.toArray();
+ }
+
+ private boolean hasCloseProjects() {
+ IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (int i = 0; i < projects.length; i++) {
+ if (!projects[i].isOpen())
+ return true;
+ }
+ return false;
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenProjectAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ProjectActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ProjectActionGroup.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ProjectActionGroup.java 2007-09-18 13:00:24 UTC (rev 3203)
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.actions.CloseResourceAction;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.internal.ide.actions.CloseUnrelatedProjectsAction;
+import org.rubypeople.rdt.ui.IContextMenuConstants;
+
+/**
+ * Adds actions to open and close a project to the global menu bar.
+ *
+ * <p>
+ * This class may be instantiated; it is not intended to be subclassed.
+ * </p>
+ *
+ * @since 2.0
+ */
+public class ProjectActionGroup extends ActionGroup {
+
+ private IWorkbenchSite fSite;
+
+ private OpenProjectAction fOpenAction;
+ private CloseResourceAction fCloseAction;
+ private CloseResourceAction fCloseUnrelatedAction;
+
+ /**
+ * Creates a new <code>ProjectActionGroup</code>. The group requires
+ * that the selection provided by the site's selection provider is of type <code>
+ * org.eclipse.jface.viewers.IStructuredSelection</code>.
+ *
+ * @param part the view part that owns this action group
+ */
+ public ProjectActionGroup(IViewPart part) {
+ fSite = part.getSite();
+ Shell shell= fSite.getShell();
+ ISelectionProvider provider= fSite.getSelectionProvider();
+ ISelection selection= provider.getSelection();
+
+ fCloseAction= new CloseResourceAction(shell);
+ fCloseAction.setActionDefinitionId("org.eclipse.ui.project.closeProject"); //$NON-NLS-1$
+
+ /*
+ * XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=128386
+ */
+ fCloseUnrelatedAction= new CloseUnrelatedProjectsAction(shell);
+ fCloseUnrelatedAction.setActionDefinitionId("org.eclipse.ui.project.closeUnrelatedProjects"); //$NON-NLS-1$
+
+ fOpenAction= new OpenProjectAction(fSite);
+ fOpenAction.setActionDefinitionId("org.eclipse.ui.project.openProject"); //$NON-NLS-1$
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection s= (IStructuredSelection)selection;
+ fOpenAction.selectionChanged(s);
+ fCloseAction.selectionChanged(s);
+ fCloseUnrelatedAction.selectionChanged(s);
+ }
+ provider.addSelectionChangedListener(fOpenAction);
+ provider.addSelectionChangedListener(fCloseAction);
+ provider.addSelectionChangedListener(fCloseUnrelatedAction);
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ workspace.addResourceChangeListener(fOpenAction);
+ workspace.addResourceChangeListener(fCloseAction);
+ workspace.addResourceChangeListener(fCloseUnrelatedAction);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in ActionGroup
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ super.fillActionBars(actionBars);
+ actionBars.setGlobalActionHandler(IDEActionFactory.CLOSE_PROJECT.getId(), fCloseAction);
+ actionBars.setGlobalActionHandler(IDEActionFactory.CLOSE_UNRELATED_PROJECTS.getId(), fCloseUnrelatedAction);
+ actionBars.setGlobalActionHandler(IDEActionFactory.OPEN_PROJECT.getId(), fOpenAction);
+ }
+
+ /* (non-Javadoc)
+ * Method declared in ActionGroup
+ */
+ public void fillContextMenu(IMenuManager menu) {
+ super.fillContextMenu(menu);
+ if (fOpenAction.isEnabled())
+ menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, fOpenAction);
+ if (fCloseAction.isEnabled())
+ menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, fCloseAction);
+ if (fCloseUnrelatedAction.isEnabled() && areOnlyProjectsSelected(fCloseUnrelatedAction.getStructuredSelection()))
+ menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, fCloseUnrelatedAction);
+ }
+
+ private boolean areOnlyProjectsSelected(IStructuredSelection selection) {
+ if (selection.isEmpty())
+ return false;
+
+ Iterator iter= selection.iterator();
+ while (iter.hasNext()) {
+ Object obj= iter.next();
+ if (obj instanceof IAdaptable) {
+ if (((IAdaptable)obj).getAdapter(IProject.class) == null)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * @see ActionGroup#dispose()
+ */
+ public void dispose() {
+ ISelectionProvider provider= fSite.getSelectionProvider();
+ provider.removeSelectionChangedListener(fOpenAction);
+ provider.removeSelectionChangedListener(fCloseAction);
+ provider.removeSelectionChangedListener(fCloseUnrelatedAction);
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ workspace.removeResourceChangeListener(fOpenAction);
+ workspace.removeResourceChangeListener(fCloseAction);
+ workspace.removeResourceChangeListener(fCloseUnrelatedAction);
+ super.dispose();
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ProjectActionGroup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-17 20:58:43
|
Revision: 3202
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3202&view=rev
Author: cawilliams
Date: 2007-09-17 13:58:36 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
add task
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-09-17 20:58:23 UTC (rev 3201)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-09-17 20:58:36 UTC (rev 3202)
@@ -7,7 +7,6 @@
import javax.xml.transform.TransformerException;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.rubypeople.rdt.core.tests.ModifyingResourceTest;
@@ -29,6 +28,7 @@
public TC_RubyRuntime(String name) {
super(name);
}
+ // TODO Need to create a test vm type or something
@Override
protected void setUp() throws Exception {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-17 20:58:25
|
Revision: 3201
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3201&view=rev
Author: cawilliams
Date: 2007-09-17 13:58:23 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
fix broken test
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-09-17 20:25:40 UTC (rev 3200)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-09-17 20:58:23 UTC (rev 3201)
@@ -64,6 +64,9 @@
standin.setInstallLocation(location.getLocation().toFile());
interpreter = standin.convertToRealVM();
RubyRuntime.setDefaultVMInstall(interpreter, null, true);
+
+ LaunchingPlugin.getDefault().getPluginPreferences().setValue(PreferenceConstants.USE_RUBY_DEBUG, false);
+ // TODO Add a test for using ruby debug!
}
@Override
@@ -83,6 +86,7 @@
buffer.append(new Path(interpreter.getInstallLocation().getAbsolutePath()).append("bin").append("ruby").toOSString());
buffer.append("\" ");
buffer.append(INTERPRETER_ARGUMENTS);
+ addSyncArgs(buffer);
if (debug) {
buffer.append(" -I ");
if (Platform.getOS().equals(Platform.OS_WIN32))
@@ -90,8 +94,7 @@
buffer.append(new Path(StandardVMDebugger.getDirectoryOfRubyDebuggerFile()).toOSString());
if (Platform.getOS().equals(Platform.OS_WIN32))
buffer.append("\"");
- }
- addSyncArgs(buffer);
+ }
if (debug) {
buffer.append(" -r");
buffer.append(debugFile);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-17 20:25:52
|
Revision: 3200
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3200&view=rev
Author: cawilliams
Date: 2007-09-17 13:25:40 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
fix to get required projects during build process (fixes some of the tests)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java 2007-09-17 20:07:05 UTC (rev 3199)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java 2007-09-17 20:25:40 UTC (rev 3200)
@@ -12,6 +12,7 @@
package org.rubypeople.rdt.internal.core.builder;
import java.io.DataOutputStream;
+import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
@@ -19,12 +20,18 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.rubypeople.rdt.core.ILoadpathEntry;
import org.rubypeople.rdt.core.IRubyModelMarker;
import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.LoadpathEntry;
import org.rubypeople.rdt.internal.core.RubyModelManager;
+import org.rubypeople.rdt.internal.core.RubyProject;
public class RubyBuilder extends IncrementalProjectBuilder {
@@ -32,6 +39,8 @@
public static boolean DEBUG;
private IProject currentProject;
+ private RubyProject rubyProject;
+ private IWorkspaceRoot workspaceRoot;
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
this.currentProject = getProject();
@@ -46,10 +55,81 @@
if (DEBUG)
RubyCore.trace("Finished build of " + buildDescription()); //$NON-NLS-1$
- return null;
+
+ IProject[] requiredProjects = getRequiredProjects(true);
+ return requiredProjects;
}
+
+ @Override
+ protected void clean(IProgressMonitor monitor) throws CoreException {
+ this.currentProject = getProject();
+ if (currentProject == null || !currentProject.isAccessible()) return;
+
+ initializeBuilder();
+
+ super.clean(monitor);
+ }
- private AbstractRdtCompiler createCompiler(int kind) {
+ private void initializeBuilder() {
+ this.rubyProject = (RubyProject) RubyCore.create(currentProject);
+ this.workspaceRoot = currentProject.getWorkspace().getRoot();
+ }
+
+ /*
+ * Return the list of projects for which it requires a resource delta. This
+ * builder's project is implicitly included and need not be specified.
+ * Builders must re-specify the list of interesting projects every time they
+ * are run as this is not carried forward beyond the next build. Missing
+ * projects should be specified but will be ignored until they are added to
+ * the workspace.
+ */
+ private IProject[] getRequiredProjects(boolean includeBinaryPrerequisites) {
+ if (rubyProject == null || workspaceRoot == null)
+ return new IProject[0];
+
+ ArrayList projects = new ArrayList();
+ try {
+ ILoadpathEntry[] entries = rubyProject.getExpandedLoadpath(true);
+ for (int i = 0, l = entries.length; i < l; i++) {
+ ILoadpathEntry entry = entries[i];
+ IPath path = entry.getPath();
+ IProject p = null;
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_PROJECT:
+ p = workspaceRoot.getProject(path.lastSegment()); // missing
+ // projects
+ // are
+ // considered
+ // too
+ if (((LoadpathEntry) entry).isOptional()
+ && !RubyProject.hasRubyNature(p)) // except if
+ // entry is
+ // optional
+ p = null;
+ break;
+ case ILoadpathEntry.CPE_LIBRARY:
+ if (includeBinaryPrerequisites && path.segmentCount() > 1) {
+ // some binary resources on the class path can come from
+ // projects that are not included in the project
+ // references
+ IResource resource = workspaceRoot.findMember(path
+ .segment(0));
+ if (resource instanceof IProject)
+ p = (IProject) resource;
+ }
+ }
+ if (p != null && !projects.contains(p))
+ projects.add(p);
+ }
+ } catch (RubyModelException e) {
+ return new IProject[0];
+ }
+ IProject[] result = new IProject[projects.size()];
+ projects.toArray(result);
+ return result;
+ }
+
+ private AbstractRdtCompiler createCompiler(int kind) {
if (isPartialBuild(kind))
return new IncrementalRdtCompiler(currentProject, getDelta(currentProject));
return new CleanRdtCompiler(currentProject);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-17 20:07:25
|
Revision: 3199
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3199&view=rev
Author: cawilliams
Date: 2007-09-17 13:07:05 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
fix syntax error in test code
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml 2007-09-17 20:04:27 UTC (rev 3198)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml 2007-09-17 20:07:05 UTC (rev 3199)
@@ -596,7 +596,7 @@
puts %-class-
puts %Q(class (m) class)
puts %Q{class {m} class}
-puts %Q{ def class #{class} { if } class}
+puts %Q{ def class #{class Chris; end} { if } class}
if
puts ""
</unformatted>
@@ -604,7 +604,7 @@
puts %-class-
puts %Q(class (m) class)
puts %Q{class {m} class}
-puts %Q{ def class #{class} { if } class}
+puts %Q{ def class #{class Chris; end} { if } class}
if
puts ""
</formatted>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-09-17 20:05:35
|
Revision: 3197
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3197&view=rev
Author: cawilliams
Date: 2007-09-17 13:04:19 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
fix broken test
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java 2007-09-17 20:04:14 UTC (rev 3196)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java 2007-09-17 20:04:19 UTC (rev 3197)
@@ -1,35 +1,133 @@
package org.rubypeople.rdt.internal.debug.ui.launcher;
-import junit.framework.TestCase;
-
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.rubypeople.eclipse.shams.debug.core.ShamLaunchConfigurationWorkingCopy;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.tests.ModifyingResourceTest;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
-public class TC_RubyEntryPointTab extends TestCase {
+public class TC_RubyEntryPointTab extends ModifyingResourceTest {
+ private static final String PROJECT_NAME = "myProjectName";
+
+ private RubyEntryPointTab fTab;
+
+ private ILaunchConfigurationWorkingCopy fConfiguration;
+
public TC_RubyEntryPointTab(String name) {
super(name);
}
- public void testIsValid() {
- RubyEntryPointTab tab = new RubyEntryPointTab();
-
- ILaunchConfigurationWorkingCopy configuration = new ShamLaunchConfigurationWorkingCopy();
- String errorMessage = tab.getErrorMessage();
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ fTab = createTab();
+ fConfiguration = new ShamLaunchConfigurationWorkingCopy();
+ }
+
+ public void testEmptyConfigurationIsInvalid() {
+ String errorMessage = fTab.getErrorMessage();
assertNull("There should be no error message.", errorMessage);
- assertTrue("The tab is not valid when the configuration is completely empty.", !tab.isValid(configuration));
- errorMessage = RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage;
- assertEquals("The tab should set the error message for no project.", errorMessage, tab.getErrorMessage());
+ assertTrue(
+ "The tab is not valid when the configuration is completely empty.",
+ !fTab.isValid(fConfiguration));
+ assertEquals(
+ "The tab should set the error message for no project.",
+ RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage,
+ fTab.getErrorMessage());
+ }
- configuration.setAttribute(IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME, "myProjectName");
- assertTrue("The tab is not valid when the configuration has only a projectname.", !tab.isValid(configuration));
- errorMessage = RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage;
- assertEquals("The tab should set the error message for no file.", errorMessage, tab.getErrorMessage());
+ public void testNonexistantProjectIsInvalid() {
+ fConfiguration.setAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ PROJECT_NAME);
+ assertTrue(
+ "The tab is not valid when the configuration has a projectname whose project doesn't exist.",
+ !fTab.isValid(fConfiguration));
+ assertEquals(
+ "The tab should set the error message for non-existant project.",
+ RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidProjectSelectionMessage,
+ fTab.getErrorMessage());
+ }
- configuration.setAttribute(IRubyLaunchConfigurationConstants.ATTR_FILE_NAME, "myFileName");
- assertTrue("The tab is valid when the configuration has a filename and projectName.", tab.isValid(configuration));
- assertNull("The tab should set the error message to null when there is a filename and projectname.", tab.getErrorMessage());
+ public void testNoFilenameIsInvalid() throws CoreException {
+ try {
+ createRubyProject(PROJECT_NAME);
+ fConfiguration.setAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ PROJECT_NAME);
+ assertTrue(
+ "The tab is not valid when the configuration has only a projectname.",
+ !fTab.isValid(fConfiguration));
+ assertEquals(
+ "The tab should set the error message for no file.",
+ RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage,
+ fTab.getErrorMessage());
+ } finally {
+ deleteProject(PROJECT_NAME);
+ }
}
+
+ public void testValidConfiguration() throws CoreException {
+ IFile file;
+ String path = null;
+ try {
+ IRubyProject project = createRubyProject(PROJECT_NAME);
+ path = new Path(PROJECT_NAME).append("myFileName").toPortableString();
+ createFile(path, "");
+ fConfiguration.setAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ PROJECT_NAME);
+ fConfiguration.setAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_FILE_NAME,
+ "myFileName");
+ assertTrue(
+ "The tab is valid when the configuration has a filename and projectName.",
+ fTab.isValid(fConfiguration));
+ assertNull(
+ "The tab should set the error message to null when there is a filename and projectname.",
+ fTab.getErrorMessage());
+ } finally {
+ deleteProject(PROJECT_NAME);
+ if (path != null) deleteFile(path);
+ }
+ }
+
+ public void testNonexistantFileIsInvalid() throws CoreException {
+ try {
+ createRubyProject(PROJECT_NAME);
+ fConfiguration.setAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ PROJECT_NAME);
+ fConfiguration.setAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_FILE_NAME,
+ "myFileName2");
+ assertTrue(
+ "The tab is invalid when the configuration has a valid projectName, but a nonexistant filename.",
+ !fTab.isValid(fConfiguration));
+ assertEquals(
+ "The tab should set the error message for non-existant file.",
+ RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage,
+ fTab.getErrorMessage());
+ } finally {
+ deleteProject(PROJECT_NAME);
+ }
+ }
+
+ // TODO Add tests for relative vs absolute filenames
+ // TODO Add tests for filenames relative to project and relative to working directory
+
+ private RubyEntryPointTab createTab() {
+ RubyEntryPointTab tab = new RubyEntryPointTab();
+ tab.createControl(new Composite(Display.getDefault().getActiveShell(),
+ SWT.NULL));
+ return tab;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|