Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2012-10-30 00:16:48 +0000
committerRoberto E. Escobar2012-10-30 00:16:48 +0000
commitfb6b30b35a249ad0444bda9626402fa8571a0ae8 (patch)
treeb0e731072dedc3fb049b7fcb8b7dc669dd8fbf9d
parent00569ee1e7b8b6ab493c48c7eeee3fc6d66227e5 (diff)
downloadorg.eclipse.osee-fb6b30b35a249ad0444bda9626402fa8571a0ae8.tar.gz
org.eclipse.osee-fb6b30b35a249ad0444bda9626402fa8571a0ae8.tar.xz
org.eclipse.osee-fb6b30b35a249ad0444bda9626402fa8571a0ae8.zip
refinement: Avoid access control checks during platform shutdown
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java
index 994595868a5..67c2b93ebf1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java
@@ -12,18 +12,21 @@ package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
import java.util.Map;
import java.util.logging.Level;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -33,7 +36,7 @@ import org.eclipse.ui.menus.UIElement;
/**
* @author Jeff C. Phillips
*/
-public class ShowArchivedBranchHandler extends AbstractHandler implements IElementUpdater {
+public class ShowArchivedBranchHandler extends CommandHandler implements IElementUpdater {
public static final String COMMAND_ID =
"org.eclipse.osee.framework.ui.skynet.branch.BranchView.showArchivedBranches";
@@ -45,9 +48,16 @@ public class ShowArchivedBranchHandler extends AbstractHandler implements IEleme
}
@Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(
- BranchOptionsEnum.SHOW_ARCHIVED_BRANCHES, !itemChk);
+ protected Object executeWithException(ExecutionEvent event, IStructuredSelection selection) throws OseeCoreException {
+ try {
+ IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
+ if (part instanceof BranchView) {
+ BranchView branchView = ((BranchView) part);
+ branchView.changePresentation(BranchOptionsEnum.SHOW_ARCHIVED_BRANCHES, !itemChk);
+ }
+ } catch (ExecutionException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
return null;
}
@@ -61,10 +71,10 @@ public class ShowArchivedBranchHandler extends AbstractHandler implements IEleme
}
@Override
- public boolean isEnabled() {
+ protected boolean isEnabledWithException(IStructuredSelection structuredSelection) {
boolean isValid = false;
- service.refreshElements(COMMAND_ID, null);
if (!DbUtil.isDbInit()) {
+ service.refreshElements(COMMAND_ID, null);
try {
isValid = AccessControlManager.isOseeAdmin();
} catch (OseeCoreException ex) {
@@ -73,4 +83,5 @@ public class ShowArchivedBranchHandler extends AbstractHandler implements IEleme
}
return isValid;
}
+
}

Back to the top