Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2008-07-24 17:35:20 +0000
committerjphillips2008-07-24 17:35:20 +0000
commit273646821aac167d69ae08859badb0f0e673b95d (patch)
treee0acd7d915b92622269dd9e6cb1e4efed5c9e66a
parent0efc8e4afb5171242ae656783c540bab8b9c38ae (diff)
downloadorg.eclipse.osee-273646821aac167d69ae08859badb0f0e673b95d.tar.gz
org.eclipse.osee-273646821aac167d69ae08859badb0f0e673b95d.tar.xz
org.eclipse.osee-273646821aac167d69ae08859badb0f0e673b95d.zip
-rw-r--r--org.eclipse.osee.framework.ui.skynet/plugin.xml7
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java88
2 files changed, 7 insertions, 88 deletions
diff --git a/org.eclipse.osee.framework.ui.skynet/plugin.xml b/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 0a0a80805c3..fa56f4cee68 100644
--- a/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -708,6 +708,13 @@
</command>
<command commandId="org.eclipse.ui.edit.copy">
</command>
+ <separator
+ name="artifactSearchViewPurgeSeparator"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.osee.framework.ui.skynet.purge.command">
+ </command>
</menuContribution>
</extension>
<extension
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java
index 3802160d3ad..28cbfc733db 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactSearchViewPage.java
@@ -26,11 +26,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -44,7 +40,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
import org.eclipse.osee.framework.plugin.core.config.ConfigUtil;
-import org.eclipse.osee.framework.skynet.core.SkynetActivator;
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;
@@ -184,7 +179,6 @@ public class ArtifactSearchViewPage extends AbstractArtifactSearchViewPage imple
menuManager.add(new Separator());
createSetAllPartitions(menuManager, viewer);
menuManager.add(new Separator());
- createPurgeArtifactHandler(menuManager, viewer);
// The additions group is a standard group
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -209,7 +203,6 @@ public class ArtifactSearchViewPage extends AbstractArtifactSearchViewPage imple
menuManager.add(new Separator());
addSetAllPartitions(menuManager, viewer);
menuManager.add(new Separator());
- addPurgeArtifactHandler(menuManager, viewer);
// The additions group is a standard group
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -218,87 +211,6 @@ public class ArtifactSearchViewPage extends AbstractArtifactSearchViewPage imple
/**
* @param menuManager
* @param viewer
- */
-
- private String addPurgeArtifactHandler(MenuManager menuManager, final TableViewer viewer) {
-
- CommandContributionItem purgeArtifactCommand =
- Commands.getLocalCommandContribution("org.eclipse.osee.framework.ui.skynet.purge.command", getSite(), null,
- null, null, null, null, null, null, null);
- menuManager.add(purgeArtifactCommand);
-
- return purgeArtifactCommand.getId();
- }
-
- private void createPurgeArtifactHandler(MenuManager menuManager, final TableViewer viewer) {
- handlerService.activateHandler(addPurgeArtifactHandler(menuManager, viewer), new AbstractSelectionEnabledHandler(
- menuManager) {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final List<Artifact> artifacts = getSelectedArtifacts(viewer);
-
- if (MessageDialog.openConfirm(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Confirm Artifact Purge ",
- " Are you sure you want to purge this artifact, all of " + "its children and all history associated with these artifacts from the database ?")) {
- Job job = new Job("Purge artifact") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- monitor.beginTask("Purge artifact", artifacts.size());
- final IProgressMonitor fMonitor = monitor;
-
- AbstractSkynetTxTemplate purgeTx =
- new AbstractSkynetTxTemplate(artifacts.iterator().next().getBranch()) {
- @Override
- protected void handleTxWork() throws OseeCoreException, SQLException {
- for (Artifact artifactToPurge : artifacts) {
- if (!artifactToPurge.isDeleted()) {
- fMonitor.setTaskName("Purge: " + artifactToPurge.getDescriptiveName());
- artifactToPurge.purgeFromBranch();
- }
- fMonitor.worked(1);
- }
- fMonitor.done();
- }
- };
-
- // Perform the purge transaction
- try {
- purgeTx.execute();
- toReturn = Status.OK_STATUS;
- } catch (Exception ex) {
- OSEELog.logException(SkynetGuiPlugin.class, ex, false);
- toReturn = new Status(Status.ERROR, SkynetActivator.PLUGIN_ID, -1, ex.getMessage(), ex);
- } finally {
- monitor.done();
- }
- return toReturn;
- }
- };
- Jobs.startJob(job);
- }
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
- boolean isEnabled =
- OseeProperties.isDeveloper() && accessControlManager.checkObjectListPermission(
- getSelectedArtifacts(viewer), PermissionEnum.WRITE);
- return isEnabled;
- }
- });
- }
-
- /**
- * @param menuManager
- * @param viewer
* @throws SQLException
*/
private void addReportHandler(MenuManager menuManager, TableViewer viewer) {

Back to the top