Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2008-01-09 03:34:55 +0000
committerjphillips2008-01-09 03:34:55 +0000
commit2ebc2991b7b56ba4dcb5ab1613f8afe53ce4fcc9 (patch)
tree4c7d889c90170bf76954c13e8de47800d4a4c7f6
parent336f75204793716b663cbf3fff4e3ba77c1421c4 (diff)
downloadorg.eclipse.osee-2ebc2991b7b56ba4dcb5ab1613f8afe53ce4fcc9.tar.gz
org.eclipse.osee-2ebc2991b7b56ba4dcb5ab1613f8afe53ce4fcc9.tar.xz
org.eclipse.osee-2ebc2991b7b56ba4dcb5ab1613f8afe53ce4fcc9.zip
-rw-r--r--MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/plugin.xml31
-rw-r--r--MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java41
-rw-r--r--MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java85
3 files changed, 157 insertions, 0 deletions
diff --git a/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/plugin.xml b/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 0f72a8f4963..60dd173637e 100644
--- a/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -180,6 +180,26 @@
class="org.eclipse.osee.framework.ui.skynet.commandHandlers.ViewerReportHandler"
commandId="org.eclipse.osee.framework.ui.skynet.viewerReport">
</handler>
+ <handler
+ class="org.eclipse.osee.framework.ui.skynet.commandHandlers.DeleteArtifactHandler"
+ commandId="org.eclipse.ui.edit.delete">
+ <activeWhen>
+ <or>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.osee.framework.ui.skynet.changeReport.ChangeReportView">
+ </equals>
+ </with>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.search.ui.views.SearchView">
+ </equals>
+ </with>
+ </or>
+ </activeWhen>
+ </handler>
</extension>
<extension name="The menus for the Branch View." point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:org.eclipse.osee.framework.ui.skynet.branch.BranchView">
@@ -244,6 +264,13 @@
</command>
<command commandId="org.eclipse.osee.framework.ui.skynet.changeReportView.tagArtifacts.command">
</command>
+ <separator
+ name="org.eclipse.ui.edit.delete.seperator"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.delete">
+ </command>
</menuContribution>
</extension>
<extension name="The menus for the SearchResultsView." point="org.eclipse.ui.menus">
@@ -270,6 +297,10 @@
commandId="org.eclipse.osee.framework.ui.skynet.revealArtifactInExplorer.command"
icon="images/magnify.gif">
</image>
+ <image
+ commandId="org.eclipse.osee.framework.ui.skynet.resource.command"
+ icon="images/edit.gif">
+ </image>
</extension>
<extension point="org.eclipse.ui.importWizards">
<wizard category="org.eclipse.osee.define.import.category" class="org.eclipse.osee.framework.ui.skynet.Import.ArtifactImportWizard" icon="images/WordMlImport.bmp" id="org.eclipse.osee.framework.ui.skynet.artifact.Import.ImportWizard" name="MS Office Documentation">
diff --git a/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java b/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java
index 601729f4229..ce34a2721a5 100644
--- a/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java
+++ b/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.skynet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -28,6 +29,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -40,6 +42,7 @@ import org.eclipse.osee.framework.plugin.core.config.ConfigUtil;
import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
import org.eclipse.osee.framework.skynet.core.access.PermissionEnum;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
import org.eclipse.osee.framework.skynet.core.artifact.Branch;
import org.eclipse.osee.framework.skynet.core.artifact.BranchPersistenceManager;
import org.eclipse.osee.framework.skynet.core.artifact.CacheArtifactModifiedEvent;
@@ -185,6 +188,8 @@ public class ArtifactSearchViewPage extends AbstractArtifactSearchViewPage imple
createOpenInMassArtifactEditorHandler(menuManager, viewer);
menuManager.add(new Separator());
createSetAllPartitions(menuManager, viewer);
+ menuManager.add(new Separator());
+ createDeleteArtifactHandler(menuManager, viewer);
// The additions group is a standard group
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -194,6 +199,42 @@ public class ArtifactSearchViewPage extends AbstractArtifactSearchViewPage imple
* @param menuManager
* @param viewer
*/
+ private void createDeleteArtifactHandler(MenuManager menuManager, final TableViewer viewer) {
+ CommandContributionItem deleteArtifactCommand =
+ Commands.getLocalCommandContribution("org.eclipse.ui.edit.delete", getSite(), null, null, null, null, null,
+ null, null, null);
+ menuManager.add(deleteArtifactCommand);
+
+ handlerService.activateHandler(deleteArtifactCommand.getId(), new AbstractSelectionEnabledHandler(menuManager) {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ try {
+ MessageDialog dialog =
+ new MessageDialog(Display.getCurrent().getActiveShell(), "Confirm Artifact Deletion", null,
+ " Are you sure you want to delete this artifact and all of the default hierarchy children?",
+ MessageDialog.QUESTION,
+ new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1);
+ if (dialog.open() == 0) {
+ ArtifactPersistenceManager.getInstance().deleteArtifact(
+ getSelectedArtifacts(viewer).toArray(Artifact.EMPTY_ARRAY));
+ }
+ } catch (SQLException ex) {
+ OSEELog.logException(SkynetGuiPlugin.class, ex, false);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return accessControlManager.checkObjectListPermission(getSelectedArtifacts(viewer), PermissionEnum.WRITE);
+ }
+ });
+ }
+
+ /**
+ * @param menuManager
+ * @param viewer
+ */
private void createReportHandler(MenuManager menuManager, TableViewer viewer) {
MenuManager reportManager = new MenuManager("Run Reports");
diff --git a/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java b/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java
new file mode 100644
index 00000000000..c7fbf0dc521
--- /dev/null
+++ b/MS_0.1.4_20080103/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.sql.SQLException;
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
+import org.eclipse.osee.framework.skynet.core.access.PermissionEnum;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.OSEELog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class DeleteArtifactHandler extends AbstractSelectionChangedHandler {
+ private static final AccessControlManager accessControlManager = AccessControlManager.getInstance();
+ private List<Artifact> artifacts;
+
+ /**
+ *
+ */
+ public DeleteArtifactHandler() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (!artifacts.isEmpty()) {
+ try {
+ MessageDialog dialog =
+ new MessageDialog(Display.getCurrent().getActiveShell(), "Confirm Artifact Deletion", null,
+ " Are you sure you want to delete this artifact and all of the default hierarchy children?",
+ MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1);
+ if (dialog.open() == 0) {
+ ArtifactPersistenceManager.getInstance().deleteArtifact(artifacts.toArray(Artifact.EMPTY_ARRAY));
+ }
+ } catch (SQLException ex) {
+ OSEELog.logException(SkynetGuiPlugin.class, ex, false);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+ boolean isEnabled = false;
+
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ isEnabled = accessControlManager.checkObjectListPermission(artifacts, PermissionEnum.WRITE);
+ }
+ return isEnabled;
+ }
+}

Back to the top