Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2012-08-30 23:09:35 +0000
committerRoberto E. Escobar2012-08-30 23:09:35 +0000
commitb70103b0d1da4eb73911d2ef2e751256d64cccd8 (patch)
treeb2902cf29a580ead9870a9474022f32414fb30a1
parentecf813e89a127214d826864720d57995876feaac (diff)
downloadorg.eclipse.osee-b70103b0d1da4eb73911d2ef2e751256d64cccd8.tar.gz
org.eclipse.osee-b70103b0d1da4eb73911d2ef2e751256d64cccd8.tar.xz
org.eclipse.osee-b70103b0d1da4eb73911d2ef2e751256d64cccd8.zip
bug[ats_08F54]: Baseline Branch Guid combo box not saving guid attribute or resolving branch
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetDam.java108
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/util/FrameworkXWidgetProvider.java3
3 files changed, 112 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java
index b9dde0fa090..0bfe5490f7a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java
@@ -43,7 +43,7 @@ public class AtsAttributeXWidgetProvider extends DefaultAttributeXWidgetProvider
if (attributeType.equals(AtsAttributeTypes.BaselineBranchGuid)) {
layouts = super.getDynamicXWidgetLayoutData(attributeType);
XWidgetRendererItem layoutData = layouts.get(0);
- layoutData.setXWidgetName("XBranchSelectWidget");
+ layoutData.setXWidgetName("XBranchSelectWidgetDam");
} else if (XFLAT_ATTRIBUTE_TYPES.contains(attributeType)) {
layouts = super.getDynamicXWidgetLayoutData(attributeType);
XWidgetRendererItem layoutData = layouts.get(0);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetDam.java
new file mode 100644
index 00000000000..889bfe19a21
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetDam.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.framework.ui.skynet.widgets;
+
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.util.Result;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+
+/**
+ * Branch Selection with branch guid storage as String
+ *
+ * @author Donald G. Dunne
+ */
+public class XBranchSelectWidgetDam extends XBranchSelectWidget implements IAttributeWidget {
+ public static final String WIDGET_ID = XBranchSelectWidgetDam.class.getSimpleName();
+
+ private Artifact artifact;
+ private IAttributeType attributeType;
+
+ public XBranchSelectWidgetDam() {
+ this("Branch");
+ }
+
+ public XBranchSelectWidgetDam(String label) {
+ super(label);
+ addXModifiedListener(new DirtyListener());
+ }
+
+ public String getStoredGuid() throws OseeCoreException {
+ return artifact.getSoleAttributeValue(attributeType, "");
+ }
+
+ @Override
+ public Artifact getArtifact() {
+ return artifact;
+ }
+
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ IOseeBranch selection = getSelection();
+ if (selection == null) {
+ artifact.deleteAttributes(attributeType);
+ } else {
+ artifact.setSoleAttributeValue(attributeType, selection.getGuid());
+ }
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(getArtifact(), getAttributeType());
+ }
+
+ @Override
+ public Result isDirty() {
+ if (isEditable()) {
+ try {
+ String storedGuid = getStoredGuid();
+ IOseeBranch widgetInput = getSelection();
+ String widgetGuid = widgetInput == null ? "" : widgetInput.getGuid();
+ if (!storedGuid.equals(widgetGuid)) {
+ return new Result(true, getAttributeType() + " is dirty");
+ }
+ } catch (OseeCoreException ex) {
+ // Do nothing
+ }
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, IAttributeType attributeTypeName) throws OseeCoreException {
+ setLabel(attributeTypeName.getUnqualifiedName());
+ this.artifact = artifact;
+ this.attributeType = attributeTypeName;
+ String storedGuid = getStoredGuid();
+ if (Strings.isValid(storedGuid)) {
+ IOseeBranch branch = BranchManager.getBranchByGuid(storedGuid);
+ if (branch != null) {
+ setSelection(branch);
+ }
+ }
+ }
+
+ @Override
+ public IAttributeType getAttributeType() {
+ return attributeType;
+ }
+
+ private class DirtyListener implements XModifiedListener {
+ @Override
+ public void widgetModified(XWidget widget) {
+ isDirty();
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/util/FrameworkXWidgetProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/util/FrameworkXWidgetProvider.java
index 3da105941a5..254a4981406 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/util/FrameworkXWidgetProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/util/FrameworkXWidgetProvider.java
@@ -42,6 +42,7 @@ import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactTypeMultiChoiceSele
import org.eclipse.osee.framework.ui.skynet.widgets.XAttributeTypeComboViewer;
import org.eclipse.osee.framework.ui.skynet.widgets.XAttributeTypeMultiChoiceSelect;
import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidgetDam;
import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidgetWithSave;
import org.eclipse.osee.framework.ui.skynet.widgets.XButton;
import org.eclipse.osee.framework.ui.skynet.widgets.XButtonPush;
@@ -330,6 +331,8 @@ public final class FrameworkXWidgetProvider {
XArtifactList artifactList = new XArtifactList(name);
artifactList.setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(XOption.MULTI_SELECT));
xWidget = artifactList;
+ } else if (xWidgetName.equals(XBranchSelectWidgetDam.WIDGET_ID)) {
+ xWidget = new XBranchSelectWidgetDam();
} else if (xWidgetName.startsWith(XBranchSelectWidget.WIDGET_ID)) {
XBranchSelectWidget widget = null;

Back to the top