Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2013-09-05 15:57:02 -0400
committermegumi.telles2013-09-05 16:50:44 -0400
commitaff03abcb1827d0c2643a8709354d2e33c98c7ea (patch)
tree182f79e2266cc34c6a6a5d7e5dc4a7e0477bf5bb
parent784d51dd6acd33f3d84ae34d4bef6c5fe18fae0f (diff)
downloadorg.eclipse.osee-aff03abcb1827d0c2643a8709354d2e33c98c7ea.tar.gz
org.eclipse.osee-aff03abcb1827d0c2643a8709354d2e33c98c7ea.tar.xz
org.eclipse.osee-aff03abcb1827d0c2643a8709354d2e33c98c7ea.zip
bug[ats_AZ5NX]: Add WordEditor Drag and Drop functionality back in0.13.0.v201309061757_REL0.13.0.v201309061757-REL0.13.0.v201309060158_RC
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java45
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java12
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java139
3 files changed, 151 insertions, 45 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java
index 9edb4c6e74..4ce054fd6e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java
@@ -17,7 +17,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -33,7 +32,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
import org.eclipse.nebula.widgets.xviewer.customize.FilterData;
import org.eclipse.nebula.widgets.xviewer.customize.SortingData;
@@ -50,14 +48,13 @@ import org.eclipse.osee.ats.goal.RemoveFromGoalAction;
import org.eclipse.osee.ats.goal.RemoveFromGoalAction.RemovedFromGoalHandler;
import org.eclipse.osee.ats.goal.SetGoalOrderAction;
import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.world.IMenuActionProvider;
import org.eclipse.osee.ats.world.IWorldViewerEventHandler;
import org.eclipse.osee.ats.world.WorldComposite;
import org.eclipse.osee.ats.world.WorldLabelProvider;
+import org.eclipse.osee.ats.world.WorldViewDragAndDrop;
import org.eclipse.osee.ats.world.WorldXViewer;
import org.eclipse.osee.ats.world.WorldXViewerEventManager;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.operation.Operations;
@@ -76,7 +73,6 @@ import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
import org.eclipse.osee.framework.ui.skynet.util.FormsUtil;
import org.eclipse.osee.framework.ui.skynet.util.LoadingComposite;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ExceptionComposite;
import org.eclipse.osee.framework.ui.swt.Widgets;
@@ -260,7 +256,7 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
if (!Widgets.isAccessible(worldComposite)) {
worldComposite =
new WorldComposite("workflow.edtor.members.tab", editor, new GoalXViewerFactory(
- (GoalArtifact) editor.getAwa()), bodyComp, SWT.BORDER);
+ (GoalArtifact) editor.getAwa()), bodyComp, SWT.BORDER, false);
new GoalDragAndDrop(worldComposite, SMAEditor.EDITOR_ID);
@@ -457,32 +453,13 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
return editor.isDisposed();
}
- private class GoalDragAndDrop extends SkynetDragAndDrop {
+ private class GoalDragAndDrop extends WorldViewDragAndDrop {
private static final String ATS_COLUMN_GOAL_ORDER = "ats.column.goalOrder";
private boolean isFeedbackAfter = false;
- private final WorldComposite worldComposite;
public GoalDragAndDrop(WorldComposite worldComposite, String viewId) {
- super(worldComposite.getXViewer().getTree(), viewId);
- this.worldComposite = worldComposite;
- }
-
- protected boolean isValidForArtifactDrop(DropTargetEvent event) {
- boolean isValid = false;
- if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
- ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
-
- if (artData != null) {
- Artifact[] artifacts = artData.getArtifacts();
- for (Artifact art : artifacts) {
- if (AtsUtil.isAtsArtifact(art) || art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- isValid = true;
- }
- }
- }
- }
- return isValid;
+ super(worldComposite, viewId);
}
private Artifact getSelectedArtifact(DropTargetEvent event) {
@@ -544,20 +521,6 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
}
@Override
- public Artifact[] getArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) worldComposite.getXViewer().getSelection();
- Iterator<?> i = selection.iterator();
- List<Artifact> artifacts = new ArrayList<Artifact>();
- while (i.hasNext()) {
- Object object = i.next();
- if (object instanceof Artifact) {
- artifacts.add((Artifact) object);
- }
- }
- return artifacts.toArray(new Artifact[artifacts.size()]);
- }
-
- @Override
public void performDragOver(DropTargetEvent event) {
if (isValidForArtifactDrop(event)) {
event.detail = DND.DROP_MOVE;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
index c80fc88a44..6c800d7441 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
@@ -3,10 +3,10 @@
* 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
+ * http://www.eclipse.org/legal/eplv10.html
*
* Contributors:
- * Boeing - initial API and implementation
+ * Boeing initial API and implementation
*******************************************************************************/
package org.eclipse.osee.ats.world;
@@ -69,10 +69,10 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
private final String id;
public WorldComposite(String id, IWorldEditor worldEditor, Composite parent, int style) {
- this(id, worldEditor, null, parent, style);
+ this(id, worldEditor, null, parent, style, true);
}
- public WorldComposite(String id, final IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style) {
+ public WorldComposite(String id, final IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style, boolean createDragAndDrop) {
super(parent, style);
this.id = id;
this.iWorldEditor = worldEditor;
@@ -97,6 +97,10 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
worldXViewer.setContentProvider(new WorldContentProvider(worldXViewer));
worldXViewer.setLabelProvider(new WorldLabelProvider(worldXViewer));
+ if (createDragAndDrop) {
+ new WorldViewDragAndDrop(this, WorldEditor.EDITOR_ID);
+ }
+
setContent(mainComp);
setExpandHorizontal(true);
setExpandVertical(true);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java
new file mode 100644
index 0000000000..cb6c8f1d04
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ /*******************************************************************************
+ * 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/eplv10.html
+ *
+ * Contributors:
+ * Boeing initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.world;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldViewDragAndDrop extends SkynetDragAndDrop {
+
+ private final WorldComposite worldComposite;
+
+ public WorldViewDragAndDrop(WorldComposite worldComposite, String viewId) {
+ super(worldComposite.getXViewer().getTree(), viewId);
+ this.worldComposite = worldComposite;
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) worldComposite.getXViewer().getSelection();
+ Iterator<?> i = selection.iterator();
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ while (i.hasNext()) {
+ Object object = i.next();
+ if (object instanceof Artifact) {
+ artifacts.add((Artifact) object);
+ }
+ }
+ return artifacts.toArray(new Artifact[artifacts.size()]);
+ }
+
+ protected boolean isValidForArtifactDrop(DropTargetEvent event) {
+ if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
+
+ if (artData != null) {
+ Artifact[] artifacts = artData.getArtifacts();
+ for (Artifact art : artifacts) {
+ if (AtsUtil.isAtsArtifact(art) || art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) {
+ if (isValidForArtifactDrop(event)) {
+ event.detail = DND.DROP_COPY;
+ }
+ }
+
+ @Override
+ public void performDrop(final DropTargetEvent event) {
+ if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ final ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
+ Job job = new Job("Loading WorldView...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ String name = "Dropped Artifacts";
+ Set<Artifact> arts = new HashSet<Artifact>();
+ if (artData != null) {
+ Artifact[] artifacts = artData.getArtifacts();
+ if (artifacts.length == 1) {
+ Artifact art = artifacts[0];
+ if (AtsUtil.isAtsArtifact(art)) {
+ name = art.getName();
+ } else if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ GroupWorldSearchItem groupWorldSearchItem = new GroupWorldSearchItem(art.getBranch());
+ groupWorldSearchItem.setSelectedGroup(art);
+ WorldEditor.open(new WorldEditorUISearchItemProvider(groupWorldSearchItem, null,
+ TableLoadOption.NoUI));
+ return Status.OK_STATUS;
+ }
+ }
+ for (Artifact art : artifacts) {
+ if (AtsUtil.isAtsArtifact(art)) {
+ arts.add(art);
+ } else if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ for (Artifact relArt : art.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
+ if (AtsUtil.isAtsArtifact(relArt)) {
+ arts.add(relArt);
+ }
+ }
+ }
+ }
+ }
+ if (arts.size() > 0) {
+ WorldEditor.open(new WorldEditorSimpleProvider(name, arts));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getLocalizedMessage(), ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ }
+ }
+
+} \ No newline at end of file

Back to the top