--- a/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Thu Feb 11 17:28:43 2010 -0800
+++ b/org.symbian.tools.wrttools/META-INF/MANIFEST.MF Fri Feb 12 13:04:26 2010 -0800
@@ -8,7 +8,6 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.emf.common,
org.eclipse.emf.ecore,
org.eclipse.core.databinding;bundle-version="1.2.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.0",
--- a/org.symbian.tools.wrttools/plugin.xml Thu Feb 11 17:28:43 2010 -0800
+++ b/org.symbian.tools.wrttools/plugin.xml Fri Feb 12 13:04:26 2010 -0800
@@ -398,53 +398,8 @@
</or>
</possibleChildren>
<actionProvider
- class="org.eclipse.wst.jsdt.internal.ui.navigator.JavaNavigatorViewActionProvider"
- id="org.eclipse.wst.jsdt.ui.navigator.actions.ViewActions">
- <enablement>
- <or>
- <instanceof
- value="org.eclipse.core.resources.IWorkspaceRoot">
- </instanceof>
- <adapt
- type="java.util.Collection">
- <count
- value="0">
- </count>
- </adapt>
- </or>
- </enablement>
- </actionProvider>
- <actionProvider
class="org.eclipse.wst.jsdt.internal.ui.navigator.JavaNavigatorActionProvider"
id="org.eclipse.wst.jsdt.ui.navigator.actions.StandardActions">
-<!-- <enablement>
- <or>
- <and>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- <test
- property="org.eclipse.core.resources.projectNature"
- value="org.symbian.tools.wrttools.WidgetProjectNature">
- </test>
- </and>
- <instanceof
- value="org.eclipse.wst.jsdt.core.IJavaScriptElement">
- </instanceof>
- <instanceof
- value="org.eclipse.wst.jsdt.core.IJarEntryResource">
- </instanceof>
- <instanceof
- value="org.eclipse.wst.jsdt.internal.ui.packageview.PackageFragmentRootContainer">
- </instanceof>
- <adapt
- type="java.util.Collection">
- <count
- value="0">
- </count>
- </adapt>
- </or>
- </enablement>-->
</actionProvider>
<actionProvider
class="org.eclipse.wst.jsdt.internal.ui.navigator.JavaNavigatorRefactorActionProvider"
@@ -452,34 +407,48 @@
overrides="org.eclipse.ui.navigator.resources.actions.RefactorActions">
<enablement>
<or>
- <and>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- <test
- property="org.eclipse.core.resources.projectNature"
- value="org.symbian.tools.wrttools.WidgetProjectNature">
- </test>
- </and>
- <instanceof
- value="org.eclipse.wst.jsdt.core.IJavaScriptElement">
- </instanceof>
- <instanceof
- value="org.eclipse.wst.jsdt.core.IJarEntryResource">
- </instanceof>
- <instanceof
- value="org.eclipse.wst.jsdt.internal.ui.packageview.PackageFragmentRootContainer">
- </instanceof>
<adapt
type="java.util.Collection">
<count
value="0">
</count>
</adapt>
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.wst.jsdt.core.IJavaScriptElement">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.wst.jsdt.core.IJarEntryResource">
+ </instanceof>
+ </or>
+ <not>
+ <instanceof
+ value="org.eclipse.wst.jsdt.core.ITypeRoot">
+ </instanceof>
+ </not>
+ </and>
</or>
</enablement>
</actionProvider>
<actionProvider
+ class="org.symbian.tools.wrttools.navigator.RenameMoveActionProvider"
+ id="org.symbian.wrttools.navigator.MoveRename"
+ overrides="org.eclipse.ui.navigator.resources.actions.RefactorActions">
+ <enablement>
+ <and>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ </adapt>
+ <not>
+ <instanceof
+ value="org.eclipse.wst.jsdt.core.IType">
+ </instanceof>
+ </not>
+ </and>
+ </enablement>
+ </actionProvider>
+ <actionProvider
class="org.eclipse.wst.jsdt.internal.ui.navigator.PackageExplorerOpenActionProvider"
id="org.eclipse.wst.jsdt.ui.navigator.actions.OpenActions"
overrides="org.eclipse.ui.navigator.resources.OpenActions">
@@ -497,9 +466,9 @@
<adapt
type="org.eclipse.core.resources.IResource">
</adapt>
- <count
- value="0">
- </count>
+ <adapt
+ type="java.util.Collection">
+ </adapt>
</or>
</enablement>
</commonWizard>
@@ -540,9 +509,6 @@
</adapt>
<adapt
type="java.util.Collection">
- <count
- value="0">
- </count>
</adapt>
</or>
</enablement>
@@ -557,9 +523,6 @@
</adapt>
<adapt
type="java.util.Collection">
- <count
- value="0">
- </count>
</adapt>
</or>
</enablement>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/navigator/RenameMoveActionProvider.java Fri Feb 12 13:04:26 2010 -0800
@@ -0,0 +1,81 @@
+package org.symbian.tools.wrttools.navigator;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.wst.jsdt.ui.IContextMenuConstants;
+import org.eclipse.wst.jsdt.ui.actions.IJavaEditorActionDefinitionIds;
+import org.eclipse.wst.jsdt.ui.actions.JdtActionConstants;
+import org.eclipse.wst.jsdt.ui.actions.MoveAction;
+import org.eclipse.wst.jsdt.ui.actions.RenameAction;
+import org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction;
+
+public class RenameMoveActionProvider extends CommonActionProvider {
+ private SelectionDispatchAction fMoveAction;
+ private SelectionDispatchAction fRenameAction;
+
+ private Collection<IAction> fActions = new HashSet<IAction>();
+
+ public void fillActionBars(IActionBars actionBars) {
+ if (fActions.size() > 0) {
+ actionBars.setGlobalActionHandler(JdtActionConstants.RENAME, fRenameAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), fRenameAction);
+
+ actionBars.setGlobalActionHandler(JdtActionConstants.MOVE, fMoveAction);
+ actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), fMoveAction);
+ }
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, new Separator());
+ for (IAction action : fActions) {
+ menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, action);
+ }
+ }
+
+ public void init(ICommonActionExtensionSite site) {
+ ICommonViewerWorkbenchSite workbenchSite= null;
+ if (site.getViewSite() instanceof ICommonViewerWorkbenchSite)
+ workbenchSite= (ICommonViewerWorkbenchSite) site.getViewSite();
+
+ // we only initialize the refactor group when in a view part
+ // (required for the constructor)
+ if (workbenchSite != null) {
+ if (workbenchSite.getPart() != null && workbenchSite.getPart() instanceof IViewPart) {
+ IViewPart viewPart= (IViewPart) workbenchSite.getPart();
+ IWorkbenchPartSite s = viewPart.getSite();
+
+ fRenameAction= new RenameAction(s);
+ initUpdatingAction(fRenameAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
+ fMoveAction= new MoveAction(s);
+ initUpdatingAction(fMoveAction, workbenchSite.getSelectionProvider(), workbenchSite.getSelectionProvider().getSelection(), IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
+ }
+ }
+ }
+
+ private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection, String actionDefinitionId){
+ action.setActionDefinitionId(actionDefinitionId);
+ action.update(selection);
+ if (provider != null)
+ provider.addSelectionChangedListener(action);
+ fActions.add(action);
+ }
+
+
+ public void setContext(ActionContext context) {
+ // Do nothing
+ }
+}