Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-03-31 16:13:11 +0000
committerRyan D. Brooks2016-03-31 16:13:11 +0000
commiteb15d8a80a49a4c6185be5b42541fcad2503b398 (patch)
tree5bbbe2e8cf468a2be0a3647e3eb6d9f067a44445
parenta6c453299a6536d2db479428a4fce0fb42921a26 (diff)
downloadorg.eclipse.osee-eb15d8a80a49a4c6185be5b42541fcad2503b398.tar.gz
org.eclipse.osee-eb15d8a80a49a4c6185be5b42541fcad2503b398.tar.xz
org.eclipse.osee-eb15d8a80a49a4c6185be5b42541fcad2503b398.zip
feature[ats_ATS280450]: Consolidate WorldEditor and TaskEditor
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorActionTest.java42
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorSelectedTest.java2
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsWorldEditorActionTest.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenNewAtsTaskEditorSelected.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java81
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAMembersTab.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATasksTab.java721
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskEditorRenderer.java18
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ExportMetricsOperation.java48
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java34
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/IXTaskViewer.java48
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java262
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java390
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java90
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java37
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java38
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java374
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java315
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java157
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java45
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java7
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java1
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java81
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java7
28 files changed, 1078 insertions, 1745 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorActionTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorActionTest.java
index 7d8aa6223d8..ea2382f9d80 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorActionTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorActionTest.java
@@ -11,13 +11,13 @@
package org.eclipse.osee.ats.client.integration.tests.ats.actions;
import java.util.Collection;
-import java.util.Collections;
import org.eclipse.jface.action.Action;
import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction.IOpenNewAtsTaskEditorHandler;
-import org.eclipse.osee.ats.client.integration.tests.ats.core.client.AtsTestUtil;
+import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.task.ITaskEditorProvider;
+import org.eclipse.osee.ats.world.WorldEditor;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -47,27 +47,47 @@ public class OpenNewAtsTaskEditorActionTest extends AbstractAtsActionRunTest {
}
@Override
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
- return Collections.singleton(AtsTestUtil.getOrCreateTaskOffTeamWf1());
+ public String getName() {
+ return "Tasks";
}
@Override
- public String getTaskEditorLabel(SearchType searchType) {
- return "Tasks";
+ public ITaskEditorProvider copyProvider() {
+ return null;
}
@Override
- public Collection<TableLoadOption> getTableLoadOptions() {
- return Collections.singleton(TableLoadOption.NoUI);
+ public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
+ // do nothing
}
@Override
- public String getName() {
- return "Tasks";
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ return null;
}
@Override
- public ITaskEditorProvider copyProvider() {
+ public IAtsVersion getTargetedVersionArtifact() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public Collection<Artifact> performSearch(SearchType searchType) {
+ return null;
+ }
+
+ @Override
+ public TableLoadOption[] getTableLoadOptions() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public String getTaskEditorLabel(SearchType searchType) {
return null;
}
};
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorSelectedTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorSelectedTest.java
index a618775ed84..6c0fd380e5d 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorSelectedTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsTaskEditorSelectedTest.java
@@ -29,7 +29,7 @@ public class OpenNewAtsTaskEditorSelectedTest extends AbstractAtsActionRunTest {
return new OpenNewAtsTaskEditorSelected(new IOpenNewAtsTaskEditorSelectedHandler() {
@Override
- public List<? extends Artifact> getSelectedArtifacts() throws OseeCoreException {
+ public List<Artifact> getSelectedArtifacts() throws OseeCoreException {
return Arrays.asList(AtsTestUtil.getTeamWf());
}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsWorldEditorActionTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsWorldEditorActionTest.java
index ce5757adae2..e1c71c0f628 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsWorldEditorActionTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/actions/OpenNewAtsWorldEditorActionTest.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.world.IWorldEditorProvider;
import org.eclipse.osee.ats.world.WorldEditor;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
@@ -73,6 +74,11 @@ public class OpenNewAtsWorldEditorActionTest extends AbstractAtsActionRunTest {
public Collection<Artifact> performSearch(SearchType searchType) {
return null;
}
+
+ @Override
+ public TableLoadOption[] getTableLoadOptions() throws OseeCoreException {
+ return null;
+ }
};
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java
index e2c883be025..60474d639fa 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java
@@ -99,7 +99,7 @@ public class AtsObjects {
return uuids;
}
- public static Collection<ArtifactId> getArtifacts(Collection<IAtsObject> atsObjects) {
+ public static Collection<ArtifactId> getArtifacts(Collection<? extends IAtsObject> atsObjects) {
List<ArtifactId> artifacts = new LinkedList<>();
for (IAtsObject task : atsObjects) {
artifacts.add(task.getStoreObject());
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenNewAtsTaskEditorSelected.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenNewAtsTaskEditorSelected.java
index 0159946d618..81af403d13d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenNewAtsTaskEditorSelected.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/OpenNewAtsTaskEditorSelected.java
@@ -37,7 +37,7 @@ public class OpenNewAtsTaskEditorSelected extends AbstractAtsAction {
public interface IOpenNewAtsTaskEditorSelectedHandler {
CustomizeData getCustomizeDataCopy() throws OseeCoreException;
- List<? extends Artifact> getSelectedArtifacts() throws OseeCoreException;
+ List<Artifact> getSelectedArtifacts() throws OseeCoreException;
}
@Override
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java
index c6897b00b69..9cccc1eea55 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java
@@ -29,7 +29,7 @@ import org.eclipse.osee.ats.actions.ResourceHistoryAction;
import org.eclipse.osee.ats.agile.SprintMemberProvider;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.version.IAtsVersion;
-import org.eclipse.osee.ats.api.workdef.IStateToken;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.actions.ISelectedAtsArtifacts;
import org.eclipse.osee.ats.core.client.artifact.GoalArtifact;
import org.eclipse.osee.ats.core.client.artifact.SprintArtifact;
@@ -42,9 +42,7 @@ import org.eclipse.osee.ats.goal.GoalMemberProvider;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.navigate.VisitedItems;
-import org.eclipse.osee.ats.task.IXTaskViewer;
import org.eclipse.osee.ats.task.TaskComposite;
-import org.eclipse.osee.ats.task.TaskTabXWidgetActionPage;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.world.AtsMetricsComposite;
import org.eclipse.osee.ats.world.IAtsMetricsProvider;
@@ -67,7 +65,6 @@ import org.eclipse.osee.framework.ui.skynet.artifact.editor.AbstractArtifactEdit
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -92,15 +89,15 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
/**
* @author Donald G. Dunne
*/
-public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportable, ISMAEditorEventHandler, ISelectedAtsArtifacts, IAtsMetricsProvider, IXTaskViewer {
+public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportable, ISMAEditorEventHandler, ISelectedAtsArtifacts, IAtsMetricsProvider {
public static final String EDITOR_ID = "org.eclipse.osee.ats.editor.SMAEditor";
private AbstractWorkflowArtifact awa;
private SMAWorkFlowTab workFlowTab;
private SMAMembersTab membersTab;
+ private SMATasksTab taskTab;
int attributesPageIndex;
private AttributesComposite attributesComposite;
private boolean privilegedEditModeEnabled = false;
- private TaskTabXWidgetActionPage taskTabXWidgetActionPage;
private final List<ISMAEditorListener> editorListeners = new ArrayList<>();
SMAEditorOutlinePage outlinePage;
@@ -159,7 +156,7 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
return aei;
}
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({"rawtypes", "unchecked"})
@Override
public Object getAdapter(Class adapter) {
if (adapter == IContentOutlinePage.class) {
@@ -205,8 +202,8 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
private void createTaskTab() throws PartInitException {
if (isTaskable()) {
- taskTabXWidgetActionPage = new TaskTabXWidgetActionPage(this);
- addPage(taskTabXWidgetActionPage);
+ taskTab = new SMATasksTab(this, (IAtsTeamWorkflow) awa, AtsClientService.get());
+ addPage(taskTab);
}
}
@@ -285,6 +282,9 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
if (membersTab != null) {
membersTab.dispose();
}
+ if (taskTab != null) {
+ taskTab.dispose();
+ }
super.dispose();
}
@@ -417,6 +417,9 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
if (membersTab != null) {
membersTab.refresh();
}
+ if (taskTab != null) {
+ taskTab.refresh();
+ }
if (attributesComposite != null) {
attributesComposite.refreshArtifact(awa);
}
@@ -545,48 +548,10 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
});
}
- @Override
- public AbstractWorkflowArtifact getAwa() {
- return awa;
- }
-
- @Override
- public String getCurrentStateName() {
- return awa.getStateMgr().getCurrentStateName();
- }
-
- @Override
- public IDirtiableEditor getEditor() {
- return this;
- }
-
- @Override
- public String getTabName() {
- return "Tasks";
- }
-
- @Override
- public Collection<TaskArtifact> getTaskArtifacts(IStateToken state) throws OseeCoreException {
- if (awa instanceof TeamWorkFlowArtifact) {
- return ((TeamWorkFlowArtifact) awa).getTaskArtifacts(state);
- }
- return Collections.emptyList();
- }
-
- @Override
- public Collection<TaskArtifact> getTaskArtifacts() throws OseeCoreException {
- if (awa instanceof TeamWorkFlowArtifact) {
- return ((TeamWorkFlowArtifact) awa).getTaskArtifacts();
- }
- return Collections.emptyList();
- }
-
- @Override
public boolean isTaskable() {
return awa instanceof TeamWorkFlowArtifact;
}
- @Override
public boolean isTasksEditable() {
boolean editable = true;
if (!(awa instanceof TeamWorkFlowArtifact) || awa.isCompletedOrCancelled()) {
@@ -631,16 +596,6 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
}
@Override
- public void handleRefreshAction() {
- // do nothing
- }
-
- @Override
- public boolean isRefreshActionHandled() {
- return false;
- }
-
- @Override
public double getManHoursPerDayPreference() throws OseeCoreException {
return awa.getManHrsPerDayPreference();
}
@@ -650,7 +605,7 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
}
public TaskComposite getTaskComposite() {
- return taskTabXWidgetActionPage.getTaskComposite();
+ return taskTab.getTaskComposite();
}
@Override
@@ -708,8 +663,10 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
if (membersTab != null && membersTab.getMembersSection() != null) {
provider = membersTab.getWorldXViewer();
}
- } else if (page.equals(taskTabXWidgetActionPage)) {
- provider = taskTabXWidgetActionPage.getTaskComposite().getTaskXViewer();
+ } else if (page.equals(taskTab)) {
+ if (taskTab.getTaskComposite() != null) {
+ provider = taskTab.getTaskComposite().getWorldXViewer();
+ }
} else {
String title = getPageText(newPageIndex);
if (title.equalsIgnoreCase("metrics")) {
@@ -731,4 +688,8 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtyReportabl
return java.util.Collections.emptyList();
}
+ public AbstractWorkflowArtifact getAwa() {
+ return awa;
+ }
+
} \ No newline at end of file
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 c5cfd288ba4..925f8d7b7bd 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
@@ -264,8 +264,8 @@ public class SMAMembersTab extends FormPage implements IWorldEditor, ISelectedAt
*/
private boolean createMembersBody() {
if (!Widgets.isAccessible(worldComposite)) {
- worldComposite = new WorldComposite("workflow.edtor.members.tab", this,
- provider.getXViewerFactory(provider.getArtifact()), bodyComp, SWT.BORDER, false);
+ worldComposite = new WorldComposite(this, provider.getXViewerFactory(provider.getArtifact()),
+ bodyComp, SWT.BORDER, false);
new MembersDragAndDrop(worldComposite, SMAEditor.EDITOR_ID);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATasksTab.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATasksTab.java
new file mode 100644
index 00000000000..707282767dc
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATasksTab.java
@@ -0,0 +1,721 @@
+/*******************************************************************************
+ * 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.editor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
+import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
+import org.eclipse.osee.ats.actions.NewAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
+import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction;
+import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
+import org.eclipse.osee.ats.api.workflow.IAtsTask;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.core.client.IAtsClient;
+import org.eclipse.osee.ats.core.client.actions.ISelectedAtsArtifacts;
+import org.eclipse.osee.ats.core.client.config.AtsBulkLoad;
+import org.eclipse.osee.ats.core.client.task.TaskArtifact;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.core.client.util.AtsTaskCache;
+import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.util.AtsObjects;
+import org.eclipse.osee.ats.export.AtsExportAction;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.task.IXTaskViewer;
+import org.eclipse.osee.ats.task.TaskComposite;
+import org.eclipse.osee.ats.task.TaskXViewerFactory;
+import org.eclipse.osee.ats.world.IMenuActionProvider;
+import org.eclipse.osee.ats.world.IWorldEditor;
+import org.eclipse.osee.ats.world.IWorldEditorProvider;
+import org.eclipse.osee.ats.world.IWorldViewerEventHandler;
+import org.eclipse.osee.ats.world.WorldAssigneeFilter;
+import org.eclipse.osee.ats.world.WorldCompletedFilter;
+import org.eclipse.osee.ats.world.WorldComposite;
+import org.eclipse.osee.ats.world.WorldXViewer;
+import org.eclipse.osee.ats.world.WorldXViewerEventManager;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.model.EventModType;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
+import org.eclipse.osee.framework.ui.skynet.util.FormsUtil;
+import org.eclipse.osee.framework.ui.skynet.util.LoadingComposite;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ExceptionComposite;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.progress.UIJob;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SMATasksTab extends FormPage implements IWorldEditor, ISelectedAtsArtifacts, IWorldViewerEventHandler, IMenuActionProvider, IXTaskViewer {
+ private IManagedForm managedForm;
+ private Composite bodyComp;
+ private ScrolledForm scrolledForm;
+ private TaskComposite taskComposite;
+ private LoadingComposite loadingComposite;
+ public final static String ID = "ats.tasks.tab";
+ private final SMAEditor editor;
+ private static Map<Long, Integer> guidToScrollLocation = new HashMap<>();
+ private final ReloadJobChangeAdapter reloadAdapter;
+ private final IAtsClient client;
+ private final IAtsTeamWorkflow teamWf;
+ private final TeamWorkFlowArtifact teamArt;
+ private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
+ private WorldAssigneeFilter worldAssigneeFilter = null;
+ private Action filterCompletedAction, filterMyAssigneeAction;
+
+ public SMATasksTab(SMAEditor editor, IAtsTeamWorkflow teamWf, IAtsClient client) {
+ super(editor, ID, "Tasks");
+ this.editor = editor;
+ this.teamWf = teamWf;
+ this.client = client;
+ reloadAdapter = new ReloadJobChangeAdapter(editor);
+ teamArt = (TeamWorkFlowArtifact) teamWf.getStoreObject();
+ setPartName(getTabName());
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+
+ this.managedForm = managedForm;
+ scrolledForm = managedForm.getForm();
+ try {
+ scrolledForm.addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ storeScrollLocation();
+ }
+ });
+ bodyComp = scrolledForm.getBody();
+ GridLayout gridLayout = new GridLayout(1, true);
+ bodyComp.setLayout(gridLayout);
+ GridData gd = new GridData(SWT.LEFT, SWT.LEFT, false, false);
+ bodyComp.setLayoutData(gd);
+
+ setLoading(true);
+ refreshData();
+ WorldXViewerEventManager.add(this);
+
+ scrolledForm.setText("Team Workflow Tasks");
+ scrolledForm.setImage(ImageManager.getImage(AtsImage.TASK));
+
+ managedForm.reflow(true);
+ } catch (Exception ex) {
+ handleException(ex);
+ }
+ }
+
+ @Override
+ public void showBusy(boolean busy) {
+ super.showBusy(busy);
+ if (getManagedForm() != null && Widgets.isAccessible(getManagedForm().getForm())) {
+ getManagedForm().getForm().getForm().setBusy(busy);
+ }
+ }
+
+ public void refreshData() {
+ if (Widgets.isAccessible(bodyComp)) {
+ List<IOperation> ops = AtsBulkLoad.getConfigLoadingOperations();
+ IOperation operation = Operations.createBuilder("Load Tasks Tab").addAll(ops).build();
+ Operations.executeAsJob(operation, false, Job.LONG, reloadAdapter);
+ }
+ }
+
+ private final class ReloadJobChangeAdapter extends JobChangeAdapter {
+
+ private final SMAEditor editor;
+ boolean firstTime = true;
+
+ private ReloadJobChangeAdapter(SMAEditor editor) {
+ this.editor = editor;
+ showBusy(true);
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ super.done(event);
+ Job job = new UIJob("Draw Tasks Tab") {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (firstTime) {
+ try {
+ if (Widgets.isAccessible(scrolledForm)) {
+ setLoading(false);
+ boolean createdAndLoaded = createMembersBody();
+ if (!createdAndLoaded) {
+ reload();
+ }
+ jumptoScrollLocation();
+ FormsUtil.addHeadingGradient(editor.getToolkit(), scrolledForm, true);
+ refreshToolbar();
+ editor.onDirtied();
+ }
+ firstTime = false;
+ } catch (OseeCoreException ex) {
+ handleException(ex);
+ } finally {
+ showBusy(false);
+ }
+ } else {
+ showBusy(false);
+ if (managedForm != null && Widgets.isAccessible(managedForm.getForm())) {
+ refresh();
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Operations.scheduleJob(job, false, Job.SHORT, null);
+ }
+ }
+
+ private void handleException(Exception ex) {
+ setLoading(false);
+ if (Widgets.isAccessible(taskComposite)) {
+ taskComposite.dispose();
+ }
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ new ExceptionComposite(bodyComp, ex);
+ bodyComp.layout();
+ }
+
+ private void setLoading(boolean set) {
+ if (set) {
+ loadingComposite = new LoadingComposite(bodyComp);
+ bodyComp.layout();
+ } else {
+ if (Widgets.isAccessible(loadingComposite)) {
+ loadingComposite.dispose();
+ }
+ }
+ showBusy(set);
+ }
+
+ /**
+ * @return true if created; false if skipped
+ */
+ private boolean createMembersBody() {
+ if (!Widgets.isAccessible(taskComposite)) {
+ taskComposite = new TaskComposite(this, this, new TaskXViewerFactory(), bodyComp, SWT.BORDER, editor,
+ teamWf.isInWork(), teamWf);
+ taskComposite.getWorldXViewer().addMenuActionProvider(this);
+ getSite().setSelectionProvider(taskComposite.getWorldXViewer());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 100;
+ gd.heightHint = 100;
+ taskComposite.setLayoutData(gd);
+
+ getSite().setSelectionProvider(taskComposite.getWorldXViewer());
+
+ reload();
+ return true;
+ }
+ return false;
+ }
+
+ public void reload() {
+ if (isTableDisposed()) {
+ return;
+ }
+ String getLoadingString = String.format("Loading Tasks for %s", editor.getAwa());
+ Job job = new Job(getLoadingString) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (isTableDisposed()) {
+ return Status.OK_STATUS;
+ }
+ try {
+ Collection<TaskArtifact> taskArts = getTaskArtifacts();
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (isTableDisposed()) {
+ return;
+ }
+ taskComposite.load("Tasks", taskArts, (CustomizeData) null, TableLoadOption.None);
+ }
+
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ String.format("Exception loading tasks for %s", teamWf.toStringWithId()), ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, false);
+ }
+
+ private boolean isTableDisposed() {
+ return taskComposite == null || taskComposite.getXViewer() == null || taskComposite.getXViewer().getTree() == null || taskComposite.getXViewer().getTree().isDisposed();
+ }
+
+ private void jumptoScrollLocation() {
+ // Jump to scroll location if set
+ Integer selection = guidToScrollLocation.get(teamWf.getUuid());
+ if (selection != null) {
+ JumpScrollbarJob job = new JumpScrollbarJob("");
+ job.schedule(500);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if (taskComposite != null) {
+ taskComposite.dispose();
+ }
+ if (editor.getToolkit() != null) {
+ editor.getToolkit().dispose();
+ }
+ }
+
+ private final Control control = null;
+
+ private void storeScrollLocation() {
+ if (managedForm != null && managedForm.getForm() != null) {
+ Integer selection = managedForm.getForm().getVerticalBar().getSelection();
+ guidToScrollLocation.put(teamWf.getUuid(), selection);
+ }
+ }
+
+ private class JumpScrollbarJob extends Job {
+ public JumpScrollbarJob(String name) {
+ super(name);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ Integer selection = guidToScrollLocation.get(teamWf.getUuid());
+
+ // Find the ScrolledComposite operating on the control.
+ ScrolledComposite sComp = null;
+ if (control == null || control.isDisposed()) {
+ return;
+ }
+ Composite parent = control.getParent();
+ while (parent != null) {
+ if (parent instanceof ScrolledComposite) {
+ sComp = (ScrolledComposite) parent;
+ break;
+ }
+ parent = parent.getParent();
+ }
+
+ if (sComp != null) {
+ sComp.setOrigin(0, selection);
+ }
+ }
+ });
+ return Status.OK_STATUS;
+
+ }
+ }
+
+ public void refresh() {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(taskComposite)) {
+ updateShown();
+ taskComposite.update();
+ taskComposite.getXViewer().refresh();
+ }
+ }
+ });
+ }
+
+ private void updateShown() {
+ Collection<TaskArtifact> members;
+ try {
+ members = getTaskArtifacts();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ return;
+ }
+ List<Artifact> loadedArtifacts = taskComposite.getLoadedArtifacts();
+ List<Artifact> toRemoveFromLoaded = new LinkedList<>(members);
+ members.removeAll(loadedArtifacts);
+ for (Artifact art : members) {
+ taskComposite.insert(art, -1);
+ }
+ loadedArtifacts.removeAll(toRemoveFromLoaded);
+ taskComposite.removeItems(loadedArtifacts);
+ taskComposite.getXViewer().remove(loadedArtifacts);
+ taskComposite.getXViewer().refresh(getTaskArtifacts());
+ }
+
+ private void refreshToolbar() {
+ IToolBarManager toolBarMgr = scrolledForm.getToolBarManager();
+ toolBarMgr.removeAll();
+ toolBarMgr.add(getWorldXViewer().getCustomizeAction());
+ toolBarMgr.add(new Separator());
+ toolBarMgr.add(new OpenNewAtsTaskEditorAction(taskComposite));
+ toolBarMgr.add(new OpenNewAtsTaskEditorSelected(taskComposite));
+ toolBarMgr.add(new OpenNewAtsWorldEditorSelectedAction(taskComposite));
+ toolBarMgr.add(new Separator());
+ toolBarMgr.add(new RefreshAction(taskComposite));
+ toolBarMgr.add(new NewAction());
+ toolBarMgr.add(new Separator());
+ createDropDownMenuActions();
+ toolBarMgr.add(new DropDownAction());
+ scrolledForm.updateToolBar();
+ }
+
+ protected void createDropDownMenuActions() {
+ try {
+ worldAssigneeFilter = new WorldAssigneeFilter();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", IAction.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterCompletedAction.isChecked()) {
+ taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
+ } else {
+ taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
+ }
+ updateExtendedStatusString();
+ taskComposite.getTaskXViewer().refresh();
+ }
+ };
+ filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
+ filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
+
+ filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", IAction.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterMyAssigneeAction.isChecked()) {
+ taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
+ } else {
+ taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
+ }
+ updateExtendedStatusString();
+ taskComposite.getTaskXViewer().refresh();
+ }
+ };
+ filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
+ filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
+ }
+
+ public void updateExtendedStatusString() {
+ taskComposite.getTaskXViewer().setExtendedStatusString(
+ //
+ (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
+ //
+ (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
+ }
+
+ public class DropDownAction extends Action implements IMenuCreator {
+ private Menu fMenu;
+
+ public DropDownAction() {
+ setText("Other");
+ setMenuCreator(this);
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
+ addKeyListener();
+ }
+
+ @Override
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+
+ addActionToMenu(fMenu, filterCompletedAction);
+ addActionToMenu(fMenu, filterMyAssigneeAction);
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ addActionToMenu(fMenu, new AtsExportAction(taskComposite.getTaskXViewer()));
+ try {
+ if (taskComposite.getIXTaskViewer().isTasksEditable()) {
+ addActionToMenu(fMenu, new ImportTasksViaSpreadsheet(taskComposite.getTeamArt(), null));
+ addActionToMenu(fMenu, new ImportTasksViaSimpleList(taskComposite.getTeamArt(), null));
+
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return fMenu;
+ }
+
+ @Override
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ @Override
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ void clear() {
+ dispose();
+ }
+
+ private void addKeyListener() {
+ taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ // do nothing
+ }
+
+ @Override
+ public void keyReleased(KeyEvent event) {
+ if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
+ if (event.keyCode == 'a') {
+ taskComposite.getTaskXViewer().getTree().setSelection(
+ taskComposite.getTaskXViewer().getTree().getItems());
+ } else if (event.keyCode == 'f') {
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ } else if (event.keyCode == 'g') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterMyAssigneeAction.run();
+ } else if (event.keyCode == 'd') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ filterMyAssigneeAction.run();
+ }
+ }
+ }
+ });
+ }
+ }
+
+ public WorldComposite getMembersSection() {
+ return taskComposite;
+ }
+
+ @Override
+ public WorldXViewer getWorldXViewer() {
+ if (taskComposite == null) {
+ return null;
+ }
+ return taskComposite.getWorldXViewer();
+ }
+
+ @Override
+ public void removeItems(Collection<? extends Object> objects) {
+ for (Object obj : objects) {
+ if (obj instanceof EventBasicGuidArtifact) {
+ EventBasicGuidArtifact guidArt = (EventBasicGuidArtifact) obj;
+ if (guidArt.getModType() == EventModType.Purged) {
+ refresh();
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void relationsModifed(Collection<Artifact> relModifiedArts, Collection<Artifact> goalMemberReordered, Collection<Artifact> sprintMemberReordered) {
+ if (relModifiedArts.contains(teamArt)) {
+ refresh();
+ }
+ }
+
+ @Override
+ public boolean isDisposed() {
+ return editor.isDisposed();
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = taskComposite.getXViewer().getMenuManager();
+ mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, new Separator());
+ }
+
+ @Override
+ public Set<? extends Artifact> getSelectedSMAArtifacts() {
+ Set<Artifact> artifacts = new HashSet<>();
+ for (Artifact art : taskComposite.getSelectedArtifacts()) {
+ if (art instanceof AbstractWorkflowArtifact) {
+ artifacts.add(art);
+ }
+ }
+ return artifacts;
+ }
+
+ @Override
+ public List<Artifact> getSelectedAtsArtifacts() {
+ List<Artifact> artifacts = new ArrayList<>();
+ for (Artifact art : taskComposite.getSelectedArtifacts()) {
+ if (art.isOfType(AtsArtifactTypes.AtsArtifact)) {
+ artifacts.add(art);
+ }
+ }
+ return artifacts;
+ }
+
+ @Override
+ public List<TaskArtifact> getSelectedTaskArtifacts() {
+ List<TaskArtifact> tasks = new ArrayList<>();
+ for (Artifact art : taskComposite.getSelectedArtifacts()) {
+ if (art instanceof TaskArtifact) {
+ tasks.add((TaskArtifact) art);
+ }
+ }
+ return tasks;
+ }
+
+ @Override
+ public void reflow() {
+ // do nothing
+ }
+
+ @Override
+ public void setTableTitle(String title, boolean warning) {
+ // do nothing
+ }
+
+ @Override
+ public void reSearch() throws OseeCoreException {
+ JobChangeAdapter listener = new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ super.done(event);
+ reload();
+ }
+
+ };
+ deCacheAndReload(listener);
+ }
+
+ private void deCacheAndReload(JobChangeAdapter listener) {
+ ArtifactQuery.reloadArtifacts(getTaskArtifacts());
+ AtsTaskCache.decache(teamArt);
+ ArtifactQuery.reloadArtifacts(Collections.singleton(teamArt));
+ }
+
+ @Override
+ public IWorldEditorProvider getWorldEditorProvider() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public void createToolBarPulldown(Menu menu) {
+ // do nothing
+ }
+
+ @Override
+ public String getCurrentTitleLabel() {
+ return null;
+ }
+
+ private Collection<IAtsTask> getTasks() {
+ return client.getTaskService().getTasks(teamWf);
+ }
+
+ public Collection<TaskArtifact> getTaskArtifacts() {
+ return org.eclipse.osee.framework.jdk.core.util.Collections.castAll(
+ AtsObjects.getArtifacts(client.getTaskService().getTasks(teamWf)));
+ }
+
+ @Override
+ public String getTabName() {
+ try {
+ return String.format("Tasks (%d)", getTasks().size());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return "Tasks";
+ }
+
+ public TaskComposite getTaskComposite() {
+ return taskComposite;
+ }
+
+ @Override
+ public IAtsTeamWorkflow getTeamWf() throws OseeCoreException {
+ return teamArt;
+ }
+
+ @Override
+ public boolean isTasksEditable() {
+ return editor.isTasksEditable();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
index 3b0224267b7..41b13443ea6 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
@@ -63,6 +63,7 @@ import org.eclipse.osee.ats.world.IAtsWorldEditorItem;
import org.eclipse.osee.ats.world.search.ArtifactTypeSearchItem;
import org.eclipse.osee.ats.world.search.ArtifactTypeWithInheritenceSearchItem;
import org.eclipse.osee.ats.world.search.AtsSearchGoalSearchItem;
+import org.eclipse.osee.ats.world.search.AtsSearchTaskSearchItem;
import org.eclipse.osee.ats.world.search.AtsSearchTeamWorkflowSearchItem;
import org.eclipse.osee.ats.world.search.MultipleIdSearchData;
import org.eclipse.osee.ats.world.search.MultipleIdSearchOperation;
@@ -148,8 +149,9 @@ public final class AtsNavigateViewItems implements XNavigateViewItems, IXNavigat
items.add(new XNavigateItemAction(item, new NewGoal(), AtsImage.GOAL));
items.add(new SearchNavigateItem(item, new MyWorldSearchItem("User's World")));
- items.add(new SearchNavigateItem(item, new AtsSearchGoalSearchItem()));
+ items.add(new SearchNavigateItem(item, new AtsSearchTaskSearchItem()));
items.add(new SearchNavigateItem(item, new AtsSearchTeamWorkflowSearchItem()));
+ items.add(new SearchNavigateItem(item, new AtsSearchGoalSearchItem()));
createVersionsSection(item, items);
createAgileSection(item, items);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskEditorRenderer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskEditorRenderer.java
index fc177410533..cc32b1c73d9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskEditorRenderer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskEditorRenderer.java
@@ -23,6 +23,7 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
import org.eclipse.osee.framework.ui.skynet.MenuCmdDef;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
/**
@@ -30,6 +31,8 @@ import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
*/
public class AtsTaskEditorRenderer extends AbstractAtsRenderer {
+ private static final String Option_TASK_WORLD_EDITOR = "task.world.editor.option";
+
@Override
public String getName() {
return "ATS Task Editor";
@@ -38,16 +41,25 @@ public class AtsTaskEditorRenderer extends AbstractAtsRenderer {
@Override
public int getApplicabilityRating(PresentationType presentationType, IArtifact artifact, Object... objects) throws OseeCoreException {
Artifact aArtifact = artifact.getFullArtifact();
+
+ VariableMap options = new VariableMap();
+ options.setValues(objects);
+
if (aArtifact.isOfType(AtsArtifactTypes.Task) && !aArtifact.isHistorical() && !presentationType.matches(
GENERALIZED_EDIT, PRODUCE_ATTRIBUTE)) {
- return PRESENTATION_SUBTYPE_MATCH;
+ if (Option_TASK_WORLD_EDITOR.equals(options.getString(OPEN_OPTION))) {
+ return SPECIALIZED_KEY_MATCH;
+ } else {
+ return PRESENTATION_SUBTYPE_MATCH;
+ }
}
return NO_MATCH;
}
@Override
public void addMenuCommandDefinitions(ArrayList<MenuCmdDef> commands, Artifact artifact) {
- commands.add(new MenuCmdDef(CommandGroup.EDIT, SPECIALIZED_EDIT, "ATS Task Editor", AtsImage.TASK));
+ commands.add(new MenuCmdDef(CommandGroup.EDIT, SPECIALIZED_EDIT, "ATS Task Editor", AtsImage.TASK, OPEN_OPTION,
+ Option_TASK_WORLD_EDITOR));
}
@Override
@@ -59,4 +71,4 @@ public class AtsTaskEditorRenderer extends AbstractAtsRenderer {
public void open(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
AtsUtil.openInAtsTaskEditor("Tasks", artifacts);
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ExportMetricsOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ExportMetricsOperation.java
deleted file mode 100644
index b76cf974b3c..00000000000
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ExportMetricsOperation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 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.task;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.ats.core.client.task.TaskArtifact;
-import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-public class ExportMetricsOperation extends AbstractOperation {
-
- private final List<? extends Artifact> artifacts;
-
- public ExportMetricsOperation(List<? extends Artifact> artifacts) {
- super("Export Metrics", Activator.PLUGIN_ID);
- this.artifacts = artifacts;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- List<TaskArtifact> taskList = asTask(artifacts);
- for (TaskArtifact task : taskList) {
- System.out.println(task.getName());
- }
- }
-
- private List<TaskArtifact> asTask(List<? extends Artifact> artifacts) {
- List<TaskArtifact> tasks = new ArrayList<>();
- for (Artifact artifact : artifacts) {
- if (artifact instanceof TaskArtifact) {
- tasks.add((TaskArtifact) artifact);
- }
- }
- return tasks;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java
index d106bc9b688..e7a1b8bbf9c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java
@@ -1,38 +1,20 @@
-/*******************************************************************************
- * 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
+/*
+ * Created on Mar 29, 2016
*
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
package org.eclipse.osee.ats.task;
import java.util.Collection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.world.IWorldEditorProvider;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ITaskEditorProvider {
-
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException;
-
- public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException;
-
- public String getName() throws OseeCoreException;
- public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException;
+public interface ITaskEditorProvider extends IWorldEditorProvider {
- public void setCustomizeData(CustomizeData customizeData);
+ Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException;
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions);
+ String getTaskEditorLabel(SearchType searchType);
- public ITaskEditorProvider copyProvider();
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/IXTaskViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/IXTaskViewer.java
index 26da531f177..999ab74062e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/IXTaskViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/IXTaskViewer.java
@@ -10,12 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.ats.task;
-import java.util.Collection;
-import org.eclipse.osee.ats.api.workdef.IStateToken;
-import org.eclipse.osee.ats.core.client.task.TaskArtifact;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
/**
* @author Donald G. Dunne
@@ -24,46 +20,8 @@ public interface IXTaskViewer {
public String getTabName() throws OseeCoreException;
- public Collection<TaskArtifact> getTaskArtifacts(IStateToken state) throws OseeCoreException;
+ public IAtsTeamWorkflow getTeamWf() throws OseeCoreException;
- public Collection<TaskArtifact> getTaskArtifacts() throws OseeCoreException;
-
- public IDirtiableEditor getEditor() throws OseeCoreException;
-
- /**
- * Denotes whether tasks are available to this object. Doesn't imply whether editable, use isTaskEditable().<br>
- * Example: This will show the task tab or not.
- *
- * @return true if view of tasks is allowed
- */
- public boolean isTaskable() throws OseeCoreException;
-
- public String getCurrentStateName() throws OseeCoreException;
-
- public AbstractWorkflowArtifact getAwa() throws OseeCoreException;
-
- /**
- * Overriding flag to denote if tasks are allowed to be edited. If false, task viewer will disable all right-click
- * and alt-left-click editing functionality.
- *
- * @return false if tasks can be created, deleted, edited
- */
- public boolean isTasksEditable() throws OseeCoreException;
-
- @Override
- public String toString();
-
- /**
- * Returning true will allow implementer class to handle the refresh button press which whill result in
- * handlRefreshAction() being called
- *
- * @return if implementer will handle refresh calls
- */
- public boolean isRefreshActionHandled() throws OseeCoreException;
-
- /**
- * Called if isRefreshActionHandled() returns true
- */
- public void handleRefreshAction() throws OseeCoreException;
+ public boolean isTasksEditable();
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
index da1d093b8cb..f6c504aebd2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
@@ -1,64 +1,32 @@
-/*******************************************************************************
- * 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
+/*
+ * Created on Mar 30, 2016
*
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
package org.eclipse.osee.ats.task;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction.IOpenNewAtsTaskEditorHandler;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected.IOpenNewAtsTaskEditorSelectedHandler;
-import org.eclipse.osee.ats.actions.TaskAddAction.ITaskAddActionHandler;
+import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
-import org.eclipse.osee.ats.api.task.JaxAtsTask;
-import org.eclipse.osee.ats.api.task.JaxAtsTaskFactory;
-import org.eclipse.osee.ats.api.task.NewTaskData;
-import org.eclipse.osee.ats.api.task.NewTaskDataFactory;
-import org.eclipse.osee.ats.api.task.NewTaskDatas;
-import org.eclipse.osee.ats.column.RelatedToStateColumn;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.task.TaskMover;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.core.client.util.AtsTaskCache;
import org.eclipse.osee.ats.editor.SMAEditor;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
-import org.eclipse.osee.ats.world.IWorldViewerEventHandler;
-import org.eclipse.osee.ats.world.WorldContentProvider;
-import org.eclipse.osee.ats.world.WorldLabelProvider;
+import org.eclipse.osee.ats.world.IWorldEditor;
+import org.eclipse.osee.ats.world.WorldComposite;
import org.eclipse.osee.ats.world.WorldXViewer;
-import org.eclipse.osee.ats.world.WorldXViewerEventManager;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction.IRefreshActionHandler;
import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryComboDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSource;
@@ -70,147 +38,35 @@ import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Tree;
-/**
- * @author Donald G. Dunne
- */
-public class TaskComposite extends Composite implements IWorldViewerEventHandler, IOpenNewAtsTaskEditorSelectedHandler, ITaskAddActionHandler, IOpenNewAtsTaskEditorHandler, IRefreshActionHandler {
+public class TaskComposite extends WorldComposite {
- private TaskXViewer taskXViewer;
private final IXTaskViewer iXTaskViewer;
- protected Label showReleaseMetricsLabel;
- private final Set<TaskArtifact> taskArts = new HashSet<>(200);
+ private TaskXViewer taskXViewer;
+ private final IDirtiableEditor dirtiableEditor;
+ boolean tasksEditable;
+ private final IAtsTeamWorkflow teamWf;
- public TaskComposite(IXTaskViewer iXTaskViewer, Composite parent, int style) {
- super(parent, style);
+ public TaskComposite(IXTaskViewer iXTaskViewer, IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style, IDirtiableEditor dirtiableEditor, boolean tasksEditable, IAtsTeamWorkflow teamWf) {
+ super(worldEditor, xViewerFactory, parent, style, false);
this.iXTaskViewer = iXTaskViewer;
-
- setLayout(ALayout.getZeroMarginLayout(1, true));
- setLayoutData(new GridData(GridData.FILL_BOTH));
-
- try {
- if (DbConnectionExceptionComposite.dbConnectionIsOk(this)) {
-
- showReleaseMetricsLabel = new Label(this, SWT.NONE);
- showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- taskXViewer = new TaskXViewer(this, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, iXTaskViewer.getEditor());
- taskXViewer.setTasksEditable(iXTaskViewer.isTasksEditable());
- taskXViewer.setNewTaskSelectionEnabled(iXTaskViewer.isTasksEditable());
- taskXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- taskXViewer.setContentProvider(new WorldContentProvider(taskXViewer));
- taskXViewer.setLabelProvider(new WorldLabelProvider(taskXViewer));
-
- Tree tree = taskXViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
- gridData.heightHint = 100;
- gridData.widthHint = 100;
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- setupDragAndDropSupport();
- parent.layout();
-
- WorldXViewerEventManager.add(this);
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void disposeComposite() {
- if (taskXViewer != null && !taskXViewer.getTree().isDisposed()) {
- taskXViewer.dispose();
- }
- WorldXViewerEventManager.remove(this);
- }
-
- public IXTaskViewer getIXTaskViewer() {
- return iXTaskViewer;
- }
-
- private void add(Collection<TaskArtifact> newTasks) {
- this.taskArts.addAll(newTasks);
- if (Widgets.isAccessible(getTaskXViewer().getControl())) {
- if (getTaskXViewer().getInput() != this.taskArts) {
- getTaskXViewer().setInputXViewer(this.taskArts);
- }
- Displays.ensureInDisplayThread(new Runnable() {
-
- @Override
- public void run() {
- taskXViewer.refresh(taskXViewer.getInput());
- }
- });
- }
- }
-
- public void loadTable() throws OseeCoreException {
- this.taskArts.clear();
- Displays.ensureInDisplayThread(new Runnable() {
-
- @Override
- public void run() {
- add(iXTaskViewer.getTaskArtifacts());
- }
- });
- }
-
- public TaskArtifact handleNewTask() {
- TaskArtifact taskArt = null;
- try {
- EntryComboDialog ed = new EntryComboDialog("Create New Task", "Enter Task Title",
- RelatedToStateColumn.RELATED_TO_STATE_SELECTION);
- List<String> validStates =
- RelatedToStateColumn.getValidInWorkStates((TeamWorkFlowArtifact) iXTaskViewer.getAwa());
- ed.setOptions(validStates);
- if (ed.open() == 0) {
- NewTaskData newTaskData = NewTaskDataFactory.get("Create New Task",
- AtsClientService.get().getUserService().getCurrentUser().getUserId(), iXTaskViewer.getAwa().getUuid());
- JaxAtsTask task = JaxAtsTaskFactory.get(newTaskData, ed.getEntry(),
- AtsClientService.get().getUserService().getCurrentUser(), new Date());
- if (Strings.isValid(ed.getSelection())) {
- task.setRelatedToState(ed.getSelection());
- }
- AtsClientService.get().getTaskService().createTasks(new NewTaskDatas(newTaskData));
-
- taskArt = (TaskArtifact) AtsClientService.get().getArtifact(task.getUuid());
- AtsTaskCache.decache((TeamWorkFlowArtifact) iXTaskViewer.getAwa());
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return taskArt;
- }
-
- public List<TaskArtifact> getSelectedTaskArtifactItems() {
- Iterator<?> i = ((IStructuredSelection) taskXViewer.getSelection()).iterator();
- ArrayList<TaskArtifact> items = new ArrayList<>();
- while (i.hasNext()) {
- Object obj = i.next();
- if (Artifacts.isOfType(obj, AtsArtifactTypes.Task)) {
- items.add((TaskArtifact) obj);
- }
- }
- return items;
+ this.dirtiableEditor = dirtiableEditor;
+ this.tasksEditable = tasksEditable;
+ this.teamWf = teamWf;
}
- public TaskXViewer getTaskXViewer() {
+ @Override
+ protected WorldXViewer createXViewer(IXViewerFactory xViewerFactory, Composite mainComp) {
+ taskXViewer = new TaskXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, xViewerFactory,
+ dirtiableEditor, teamWf);
+ taskXViewer.setTasksEditable(tasksEditable);
+ taskXViewer.setNewTaskSelectionEnabled(tasksEditable);
return taskXViewer;
}
@Override
- public Object getData() {
- return taskXViewer.getInput();
- }
-
- private void setupDragAndDropSupport() {
+ protected void setupDragAndDropSupport(boolean createDragAndDrop) {
DragSource source = new DragSource(taskXViewer.getTree(), DND.DROP_COPY);
source.setTransfer(new Transfer[] {ArtifactTransfer.getInstance()});
source.addDragListener(new DragSourceListener() {
@@ -259,7 +115,7 @@ public class TaskComposite extends Composite implements IWorldViewerEventHandler
private void performDrop(DropTargetEvent e) {
if (e.data instanceof ArtifactData) {
try {
- if (iXTaskViewer.getAwa() == null) {
+ if (iXTaskViewer.getTeamWf() == null) {
return;
}
List<TaskArtifact> taskArts = new LinkedList<>();
@@ -272,8 +128,8 @@ public class TaskComposite extends Composite implements IWorldViewerEventHandler
AWorkbench.popup("No Tasks To Drop");
return;
}
- TaskMover mover = new TaskMover(AtsClientService.get().getWorkDefinitionAdmin(),
- (TeamWorkFlowArtifact) iXTaskViewer.getAwa(), taskArts);
+ TaskMover mover =
+ new TaskMover(AtsClientService.get().getWorkDefinitionAdmin(), iXTaskViewer.getTeamWf(), taskArts);
mover.moveTasks();
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
@@ -281,67 +137,21 @@ public class TaskComposite extends Composite implements IWorldViewerEventHandler
}
}
- public String getActionDescription() {
- return null;
- }
-
@Override
- public void refreshActionHandler() {
- try {
- if (iXTaskViewer.isRefreshActionHandled()) {
- iXTaskViewer.handleRefreshAction();
- } else {
- loadTable();
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public CustomizeData getCustomizeDataCopy() {
- return taskXViewer.getCustomizeMgr().generateCustDataFromTable();
- }
-
- @Override
- public ITaskEditorProvider getTaskEditorProviderCopy() throws OseeCoreException {
- return ((TaskEditorInput) ((TaskEditor) iXTaskViewer.getEditor()).getEditorInput()).getItaskEditorProvider().copyProvider();
- }
-
- @Override
- public List<? extends Artifact> getSelectedArtifacts() {
- return getSelectedTaskArtifactItems();
+ public WorldXViewer getXViewer() {
+ return taskXViewer;
}
- @Override
- public void taskAddActionHandler() {
- handleNewTask();
+ public IXTaskViewer getIXTaskViewer() {
+ return iXTaskViewer;
}
- @Override
- public WorldXViewer getWorldXViewer() {
+ public TaskXViewer getTaskXViewer() {
return taskXViewer;
}
- @Override
- public void removeItems(Collection<? extends Object> objects) {
- taskArts.removeAll(objects);
+ public TeamWorkFlowArtifact getTeamArt() {
+ return (TeamWorkFlowArtifact) teamWf.getStoreObject();
}
- @Override
- public void relationsModifed(Collection<Artifact> relModifiedArts, Collection<Artifact> goalMemberReordered, Collection<Artifact> sprintMemberReordered) {
- try {
- loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- public void onTasksDeleted() {
- try {
- AtsTaskCache.decache((TeamWorkFlowArtifact) iXTaskViewer.getAwa());
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.WARNING, ex);
- }
- }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java
index cd5264acc2b..113a51f2a89 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java
@@ -1,356 +1,77 @@
-/*******************************************************************************
- * 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
+/*
+ * Created on Mar 29, 2016
*
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
package org.eclipse.osee.ats.task;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.logging.Level;
-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.ISelectionProvider;
-import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
-import org.eclipse.osee.ats.api.version.IAtsVersion;
-import org.eclipse.osee.ats.api.workdef.IStateToken;
-import org.eclipse.osee.ats.core.client.task.TaskArtifact;
-import org.eclipse.osee.ats.core.client.util.AtsChangeSet;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.ats.core.util.AtsUtilCore;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.ats.internal.AtsClientService;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.AtsMetricsComposite;
-import org.eclipse.osee.ats.world.IAtsMetricsProvider;
import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
+import org.eclipse.osee.ats.world.WorldEditorInput;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.OseeStatusContributionItemFactory;
-import org.eclipse.osee.framework.ui.skynet.artifact.editor.AbstractArtifactEditor;
-import org.eclipse.osee.framework.ui.swt.CursorManager;
import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditor extends AbstractArtifactEditor implements IAtsMetricsProvider, IXTaskViewer {
+public class TaskEditor extends WorldEditor implements IXTaskViewer {
+
public static final String EDITOR_ID = "org.eclipse.osee.ats.editor.TaskEditor";
- private int mainPageIndex, metricsPageIndex;
- private TaskEditorXWidgetActionPage taskActionPage;
- private final Collection<TaskArtifact> tasks = new CopyOnWriteArraySet<>();
- private boolean loading = false;
- public final static int TITLE_MAX_LENGTH = WorldEditor.TITLE_MAX_LENGTH;
+ boolean loading = false;
@Override
- public void doSave(IProgressMonitor monitor) {
- try {
- AtsChangeSet changes = new AtsChangeSet("Task Editor Save");
- for (TaskArtifact taskArt : tasks) {
- changes.add(taskArt);
- }
- changes.execute();
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- onDirtied();
- }
-
- public List<Artifact> getLoadedArtifacts() {
- return taskActionPage.getTaskComposite().getTaskXViewer().getLoadedArtifacts();
+ public String getTabName() throws OseeCoreException {
+ return "Tasks";
}
@Override
- public boolean isSaveOnCloseNeeded() {
- return isDirty();
+ public IAtsTeamWorkflow getTeamWf() throws OseeCoreException {
+ return null;
}
- public static Collection<TaskEditor> getEditors() {
- final List<TaskEditor> editors = new ArrayList<>();
- Displays.pendInDisplayThread(new Runnable() {
+ public static void open(final ITaskEditorProvider provider) {
+ Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
- for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
- editors.add((TaskEditor) editor.getEditor(false));
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ try {
+ page.openEditor(new WorldEditorInput(provider), EDITOR_ID);
+ } catch (PartInitException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
}
});
- return editors;
}
- public static void closeAll() {
- Displays.ensureInDisplayThread(new Runnable() {
+ public static Collection<WorldEditor> getEditors() {
+ final List<WorldEditor> editors = new ArrayList<>();
+ Displays.pendInDisplayThread(new Runnable() {
@Override
public void run() {
for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
- AWorkbench.getActivePage().closeEditor(editor.getEditor(false), false);
+ editors.add((WorldEditor) editor.getEditor(false));
}
}
});
+ return editors;
}
- public void setTableTitle(final String title, final boolean warning) {
- taskActionPage.setTableTitle(title, warning);
- }
-
- @Override
- public void dispose() {
- for (TaskArtifact taskArt : tasks) {
- if (taskArt != null && !taskArt.isDeleted() && taskArt.isSMAEditorDirty().isTrue()) {
- taskArt.revertSMA();
- }
- }
- if (taskActionPage != null && taskActionPage.getTaskComposite() != null) {
- taskActionPage.getTaskComposite().disposeComposite();
- }
- super.dispose();
- }
-
- @Override
- public boolean isDirty() {
- for (TaskArtifact taskArt : tasks) {
- if (taskArt.isDeleted()) {
- continue;
- } else if (taskArt.isSMAEditorDirty().isTrue()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "TaskEditor";
- }
-
- /**
- * @return the taskActionPage
- */
- public TaskEditorXWidgetActionPage getTaskActionPage() {
- return taskActionPage;
- }
-
- @Override
- protected void addPages() {
-
- try {
- OseeStatusContributionItemFactory.addTo(this, true);
-
- IEditorInput editorInput = getEditorInput();
- if (!(editorInput instanceof TaskEditorInput)) {
- throw new OseeArgumentException("Editor Input not TaskEditorInput");
- }
-
- createMainTab();
- createMetricsTab();
-
- setActivePage(mainPageIndex);
- loadTable();
-
- getSite().setSelectionProvider(getTaskActionPage().getTaskComposite().getTaskXViewer());
-
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- } catch (PartInitException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- private void createMainTab() throws PartInitException {
- taskActionPage = new TaskEditorXWidgetActionPage(this);
- mainPageIndex = addPage(taskActionPage);
- }
-
- private void createMetricsTab() {
- Composite comp = AtsUtil.createCommonPageComposite(getContainer());
- AtsUtil.createCommonToolBar(comp);
- new AtsMetricsComposite(this, comp, SWT.NONE);
- metricsPageIndex = addPage(comp);
- setPageText(metricsPageIndex, "Metrics");
- }
-
- public ITaskEditorProvider getTaskEditorProvider() {
- TaskEditorInput aei = (TaskEditorInput) getEditorInput();
- return aei.getItaskEditorProvider();
- }
-
- private void loadTable() throws OseeCoreException {
- ITaskEditorProvider provider = getTaskEditorProvider();
- setPartName(provider.getTaskEditorLabel(SearchType.Search));
-
- if (loading) {
- AWorkbench.popup("Already Loading, Please Wait");
- return;
- }
- LoadTableJob job = null;
- job = new LoadTableJob(provider, SearchType.ReSearch, this);
- job.setUser(false);
- job.setPriority(Job.LONG);
- job.schedule();
- if (provider.getTableLoadOptions() != null && provider.getTableLoadOptions().contains(
- TableLoadOption.ForcePend)) {
- try {
- job.join();
- } catch (InterruptedException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- }
-
- @Override
- public void onDirtied() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- firePropertyChange(PROP_DIRTY);
- }
- });
- }
-
- public static void open(final ITaskEditorProvider provider) throws OseeCoreException {
+ public static void closeAll() {
Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
- IWorkbenchPage page = AWorkbench.getActivePage();
- try {
- page.openEditor(new TaskEditorInput(provider), EDITOR_ID);
- } catch (PartInitException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }, provider.getTableLoadOptions() != null && provider.getTableLoadOptions().contains(TableLoadOption.ForcePend));
- }
-
- private static class LoadTableJob extends Job {
-
- private final ITaskEditorProvider itaskEditorProvider;
- private final TaskEditor taskEditor;
- private final SearchType searchType;
-
- public LoadTableJob(ITaskEditorProvider itaskEditorProvider, SearchType searchType, TaskEditor taskEditor) throws OseeCoreException {
- super("Loading \"" + itaskEditorProvider.getTaskEditorLabel(searchType) + "\"");
- this.searchType = searchType;
- this.taskEditor = taskEditor;
- taskEditor.setPartName(itaskEditorProvider.getTaskEditorLabel(searchType));
- taskEditor.setTableTitle("Loading \"" + itaskEditorProvider.getTaskEditorLabel(searchType) + "\"", false);
- this.itaskEditorProvider = itaskEditorProvider;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (taskEditor.isLoading()) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Already Loading, Please Wait", null);
- }
- try {
- taskEditor.setLoading(true);
- taskEditor.getTaskActionPage().getTaskComposite().getTaskXViewer().clear(true);
- final List<TaskArtifact> taskArts = new ArrayList<>();
- for (Artifact artifact : itaskEditorProvider.getTaskEditorTaskArtifacts()) {
- if (artifact.isOfType(AtsArtifactTypes.Task)) {
- taskArts.add((TaskArtifact) artifact);
- }
+ for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
+ AWorkbench.getActivePage().closeEditor(editor.getEditor(false), false);
}
- taskEditor.tasks.clear();
- taskEditor.tasks.addAll(taskArts);
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- taskEditor.setPartName(itaskEditorProvider.getTaskEditorLabel(searchType));
- if (taskArts.isEmpty()) {
- taskEditor.setTableTitle(
- "No Results Found - " + itaskEditorProvider.getTaskEditorLabel(searchType), true);
- } else {
- taskEditor.setTableTitle(itaskEditorProvider.getTaskEditorLabel(searchType), false);
- }
- taskEditor.getTaskActionPage().getTaskComposite().loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- });
- } catch (final Exception ex) {
- monitor.done();
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Can't load tasks", ex);
- } finally {
- taskEditor.setLoading(false);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- }
-
- @Override
- public Collection<? extends Artifact> getMetricsWorkItems() {
- return tasks;
- }
-
- @Override
- public IAtsVersion getMetricsVersion() throws OseeCoreException {
- for (TaskArtifact taskArt : tasks) {
- if (AtsClientService.get().getVersionService().hasTargetedVersion(taskArt)) {
- return AtsClientService.get().getVersionService().getTargetedVersion(taskArt);
}
- }
- return null;
- }
-
- @Override
- public String getCurrentStateName() {
- return "";
- }
-
- @Override
- public IDirtiableEditor getEditor() {
- return this;
- }
-
- @Override
- public AbstractWorkflowArtifact getAwa() {
- return null;
- }
-
- @Override
- public String getTabName() {
- return "Tasks";
- }
-
- @Override
- public Collection<TaskArtifact> getTaskArtifacts(IStateToken state) {
- return tasks;
- }
-
- @Override
- public Collection<TaskArtifact> getTaskArtifacts() {
- return tasks;
- }
-
- @Override
- public boolean isTaskable() {
- return false;
+ });
}
@Override
@@ -358,57 +79,4 @@ public class TaskEditor extends AbstractArtifactEditor implements IAtsMetricsPro
return true;
}
- @Override
- public boolean isRefreshActionHandled() {
- return true;
- }
-
- @Override
- public void handleRefreshAction() throws OseeCoreException {
- loadTable();
- }
-
- @Override
- public double getManHoursPerDayPreference() throws OseeCoreException {
- if (tasks.isEmpty()) {
- return AtsUtilCore.DEFAULT_HOURS_PER_WORK_DAY;
- }
- return tasks.iterator().next().getManHrsPerDayPreference();
- }
-
- public boolean isLoading() {
- return loading;
- }
-
- public void setLoading(final boolean loading) {
- this.loading = loading;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(taskActionPage.getTaskComposite())) {
- if (loading) {
- taskActionPage.getTaskComposite().setCursor(CursorManager.getCursor(SWT.CURSOR_WAIT));
- } else {
- taskActionPage.getTaskComposite().setCursor(null);
- }
- }
- }
- });
- }
-
- @Override
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- if (newPageIndex != -1 && pages.size() > newPageIndex) {
- Object page = pages.get(newPageIndex);
- if (page != null) {
- ISelectionProvider provider = taskActionPage.getTaskComposite().getTaskXViewer();
- String title = getPageText(newPageIndex);
- if (title.equalsIgnoreCase("metrics")) {
- provider = null;
- }
- getSite().setSelectionProvider(provider);
- }
- }
- }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java
deleted file mode 100644
index 1086e2795e5..00000000000
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java
+++ /dev/null
@@ -1,90 +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.task;
-
-import java.util.logging.Level;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditorInput implements IEditorInput {
-
- private final ITaskEditorProvider itaskEditorProvider;
-
- @Override
- public int hashCode() {
- return itaskEditorProvider.hashCode();
- }
-
- public ITaskEditorProvider getItaskEditorProvider() {
- return itaskEditorProvider;
- }
-
- public TaskEditorInput(ITaskEditorProvider itaskEditorProvider) {
- this.itaskEditorProvider = itaskEditorProvider;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof TaskEditorInput)) {
- return false;
- }
- TaskEditorInput castObj = (TaskEditorInput) obj;
- return castObj.itaskEditorProvider.equals(this.itaskEditorProvider);
- }
-
- @Override
- public boolean exists() {
- return false;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- @Override
- public String getToolTipText() {
- try {
- return itaskEditorProvider.getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- return "Exception getting name: " + ex.getLocalizedMessage();
- }
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public String getName() {
- try {
- return itaskEditorProvider.getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- return "Exception getting name: " + ex.getLocalizedMessage();
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java
index ad5c2fb5013..3527f20293c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java
@@ -10,50 +10,19 @@
*******************************************************************************/
package org.eclipse.osee.ats.task;
-import java.util.Collection;
import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.ats.world.WorldEditorProvider;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
/**
* @author Donald G. Dunne
*/
-public abstract class TaskEditorProvider implements ITaskEditorProvider {
-
- protected TableLoadOption[] tableLoadOptions;
- protected CustomizeData customizeData;
+public abstract class TaskEditorProvider extends WorldEditorProvider implements ITaskEditorProvider {
public TaskEditorProvider(CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
+ super(customizeData, tableLoadOptions);
this.customizeData = customizeData;
this.tableLoadOptions = tableLoadOptions;
}
- /**
- * @return the customizeData
- */
- public CustomizeData getCustomizeData() {
- return customizeData;
- }
-
- @Override
- public Collection<TableLoadOption> getTableLoadOptions() {
- return Collections.getAggregate(tableLoadOptions);
- }
-
- /**
- * @param tableLoadOptions the tableLoadOptions to set
- */
- @Override
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
- this.tableLoadOptions = tableLoadOptions;
- }
-
- /**
- * @param customizeData the customizeData to set
- */
- @Override
- public void setCustomizeData(CustomizeData customizeData) {
- this.customizeData = customizeData;
- }
-
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java
index 89528c69e42..7b5aa57586b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java
@@ -12,8 +12,9 @@ package org.eclipse.osee.ats.task;
import java.util.Collection;
import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
@@ -23,36 +24,51 @@ import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLo
public class TaskEditorSimpleProvider extends TaskEditorProvider {
private final String name;
- private final Collection<? extends Artifact> artifacts;
+ private final Collection<Artifact> artifacts;
- public TaskEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts) {
+ public TaskEditorSimpleProvider(String name, Collection<Artifact> artifacts) {
this(name, artifacts, null, TableLoadOption.None);
}
- public TaskEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts, CustomizeData customizeData, TableLoadOption... tableLoadOption) {
+ public TaskEditorSimpleProvider(String name, Collection<Artifact> artifacts, CustomizeData customizeData, TableLoadOption... tableLoadOption) {
super(customizeData, tableLoadOption);
this.name = name;
this.artifacts = artifacts;
}
@Override
- public String getTaskEditorLabel(SearchType searchType) {
- return Strings.truncate(name, TaskEditor.TITLE_MAX_LENGTH, true);
+ public String getName() {
+ return name;
}
@Override
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() {
- return artifacts;
+ public ITaskEditorProvider copyProvider() {
+ return new TaskEditorSimpleProvider(name, artifacts, customizeData, tableLoadOptions);
}
@Override
- public String getName() {
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
return name;
}
@Override
- public ITaskEditorProvider copyProvider() {
- return new TaskEditorSimpleProvider(name, artifacts, customizeData, tableLoadOptions);
+ public IAtsVersion getTargetedVersionArtifact() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public Collection<Artifact> performSearch(SearchType searchType) {
+ return artifacts;
+ }
+
+ @Override
+ public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
+ return artifacts;
+ }
+
+ @Override
+ public String getTaskEditorLabel(SearchType searchType) {
+ return "Tasks";
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java
deleted file mode 100644
index 5bbdf360c54..00000000000
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java
+++ /dev/null
@@ -1,374 +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.task;
-
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.actions.ImportListener;
-import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
-import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
-import org.eclipse.osee.ats.actions.NewAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
-import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.export.AtsExportAction;
-import org.eclipse.osee.ats.help.ui.AtsHelpContext;
-import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.ats.util.WorkflowMetrics;
-import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage;
-import org.eclipse.osee.ats.world.WorldAssigneeFilter;
-import org.eclipse.osee.ats.world.WorldCompletedFilter;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.core.util.Result;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionUtility;
-import org.eclipse.osee.framework.ui.skynet.widgets.util.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditorXWidgetActionPage extends AtsXWidgetActionFormPage {
-
- private final TaskEditor taskEditor;
- private TaskComposite taskComposite;
- private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
- private WorldAssigneeFilter worldAssigneeFilter = null;
- private Action filterCompletedAction, filterMyAssigneeAction, selectionMetricsAction, exportMetricsReportAction;
-
- public TaskEditorXWidgetActionPage(TaskEditor taskEditor) {
- super(taskEditor, "org.eclipse.osee.ats.actionPage", "Actions");
- this.taskEditor = taskEditor;
- }
-
- @Override
- public Section createResultsSection(Composite body) {
- resultsSection = toolkit.createSection(body, ExpandableComposite.NO_TITLE);
- resultsSection.setText("Results");
- resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- resultsContainer = toolkit.createClientContainer(resultsSection, 1);
- taskComposite = new TaskComposite(taskEditor, resultsContainer, SWT.BORDER);
- HelpUtil.setHelp(taskComposite, AtsHelpContext.WORKFLOW_EDITOR__TASK_TAB);
- return resultsSection;
- }
-
- public TaskComposite getTaskComposite() {
- return taskComposite;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- scrolledForm.setImage(ImageManager.getImage(AtsImage.TASK));
-
- Result result = DbConnectionUtility.areOSEEServicesAvailable();
- if (result.isFalse()) {
- AWorkbench.popup("ERROR", "DB Relation Unavailable");
- return;
- }
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
- return null;
- }
-
- @Override
- public Result isResearchSearchValid() {
- return taskEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
- }
-
- public void reSearch() throws OseeCoreException {
- Result result = isResearchSearchValid();
- if (result.isFalse()) {
- AWorkbench.popup(result);
- return;
- }
- taskEditor.handleRefreshAction();
- }
-
- @Override
- public String getXWidgetsXml() throws OseeCoreException {
- return null;
- }
-
- @Override
- public void handleSearchButtonPressed() {
- try {
- reSearch();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- protected void createToolBar(IToolBarManager toolBarManager) {
- super.createToolBar(toolBarManager);
-
- toolBarManager.add(taskComposite.getTaskXViewer().getCustomizeAction());
- toolBarManager.add(new Separator());
- toolBarManager.add(new OpenNewAtsTaskEditorAction(taskComposite));
- toolBarManager.add(new OpenNewAtsTaskEditorSelected(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new RefreshAction(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new NewAction());
- toolBarManager.add(new Separator());
- createDropDownMenuActions();
- toolBarManager.add(new DropDownAction());
- }
- public class DropDownAction extends Action implements IMenuCreator {
- private Menu fMenu;
-
- public DropDownAction() {
- setText("Other");
- setMenuCreator(this);
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
- addKeyListener();
- addSelectionListener();
- }
-
- @Override
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu = new Menu(parent);
- addActionToMenu(fMenu, selectionMetricsAction);
- addActionToMenu(fMenu, filterCompletedAction);
- addActionToMenu(fMenu, filterMyAssigneeAction);
- new MenuItem(fMenu, SWT.SEPARATOR);
- addActionToMenu(fMenu, exportMetricsReportAction);
- addActionToMenu(fMenu, new AtsExportAction(taskComposite.getTaskXViewer()));
- try {
- if (taskComposite.getIXTaskViewer().isTasksEditable()) {
- addActionToMenu(fMenu, new ImportTasksViaSpreadsheet(
- (TeamWorkFlowArtifact) taskComposite.getIXTaskViewer().getAwa(), new ImportListener() {
- @Override
- public void importCompleted() {
- try {
- taskComposite.loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }));
- addActionToMenu(fMenu, new ImportTasksViaSimpleList(
- (TeamWorkFlowArtifact) taskComposite.getIXTaskViewer().getAwa(), new ImportListener() {
- @Override
- public void importCompleted() {
- try {
- taskComposite.loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }));
-
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- return fMenu;
- }
-
- @Override
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu = null;
- }
- }
-
- @Override
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- void clear() {
- dispose();
- }
-
- private void addKeyListener() {
- taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
- @Override
- public void keyPressed(KeyEvent event) {
- // do nothing
- }
-
- @Override
- public void keyReleased(KeyEvent event) {
- if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
- if (event.keyCode == 'a') {
- taskComposite.getTaskXViewer().getTree().setSelection(
- taskComposite.getTaskXViewer().getTree().getItems());
- } else if (event.keyCode == 'x') {
- selectionMetricsAction.setChecked(!selectionMetricsAction.isChecked());
- selectionMetricsAction.run();
- } else if (event.keyCode == 'f') {
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- } else if (event.keyCode == 'g') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterMyAssigneeAction.run();
- } else if (event.keyCode == 'd') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- filterMyAssigneeAction.run();
- }
- }
- }
- });
- }
-
- private void addSelectionListener() {
- taskComposite.getTaskXViewer().getTree().addSelectionListener(new SelectionListener() {
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectionMetricsAction != null) {
- if (selectionMetricsAction.isChecked()) {
- selectionMetricsAction.run();
- } else {
- if (taskComposite != null) {
- taskComposite.showReleaseMetricsLabel.setText("");
- }
- }
- }
- }
- });
- }
- }
-
- public void updateExtraInfoLine() throws OseeCoreException {
- if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
- if (taskComposite.getTaskXViewer() != null && taskComposite.getTaskXViewer().getSelectedSMAArtifacts() != null && !taskComposite.getTaskXViewer().getSelectedSMAArtifacts().isEmpty()) {
- taskComposite.showReleaseMetricsLabel.setText(
- WorkflowMetrics.getEstRemainMetrics(taskComposite.getTaskXViewer().getSelectedSMAArtifacts(), null,
- taskComposite.getTaskXViewer().getSelectedSMAArtifacts().iterator().next().getManHrsPerDayPreference(),
- null));
- } else {
- taskComposite.showReleaseMetricsLabel.setText("");
- }
- }
- taskComposite.showReleaseMetricsLabel.getParent().layout();
- }
-
- public void updateExtendedStatusString() {
- taskComposite.getTaskXViewer().setExtendedStatusString(
- //
- (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
- //
- (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
- }
-
- protected void createDropDownMenuActions() {
- try {
- worldAssigneeFilter = new WorldAssigneeFilter();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", IAction.AS_CHECK_BOX) {
- @Override
- public void run() {
- try {
- updateExtraInfoLine();
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
- selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
- selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
-
- filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", IAction.AS_CHECK_BOX) {
- @Override
- public void run() {
- if (filterCompletedAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
- filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
-
- filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", IAction.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterMyAssigneeAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
- filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
-
- exportMetricsReportAction = new Action("Export Metrics Report", IAction.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- List<? extends Artifact> selected = taskComposite.getSelectedArtifacts();
- Operations.executeAsJob(new ExportMetricsOperation(selected), true);
- }
- };
- exportMetricsReportAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EXPORT_DATA));
-
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java
deleted file mode 100644
index e912a7b2cb9..00000000000
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java
+++ /dev/null
@@ -1,315 +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.task;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.osee.ats.actions.DeleteTasksAction;
-import org.eclipse.osee.ats.actions.DeleteTasksAction.TaskArtifactProvider;
-import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
-import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
-import org.eclipse.osee.ats.actions.NewAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
-import org.eclipse.osee.ats.actions.TaskAddAction;
-import org.eclipse.osee.ats.core.client.task.TaskArtifact;
-import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.export.AtsExportAction;
-import org.eclipse.osee.ats.help.ui.AtsHelpContext;
-import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage;
-import org.eclipse.osee.ats.world.WorldAssigneeFilter;
-import org.eclipse.osee.ats.world.WorldCompletedFilter;
-import org.eclipse.osee.framework.core.util.Result;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionUtility;
-import org.eclipse.osee.framework.ui.skynet.widgets.util.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskTabXWidgetActionPage extends AtsXWidgetActionFormPage {
-
- private final SMAEditor smaEditor;
- private TaskComposite taskComposite;
- private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
- private WorldAssigneeFilter worldAssigneeFilter = null;
- private Action filterCompletedAction, filterMyAssigneeAction;
-
- public TaskTabXWidgetActionPage(SMAEditor smaEditor) {
- super(smaEditor, "org.eclipse.osee.ats.actionPage", getTabName(smaEditor.getAwa()));
- this.smaEditor = smaEditor;
- }
-
- @Override
- public Section createResultsSection(Composite body) throws OseeCoreException {
- resultsSection = toolkit.createSection(body, ExpandableComposite.NO_TITLE);
- resultsSection.setText("Results");
- resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- resultsContainer = toolkit.createClientContainer(resultsSection, 1);
- taskComposite = new TaskComposite(smaEditor, resultsContainer, SWT.BORDER);
- HelpUtil.setHelp(taskComposite, AtsHelpContext.WORKFLOW_EDITOR__TASK_TAB);
- taskComposite.loadTable();
- return resultsSection;
- }
-
- public TaskComposite getTaskComposite() {
- return taskComposite;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- scrolledForm.setImage(ArtifactImageManager.getImage(smaEditor.getAwa()));
- String title = smaEditor.getAwa().getName();
- if (title.length() > 80) {
- title = title.substring(0, 80 - 1) + "...";
- }
- scrolledForm.setText(String.format("Tasks for \"%s\"", title));
-
- Result result = DbConnectionUtility.areOSEEServicesAvailable();
- if (result.isFalse()) {
- AWorkbench.popup("ERROR", "DB Relation Unavailable");
- return;
- }
- }
-
- private static String getTabName(AbstractWorkflowArtifact awa) {
- try {
- if (awa instanceof TeamWorkFlowArtifact) {
- return String.format("Tasks (%d)", ((TeamWorkFlowArtifact) awa).getTaskArtifacts().size());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return "Tasks";
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
- return null;
- }
-
- @Override
- public Result isResearchSearchValid() {
- return smaEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
- }
-
- @Override
- public String getXWidgetsXml() {
- return null;
- }
-
- @Override
- public void handleSearchButtonPressed() {
- // do nothing
- }
-
- @Override
- protected void createToolBar(IToolBarManager toolBarManager) {
- super.createToolBar(toolBarManager);
-
- try {
- if (taskComposite.getIXTaskViewer().isTasksEditable()) {
- toolBarManager.add(new TaskAddAction(taskComposite));
- TaskArtifactProvider taskProvider = new TaskArtifactProvider() {
-
- @Override
- public List<TaskArtifact> getSelectedArtifacts() {
- return taskComposite.getSelectedTaskArtifactItems();
- }
- };
- toolBarManager.add(new DeleteTasksAction(taskProvider));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- toolBarManager.add(new Separator());
- toolBarManager.add(taskComposite.getTaskXViewer().getCustomizeAction());
- toolBarManager.add(new Separator());
- toolBarManager.add(new OpenNewAtsTaskEditorAction(taskComposite));
- toolBarManager.add(new OpenNewAtsTaskEditorSelected(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new RefreshAction(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new NewAction());
- toolBarManager.add(new Separator());
- createDropDownMenuActions();
- toolBarManager.add(new DropDownAction());
-
- }
-
- public class DropDownAction extends Action implements IMenuCreator {
- private Menu fMenu;
-
- public DropDownAction() {
- setText("Other");
- setMenuCreator(this);
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
- addKeyListener();
- }
-
- @Override
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu = new Menu(parent);
-
- addActionToMenu(fMenu, filterCompletedAction);
- addActionToMenu(fMenu, filterMyAssigneeAction);
- new MenuItem(fMenu, SWT.SEPARATOR);
- addActionToMenu(fMenu, new AtsExportAction(taskComposite.getTaskXViewer()));
- try {
- if (taskComposite.getIXTaskViewer().isTasksEditable()) {
- addActionToMenu(fMenu,
- new ImportTasksViaSpreadsheet((TeamWorkFlowArtifact) taskComposite.getIXTaskViewer().getAwa(), null));
- addActionToMenu(fMenu,
- new ImportTasksViaSimpleList((TeamWorkFlowArtifact) taskComposite.getIXTaskViewer().getAwa(), null));
-
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- return fMenu;
- }
-
- @Override
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu = null;
- }
- }
-
- @Override
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- void clear() {
- dispose();
- }
-
- private void addKeyListener() {
- taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
- @Override
- public void keyPressed(KeyEvent event) {
- // do nothing
- }
-
- @Override
- public void keyReleased(KeyEvent event) {
- if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
- if (event.keyCode == 'a') {
- taskComposite.getTaskXViewer().getTree().setSelection(
- taskComposite.getTaskXViewer().getTree().getItems());
- } else if (event.keyCode == 'f') {
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- } else if (event.keyCode == 'g') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterMyAssigneeAction.run();
- } else if (event.keyCode == 'd') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- filterMyAssigneeAction.run();
- }
- }
- }
- });
- }
- }
-
- public void updateExtendedStatusString() {
- taskComposite.getTaskXViewer().setExtendedStatusString(
- //
- (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
- //
- (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
- }
-
- protected void createDropDownMenuActions() {
- try {
- worldAssigneeFilter = new WorldAssigneeFilter();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", IAction.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterCompletedAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
- filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
-
- filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", IAction.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterMyAssigneeAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
- filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java
index ded250acabc..887e2dd0dc7 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
+ * Copyright (c) 2016 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
@@ -12,99 +12,54 @@ package org.eclipse.osee.ats.task;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Iterator;
+import java.util.Date;
+import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
import org.eclipse.osee.ats.AtsImage;
import org.eclipse.osee.ats.actions.EditAssigneeAction;
import org.eclipse.osee.ats.actions.EditStatusAction;
-import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
-import org.eclipse.osee.ats.column.HoursSpentSMAStateColumn;
-import org.eclipse.osee.ats.column.HoursSpentStateTotalColumn;
-import org.eclipse.osee.ats.column.PercentCompleteSMAStateColumn;
-import org.eclipse.osee.ats.column.PercentCompleteTotalColumn;
+import org.eclipse.osee.ats.api.task.JaxAtsTask;
+import org.eclipse.osee.ats.api.task.JaxAtsTaskFactory;
+import org.eclipse.osee.ats.api.task.NewTaskData;
+import org.eclipse.osee.ats.api.task.NewTaskDataFactory;
+import org.eclipse.osee.ats.api.task.NewTaskDatas;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.column.RelatedToStateColumn;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
-import org.eclipse.osee.ats.editor.SMAPromptChangeStatus;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.core.client.util.AtsTaskCache;
import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.workflow.TransitionToMenu;
import org.eclipse.osee.ats.world.AtsWorldEditorItems;
import org.eclipse.osee.ats.world.IAtsWorldEditorItem;
import org.eclipse.osee.ats.world.WorldXViewer;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryComboDialog;
import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeItem;
-/**
- * @author Donald G. Dunne
- */
public class TaskXViewer extends WorldXViewer {
- private final TaskComposite taskComposite;
- private boolean tasksEditable = true;
+ Action editAssigneeAction;
+ Action addNewTaskAction;
private boolean newTaskSelectionEnabled = false;
- private static String viewerId = GUID.create();
-
- public TaskXViewer(TaskComposite taskComposite, int style, IDirtiableEditor editor) {
- super(taskComposite, style, new TaskXViewerFactory(), editor);
- this.taskComposite = taskComposite;
- }
-
- @Override
- public String toString() {
- if (taskComposite == null) {
- return "TaskXViewer";
- }
- try {
- if (taskComposite.getIXTaskViewer().getAwa() != null) {
- return "TaskXViewer - id:" + viewerId + " - " + taskComposite.getIXTaskViewer().getAwa().toString();
- }
- return "TaskXViewer - id:" + viewerId + " - " + taskComposite.getIXTaskViewer().toString();
- } catch (Exception ex) {
- return "TaskXViewer - id:" + viewerId;
- }
- }
-
- @Override
- public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
- super.handleColumnMultiEdit(treeColumn, treeItems);
- handleColumnMultiEdit(treeColumn, treeItems, false);
- refresh();
- editor.onDirtied();
- }
-
- public TaskArtifact getSelectedTaskArtifact() {
- Collection<TaskArtifact> arts = getSelectedTaskArtifacts();
- if (arts.size() > 0) {
- return arts.iterator().next();
- }
- return null;
- }
+ private boolean tasksEditable = true;
+ private final IAtsTeamWorkflow teamWf;
- public boolean isSelectedTaskArtifactsAreInWork() throws OseeCoreException {
- Iterator<?> i = ((IStructuredSelection) getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (Artifacts.isOfType(obj, AtsArtifactTypes.Task) && !((TaskArtifact) obj).isInWork()) {
- return false;
- }
- }
- return true;
+ public TaskXViewer(Composite parent, int style, IXViewerFactory xViewerFactory, IDirtiableEditor editor, IAtsTeamWorkflow teamWf) {
+ super(parent, style, xViewerFactory, editor);
+ this.teamWf = teamWf;
}
- Action editAssigneeAction;
- Action addNewTaskAction;
-
@Override
public void createMenuActions() {
super.createMenuActions();
@@ -115,7 +70,7 @@ public class TaskXViewer extends WorldXViewer {
addNewTaskAction = new Action("New Task", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
- taskComposite.handleNewTask();
+ handleNewTask();
}
};
addNewTaskAction.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.NEW_TASK));
@@ -156,36 +111,6 @@ public class TaskXViewer extends WorldXViewer {
}
- @Override
- public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
- if (!isTasksEditable()) {
- AWorkbench.popup("ERROR", "Editing disabled for current state.");
- return false;
- }
- XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- try {
- TaskArtifact taskArt = (TaskArtifact) treeItem.getData();
- boolean modified = false;
-
- if (xCol.equals(HoursSpentSMAStateColumn.getInstance()) || xCol.equals(
- HoursSpentStateTotalColumn.getInstance()) || xCol.equals(
- PercentCompleteSMAStateColumn.getInstance()) || xCol.equals(PercentCompleteTotalColumn.getInstance())) {
- modified = SMAPromptChangeStatus.promptChangeStatus(Arrays.asList(taskArt), false);
- } else {
- modified = super.handleAltLeftClick(treeColumn, treeItem);
- }
-
- if (modified) {
- editor.onDirtied();
- update(treeItem.getData(), null);
- return true;
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
public boolean isTasksEditable() {
return tasksEditable;
}
@@ -202,13 +127,31 @@ public class TaskXViewer extends WorldXViewer {
this.newTaskSelectionEnabled = newTaskSelectionEnabled;
}
- public TaskComposite getTaskComposite() {
- return taskComposite;
- }
-
- @Override
- public boolean isAltLeftClickPersist() {
- return false;
+ public TaskArtifact handleNewTask() {
+ TaskArtifact taskArt = null;
+ try {
+ EntryComboDialog ed = new EntryComboDialog("Create New Task", "Enter Task Title",
+ RelatedToStateColumn.RELATED_TO_STATE_SELECTION);
+ List<String> validStates =
+ RelatedToStateColumn.getValidInWorkStates((TeamWorkFlowArtifact) teamWf.getStoreObject());
+ ed.setOptions(validStates);
+ if (ed.open() == 0) {
+ NewTaskData newTaskData = NewTaskDataFactory.get("Create New Task",
+ AtsClientService.get().getUserService().getCurrentUser().getUserId(), teamWf.getUuid());
+ JaxAtsTask task = JaxAtsTaskFactory.get(newTaskData, ed.getEntry(),
+ AtsClientService.get().getUserService().getCurrentUser(), new Date());
+ if (Strings.isValid(ed.getSelection())) {
+ task.setRelatedToState(ed.getSelection());
+ }
+ AtsClientService.get().getTaskService().createTasks(new NewTaskDatas(newTaskData));
+
+ taskArt = (TaskArtifact) AtsClientService.get().getArtifact(task.getUuid());
+ AtsTaskCache.decache((TeamWorkFlowArtifact) teamWf.getStoreObject());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return taskArt;
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java
index a7b315c7466..dbc451e1a54 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java
@@ -40,4 +40,6 @@ public interface IWorldEditorProvider {
Collection<Artifact> performSearch(SearchType searchType);
+ public TableLoadOption[] getTableLoadOptions() throws OseeCoreException;
+
}
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 2029fe487ae..428196df4c4 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
@@ -30,8 +30,11 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction.IOpenNewAtsTaskEditorHandler;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected.IOpenNewAtsTaskEditorSelectedHandler;
import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorAction.IOpenNewAtsWorldEditorHandler;
import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction.IOpenNewAtsWorldEditorSelectedHandler;
+import org.eclipse.osee.ats.actions.TaskAddAction.ITaskAddActionHandler;
import org.eclipse.osee.ats.agile.SprintOrderColumn;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.column.GoalOrderColumn;
@@ -42,6 +45,8 @@ import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.task.ITaskEditorProvider;
+import org.eclipse.osee.ats.task.TaskXViewer;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.world.search.WorldSearchItem;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
@@ -72,21 +77,19 @@ import org.eclipse.swt.widgets.Control;
/**
* @author Donald G. Dunne
*/
-public class WorldComposite extends ScrolledComposite implements ISelectedAtsArtifacts, IWorldViewerEventHandler, IOpenNewAtsWorldEditorHandler, IOpenNewAtsWorldEditorSelectedHandler, IRefreshActionHandler {
+public class WorldComposite extends ScrolledComposite implements ISelectedAtsArtifacts, IWorldViewerEventHandler, IOpenNewAtsWorldEditorHandler, IOpenNewAtsWorldEditorSelectedHandler, IOpenNewAtsTaskEditorHandler, IOpenNewAtsTaskEditorSelectedHandler, IRefreshActionHandler, ITaskAddActionHandler {
private final WorldXViewer worldXViewer;
private final Set<Artifact> worldArts = new HashSet<>(200);
private final Set<Artifact> otherArts = new HashSet<>(200);
protected IWorldEditor iWorldEditor;
- private final String id;
- public WorldComposite(String id, IWorldEditor worldEditor, Composite parent, int style) {
- this(id, worldEditor, null, parent, style, true);
+ public WorldComposite(IWorldEditor worldEditor, Composite parent, int style) {
+ this(worldEditor, null, parent, style, true);
}
- public WorldComposite(String id, final IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style, boolean createDragAndDrop) {
+ public WorldComposite(final IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style, boolean createDragAndDrop) {
super(parent, style);
- this.id = id;
this.iWorldEditor = worldEditor;
setLayout(new GridLayout(1, true));
@@ -98,16 +101,13 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
if (DbConnectionExceptionComposite.dbConnectionIsOk(this)) {
- worldXViewer = new WorldXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION,
- xViewerFactory != null ? xViewerFactory : new WorldXViewerFactory(), null);
+ worldXViewer = createXViewer(xViewerFactory, mainComp);
worldXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
worldXViewer.setContentProvider(new WorldContentProvider(worldXViewer));
worldXViewer.setLabelProvider(new WorldLabelProvider(worldXViewer));
- if (createDragAndDrop) {
- new WorldViewDragAndDrop(this, WorldEditor.EDITOR_ID);
- }
+ setupDragAndDropSupport(createDragAndDrop);
setContent(mainComp);
setExpandHorizontal(true);
@@ -120,6 +120,17 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
}
}
+ protected void setupDragAndDropSupport(boolean createDragAndDrop) {
+ if (createDragAndDrop) {
+ new WorldViewDragAndDrop(this, WorldEditor.EDITOR_ID);
+ }
+ }
+
+ protected WorldXViewer createXViewer(IXViewerFactory xViewerFactory, Composite mainComp) {
+ return new WorldXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION,
+ xViewerFactory != null ? xViewerFactory : new WorldXViewerFactory(), null);
+ }
+
public double getManHoursPerDayPreference() throws OseeCoreException {
if (worldArts.size() > 0) {
Artifact artifact = worldArts.iterator().next();
@@ -363,7 +374,7 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
@Override
public String toString() {
- return String.format("WorldComposite [%s][%s]", id, iWorldEditor.getCurrentTitleLabel());
+ return String.format("WorldComposite [%s]", iWorldEditor.getCurrentTitleLabel());
}
@Override
@@ -399,4 +410,14 @@ public class WorldComposite extends ScrolledComposite implements ISelectedAtsArt
return tasks;
}
+ @Override
+ public ITaskEditorProvider getTaskEditorProviderCopy() throws OseeCoreException {
+ return (ITaskEditorProvider) getWorldEditorProviderCopy();
+ }
+
+ @Override
+ public void taskAddActionHandler() {
+ ((TaskXViewer) worldXViewer).handleNewTask();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java
index c8cd456de06..f5f6264dc0f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.help.ui.AtsHelpContext;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.ats.task.TaskEditorProvider;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
@@ -51,7 +52,7 @@ import org.eclipse.ui.part.MultiPageEditorPart;
*/
public class WorldEditor extends FormEditor implements IWorldEditor, IDirtiableEditor, IAtsMetricsProvider {
public static final String EDITOR_ID = "org.eclipse.osee.ats.world.WorldEditor";
- private WorldXWidgetActionPage worldXWidgetActionPage;
+ protected WorldXWidgetActionPage worldXWidgetActionPage;
public static final int TITLE_MAX_LENGTH = 80;
@Override
@@ -293,4 +294,8 @@ public class WorldEditor extends FormEditor implements IWorldEditor, IDirtiableE
// do nothing
}
+ public boolean isTaskEditor() {
+ return getWorldEditorInput().getIWorldEditorProvider() instanceof TaskEditorProvider;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java
index 3d4ac2e7091..3d1f199e8bf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java
@@ -58,6 +58,7 @@ public abstract class WorldEditorProvider implements IWorldEditorProvider {
return null;
}
+ @Override
public TableLoadOption[] getTableLoadOptions() {
return tableLoadOptions;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
index 895a043663b..9c7100fc837 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.world;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -25,16 +26,23 @@ import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.actions.DeleteTasksAction;
+import org.eclipse.osee.ats.actions.DeleteTasksAction.TaskArtifactProvider;
import org.eclipse.osee.ats.actions.NewAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorAction;
import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction;
+import org.eclipse.osee.ats.actions.TaskAddAction;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.artifact.GoalManager;
import org.eclipse.osee.ats.core.client.action.ActionManager;
import org.eclipse.osee.ats.core.client.review.ReviewManager;
+import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.task.TaskComposite;
import org.eclipse.osee.ats.util.WorkflowMetrics;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.core.util.Result;
@@ -89,7 +97,7 @@ public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
}
public WorldXWidgetActionPage(WorldEditor worldEditor) {
- super(worldEditor, ID, "Actions");
+ super(worldEditor, ID, (worldEditor.isTaskEditor() ? "Tasks" : "Actions"));
this.worldEditor = worldEditor;
}
@@ -112,16 +120,55 @@ public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
+ setPartName(getTabName());
+ }
+
+ private String getTabName() {
+ String name = "Tasks";
+ try {
+ if (getTaskComposite() != null) {
+ TeamWorkFlowArtifact teamArt = getTaskComposite().getTeamArt();
+ name = String.format("Tasks (%d)", teamArt.getTaskArtifacts().size());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return name;
}
@Override
protected void createToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(new GroupMarker(MENU_GROUP_PRE));
+ if (worldEditor.isTaskEditor()) {
+ try {
+ TaskComposite taskComposite = getTaskComposite();
+ if (taskComposite != null && taskComposite.getIXTaskViewer().isTasksEditable()) {
+ toolBarManager.add(new TaskAddAction(taskComposite));
+ TaskArtifactProvider taskProvider = new TaskArtifactProvider() {
+
+ @Override
+ public List<TaskArtifact> getSelectedArtifacts() {
+ return taskComposite.getSelectedTaskArtifacts();
+ }
+ };
+ toolBarManager.add(new DeleteTasksAction(taskProvider));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ toolBarManager.add(new Separator());
+
toolBarManager.add(worldComposite.getXViewer().getCustomizeAction());
toolBarManager.add(new Separator());
- toolBarManager.add(new OpenNewAtsWorldEditorAction(worldComposite));
- toolBarManager.add(new OpenNewAtsWorldEditorSelectedAction(worldComposite));
+ if (worldEditor.isTaskEditor()) {
+ toolBarManager.add(new OpenNewAtsTaskEditorAction(worldComposite));
+ toolBarManager.add(new OpenNewAtsTaskEditorSelected(worldComposite));
+ } else {
+ toolBarManager.add(new OpenNewAtsWorldEditorAction(worldComposite));
+ toolBarManager.add(new OpenNewAtsWorldEditorSelectedAction(worldComposite));
+ }
toolBarManager.add(new Separator());
toolBarManager.add(new ExpandAllAction(worldComposite.getXViewer()));
toolBarManager.add(new CollapseAllAction(worldComposite.getXViewer()));
@@ -155,7 +202,7 @@ public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
showReleaseMetricsLabel = toolkit.createLabel(resultsContainer, "");
showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- worldComposite = new WorldComposite("world.editor.main", worldEditor, resultsContainer, SWT.BORDER);
+ worldComposite = new WorldComposite(worldEditor, resultsContainer, SWT.BORDER);
toolkit.adapt(worldComposite);
return resultsSection;
}
@@ -224,15 +271,19 @@ public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
}
fMenu = new Menu(parent);
- addActionToMenu(fMenu, selectionMetricsAction);
+ if (!worldEditor.isTaskEditor()) {
+ addActionToMenu(fMenu, selectionMetricsAction);
+ }
addActionToMenu(fMenu, filterCompletedAction);
addActionToMenu(fMenu, filterMyAssigneeAction);
- new MenuItem(fMenu, SWT.SEPARATOR);
- addActionToMenu(fMenu, toAction);
- addActionToMenu(fMenu, toGoal);
- addActionToMenu(fMenu, toWorkFlow);
- addActionToMenu(fMenu, toTask);
- addActionToMenu(fMenu, toReview);
+ if (!worldEditor.isTaskEditor()) {
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ addActionToMenu(fMenu, toAction);
+ addActionToMenu(fMenu, toGoal);
+ addActionToMenu(fMenu, toWorkFlow);
+ addActionToMenu(fMenu, toTask);
+ addActionToMenu(fMenu, toReview);
+ }
worldEditor.createToolBarPulldown(fMenu);
@@ -313,6 +364,14 @@ public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
}
}
+ private TaskComposite getTaskComposite() {
+ TaskComposite taskComposite = null;
+ if (worldComposite instanceof TaskComposite) {
+ taskComposite = (TaskComposite) worldComposite;
+ }
+ return taskComposite;
+ }
+
private void addSelectionListener() {
worldComposite.getXViewer().getTree().addSelectionListener(new SelectionAdapter() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index 23e30f9c211..286586f222d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -17,8 +17,9 @@ Import-Package: com.google.common.base;version="15.0.0",
com.lowagie.text.rtf,
javax.mail,
javax.mail.internet,
- javax.ws.rs.client;version="2.0.0",
- javax.ws.rs.core;version="2.0.0",
+ javax.ws.rs,
+ javax.ws.rs.client,
+ javax.ws.rs.core,
org.apache.commons.io,
org.apache.commons.lang,
org.apache.commons.lang.mutable,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
index 028d0bcd4a8..67a5610a851 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
@@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
+import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.codehaus.jackson.map.ObjectMapper;
@@ -143,8 +144,10 @@ public class FrameworkArtifactImageProvider extends ArtifactImageProvider {
}
} catch (Exception ex) {
- OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex,
- "Error processing dynamic artifact images.");
+ if (!(ex instanceof NotFoundException)) {
+ OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex,
+ "Error processing dynamic artifact images.");
+ }
}
}

Back to the top