Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfaure2011-06-06 12:57:20 +0000
committertfaure2011-06-06 12:57:20 +0000
commit28e7e9c81e62b3746b25887a231962cb56932283 (patch)
treec329f5b038b017122e2e452a12dbc14c1a254ed7 /incoming
parent75d19664a7b43d77e09c0de2f80b02db8b0694e4 (diff)
downloadorg.eclipse.papyrus-28e7e9c81e62b3746b25887a231962cb56932283.tar.gz
org.eclipse.papyrus-28e7e9c81e62b3746b25887a231962cb56932283.tar.xz
org.eclipse.papyrus-28e7e9c81e62b3746b25887a231962cb56932283.zip
NEW - bug 346708: [Usability] Papyrus shall enable a feature for logical view in Project Explorer
https://bugs.eclipse.org/bugs/show_bug.cgi?id=346708 manage drop and use new incoming plugin oep.ui.resources
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.onefile/META-INF/MANIFEST.MF3
-rw-r--r--incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/model/adapters/PapyrusCommonDropAdapterAssistant.java5
-rw-r--r--incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/providers/PapyrusModelActionProvider.java33
3 files changed, 38 insertions, 3 deletions
diff --git a/incoming/org.eclipse.papyrus.onefile/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.onefile/META-INF/MANIFEST.MF
index 26784726ce3..25613c71286 100644
--- a/incoming/org.eclipse.papyrus.onefile/META-INF/MANIFEST.MF
+++ b/incoming/org.eclipse.papyrus.onefile/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Activator: org.eclipse.papyrus.onefile.Activator
Require-Bundle: org.eclipse.papyrus.core,
org.eclipse.ui.navigator,
org.eclipse.team.ui,
- org.eclipse.ui.navigator.resources
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.papyrus.ui.resources
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/model/adapters/PapyrusCommonDropAdapterAssistant.java b/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/model/adapters/PapyrusCommonDropAdapterAssistant.java
index d1b547928ef..76cfb8f4a97 100644
--- a/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/model/adapters/PapyrusCommonDropAdapterAssistant.java
+++ b/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/model/adapters/PapyrusCommonDropAdapterAssistant.java
@@ -12,6 +12,7 @@
package org.eclipse.papyrus.onefile.model.adapters;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -67,7 +68,9 @@ public class PapyrusCommonDropAdapterAssistant extends
Object o = i.next();
if (o instanceof IPapyrusFile) {
IPapyrusFile papy = (IPapyrusFile) o;
- elements.add(papy.getMainFile());
+ // TODO if a drop assistant is implemented use previous implementation :
+ // elements.add(papy.getMainFile());
+ elements.addAll(Arrays.asList(papy.getAssociatedResources()));
}
}
}
diff --git a/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/providers/PapyrusModelActionProvider.java b/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/providers/PapyrusModelActionProvider.java
index 0f69f6440bf..92d565c6bec 100644
--- a/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/providers/PapyrusModelActionProvider.java
+++ b/incoming/org.eclipse.papyrus.onefile/src/org/eclipse/papyrus/onefile/providers/PapyrusModelActionProvider.java
@@ -26,6 +26,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.onefile.model.IPapyrusFile;
+import org.eclipse.papyrus.onefile.utils.Utils;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IViewPart;
@@ -37,6 +38,7 @@ import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.CopyResourceAction;
import org.eclipse.ui.actions.DeleteResourceAction;
+import org.eclipse.ui.actions.MoveResourceAction;
import org.eclipse.ui.actions.RefreshAction;
import org.eclipse.ui.actions.RenameResourceAction;
import org.eclipse.ui.ide.IDE;
@@ -63,6 +65,7 @@ public class PapyrusModelActionProvider extends CommonActionProvider {
private Action copyAction;
private Action renameAction;
private Action refreshAction;
+ private Action moveAction;
public PapyrusModelActionProvider() {
@@ -82,6 +85,8 @@ public class PapyrusModelActionProvider extends CommonActionProvider {
deleteAction);
actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(),
renameAction);
+ actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(),
+ moveAction);
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
copyAction);
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(),
@@ -96,12 +101,13 @@ public class PapyrusModelActionProvider extends CommonActionProvider {
super.fillContextMenu(menu);
appendToGroup(menu, openAction, ICommonMenuConstants.GROUP_OPEN);
appendToGroup(menu, deleteAction, ICommonMenuConstants.GROUP_EDIT);
+ appendToGroup(menu, moveAction, ICommonMenuConstants.GROUP_EDIT);
appendToGroup(menu, copyAction, ICommonMenuConstants.GROUP_EDIT);
appendToGroup(menu, renameAction, ICommonMenuConstants.GROUP_EDIT);
appendToGroup(menu, refreshAction, ICommonMenuConstants.GROUP_EDIT);
}
- private void appendToGroup(IMenuManager menu, Action action, String id) {
+ private void appendToGroup(IMenuManager menu, IAction action, String id) {
if (action != null && action.isEnabled()) {
menu.appendToGroup(id, action);
}
@@ -154,6 +160,14 @@ public class PapyrusModelActionProvider extends CommonActionProvider {
};
deleteAction = new DeleteResourceAction(provider) {
+
+ @Override
+ public boolean isEnabled() {
+ return getSelectedResources() != null
+ && getSelectedResources().size() > 0
+ && Utils.isDi((IResource) getSelectedResources().get(0));
+
+ }
@Override
public IStructuredSelection getStructuredSelection() {
@@ -166,6 +180,19 @@ public class PapyrusModelActionProvider extends CommonActionProvider {
}
};
+ moveAction = new MoveResourceAction(provider)
+ {
+ @Override
+ public IStructuredSelection getStructuredSelection() {
+ return helper.getStructuredSelection(getContext());
+ }
+
+ @Override
+ protected List getSelectedResources() {
+ return helper.getSelectedResources(getContext());
+ }
+ };
+
copyAction = new CopyResourceAction(provider) {
@Override
public IStructuredSelection getStructuredSelection() {
@@ -202,6 +229,10 @@ public class PapyrusModelActionProvider extends CommonActionProvider {
makeAction(deleteAction, IWorkbenchCommandConstants.EDIT_DELETE,
ISharedImages.IMG_TOOL_DELETE,
ISharedImages.IMG_TOOL_DELETE_DISABLED);
+ makeAction(moveAction, ActionFactory.MOVE.getId(),null,null);
+ makeAction(copyAction, IWorkbenchCommandConstants.EDIT_CUT,
+ ISharedImages.IMG_TOOL_CUT,
+ ISharedImages.IMG_TOOL_CUT_DISABLED);
makeAction(copyAction, IWorkbenchCommandConstants.EDIT_COPY,
ISharedImages.IMG_TOOL_COPY,
ISharedImages.IMG_TOOL_COPY_DISABLED);

Back to the top