diff options
| author | Jens Baumgart | 2010-04-26 14:55:58 +0000 |
|---|---|---|
| committer | Chris Aniszczyk | 2010-04-26 20:24:09 +0000 |
| commit | d94684dfa0313def9a9b5afdefc0b5e3af6e6350 (patch) | |
| tree | 13ce4e507b78aee30f08bc7be37b03b2eef03c3a | |
| parent | 9d8b3265b54dd58c4b27fbcc9dc6e4479a062948 (diff) | |
| download | egit-d94684dfa0313def9a9b5afdefc0b5e3af6e6350.tar.gz egit-d94684dfa0313def9a9b5afdefc0b5e3af6e6350.tar.xz egit-d94684dfa0313def9a9b5afdefc0b5e3af6e6350.zip | |
Fix selection handling in AbstractOperationAction
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.java | 17 |
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 269dfb4062..00b2deca23 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); |
