Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2013-08-28 21:13:59 +0000
committerGerrit Code Review @ Eclipse.org2013-08-30 17:00:13 +0000
commit29776a90082d311386f7626910516c5087a80532 (patch)
treecae53ca9b12fed780f48f4c3023c8897c4742e3d /plugins
parent485f8bd6b91663600e7473d38a06c22b78bf5efe (diff)
downloadorg.eclipse.osee-29776a90082d311386f7626910516c5087a80532.tar.gz
org.eclipse.osee-29776a90082d311386f7626910516c5087a80532.tar.xz
org.eclipse.osee-29776a90082d311386f7626910516c5087a80532.zip
bug[ats_FZXBB]: Fix goal order scrambled by SMAMembersTab transaction
--Allow drag/drop in the Goal Member tab when sorted on Goal Order only --Add OpenNewAtsWorldEditorSelectedAction to SMAMembersTab --Remove WorldViewDragAndDrop Change-Id: I067d161830eab70ba07ad7f063c64819cb8a7589
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java102
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java8
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java138
3 files changed, 94 insertions, 154 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 48e6b3319a..9edb4c6e74 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,6 +17,7 @@ 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;
@@ -32,7 +33,11 @@ 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;
+import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.core.client.actions.ISelectedAtsArtifacts;
@@ -45,16 +50,18 @@ 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;
+import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -69,6 +76,7 @@ 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;
@@ -252,7 +260,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, false);
+ (GoalArtifact) editor.getAwa()), bodyComp, SWT.BORDER);
new GoalDragAndDrop(worldComposite, SMAEditor.EDITOR_ID);
@@ -409,6 +417,7 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
private void refreshToolbar() {
IToolBarManager toolBarMgr = scrolledForm.getToolBarManager();
toolBarMgr.removeAll();
+ toolBarMgr.add(new OpenNewAtsWorldEditorSelectedAction(worldComposite));
toolBarMgr.add(getWorldXViewer().getCustomizeAction());
toolBarMgr.add(new RefreshAction(worldComposite));
scrolledForm.updateToolBar();
@@ -448,12 +457,32 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
return editor.isDisposed();
}
- private class GoalDragAndDrop extends WorldViewDragAndDrop {
+ private class GoalDragAndDrop extends SkynetDragAndDrop {
+ 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, 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;
}
private Artifact getSelectedArtifact(DropTargetEvent event) {
@@ -463,6 +492,48 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
return null;
}
+ private CustomizeData getCustomizeData() throws OseeCoreException {
+ CustomizeData customizeData = worldComposite.getCustomizeDataCopy();
+ Conditions.checkNotNull(customizeData, "Customized Data");
+ return customizeData;
+ }
+
+ private FilterData getFilterData() throws OseeCoreException {
+ FilterData filterData = getCustomizeData().getFilterData();
+ Conditions.checkNotNull(filterData, "Filter Data");
+ return filterData;
+ }
+
+ private SortingData getSortingData() throws OseeCoreException {
+ SortingData sortingData = getCustomizeData().getSortingData();
+ Conditions.checkNotNull(sortingData, "Sort Data");
+ return sortingData;
+ }
+
+ private String getFilterText() throws OseeCoreException {
+ String filterText = getFilterData().getFilterText();
+ Conditions.checkNotNull(filterText, "Filter Text");
+ return filterText;
+ }
+
+ private List<String> getSortingIds() throws OseeCoreException {
+ return getSortingData().getSortingIds();
+ }
+
+ private boolean isSortedByGoalOrder() throws OseeCoreException {
+ List<String> sortingIds = getSortingIds();
+ return (sortingIds.size() == 1 && sortingIds.contains(ATS_COLUMN_GOAL_ORDER));
+ }
+
+ private boolean isGoalFiltered() throws OseeCoreException {
+ String filterText = getFilterText();
+ return Strings.isValid(filterText);
+ }
+
+ private boolean isDropValid() throws OseeCoreException {
+ return !isGoalFiltered() && isSortedByGoalOrder();
+ }
+
@Override
public void operationChanged(DropTargetEvent event) {
if (!(event.detail == 1)) {
@@ -473,6 +544,20 @@ 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;
@@ -493,8 +578,9 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
final List<Artifact> droppedArtifacts = Arrays.asList(artData.getArtifacts());
Collections.reverse(droppedArtifacts);
final Artifact dropTarget = getSelectedArtifact(event);
- if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
- try {
+ try {
+ if (isDropValid() && ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+
Collections.reverse(droppedArtifacts);
List<Artifact> members = goalArtifact.getMembers();
for (Artifact dropped : droppedArtifacts) {
@@ -511,9 +597,9 @@ public class SMAMembersTab extends FormPage implements ISelectedAtsArtifacts, IW
goalArtifact.persist(SMAMembersTab.class.getSimpleName());
worldComposite.getXViewer().refresh(goalArtifact);
worldComposite.getXViewer().update(dropTarget, null);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.WARNING, Lib.exceptionToString(ex));
}
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.WARNING, Lib.exceptionToString(ex));
}
}
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 f1185284b6..c80fc88a44 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
@@ -73,10 +73,6 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
}
public WorldComposite(String id, final IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style) {
- this(id, worldEditor, null, parent, style, true);
- }
-
- public WorldComposite(String id, final IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style, boolean createDragAndDrop) {
super(parent, style);
this.id = id;
this.iWorldEditor = worldEditor;
@@ -101,10 +97,6 @@ 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
deleted file mode 100644
index b882799ea1..0000000000
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * 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.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);
- }
- }
-
-}

Back to the top