|
From: <caw...@us...> - 2007-09-13 00:24:03
|
Revision: 3165
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3165&view=rev
Author: cawilliams
Date: 2007-09-12 17:24:01 -0700 (Wed, 12 Sep 2007)
Log Message:
-----------
be able to convert ISourceFolder and ISourceFolderRoot to IResource (except external ones)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyElementAdapterFactory.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyElementAdapterFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyElementAdapterFactory.java 2007-09-12 20:42:28 UTC (rev 3164)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyElementAdapterFactory.java 2007-09-13 00:24:01 UTC (rev 3165)
@@ -17,6 +17,8 @@
import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.ISourceFolder;
+import org.rubypeople.rdt.core.ISourceFolderRoot;
import org.rubypeople.rdt.internal.corext.util.RubyModelUtil;
/**
@@ -48,12 +50,25 @@
// corresponding resource
switch (element.getElementType()) {
case IRubyElement.TYPE:
- // top level types behave like the CU
+ // top level types behave like the ruby script
IRubyElement parent = element.getParent();
if (parent instanceof IRubyScript) { return RubyModelUtil.toOriginal((IRubyScript) parent).getResource(); }
return null;
case IRubyElement.SCRIPT:
return RubyModelUtil.toOriginal((IRubyScript) element).getResource();
+ case IRubyElement.SOURCE_FOLDER:
+ ISourceFolder folder = (ISourceFolder) element;
+ ISourceFolderRoot root= (ISourceFolderRoot) element.getAncestor(IRubyElement.SOURCE_FOLDER_ROOT);
+ if (!root.isExternal()) {
+ return element.getResource();
+ }
+ return null;
+ case IRubyElement.SOURCE_FOLDER_ROOT:
+ root = (ISourceFolderRoot) element;
+ if (root.isExternal()) {
+ return null;
+ }
+ return root.getResource();
case IRubyElement.RUBY_PROJECT:
case IRubyElement.RUBY_MODEL:
return element.getResource();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|