feature[TW19140]: Convert XHyperlinkLabelValueSelection to hyperlink label
Change-Id: If21d668193b7159716dbbb1d358f06e091382e8a
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/AtsObjectLabelProvider.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/AtsObjectLabelProvider.java
index 0e4de32..db07e0b 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/AtsObjectLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/AtsObjectLabelProvider.java
@@ -66,6 +66,8 @@
} else if (element instanceof Match && ((Match) element).getElement() instanceof Artifact) {
return ArtifactImageManager.getImage(
AtsApiService.get().getQueryServiceIde().getArtifact(((Match) element).getElement()));
+ } else if (element instanceof String) {
+ return null;
}
return ImageManager.getImage(ImageManager.MISSING);
}
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/AtsWidgetProvider.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/AtsWidgetProvider.java
index 05d2193..af5f09f 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/AtsWidgetProvider.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/AtsWidgetProvider.java
@@ -51,6 +51,7 @@
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.skynet.widgets.XDateWithValidateDam;
import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelGroupSelection;
+import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlinkLabelValueSelectionDam;
import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
import org.eclipse.osee.framework.ui.skynet.widgets.util.IXWidgetProvider;
@@ -225,6 +226,8 @@
return new XActionableItemWidget();
} else if (widgetName.equals(XTaskEstSiblingWorldDemoWidget.WIDGET_ID)) {
return new XTaskEstSiblingWorldDemoWidget();
+ } else if (widgetName.equals(XHyperlinkLabelValueSelectionDam.WIDGET_ID)) {
+ return new XHyperlinkLabelValueSelectionDam();
}
return toReturn;
}
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/XEstimatedPointsWidget.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/XEstimatedPointsWidget.java
index 51086e4..888593b6 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/XEstimatedPointsWidget.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/widgets/XEstimatedPointsWidget.java
@@ -23,12 +23,12 @@
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.widgets.ArtifactWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlinkLabelValueSelDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlinkLabelCmdValueSelDam;
/**
* @author Donald G. Dunne
*/
-public class XEstimatedPointsWidget extends XHyperlinkLabelValueSelDam implements ArtifactWidget {
+public class XEstimatedPointsWidget extends XHyperlinkLabelCmdValueSelDam implements ArtifactWidget {
public static final Object WIDGET_ID = XEstimatedPointsWidget.class.getSimpleName();
public float points = 0;
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstLabelProvider.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstLabelProvider.java
index 02e8a9c..1de025a 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstLabelProvider.java
@@ -88,6 +88,9 @@
} else if (xViewerColumn.getName().equals("TLE Reviewed")) {
return "";
} else if (xViewerColumn.getName().equals("Related Workflow")) {
+ if (task.isCancelled()) {
+ return "";
+ }
IAtsTeamWorkflow teamWf = TaskEstUtil.getWorkflow(task.getParentTeamWorkflow(), task, atsApi);
if (teamWf != null) {
return teamWf.toStringWithId();
@@ -120,6 +123,9 @@
return ImageManager.getImage(AtsImage.CHECK_BLUE);
}
} else if (xViewerColumn.getName().equals("Related Workflow")) {
+ if (task.isCancelled()) {
+ return null;
+ }
IAtsTeamWorkflow teamWf = TaskEstUtil.getWorkflow(task.getParentTeamWorkflow(), task, atsApi);
if (teamWf != null) {
return ImageManager.getImage(AtsImage.WORKFLOW);
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstViewer.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstViewer.java
index 3a51606..8243405 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstViewer.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/XTaskEstViewer.java
@@ -76,6 +76,9 @@
} else if (xViewerColumn.getName().equals(XTaskEstXViewerFactory.Related_Wf_Col.getName())) {
if ((treeItem.getData() instanceof IAtsTask)) {
IAtsTask task = (IAtsTask) treeItem.getData();
+ if (task.isCancelled()) {
+ return false;
+ }
IAtsTeamWorkflow teamWf = TaskEstUtil.getWorkflow(crTeamWf, task, atsApi);
if (teamWf != null) {
WorkflowEditor.edit(teamWf);
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/sibling/operation/CreateSiblingOffTaskEstOperation.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/sibling/operation/CreateSiblingOffTaskEstOperation.java
index 8caac25..13e10a7 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/sibling/operation/CreateSiblingOffTaskEstOperation.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/cr/estimates/sibling/operation/CreateSiblingOffTaskEstOperation.java
@@ -74,6 +74,10 @@
// if TED and task and estimate <= 0, do nothing
IAtsTask task = TaskEstUtil.getTask(teamWf, ted, atsApi);
if (task.isValid()) {
+ if (task.isCancelled()) {
+ teds.remove(ted);
+ continue;
+ }
String ptsStr = atsApi.getAgileService().getPointsStr(task);
if (!Strings.isValid(ptsStr)) {
rd.errorf("No estimated points for task %s\n", task.toStringWithId());
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/task/mini/XMiniTaskWidget.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/task/mini/XMiniTaskWidget.java
index b5cd021..cbd419f 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/task/mini/XMiniTaskWidget.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/task/mini/XMiniTaskWidget.java
@@ -195,6 +195,9 @@
public abstract ToolBar createActionBar(Composite tableComp);
public void setXviewerTreeSize() {
+ if (xTaskViewer == null || !Widgets.isAccessible(xTaskViewer.getTree())) {
+ return;
+ }
Tree tree = xTaskViewer.getTree();
int size = xTaskViewer.getTree().getItemCount();
if (size > MAX_TABLE_SIZE) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelCmdValueSelDam.java
similarity index 87%
rename from plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelDam.java
rename to plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelCmdValueSelDam.java
index 817e93b..75a5bf3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelCmdValueSelDam.java
@@ -24,24 +24,26 @@
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
/**
+ * XWidget where label is hyperlink and value is label.
+ *
* @author Donald G. Dunne
*/
-public abstract class XHyperlinkLabelValueSelDam extends XHyperlinkLabelCmdValueSelection implements AttributeWidget {
+public abstract class XHyperlinkLabelCmdValueSelDam extends XHyperlinkLabelCmdValueSelection implements AttributeWidget {
private Artifact artifact;
private AttributeTypeToken attributeType;
- public XHyperlinkLabelValueSelDam(String label) {
+ public XHyperlinkLabelCmdValueSelDam(String label) {
this(label, false);
}
- public XHyperlinkLabelValueSelDam(String label, boolean supportClear, Integer truncateValueLength) {
+ public XHyperlinkLabelCmdValueSelDam(String label, boolean supportClear, Integer truncateValueLength) {
super(label);
this.supportClear = supportClear;
this.truncateValueLength = truncateValueLength;
}
- public XHyperlinkLabelValueSelDam(String label, boolean supportClear) {
+ public XHyperlinkLabelCmdValueSelDam(String label, boolean supportClear) {
this(label, supportClear, null);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelection.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelection.java
index 574a0f3..0d16e38 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelection.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelection.java
@@ -24,7 +24,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
/**
@@ -32,7 +31,8 @@
*/
public abstract class XHyperlinkLabelValueSelection extends GenericXWidget {
- Hyperlink valueHyperlinkLabel;
+ protected Hyperlink labelHyperlink;
+ protected Label labelWidget;
protected Label valueLabel;
protected Composite comp;
@@ -55,31 +55,23 @@
} else {
comp.setLayoutData(new GridData());
}
-
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(comp, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- GridData gd = new GridData();
- if (isFillHorizontally()) {
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = SWT.FILL;
+ if (toolkit != null) {
+ toolkit.adapt(comp);
}
if (isEditable()) {
if (toolkit == null) {
- valueHyperlinkLabel = new Hyperlink(comp, SWT.NONE);
+ labelHyperlink = new Hyperlink(comp, SWT.NONE);
+ labelHyperlink.setText(getLabel());
} else {
- valueHyperlinkLabel = toolkit.createHyperlink(comp, " <edit>", SWT.NONE);
+ labelHyperlink = toolkit.createHyperlink(comp, getLabel() + ":", SWT.NONE);
}
- valueHyperlinkLabel.setToolTipText(Strings.isValid(getToolTip()) ? getToolTip() : "Select to Modify");
- valueHyperlinkLabel.setLayoutData(gd);
- valueHyperlinkLabel.addListener(SWT.MouseUp, new Listener() {
+ labelHyperlink.setToolTipText(Strings.isValid(getToolTip()) ? getToolTip() : "Select to Modify");
+ labelHyperlink.setLayoutData(new GridData());
+ if (getToolTip() != null) {
+ labelHyperlink.setToolTipText(getToolTip());
+ }
+ labelHyperlink.addListener(SWT.MouseUp, new Listener() {
@Override
public void handleEvent(Event event) {
if (handleSelection()) {
@@ -90,12 +82,27 @@
});
} else {
if (toolkit == null) {
- valueLabel = new Label(comp, SWT.NONE);
+ labelWidget = new Label(comp, SWT.NONE);
} else {
- valueLabel = toolkit.createLabel(comp, " Not Set", SWT.NONE);
+ labelWidget = toolkit.createLabel(comp, getLabel() + ":", SWT.NONE);
}
+ labelWidget.setLayoutData(new GridData());
+ }
+
+ GridData gd = new GridData();
+ if (isFillHorizontally()) {
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = SWT.FILL;
+ }
+
+ valueLabel = new Label(comp, SWT.NONE);
+ valueLabel.setText(getLabel() + ":");
+ if (toolkit != null) {
+ toolkit.adapt(valueLabel, false, false);
+ }
+ valueLabel.setLayoutData(gd);
+ if (getToolTip() != null) {
valueLabel.setToolTipText(getToolTip());
- valueLabel.setLayoutData(gd);
}
refresh();
@@ -103,24 +110,16 @@
@Override
public void refresh() {
- if (getControl() == null || getControl().isDisposed()) {
+ if (!Widgets.isAccessible(comp)) {
return;
}
- if (Widgets.isAccessible(valueHyperlinkLabel)) {
- if (getCurrentValue().equals(valueHyperlinkLabel.getText())) {
- return;
- }
- valueHyperlinkLabel.setText(getCurrentValue());
- valueHyperlinkLabel.update();
- valueHyperlinkLabel.getParent().update();
- } else if (Widgets.isAccessible(valueLabel)) {
+ if (Widgets.isAccessible(valueLabel)) {
if (getCurrentValue().equals(valueLabel.getText())) {
return;
}
valueLabel.setText(getCurrentValue());
valueLabel.update();
valueLabel.getParent().update();
-
}
validate();
}
@@ -130,31 +129,13 @@
}
@Override
- public Control getControl() {
- if (Widgets.isAccessible(valueHyperlinkLabel)) {
- return valueHyperlinkLabel;
- }
- if (Widgets.isAccessible(valueLabel)) {
- return valueLabel;
- }
- return null;
- }
-
- @Override
- public void adaptControls(FormToolkit toolkit) {
- super.adaptControls(toolkit);
- if (Widgets.isAccessible(valueHyperlinkLabel)) {
- toolkit.adapt(valueHyperlinkLabel, true, true);
- valueHyperlinkLabel.update();
- }
- if (Widgets.isAccessible(valueLabel)) {
- toolkit.adapt(valueLabel, true, true);
- valueLabel.update();
- }
- }
-
- @Override
public String toHTML(String labelFont) {
return AHTML.getLabelValueStr(AHTML.LABEL_FONT, getLabel(), getCurrentValue());
}
+
+ @Override
+ public Control getControl() {
+ return comp;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelectionDam.java
similarity index 69%
copy from plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelDam.java
copy to plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelectionDam.java
index 817e93b..899bf02 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlinkLabelValueSelectionDam.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.widgets;
+import java.util.Collections;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
@@ -21,28 +22,41 @@
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPromptChange;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
/**
+ * XWidget where label is hyperlink and value is label.
+ *
* @author Donald G. Dunne
*/
-public abstract class XHyperlinkLabelValueSelDam extends XHyperlinkLabelCmdValueSelection implements AttributeWidget {
+public class XHyperlinkLabelValueSelectionDam extends XHyperlinkLabelValueSelection implements AttributeWidget {
- private Artifact artifact;
- private AttributeTypeToken attributeType;
+ public static final String WIDGET_ID = XHyperlinkLabelValueSelectionDam.class.getSimpleName();
- public XHyperlinkLabelValueSelDam(String label) {
- this(label, false);
+ protected Artifact artifact;
+ protected AttributeTypeToken attributeType;
+
+ public XHyperlinkLabelValueSelectionDam() {
+ super("");
}
- public XHyperlinkLabelValueSelDam(String label, boolean supportClear, Integer truncateValueLength) {
+ public XHyperlinkLabelValueSelectionDam(String label) {
super(label);
- this.supportClear = supportClear;
- this.truncateValueLength = truncateValueLength;
}
- public XHyperlinkLabelValueSelDam(String label, boolean supportClear) {
- this(label, supportClear, null);
+ @Override
+ public boolean handleSelection() {
+ return ArtifactPromptChange.promptChangeAttribute(attributeType, Collections.singleton(artifact), true);
+ }
+
+ @Override
+ public String getCurrentValue() {
+ String value = artifact.getAttributesToString(attributeType);
+ if (Strings.isInValid(value)) {
+ value = "No Set";
+ }
+ return value;
}
@Override
@@ -78,6 +92,9 @@
public void setAttributeType(Artifact artifact, AttributeTypeToken attributeType) {
this.artifact = artifact;
this.attributeType = attributeType;
+ if (Strings.isInValid(getLabel())) {
+ setLabel(attributeType.getUnqualifiedName());
+ }
}
@Override
@@ -90,13 +107,9 @@
IStatus status = super.isValid();
if (status.isOK()) {
try {
- if (getArtifact() != null && getAttributeType() != null) {
+ if (getArtifact() != null && getAttributeType() != null && Strings.isValid(getCurrentValue())) {
status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, getArtifact(), getAttributeType(),
getCurrentValue());
- if (status.isOK() && isRequiredEntry() && Strings.isInValid(getCurrentValue())) {
- status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- String.format("Must enter [%s]", attributeType.getUnqualifiedName()));
- }
}
} catch (OseeCoreException ex) {
status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error getting Artifact", ex);