--- a/org.symbian.tools.wrttools.feature/compile.org.symbian.tools.wrttools.xml Tue Jan 26 13:27:13 2010 -0800
+++ b/org.symbian.tools.wrttools.feature/compile.org.symbian.tools.wrttools.xml Tue Jan 26 16:53:12 2010 -0800
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Compile org.symbian.tools.wrttools" default="main">
<target name="main">
- <ant antfile="build.xml" dir="../../../../dev/wrt-integration/org.symbian.tools.wrttools.jseditors" target="build.jars"/>
- <ant antfile="build.xml" dir="../../../../dev/wrt-integration/org.symbian.tools.wrttools" target="build.jars"/>
- <ant antfile="build.xml" dir="../../../../dev/wrt-integration/org.symbian.tools.wrttools.previewer" target="build.jars"/>
- <ant antfile="build.xml" dir="../../../../dev/wrt-integration/org.symbian.tools.wrttools.debug.core" target="build.jars"/>
- <ant antfile="build.xml" dir="../../../../dev/wrt-integration/org.symbian.tools.wrttools.product" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.symbian.tools.wrttools.jseditors" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.symbian.tools.wrttools" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.symbian.tools.wrttools.previewer" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.symbian.tools.wrttools.debug.core" target="build.jars"/>
</target>
</project>
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Jan 26 13:27:13 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Jan 26 16:53:12 2010 -0800
@@ -71,7 +71,6 @@
if (contents != null) {
copyData(contents, resp.getOutputStream());
} else {
- System.err.println(path);
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
} catch (CoreException e) {
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/PreviewPage.java Tue Jan 26 13:27:13 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/PreviewPage.java Tue Jan 26 16:53:12 2010 -0800
@@ -217,7 +217,6 @@
}
private void applyProxySettings() {
-
IProxyService px = PreviewerPlugin.getDefault().getProxyService();
if(px != null){
boolean proxyEnabled = px.isProxiesEnabled();
--- a/org.symbian.tools.wrttools/plugin.xml Tue Jan 26 13:27:13 2010 -0800
+++ b/org.symbian.tools.wrttools/plugin.xml Tue Jan 26 16:53:12 2010 -0800
@@ -128,30 +128,35 @@
<insertionPoint name="group.open" separator="true" />
<insertionPoint name="group.openWith" />
<insertionPoint name="group.edit" separator="true" />
- <insertionPoint name="group.reorganize" />
+ <insertionPoint name="group.reorganize" separator="true" />
<insertionPoint name="group.port" separator="true" />
<insertionPoint name="group.build" separator="true" />
<insertionPoint name="group.generate" separator="true" />
<insertionPoint name="group.search" separator="true" />
<insertionPoint name="additions" separator="true" />
<insertionPoint name="group.properties" separator="true" />
-
</popupMenu>
</viewer>
<viewerContentBinding viewerId="org.symbian.tools.wrttools.wrtnavigator">
<includes>
- <contentExtension pattern="org.eclipse.ui.navigator.resourceContent" />
<contentExtension
isRoot="true"
pattern="org.symbian.tools.wrttools.navigatorcontent"/>
<contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*" />
<contentExtension pattern="org.eclipse.ui.navigator.resources.linkHelper" />
- <contentExtension pattern="org.eclipse.ui.navigator.resources.workingSets" />
</includes>
</viewerContentBinding>
<viewerActionBinding viewerId="org.symbian.tools.wrttools.wrtnavigator">
<includes>
- <actionExtension pattern="org.eclipse.ui.navigator.resources.*" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.PortingActions" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.GotoActions" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.GoIntoActions" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.NewActions" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.PropertiesActionProvider" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.WorkManagementActionProvider" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.ResourceMgmtActions" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.UndoRedoActionProvider" />
+ <actionExtension pattern="org.eclipse.ui.navigator.resources.WorkingSetActions" />
</includes>
</viewerActionBinding>
<dragAssistant
@@ -232,9 +237,8 @@
</actionProvider>
<actionProvider
class="org.eclipse.wst.jsdt.internal.ui.navigator.JavaNavigatorActionProvider"
- id="org.eclipse.wst.jsdt.ui.navigator.actions.StandardActions"
- overrides="org.eclipse.ui.navigator.resources.actions.EditActions">
- <enablement>
+ id="org.eclipse.wst.jsdt.ui.navigator.actions.StandardActions">
+<!-- <enablement>
<or>
<and>
<instanceof
@@ -261,7 +265,7 @@
</count>
</adapt>
</or>
- </enablement>
+ </enablement>-->
</actionProvider>
<actionProvider
class="org.eclipse.wst.jsdt.internal.ui.navigator.JavaNavigatorRefactorActionProvider"
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/navigator/WRTNavigatorContentProvider.java Tue Jan 26 13:27:13 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/navigator/WRTNavigatorContentProvider.java Tue Jan 26 16:53:12 2010 -0800
@@ -6,10 +6,19 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
+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;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.core.IJavaScriptModel;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
@@ -20,8 +29,52 @@
public class WRTNavigatorContentProvider extends JavaNavigatorContentProvider
implements ITreeContentProvider {
+ private static final class RootResourceFinder implements
+ IResourceDeltaVisitor {
+ public IResource resource = null;
- private static final class TreeElementsComparator implements Comparator<Object> {
+ private IResource getCommonAncestor(IResource r1, IResource r2) {
+ if (r1 == null) {
+ return r2;
+ }
+ if (r2 == null) {
+ return null;
+ }
+ if (r1.equals(r2)) {
+ return r1;
+ }
+ IPath p1 = r1.getFullPath();
+ IPath p2 = r2.getFullPath();
+ int l1 = p1.segmentCount();
+ int l2 = p2.segmentCount();
+
+ if (l1 == 0 || l2 == 0) {
+ return null;
+ }
+ int l = Math.min(l1, l2);
+ do {
+ p1 = p1.uptoSegment(l);
+ p2 = p2.uptoSegment(l);
+ l = l - 1;
+ } while (l > 0 && (p1 != p2));
+ IWorkspaceRoot r = r1.getWorkspace().getRoot();
+ return l == 0 ? null : l == 1 ? r.getProject(p1.lastSegment()) : r
+ .getFolder(p1);
+ }
+
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if ((delta.getKind() & (IResourceDelta.ADDED | IResourceDelta.REMOVED)) != 0) {
+ resource = getCommonAncestor(resource, delta.getResource()
+ .getParent());
+ return false;
+ }
+ return true;
+ }
+ }
+
+ private static final class TreeElementsComparator implements
+ Comparator<Object> {
@Override
public int compare(Object o1, Object o2) {
IResource res1 = getResource(o1);
@@ -33,10 +86,10 @@
} 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) {
@@ -46,37 +99,52 @@
}
}
- private boolean isFolder(IResource res1) {
- return res1.getType() == IResource.FOLDER || res1.getType() == IResource.PROJECT;
- }
-
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);
+ 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 IResourceChangeListener listener = new IResourceChangeListener() {
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ RootResourceFinder visitor = new RootResourceFinder();
+ try {
+ event.getDelta().accept(visitor);
+ } catch (CoreException e) {
+ Activator.log(e);
+ refreshViewer(null);
+ }
+ refreshViewer(visitor.resource);
+ }
+ };
+ private Viewer viewer;
+
@Override
- protected Object[] getPackageFragmentRoots(IJavaScriptProject project)
- throws JavaScriptModelException {
- try {
- return filter(project.getProject().members());
- } catch (CoreException e) {
- Activator.log(e);
+ public void dispose() {
+ if (viewer != null) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(
+ listener);
}
- return new Object[0];
+ super.dispose();
}
-
+
private Object[] filter(IResource[] members) {
- TreeSet<Object> output = new TreeSet<Object>(new TreeElementsComparator());
+ TreeSet<Object> output = new TreeSet<Object>(
+ new TreeElementsComparator());
for (int i = 0; i < members.length; i++) {
IResource resource = members[i];
Object res = resource;
@@ -95,7 +163,49 @@
protected Object[] getFolderContent(IFolder folder) throws CoreException {
return filter(folder.members());
}
-
+
+ @Override
+ protected Object[] getPackageFragmentRoots(IJavaScriptProject project)
+ throws JavaScriptModelException {
+ try {
+ return filter(project.getProject().members());
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return new Object[0];
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (this.viewer == null) {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
+ }
+ this.viewer = viewer;
+ super.inputChanged(viewer, oldInput, newInput);
+ }
+ //
+ // @SuppressWarnings("unchecked")
+ // @Override
+ // protected void postAdd(final Object parent, final Object element,
+ // Collection runnables) {
+ // final Object p;
+ // if (element instanceof IProject) {
+ // p = null;
+ // } else {
+ // p = parent;
+ // }
+ // runnables.add(new Runnable() {
+ // @Override
+ // public void run() {
+ // if (p != null) {
+ // ((TreeViewer) viewer).refresh(p);
+ // } else {
+ // ((TreeViewer) viewer).refresh();
+ // }
+ // }
+ // });
+ // }
+
@Override
protected void postAdd(Object parent, Object element, Collection runnables) {
if (parent instanceof IWorkspace) {
@@ -107,31 +217,13 @@
super.postAdd(parent, element, runnables);
}
}
-
-// @Override
-// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-// this.viewer = viewer;
-// super.inputChanged(viewer, oldInput, newInput);
-// }
-//
-// @SuppressWarnings("unchecked")
-// @Override
-// protected void postAdd(final Object parent, final Object element, Collection runnables) {
-// final Object p;
-// if (element instanceof IProject) {
-// p = null;
-// } else {
-// p = parent;
-// }
-// runnables.add(new Runnable() {
-// @Override
-// public void run() {
-// if (p != null) {
-// ((TreeViewer) viewer).refresh(p);
-// } else {
-// ((TreeViewer) viewer).refresh();
-// }
-// }
-// });
-// }
+
+ protected void refreshViewer(final IResource resource) {
+ viewer.getControl().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ((TreeViewer) viewer).refresh(resource);
+ }
+ });
+ }
}