aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2010-04-26 10:55:58 (EDT)
committerChris Aniszczyk2010-04-26 16:24:09 (EDT)
commitd94684dfa0313def9a9b5afdefc0b5e3af6e6350 (patch)
tree13ce4e507b78aee30f08bc7be37b03b2eef03c3a
parent9d8b3265b54dd58c4b27fbcc9dc6e4479a062948 (diff)
downloadegit-d94684dfa0313def9a9b5afdefc0b5e3af6e6350.zip
egit-d94684dfa0313def9a9b5afdefc0b5e3af6e6350.tar.gz
egit-d94684dfa0313def9a9b5afdefc0b5e3af6e6350.tar.bz2
Fix selection handling in AbstractOperationActionrefs/changes/05/605/2
Team actions based on AbstractOperationAction were disabled in the Java edtior due to wrong selection handling. The selection is now retrieved in selectionChanged. The operation is now created in the run method. Change-Id: Ia0c961c3f8adde2877d962ee1ff1f6de97776faf Bug: 310440 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java
index 269dfb4..00b2dec 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java
@@ -40,21 +40,18 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
private IWorkspaceRunnable op;
- public void selectionChanged(final IAction act, final ISelection sel) {
- // work performed in setActivePart
- }
+ private List selection;
- public void setActivePart(final IAction act, final IWorkbenchPart part) {
- wp = part;
- ISelection sel = part.getSite().getPage().getSelection();
- final List selection;
+ public void selectionChanged(final IAction act, final ISelection sel) {
if (sel instanceof IStructuredSelection && !sel.isEmpty()) {
selection = ((IStructuredSelection) sel).toList();
} else {
selection = Collections.EMPTY_LIST;
}
- op = createOperation(selection);
- act.setEnabled(op != null && wp != null);
+ }
+
+ public void setActivePart(final IAction act, final IWorkbenchPart part) {
+ wp = part;
}
/**
@@ -73,6 +70,7 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
}
public void run(final IAction act) {
+ op = createOperation(selection);
if (op != null) {
try {
try {
@@ -101,7 +99,6 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
if (e instanceof CoreException) {
status = ((CoreException) e).getStatus();
- e = status.getException();
} else {
status = new Status(IStatus.ERROR, Activator.getPluginId(),
1, msg, e);