--- a/org.symbian.tools.wrttools.product/plugin.xml Fri Feb 26 16:55:03 2010 -0800
+++ b/org.symbian.tools.wrttools.product/plugin.xml Fri Feb 26 17:41:00 2010 -0800
@@ -199,4 +199,19 @@
</class>
</page>
</extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.symbian.tools.wrttools.mainPerspective">
+ <showInPart
+ id="org.symbian.tools.wrttools.wrtnavigator">
+ </showInPart>
+ </perspectiveExtension>
+ <perspectiveExtension
+ targetID="org.eclipse.debug.ui.DebugPerspective">
+ <showInPart
+ id="org.symbian.tools.wrttools.wrtnavigator">
+ </showInPart>
+ </perspectiveExtension>
+ </extension>
</plugin>
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/navigator/WRTNavigatorContentProvider.java Fri Feb 26 16:55:03 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/navigator/WRTNavigatorContentProvider.java Fri Feb 26 17:41:00 2010 -0800
@@ -1,7 +1,6 @@
package org.symbian.tools.wrttools.navigator;
import java.util.Collection;
-import java.util.Comparator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -14,7 +13,6 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
@@ -73,50 +71,6 @@
}
}
- private static final class TreeElementsComparator implements
- Comparator<Object> {
- public int compare(Object o1, Object o2) {
- IResource res1 = getResource(o1);
- IResource res2 = getResource(o2);
- if (o1 == o2) {
- return 0;
- } else if (o1 == null) {
- return -1;
- } else if (o2 == null) {
- return 1;
- }
-
- boolean isFolder1 = isFolder(res1);
- boolean isFolder2 = isFolder(res2);
-
- if (isFolder1 == isFolder2) {
- return res1.getName().compareTo(res2.getName());
- } else if (isFolder1) {
- return 1;
- } else {
- return -1;
- }
- }
-
- private IResource getResource(Object o1) {
- final IResource result;
- if (o1 instanceof IResource) {
- result = (IResource) o1;
- } else if (o1 instanceof IAdaptable) {
- result = (IResource) ((IAdaptable) o1)
- .getAdapter(IResource.class);
- } else {
- result = null;
- }
- return result;
- }
-
- private boolean isFolder(IResource res1) {
- return res1.getType() == IResource.FOLDER
- || res1.getType() == IResource.PROJECT;
- }
- }
-
private final IResourceChangeListener listener = new IResourceChangeListener() {
public void resourceChanged(IResourceChangeEvent event) {
IResource refresh = null;
@@ -222,4 +176,24 @@
}
return super.getChildren(parentElement);
}
+
+ @Override
+ public Object getParent(Object element) {
+ Object parent = super.getParent(element);
+ if (element instanceof IJavaScriptElement && parent instanceof IJavaScriptElement) {
+ IJavaScriptElement jsChild = (IJavaScriptElement) element;
+ IJavaScriptElement jsParent = (IJavaScriptElement) parent;
+
+ try {
+ IResource childResource = jsChild.getCorrespondingResource();
+ IResource parentResource = jsParent.getCorrespondingResource();
+ if (childResource == null && parentResource != null) {
+ return parentResource;
+ }
+ } catch (JavaScriptModelException e) {
+ Activator.log(e);
+ }
+ }
+ return parent;
+ }
}