Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-07-23 22:53:46 +0000
committerrescobar2010-07-23 22:53:46 +0000
commitc97b410e1accc61b4829375247c6b6efc6382a9e (patch)
treed145ee5eb60a193da93835591d159751dedac593
parent1c93a625f413a5b1b119c73ff7d3acc5badfe52b (diff)
downloadorg.eclipse.osee-c97b410e1accc61b4829375247c6b6efc6382a9e.tar.gz
org.eclipse.osee-c97b410e1accc61b4829375247c6b6efc6382a9e.tar.xz
org.eclipse.osee-c97b410e1accc61b4829375247c6b6efc6382a9e.zip
"Team Workflow" - YGHW1 - "Block changes to requirements unless done under an appropriate action."
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/widget/EstimatedHoursXWidget.java26
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/XCancellationReasonTextWidget.java90
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java510
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java739
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java1099
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java889
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java35
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java35
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCheckBoxDam.java82
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboBooleanDam.java115
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboDam.java116
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java120
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlabelMemberSelDam.java136
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XIntegerDam.java108
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelDam.java221
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDam.java82
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java132
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java93
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDescriptiveName.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetDecorator.java175
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayout.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayoutData.java401
27 files changed, 2890 insertions, 2515 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/widget/EstimatedHoursXWidget.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/widget/EstimatedHoursXWidget.java
index 98dd98e6556..4e7c4d41d35 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/widget/EstimatedHoursXWidget.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/widget/EstimatedHoursXWidget.java
@@ -25,18 +25,18 @@ import org.eclipse.swt.widgets.Composite;
*/
public class EstimatedHoursXWidget extends XFloatDam {
- public EstimatedHoursXWidget(StateMachineArtifact sma, Composite composite, int horizontalSpan, XModifiedListener xModListener) {
- super(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getDisplayName());
- try {
- if (xModListener != null) {
- addXModifiedListener(xModListener);
- }
- setArtifact(sma, ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
- setFillHorizontally(true);
- createWidgets(composite, horizontalSpan);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- }
+ public EstimatedHoursXWidget(StateMachineArtifact sma, Composite composite, int horizontalSpan, XModifiedListener xModListener) {
+ super(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getDisplayName());
+ try {
+ if (xModListener != null) {
+ addXModifiedListener(xModListener);
+ }
+ setAttributeType(sma, ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
+ setFillHorizontally(true);
+ createWidgets(composite, horizontalSpan);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/XCancellationReasonTextWidget.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/XCancellationReasonTextWidget.java
index 4b63ae2dd06..103a4504e3c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/XCancellationReasonTextWidget.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/XCancellationReasonTextWidget.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util;
-
+package org.eclipse.osee.ats.util;
+
import org.eclipse.osee.ats.artifact.StateMachineArtifact;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -18,45 +18,47 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
import org.eclipse.osee.framework.ui.skynet.widgets.XText;
import org.eclipse.osee.framework.ui.swt.Widgets;
-
-/**
- * @author Donald G. Dunne
- */
-public class XCancellationReasonTextWidget extends XText implements IArtifactWidget {
-
- private StateMachineArtifact sma;
-
- public XCancellationReasonTextWidget(StateMachineArtifact sma) throws OseeCoreException {
- super("Cancallation Reason");
- setArtifact(sma, null);
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- if (!Widgets.isAccessible(getControl())) return Result.FalseResult;
- if (!getText().equals(sma.getLog().getCancellationReason())) {
- return new Result(true, "Cancallation Reason dirty");
- }
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- if (Strings.isValid(getText())) {
- sma.getLog().setCancellationReason(getText());
- }
- }
-
- @Override
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- if (artifact instanceof StateMachineArtifact) {
- this.sma = (StateMachineArtifact) artifact;
- setText(sma.getLog().getCancellationReason());
- }
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XCancellationReasonTextWidget extends XText implements IArtifactWidget {
+
+ private StateMachineArtifact sma;
+
+ public XCancellationReasonTextWidget(StateMachineArtifact sma) throws OseeCoreException {
+ super("Cancallation Reason");
+ setArtifact(sma);
+ }
+
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ if (!Widgets.isAccessible(getControl())) {
+ return Result.FalseResult;
+ }
+ if (!getText().equals(sma.getLog().getCancellationReason())) {
+ return new Result(true, "Cancallation Reason dirty");
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ }
+
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ if (Strings.isValid(getText())) {
+ sma.getLog().setCancellationReason(getText());
+ }
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) throws OseeCoreException {
+ if (artifact instanceof StateMachineArtifact) {
+ this.sma = (StateMachineArtifact) artifact;
+ setText(sma.getLog().getCancellationReason());
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
index ac6d0c551ee..5f8ff265ed3 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
@@ -58,256 +58,264 @@ import org.eclipse.swt.widgets.Listener;
*/
public class XWorkingBranch extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener, IBranchEventListener {
- private TeamWorkFlowArtifact teamArt;
- private Button createBranchButton;
- private Button showArtifactExplorer;
- private Button showChangeReport;
- private Button deleteBranchButton;
- private XWorkingBranchEnablement enablement;
-
- public static enum BranchStatus {
- Not_Started, Changes_InProgress, Changes_NotPermitted
- }
- public final static String WIDGET_ID = ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName();
-
- public XWorkingBranch() {
- super("Working Branch", "");
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- if (horizontalSpan < 2) {
- horizontalSpan = 2;
- }
- if (!getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- }
-
- Composite bComp = new Composite(parent, SWT.NONE);
- bComp.setLayout(new GridLayout(4, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if (toolkit != null) {
- toolkit.adapt(bComp);
- }
-
- createBranchButton = createNewButton(bComp);
- createBranchButton.setToolTipText("Create Working Branch");
- createBranchButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- teamArt.getBranchMgr().createWorkingBranch(null, true);
- }
- });
-
- showArtifactExplorer = createNewButton(bComp);
- showArtifactExplorer.setToolTipText("Show Artifact Explorer");
- showArtifactExplorer.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- try {
- ArtifactExplorer.exploreBranch(teamArt.getWorkingBranch());
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- showChangeReport = createNewButton(bComp);
- showChangeReport.setToolTipText("Show Change Report");
- showChangeReport.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- teamArt.getBranchMgr().showChangeReport();
- }
- });
-
- deleteBranchButton = createNewButton(bComp);
- deleteBranchButton.setToolTipText("Delete Working Branch");
- deleteBranchButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- teamArt.getBranchMgr().deleteWorkingBranch(true);
- refresh();
- }
- });
-
- if (AtsPlugin.getInstance() != null) {
- createBranchButton.setImage(ImageManager.getImage(FrameworkImage.BRANCH));
- deleteBranchButton.setImage(ImageManager.getImage(FrameworkImage.TRASH));
- }
- if (SkynetGuiPlugin.getInstance() != null) {
- showArtifactExplorer.setImage(ImageManager.getImage(FrameworkImage.ARTIFACT_EXPLORER));
- showChangeReport.setImage(ImageManager.getImage(FrameworkImage.BRANCH_CHANGE));
- }
- refreshLabel();
- refreshEnablement();
- }
-
- public Button createNewButton(Composite comp) {
- if (toolkit != null) {
- return toolkit.createButton(comp, null, SWT.PUSH);
- }
- return new Button(comp, SWT.PUSH);
- }
-
- public void refreshLabel() {
- if (!getLabel().equals("")) {
- try {
- labelWidget.setText(getLabel() + ": " + (enablement.getWorkingBranch() != null ? enablement.getWorkingBranch().getShortName() : "") + " " + enablement.getStatus().name());
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
- }
-
- public void refreshEnablement() {
- createBranchButton.setEnabled(enablement.isCreateBranchButtonEnabled());
- showArtifactExplorer.setEnabled(enablement.isShowArtifactExplorerButtonEnabled());
- showChangeReport.setEnabled(enablement.isShowChangeReportButtonEnabled());
- deleteBranchButton.setEnabled(enablement.isDeleteBranchButtonEnabled());
- }
-
- public static boolean isPurgeBranchButtonEnabled(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
- return teamArt.getBranchMgr().isWorkingBranchInWork();
- }
-
- @Override
- public void setFocus() {
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- }
-
- @Override
- public Control getControl() {
- return labelWidget;
- }
-
- @Override
- public Object getData() {
- return null;
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public IStatus isValid() {
- // Need this cause it removes all error items of this namespace
- return new Status(IStatus.OK, getClass().getSimpleName(), "");
- }
-
- @Override
- public void refresh() {
- // don't do anything here cause to expensive to check for branch conditions during every refresh
- }
-
- public void refreshOnBranchEvent() {
- if (teamArt == null || teamArt.getBranchMgr() == null || labelWidget == null || labelWidget.isDisposed()) {
- return;
- }
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- enablement.refresh();
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (Widgets.isAccessible(createBranchButton)) {
- refreshLabel();
- refreshEnablement();
- }
- }
- });
- }
- };
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String toHTML(String labelFont) {
- return "";
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- }
-
- @Override
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.teamArt = (TeamWorkFlowArtifact) artifact;
- enablement = new XWorkingBranchEnablement(teamArt);
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, int branchId) throws OseeCoreException {
- refreshOnBranchEvent();
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- refreshOnBranchEvent();
- }
-
- public Button getCreateBranchButton() {
- return createBranchButton;
- }
-
- public Button getShowArtifactExplorerButton() {
- return showArtifactExplorer;
- }
-
- public Button getShowChangeReportButton() {
- return showChangeReport;
- }
-
- public Button getDeleteBranchButton() {
- return deleteBranchButton;
- }
-
- public String toString() {
- return String.format("%s", getLabel());
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return AtsUtil.getAtsObjectEventFilters();
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- refreshOnBranchEvent();
- }
-
- @Override
- public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
- refreshOnBranchEvent();
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
+ private TeamWorkFlowArtifact teamArt;
+ private Button createBranchButton;
+ private Button showArtifactExplorer;
+ private Button showChangeReport;
+ private Button deleteBranchButton;
+ private XWorkingBranchEnablement enablement;
+
+ public static enum BranchStatus {
+ Not_Started,
+ Changes_InProgress,
+ Changes_NotPermitted
+ }
+ public final static String WIDGET_ID = ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName();
+
+ public XWorkingBranch() {
+ super("Working Branch", "");
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ if (horizontalSpan < 2) {
+ horizontalSpan = 2;
+ }
+ if (!getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ }
+
+ Composite bComp = new Composite(parent, SWT.NONE);
+ bComp.setLayout(new GridLayout(4, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if (toolkit != null) {
+ toolkit.adapt(bComp);
+ }
+
+ createBranchButton = createNewButton(bComp);
+ createBranchButton.setToolTipText("Create Working Branch");
+ createBranchButton.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ teamArt.getBranchMgr().createWorkingBranch(null, true);
+ }
+ });
+
+ showArtifactExplorer = createNewButton(bComp);
+ showArtifactExplorer.setToolTipText("Show Artifact Explorer");
+ showArtifactExplorer.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ try {
+ ArtifactExplorer.exploreBranch(teamArt.getWorkingBranch());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ showChangeReport = createNewButton(bComp);
+ showChangeReport.setToolTipText("Show Change Report");
+ showChangeReport.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ teamArt.getBranchMgr().showChangeReport();
+ }
+ });
+
+ deleteBranchButton = createNewButton(bComp);
+ deleteBranchButton.setToolTipText("Delete Working Branch");
+ deleteBranchButton.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ teamArt.getBranchMgr().deleteWorkingBranch(true);
+ refresh();
+ }
+ });
+
+ if (AtsPlugin.getInstance() != null) {
+ createBranchButton.setImage(ImageManager.getImage(FrameworkImage.BRANCH));
+ deleteBranchButton.setImage(ImageManager.getImage(FrameworkImage.TRASH));
+ }
+ if (SkynetGuiPlugin.getInstance() != null) {
+ showArtifactExplorer.setImage(ImageManager.getImage(FrameworkImage.ARTIFACT_EXPLORER));
+ showChangeReport.setImage(ImageManager.getImage(FrameworkImage.BRANCH_CHANGE));
+ }
+ refreshLabel();
+ refreshEnablement();
+ }
+
+ public Button createNewButton(Composite comp) {
+ if (toolkit != null) {
+ return toolkit.createButton(comp, null, SWT.PUSH);
+ }
+ return new Button(comp, SWT.PUSH);
+ }
+
+ public void refreshLabel() {
+ if (!getLabel().equals("")) {
+ try {
+ labelWidget.setText(getLabel() + ": " + (enablement.getWorkingBranch() != null ? enablement.getWorkingBranch().getShortName() : "") + " " + enablement.getStatus().name());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+ }
+
+ public void refreshEnablement() {
+ createBranchButton.setEnabled(enablement.isCreateBranchButtonEnabled());
+ showArtifactExplorer.setEnabled(enablement.isShowArtifactExplorerButtonEnabled());
+ showChangeReport.setEnabled(enablement.isShowChangeReportButtonEnabled());
+ deleteBranchButton.setEnabled(enablement.isDeleteBranchButtonEnabled());
+ }
+
+ public static boolean isPurgeBranchButtonEnabled(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
+ return teamArt.getBranchMgr().isWorkingBranchInWork();
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ }
+
+ @Override
+ public Control getControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public Object getData() {
+ return null;
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public IStatus isValid() {
+ // Need this cause it removes all error items of this namespace
+ return new Status(IStatus.OK, getClass().getSimpleName(), "");
+ }
+
+ @Override
+ public void refresh() {
+ // don't do anything here cause to expensive to check for branch conditions during every refresh
+ }
+
+ public void refreshOnBranchEvent() {
+ if (teamArt == null || teamArt.getBranchMgr() == null || labelWidget == null || labelWidget.isDisposed()) {
+ return;
+ }
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ enablement.refresh();
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(createBranchButton)) {
+ refreshLabel();
+ refreshEnablement();
+ }
+ }
+ });
+ }
+ };
+ Thread thread = new Thread(runnable);
+ thread.start();
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return "";
+ }
+
+ @Override
+ public Result isDirty() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ }
+
+ @Override
+ public void saveToArtifact() {
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) {
+ this.teamArt = (TeamWorkFlowArtifact) artifact;
+ enablement = new XWorkingBranchEnablement(teamArt);
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, int branchId) {
+ refreshOnBranchEvent();
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) {
+ refreshOnBranchEvent();
+ }
+
+ public Button getCreateBranchButton() {
+ return createBranchButton;
+ }
+
+ public Button getShowArtifactExplorerButton() {
+ return showArtifactExplorer;
+ }
+
+ public Button getShowChangeReportButton() {
+ return showChangeReport;
+ }
+
+ public Button getDeleteBranchButton() {
+ return deleteBranchButton;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s", getLabel());
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return AtsUtil.getAtsObjectEventFilters();
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ refreshOnBranchEvent();
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
+ refreshOnBranchEvent();
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java
index a611b1f1303..feb9c8b2c57 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java
@@ -25,6 +25,7 @@ import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.util.AHTML;
import org.eclipse.osee.framework.logging.OseeLevel;
@@ -67,373 +68,375 @@ import org.eclipse.swt.widgets.Tree;
*/
public class XCommitManager extends XWidget implements IArtifactWidget, IMergeBranchEventListener, IBranchEventListener {
- private CommitXManager xCommitManager;
- private IDirtiableEditor editor;
- public final static String normalColor = "#EEEEEE";
- private TeamWorkFlowArtifact teamArt;
- private static final int paddedTableHeightHint = 2;
- private Label extraInfoLabel;
- public final static String WIDGET_ID = ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName();
- private ToolBar toolBar;
-
- public XCommitManager() {
- super("Commit Manager");
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- try {
- if (!teamArt.getBranchMgr().isWorkingBranchInWork() && !teamArt.getBranchMgr().isCommittedBranchExists()) {
- labelWidget.setText(getLabel() + ": No working or committed branches available.");
- } else {
-
- Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- createTaskActionBar(mainComp);
-
- labelWidget.setText(getLabel() + ": ");// If ATS Admin, allow right-click to auto-complete reviews
- if (AtsUtil.isAtsAdmin() && !AtsUtil.isProductionDb()) {
- labelWidget.addListener(SWT.MouseUp, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.button == 3) {
- if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Auto Commit Branches",
- "ATS Admin\n\nAuto Commit Branches?")) {
- return;
- }
- try {
- for (Branch destinationBranch : teamArt.getBranchMgr().getBranchesLeftToCommit()) {
- teamArt.getBranchMgr().commitWorkingBranch(false, true, destinationBranch, true);
- Thread.sleep(1000);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- });
- }
-
- xCommitManager = new CommitXManager(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xCommitManager.getTree().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- xCommitManager.setContentProvider(new XCommitContentProvider(xCommitManager));
- xCommitManager.setLabelProvider(new XCommitLabelProvider(xCommitManager));
-
- if (toolkit != null && xCommitManager.getStatusLabel() != null) {
- toolkit.adapt(xCommitManager.getStatusLabel(), false, false);
- }
-
- setXviewerTree();
- loadTable();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- int lastDefectListSize = 0;
-
- public void setXviewerTree() {
- Tree tree = xCommitManager.getTree();
- int defectListSize = xCommitManager.getTree().getItemCount();
- if (defectListSize == lastDefectListSize) {
- return;
- }
- lastDefectListSize = defectListSize;
- int treeItemHeight = xCommitManager.getTree().getItemHeight();
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = treeItemHeight * (paddedTableHeightHint + defectListSize);
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public void createTaskActionBar(Composite parent) {
-
- // Button composite for state transitions, etc
- Composite bComp = new Composite(parent, SWT.NONE);
- // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
- bComp.setLayout(new GridLayout(2, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite leftComp = new Composite(bComp, SWT.NONE);
- leftComp.setLayout(new GridLayout());
- leftComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(leftComp, SWT.NONE);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
-
- Composite rightComp = new Composite(bComp, SWT.NONE);
- rightComp.setLayout(new GridLayout());
- rightComp.setLayoutData(new GridData(GridData.END));
-
- toolBar = new ToolBar(rightComp, SWT.FLAT | SWT.RIGHT);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- toolBar.setLayoutData(gd);
- ToolItem item = null;
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
- item.setToolTipText("Refresh");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- loadTable();
- }
- });
-
- }
-
- public void loadTable() {
- try {
- if (xCommitManager != null && teamArt != null && xCommitManager.getContentProvider() != null) {
- Collection<ICommitConfigArtifact> configArtSet =
- teamArt.getBranchMgr().getConfigArtifactsConfiguredToCommitTo();
- xCommitManager.setInput(configArtSet);
- xCommitManager.refresh();
- refresh();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @SuppressWarnings("rawtypes")
- public ArrayList<Branch> getSelectedBranches() {
- ArrayList<Branch> items = new ArrayList<Branch>();
- if (xCommitManager == null) {
- return items;
- }
- if (xCommitManager.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) xCommitManager.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((Branch) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- if (xCommitManager == null) {
- return null;
- }
- return xCommitManager.getTree();
- }
-
- @Override
- public void dispose() {
- if (xCommitManager != null) {
- xCommitManager.dispose();
- }
- OseeEventManager.removeListener(this);
- }
-
- @Override
- public void setFocus() {
- if (xCommitManager != null) {
- xCommitManager.getTree().setFocus();
- }
- }
-
- @Override
- public void refresh() {
- if (xCommitManager == null || xCommitManager.getTree() == null || xCommitManager.getTree().isDisposed()) {
- return;
- }
- validate();
- setXviewerTree();
- }
-
- private void updateExtraInfoLabel(final int color, final String infoStr) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(extraInfoLabel)) {
- String currentString = extraInfoLabel.getText();
- if (infoStr == null && currentString != null || infoStr != null && currentString == null || !infoStr.equals(currentString)) {
- extraInfoLabel.setText("Double-click item to perform Action");
- }
- extraInfoLabel.setForeground(Displays.getSystemColor(color));
- }
- }
- });
- }
-
- @Override
- public IStatus isValid() {
- Status returnStatus = new Status(IStatus.OK, getClass().getSimpleName(), "");
- try {
- int backgroundColor = SWT.COLOR_BLACK;
- String infoStr = "Double-click item to perform Action";
- if (xCommitManager != null && xCommitManager.getXCommitViewer() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr() != null) {
- if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isAllObjectsToCommitToConfigured()) {
- infoStr = "All branches must be configured and committed - Double-click item to perform Action";
- backgroundColor = SWT.COLOR_RED;
- returnStatus =
- new Status(IStatus.ERROR, getClass().getSimpleName(),
- "All branches must be configured and committed.");
- } else if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isBranchesAllCommitted()) {
- infoStr = "All branches must be committed - Double-click item to perform Action";
- backgroundColor = SWT.COLOR_RED;
- returnStatus = new Status(IStatus.ERROR, getClass().getSimpleName(), "All branches must be committed.");
- }
- }
- updateExtraInfoLabel(backgroundColor, infoStr);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(IStatus.ERROR, getClass().getSimpleName(), ex.getLocalizedMessage());
- }
- return returnStatus;
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public String toHTML(String labelFont) {
- return AHTML.simplePage("Unhandled");
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- /**
- * @return Returns the xViewer.
- */
- public CommitXManager getXViewer() {
- return xCommitManager;
- }
-
- @Override
- public Object getData() {
- return xCommitManager.getInput();
- }
-
- public IDirtiableEditor getEditor() {
- return editor;
- }
-
- public void setEditor(IDirtiableEditor editor) {
- this.editor = editor;
- }
-
- public void setArtifact(Artifact artifact, String attrName) throws IllegalStateException {
- if (!(artifact instanceof TeamWorkFlowArtifact)) {
- throw new IllegalStateException("Must be TeamWorkflowArtifact, set was a " + artifact.getArtifactTypeName());
- }
- this.teamArt = (TeamWorkFlowArtifact) artifact;
- loadTable();
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- }
-
- /**
- * @return the artifact
- */
- public TeamWorkFlowArtifact getTeamArt() {
- return teamArt;
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, final BranchEventType branchModType, int branchId) throws OseeCoreException {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (branchModType == BranchEventType.MergeConflictResolved) {
- xCommitManager.refresh();
- refresh();
- } else {
- loadTable();
- }
- }
- });
- }
-
- @Override
- public void handleMergeBranchEvent(Sender sender, MergeBranchEventType branchModType, int branchId) throws OseeCoreException {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- xCommitManager.refresh();
- refresh();
- }
- });
- }
-
- @Override
- public Control getErrorMessageControl() {
- return labelWidget;
- }
-
- public String toString() {
- return String.format("%s", getLabel());
- }
-
- @Override
- public void handleBranchEvent(Sender sender, final BranchEvent branchEvent) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (branchEvent.getEventType() == BranchEventType.MergeConflictResolved) {
- xCommitManager.refresh();
- refresh();
- } else {
- loadTable();
- }
- }
- });
-
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return null;
- }
+ private CommitXManager xCommitManager;
+ private IDirtiableEditor editor;
+ public final static String normalColor = "#EEEEEE";
+ private TeamWorkFlowArtifact teamArt;
+ private static final int paddedTableHeightHint = 2;
+ private Label extraInfoLabel;
+ public final static String WIDGET_ID = ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName();
+ private ToolBar toolBar;
+
+ public XCommitManager() {
+ super("Commit Manager");
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ try {
+ if (!teamArt.getBranchMgr().isWorkingBranchInWork() && !teamArt.getBranchMgr().isCommittedBranchExists()) {
+ labelWidget.setText(getLabel() + ": No working or committed branches available.");
+ } else {
+
+ Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ createTaskActionBar(mainComp);
+
+ labelWidget.setText(getLabel() + ": ");// If ATS Admin, allow right-click to auto-complete reviews
+ if (AtsUtil.isAtsAdmin() && !AtsUtil.isProductionDb()) {
+ labelWidget.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (event.button == 3) {
+ if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Auto Commit Branches",
+ "ATS Admin\n\nAuto Commit Branches?")) {
+ return;
+ }
+ try {
+ for (Branch destinationBranch : teamArt.getBranchMgr().getBranchesLeftToCommit()) {
+ teamArt.getBranchMgr().commitWorkingBranch(false, true, destinationBranch, true);
+ Thread.sleep(1000);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ });
+ }
+
+ xCommitManager = new CommitXManager(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ xCommitManager.getTree().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ xCommitManager.setContentProvider(new XCommitContentProvider(xCommitManager));
+ xCommitManager.setLabelProvider(new XCommitLabelProvider(xCommitManager));
+
+ if (toolkit != null && xCommitManager.getStatusLabel() != null) {
+ toolkit.adapt(xCommitManager.getStatusLabel(), false, false);
+ }
+
+ setXviewerTree();
+ loadTable();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ int lastDefectListSize = 0;
+
+ public void setXviewerTree() {
+ Tree tree = xCommitManager.getTree();
+ int defectListSize = xCommitManager.getTree().getItemCount();
+ if (defectListSize == lastDefectListSize) {
+ return;
+ }
+ lastDefectListSize = defectListSize;
+ int treeItemHeight = xCommitManager.getTree().getItemHeight();
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.heightHint = treeItemHeight * (paddedTableHeightHint + defectListSize);
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public void createTaskActionBar(Composite parent) {
+
+ // Button composite for state transitions, etc
+ Composite bComp = new Composite(parent, SWT.NONE);
+ // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+ bComp.setLayout(new GridLayout(2, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite leftComp = new Composite(bComp, SWT.NONE);
+ leftComp.setLayout(new GridLayout());
+ leftComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(leftComp, SWT.NONE);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+
+ Composite rightComp = new Composite(bComp, SWT.NONE);
+ rightComp.setLayout(new GridLayout());
+ rightComp.setLayoutData(new GridData(GridData.END));
+
+ toolBar = new ToolBar(rightComp, SWT.FLAT | SWT.RIGHT);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ toolBar.setLayoutData(gd);
+ ToolItem item = null;
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
+ item.setToolTipText("Refresh");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ loadTable();
+ }
+ });
+
+ }
+
+ public void loadTable() {
+ try {
+ if (xCommitManager != null && teamArt != null && xCommitManager.getContentProvider() != null) {
+ Collection<ICommitConfigArtifact> configArtSet =
+ teamArt.getBranchMgr().getConfigArtifactsConfiguredToCommitTo();
+ xCommitManager.setInput(configArtSet);
+ xCommitManager.refresh();
+ refresh();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ArrayList<Branch> getSelectedBranches() {
+ ArrayList<Branch> items = new ArrayList<Branch>();
+ if (xCommitManager == null) {
+ return items;
+ }
+ if (xCommitManager.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) xCommitManager.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((Branch) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ if (xCommitManager == null) {
+ return null;
+ }
+ return xCommitManager.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ if (xCommitManager != null) {
+ xCommitManager.dispose();
+ }
+ OseeEventManager.removeListener(this);
+ }
+
+ @Override
+ public void setFocus() {
+ if (xCommitManager != null) {
+ xCommitManager.getTree().setFocus();
+ }
+ }
+
+ @Override
+ public void refresh() {
+ if (xCommitManager == null || xCommitManager.getTree() == null || xCommitManager.getTree().isDisposed()) {
+ return;
+ }
+ validate();
+ setXviewerTree();
+ }
+
+ private void updateExtraInfoLabel(final int color, final String infoStr) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(extraInfoLabel)) {
+ String currentString = extraInfoLabel.getText();
+ if (infoStr == null && currentString != null || infoStr != null && currentString == null || !infoStr.equals(currentString)) {
+ extraInfoLabel.setText("Double-click item to perform Action");
+ }
+ extraInfoLabel.setForeground(Displays.getSystemColor(color));
+ }
+ }
+ });
+ }
+
+ @Override
+ public IStatus isValid() {
+ Status returnStatus = new Status(IStatus.OK, getClass().getSimpleName(), "");
+ try {
+ int backgroundColor = SWT.COLOR_BLACK;
+ String infoStr = "Double-click item to perform Action";
+ if (xCommitManager != null && xCommitManager.getXCommitViewer() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr() != null) {
+ if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isAllObjectsToCommitToConfigured()) {
+ infoStr = "All branches must be configured and committed - Double-click item to perform Action";
+ backgroundColor = SWT.COLOR_RED;
+ returnStatus =
+ new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "All branches must be configured and committed.");
+ } else if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isBranchesAllCommitted()) {
+ infoStr = "All branches must be committed - Double-click item to perform Action";
+ backgroundColor = SWT.COLOR_RED;
+ returnStatus = new Status(IStatus.ERROR, getClass().getSimpleName(), "All branches must be committed.");
+ }
+ }
+ updateExtraInfoLabel(backgroundColor, infoStr);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(IStatus.ERROR, getClass().getSimpleName(), ex.getLocalizedMessage());
+ }
+ return returnStatus;
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return AHTML.simplePage("Unhandled");
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public CommitXManager getXViewer() {
+ return xCommitManager;
+ }
+
+ @Override
+ public Object getData() {
+ return xCommitManager.getInput();
+ }
+
+ public IDirtiableEditor getEditor() {
+ return editor;
+ }
+
+ public void setEditor(IDirtiableEditor editor) {
+ this.editor = editor;
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) throws OseeCoreException {
+ if (!(artifact instanceof TeamWorkFlowArtifact)) {
+ throw new OseeStateException("Must be TeamWorkflowArtifact, set was a " + artifact.getArtifactTypeName());
+ }
+ this.teamArt = (TeamWorkFlowArtifact) artifact;
+ loadTable();
+ }
+
+ @Override
+ public Result isDirty() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ }
+
+ @Override
+ public void saveToArtifact() {
+ }
+
+ /**
+ * @return the artifact
+ */
+ public TeamWorkFlowArtifact getTeamArt() {
+ return teamArt;
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, final BranchEventType branchModType, int branchId) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (branchModType == BranchEventType.MergeConflictResolved) {
+ xCommitManager.refresh();
+ refresh();
+ } else {
+ loadTable();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleMergeBranchEvent(Sender sender, MergeBranchEventType branchModType, int branchId) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ xCommitManager.refresh();
+ refresh();
+ }
+ });
+ }
+
+ @Override
+ public Control getErrorMessageControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s", getLabel());
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, final BranchEvent branchEvent) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (branchEvent.getEventType() == BranchEventType.MergeConflictResolved) {
+ xCommitManager.refresh();
+ refresh();
+ } else {
+ loadTable();
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java
index 50545cc2d26..8a1efba1fb0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java
@@ -85,552 +85,555 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
*/
public class XDefectViewer extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener {
- private DefectXViewer xViewer;
- private IDirtiableEditor editor;
- private IReviewArtifact reviewArt;
- public final static String normalColor = "#EEEEEE";
- private static ToolItem newDefectItem, deleteDefectItem;
- private Label extraInfoLabel;
- private Composite parentComposite;
- private static ToolItem expandDefectItem, collapseDefectItem;
- private static Map<IReviewArtifact, Boolean> mapOfReviewArtifacts = new LinkedHashMap<IReviewArtifact, Boolean>();
- private ToolBar toolBar;
- private static Map<IReviewArtifact, Integer> tableHeight = new HashMap<IReviewArtifact, Integer>();
-
- public XDefectViewer() {
- super("Defects");
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- parentComposite = parent;
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- final Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- createTaskActionBar(mainComp);
-
- xViewer = new DefectXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xViewer.setContentProvider(new DefectContentProvider(xViewer));
- xViewer.setLabelProvider(new DefectLabelProvider(xViewer));
- xViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- refreshActionEnablement();
- }
- });
- new ActionContributionItem(xViewer.getCustomizeAction()).fill(toolBar, -1);
- if (toolkit != null) {
- toolkit.adapt(xViewer.getStatusLabel(), false, false);
- }
-
- refreshTableSize();
- // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
-
- final Sash sash = new Sash(parent, SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 3;
- sash.setLayoutData(gd);
- sash.setBackground(Displays.getSystemColor(SWT.COLOR_GRAY));
- sash.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- Rectangle treeRect = xViewer.getTree().getClientArea();
- int newHeight = treeRect.height + e.y;
- setTableHeight(newHeight);
- refreshTableSize();
- mainComp.layout();
- xViewer.refresh();
- if (getForm(mainComp) != null) {
- getForm(mainComp).reflow(true);
- }
- }
- });
-
- loadTable();
- }
-
- private void refreshTableSize() {
- Tree tree = xViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = getTableHeight();
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public void setXviewerTree(boolean expand) {
- }
-
- private int getTableHeight() {
- if (reviewArt != null && tableHeight.containsKey(reviewArt)) {
- return tableHeight.get(reviewArt);
- }
- return 100;
- }
-
- private void setTableHeight(int newHeight) {
- if (reviewArt != null) {
- if (newHeight < 100) newHeight = 100;
- tableHeight.put(reviewArt, newHeight);
- }
- }
-
- public void createTaskActionBar(Composite parent) {
-
- // Button composite for state transitions, etc
- Composite bComp = new Composite(parent, SWT.NONE);
- // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
- bComp.setLayout(new GridLayout(2, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite actionComp = new Composite(bComp, SWT.NONE);
- actionComp.setLayout(new GridLayout());
- actionComp.setLayoutData(new GridData(GridData.END));
-
- toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- toolBar.setLayoutData(gd);
- ToolItem item = null;
-
- expandDefectItem = new ToolItem(toolBar, SWT.PUSH);
- expandDefectItem.setImage(ImageManager.getImage(FrameworkImage.EXPAND_ALL));
- expandDefectItem.setToolTipText("Expand Defect List");
- expandDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- mapOfReviewArtifacts.put(reviewArt, true);
- handleExpandCollapseDefectTableList();
- }
- });
-
- collapseDefectItem = new ToolItem(toolBar, SWT.PUSH);
- collapseDefectItem.setImage(ImageManager.getImage(FrameworkImage.COLLAPSE_ALL));
- collapseDefectItem.setToolTipText("Collapse Defect List");
- collapseDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- mapOfReviewArtifacts.put(reviewArt, false);
- handleExpandCollapseDefectTableList();
- }
- });
-
- newDefectItem = new ToolItem(toolBar, SWT.PUSH);
- newDefectItem.setImage(ImageManager.getImage(FrameworkImage.GREEN_PLUS));
- newDefectItem.setToolTipText("New Defect");
- newDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleNewDefect();
- }
- });
-
- deleteDefectItem = new ToolItem(toolBar, SWT.PUSH);
- deleteDefectItem.setImage(ImageManager.getImage(FrameworkImage.X_RED));
- deleteDefectItem.setToolTipText("Delete Defect");
- deleteDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleDeleteDefect(false);
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
- item.setToolTipText("Refresh Defects");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- loadTable();
- }
- });
-
- createTaskActionBarPulldown(toolBar, actionComp);
-
- Composite labelComp = new Composite(bComp, SWT.NONE);
- labelComp.setLayout(new GridLayout());
- labelComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(labelComp, SWT.NONE);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
-
- refreshActionEnablement();
- }
-
- public void refreshActionEnablement() {
- deleteDefectItem.setEnabled(isEditable() && getSelectedDefectItems().size() > 0);
- newDefectItem.setEnabled(isEditable());
- }
-
- public void createTaskActionBarPulldown(final ToolBar toolBar, Composite composite) {
- final ToolItem dropDown = new ToolItem(toolBar, SWT.DROP_DOWN);
- dropDown.setImage(ImageManager.getImage(FrameworkImage.GEAR));
- final Menu menu = new Menu(composite);
-
- dropDown.addListener(SWT.Selection, new Listener() {
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- if (event.detail == SWT.ARROW) {
- Rectangle rect = dropDown.getBounds();
- Point pt = new Point(rect.x, rect.y + rect.height);
- pt = toolBar.toDisplay(pt);
- menu.setLocation(pt.x, pt.y);
- menu.setVisible(true);
- }
- }
- });
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("Create Defects via simple list");
- item.setEnabled(isEditable());
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleImportDefectsViaList();
- }
- });
-
- }
-
- private void handleExpandCollapseDefectTableList() {
- if (mapOfReviewArtifacts != null && mapOfReviewArtifacts.containsKey(reviewArt) && mapOfReviewArtifacts.get(reviewArt)) {
- setXviewerTree(true);
- } else {
- setXviewerTree(false);
- }
- xViewer.refresh();
- if (getForm(parentComposite) != null) {
- getForm(parentComposite).reflow(true);
- }
- }
-
- public ScrolledForm getForm(Composite composite) {
- ScrolledForm form = null;
- if (composite == null) {
- return null;
- }
- if (composite instanceof ScrolledForm) {
- return (ScrolledForm) composite;
- }
- if (!(composite instanceof ScrolledForm)) {
- form = getForm(composite.getParent());
- }
- return form;
- }
-
- public void loadTable() {
- try {
- if (reviewArt != null && xViewer != null) {
- xViewer.set(reviewArt.getDefectManager().getDefectItems());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- handleExpandCollapseDefectTableList();
- refresh();
- }
-
- public void handleImportDefectsViaList() {
- try {
- EntryDialog ed =
- new EntryDialog(Displays.getActiveShell(), "Create Defects", null,
- "Enter task titles, one per line.", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
- ed.setFillVertically(true);
- if (ed.open() == 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import Review Defects");
- for (String str : ed.getEntry().split("\n")) {
- str = str.replaceAll("\r", "");
- if (!str.equals("")) {
- reviewArt.getDefectManager().addDefectItem(str, false, transaction);
- }
- }
- transaction.execute();
- loadTable();
- notifyXModifiedListeners();
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void handleDeleteDefect(boolean persist) {
- final List<DefectItem> items = getSelectedDefectItems();
- if (items.isEmpty()) {
- AWorkbench.popup("ERROR", "No Defects Selected");
- return;
- }
- StringBuilder builder = new StringBuilder();
- for (DefectItem defectItem : items) {
- builder.append("\"" + defectItem.getDescription() + "\"\n");
- }
-
- boolean delete =
- MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Delete Defects", "Are You Sure You Wish to Delete the Defects(s):\n\n" + builder.toString());
- if (delete) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete Review Defects");
- deleteDefectHelper(items, persist, transaction);
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- private void deleteDefectHelper(List<DefectItem> items, boolean persist, SkynetTransaction transaction) {
- try {
- for (DefectItem defectItem : items) {
- reviewArt.getDefectManager().removeDefectItem(defectItem, persist, transaction);
- xViewer.remove(defectItem);
- }
- loadTable();
- notifyXModifiedListeners();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void handleNewDefect() {
- EntryDialog ed =
- new EntryDialog(Displays.getActiveShell(), "Create New Defect", null,
- "Enter Defect Description", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
- if (ed.open() == 0) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Add Review Defect");
- reviewArt.getDefectManager().addDefectItem(ed.getEntry(), false, transaction);
- transaction.execute();
- notifyXModifiedListeners();
- loadTable();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- @SuppressWarnings("rawtypes")
- public ArrayList<DefectItem> getSelectedDefectItems() {
- ArrayList<DefectItem> items = new ArrayList<DefectItem>();
- if (xViewer == null) {
- return items;
- }
- if (xViewer.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) xViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((DefectItem) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- return xViewer.getTree();
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- xViewer.dispose();
- }
-
- @Override
- public void setFocus() {
- xViewer.getTree().setFocus();
- }
-
- @Override
- public void refresh() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- xViewer.refresh();
- validate();
- refreshActionEnablement();
- }
-
- @Override
- public IStatus isValid() {
- try {
- if (isRequiredEntry() && xViewer.getTree().getItemCount() == 0) {
- extraInfoLabel.setText("At least one defect entry is required. Select \"New Defect\" to add.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
- return new Status(IStatus.ERROR, getClass().getSimpleName(), "At least one defect entry is required");
- }
- if (reviewArt != null) {
- for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
- if (item.isClosed() == false || item.getDisposition() == Disposition.None || item.getSeverity() == Severity.None && item.getDisposition() != Disposition.Duplicate && item.getDisposition() != Disposition.Reject) {
- extraInfoLabel.setText("All items must be marked for severity, disposition and closed. Select icon in cell or right-click to update field.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
- return new Status(IStatus.ERROR, getClass().getSimpleName(),
- "Review not complete until all items are marked for severity, disposition and closed");
- }
- }
- }
- extraInfoLabel.setText("Select \"New Defect\" to add. Select icon in cell or right-click to update field.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(IStatus.ERROR, getClass().getSimpleName(),
- "Exception validating defects. See log for details. " + ex);
- }
- // Need this cause it removes all error items of this namespace
- return new Status(IStatus.OK, getClass().getSimpleName(), "");
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public String toHTML(String labelFont) {
- if (getXViewer().getTree().getItemCount() == 0) {
- return "";
- }
- StringBuffer html = new StringBuffer();
- try {
- html.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Tasks"));
- html.append(AHTML.startBorderTable(100, normalColor, ""));
- html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Date", "User", "Location", "Description",
- "Severity", "Disposition", "Injection Activity", "Resolution", "Location", "Closted"}));
- for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
- html.append(AHTML.addRowMultiColumnTable(new String[] {item.getCreatedDate(XDate.MMDDYY),
- item.getUser().getName(), item.getLocation(), item.getDescription(), item.getSeverity().name(),
- item.getDisposition().name(), item.getInjectionActivity().name(), item.getResolution(),
- item.isClosed() + ""}));
- }
- html.append(AHTML.endBorderTable());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- return "Defect Item Exception - " + ex.getLocalizedMessage();
- }
- return html.toString();
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- /**
- * @return Returns the xViewer.
- */
- public DefectXViewer getXViewer() {
- return xViewer;
- }
-
- @Override
- public Object getData() {
- return xViewer.getInput();
- }
-
- public IDirtiableEditor getEditor() {
- return editor;
- }
-
- public void setEditor(IDirtiableEditor editor) {
- this.editor = editor;
- }
-
- public IReviewArtifact getReviewArt() {
- return reviewArt;
- }
-
- public void setReviewArt(IReviewArtifact reviewArt) {
- this.reviewArt = reviewArt;
- if (xViewer != null) {
- loadTable();
- }
- }
-
- public void setArtifact(Artifact artifact, String attrName) {
- setReviewArt((IReviewArtifact) artifact);
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- // DefectViewer uses artifact as storage mechanism; nothing to do here
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- // DefectViewer uses artifact as storage mechanism which already determines dirty
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- // Nothing to revert cause artifact will be reverted
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
- if (transData.getBranchId() != AtsUtil.getAtsBranch().getId()) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- if (transData.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
- loadTable();
- } else {
- refresh();
- }
- }
- });
- }
-
- @Override
- public Control getErrorMessageControl() {
- return labelWidget;
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getReviewArtifactTypeEventFilter());
- }
-
- @Override
- public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
- if (!artifactEvent.isHasEvent(reviewArt.getArtifact())) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- if (artifactEvent.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
- loadTable();
- } else {
- refresh();
- }
- }
- });
- }
+ private DefectXViewer xViewer;
+ private IDirtiableEditor editor;
+ private IReviewArtifact reviewArt;
+ public final static String normalColor = "#EEEEEE";
+ private static ToolItem newDefectItem, deleteDefectItem;
+ private Label extraInfoLabel;
+ private Composite parentComposite;
+ private static ToolItem expandDefectItem, collapseDefectItem;
+ private static Map<IReviewArtifact, Boolean> mapOfReviewArtifacts = new LinkedHashMap<IReviewArtifact, Boolean>();
+ private ToolBar toolBar;
+ private static Map<IReviewArtifact, Integer> tableHeight = new HashMap<IReviewArtifact, Integer>();
+
+ public XDefectViewer() {
+ super("Defects");
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ parentComposite = parent;
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ final Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ createTaskActionBar(mainComp);
+
+ xViewer = new DefectXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ xViewer.setContentProvider(new DefectContentProvider(xViewer));
+ xViewer.setLabelProvider(new DefectLabelProvider(xViewer));
+ xViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ refreshActionEnablement();
+ }
+ });
+ new ActionContributionItem(xViewer.getCustomizeAction()).fill(toolBar, -1);
+ if (toolkit != null) {
+ toolkit.adapt(xViewer.getStatusLabel(), false, false);
+ }
+
+ refreshTableSize();
+ // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
+
+ final Sash sash = new Sash(parent, SWT.HORIZONTAL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 3;
+ sash.setLayoutData(gd);
+ sash.setBackground(Displays.getSystemColor(SWT.COLOR_GRAY));
+ sash.addListener(SWT.MouseUp, new Listener() {
+ public void handleEvent(Event e) {
+ Rectangle treeRect = xViewer.getTree().getClientArea();
+ int newHeight = treeRect.height + e.y;
+ setTableHeight(newHeight);
+ refreshTableSize();
+ mainComp.layout();
+ xViewer.refresh();
+ if (getForm(mainComp) != null) {
+ getForm(mainComp).reflow(true);
+ }
+ }
+ });
+
+ loadTable();
+ }
+
+ private void refreshTableSize() {
+ Tree tree = xViewer.getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = getTableHeight();
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public void setXviewerTree(boolean expand) {
+ }
+
+ private int getTableHeight() {
+ if (reviewArt != null && tableHeight.containsKey(reviewArt)) {
+ return tableHeight.get(reviewArt);
+ }
+ return 100;
+ }
+
+ private void setTableHeight(int newHeight) {
+ if (reviewArt != null) {
+ if (newHeight < 100) {
+ newHeight = 100;
+ }
+ tableHeight.put(reviewArt, newHeight);
+ }
+ }
+
+ public void createTaskActionBar(Composite parent) {
+
+ // Button composite for state transitions, etc
+ Composite bComp = new Composite(parent, SWT.NONE);
+ // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+ bComp.setLayout(new GridLayout(2, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite actionComp = new Composite(bComp, SWT.NONE);
+ actionComp.setLayout(new GridLayout());
+ actionComp.setLayoutData(new GridData(GridData.END));
+
+ toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ toolBar.setLayoutData(gd);
+ ToolItem item = null;
+
+ expandDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ expandDefectItem.setImage(ImageManager.getImage(FrameworkImage.EXPAND_ALL));
+ expandDefectItem.setToolTipText("Expand Defect List");
+ expandDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ mapOfReviewArtifacts.put(reviewArt, true);
+ handleExpandCollapseDefectTableList();
+ }
+ });
+
+ collapseDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ collapseDefectItem.setImage(ImageManager.getImage(FrameworkImage.COLLAPSE_ALL));
+ collapseDefectItem.setToolTipText("Collapse Defect List");
+ collapseDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ mapOfReviewArtifacts.put(reviewArt, false);
+ handleExpandCollapseDefectTableList();
+ }
+ });
+
+ newDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ newDefectItem.setImage(ImageManager.getImage(FrameworkImage.GREEN_PLUS));
+ newDefectItem.setToolTipText("New Defect");
+ newDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleNewDefect();
+ }
+ });
+
+ deleteDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ deleteDefectItem.setImage(ImageManager.getImage(FrameworkImage.X_RED));
+ deleteDefectItem.setToolTipText("Delete Defect");
+ deleteDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDeleteDefect(false);
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
+ item.setToolTipText("Refresh Defects");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ loadTable();
+ }
+ });
+
+ createTaskActionBarPulldown(toolBar, actionComp);
+
+ Composite labelComp = new Composite(bComp, SWT.NONE);
+ labelComp.setLayout(new GridLayout());
+ labelComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(labelComp, SWT.NONE);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+
+ refreshActionEnablement();
+ }
+
+ public void refreshActionEnablement() {
+ deleteDefectItem.setEnabled(isEditable() && getSelectedDefectItems().size() > 0);
+ newDefectItem.setEnabled(isEditable());
+ }
+
+ public void createTaskActionBarPulldown(final ToolBar toolBar, Composite composite) {
+ final ToolItem dropDown = new ToolItem(toolBar, SWT.DROP_DOWN);
+ dropDown.setImage(ImageManager.getImage(FrameworkImage.GEAR));
+ final Menu menu = new Menu(composite);
+
+ dropDown.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(org.eclipse.swt.widgets.Event event) {
+ if (event.detail == SWT.ARROW) {
+ Rectangle rect = dropDown.getBounds();
+ Point pt = new Point(rect.x, rect.y + rect.height);
+ pt = toolBar.toDisplay(pt);
+ menu.setLocation(pt.x, pt.y);
+ menu.setVisible(true);
+ }
+ }
+ });
+
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Create Defects via simple list");
+ item.setEnabled(isEditable());
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleImportDefectsViaList();
+ }
+ });
+
+ }
+
+ private void handleExpandCollapseDefectTableList() {
+ if (mapOfReviewArtifacts != null && mapOfReviewArtifacts.containsKey(reviewArt) && mapOfReviewArtifacts.get(reviewArt)) {
+ setXviewerTree(true);
+ } else {
+ setXviewerTree(false);
+ }
+ xViewer.refresh();
+ if (getForm(parentComposite) != null) {
+ getForm(parentComposite).reflow(true);
+ }
+ }
+
+ public ScrolledForm getForm(Composite composite) {
+ ScrolledForm form = null;
+ if (composite == null) {
+ return null;
+ }
+ if (composite instanceof ScrolledForm) {
+ return (ScrolledForm) composite;
+ }
+ if (!(composite instanceof ScrolledForm)) {
+ form = getForm(composite.getParent());
+ }
+ return form;
+ }
+
+ public void loadTable() {
+ try {
+ if (reviewArt != null && xViewer != null) {
+ xViewer.set(reviewArt.getDefectManager().getDefectItems());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ handleExpandCollapseDefectTableList();
+ refresh();
+ }
+
+ public void handleImportDefectsViaList() {
+ try {
+ EntryDialog ed =
+ new EntryDialog(Displays.getActiveShell(), "Create Defects", null,
+ "Enter task titles, one per line.", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
+ ed.setFillVertically(true);
+ if (ed.open() == 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import Review Defects");
+ for (String str : ed.getEntry().split("\n")) {
+ str = str.replaceAll("\r", "");
+ if (!str.equals("")) {
+ reviewArt.getDefectManager().addDefectItem(str, false, transaction);
+ }
+ }
+ transaction.execute();
+ loadTable();
+ notifyXModifiedListeners();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void handleDeleteDefect(boolean persist) {
+ final List<DefectItem> items = getSelectedDefectItems();
+ if (items.isEmpty()) {
+ AWorkbench.popup("ERROR", "No Defects Selected");
+ return;
+ }
+ StringBuilder builder = new StringBuilder();
+ for (DefectItem defectItem : items) {
+ builder.append("\"" + defectItem.getDescription() + "\"\n");
+ }
+
+ boolean delete =
+ MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Delete Defects", "Are You Sure You Wish to Delete the Defects(s):\n\n" + builder.toString());
+ if (delete) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete Review Defects");
+ deleteDefectHelper(items, persist, transaction);
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ private void deleteDefectHelper(List<DefectItem> items, boolean persist, SkynetTransaction transaction) {
+ try {
+ for (DefectItem defectItem : items) {
+ reviewArt.getDefectManager().removeDefectItem(defectItem, persist, transaction);
+ xViewer.remove(defectItem);
+ }
+ loadTable();
+ notifyXModifiedListeners();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void handleNewDefect() {
+ EntryDialog ed =
+ new EntryDialog(Displays.getActiveShell(), "Create New Defect", null, "Enter Defect Description",
+ MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
+ if (ed.open() == 0) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Add Review Defect");
+ reviewArt.getDefectManager().addDefectItem(ed.getEntry(), false, transaction);
+ transaction.execute();
+ notifyXModifiedListeners();
+ loadTable();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ArrayList<DefectItem> getSelectedDefectItems() {
+ ArrayList<DefectItem> items = new ArrayList<DefectItem>();
+ if (xViewer == null) {
+ return items;
+ }
+ if (xViewer.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) xViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((DefectItem) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ return xViewer.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ xViewer.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ xViewer.getTree().setFocus();
+ }
+
+ @Override
+ public void refresh() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ xViewer.refresh();
+ validate();
+ refreshActionEnablement();
+ }
+
+ @Override
+ public IStatus isValid() {
+ try {
+ if (isRequiredEntry() && xViewer.getTree().getItemCount() == 0) {
+ extraInfoLabel.setText("At least one defect entry is required. Select \"New Defect\" to add.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ return new Status(IStatus.ERROR, getClass().getSimpleName(), "At least one defect entry is required");
+ }
+ if (reviewArt != null) {
+ for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
+ if (item.isClosed() == false || item.getDisposition() == Disposition.None || item.getSeverity() == Severity.None && item.getDisposition() != Disposition.Duplicate && item.getDisposition() != Disposition.Reject) {
+ extraInfoLabel.setText("All items must be marked for severity, disposition and closed. Select icon in cell or right-click to update field.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ return new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "Review not complete until all items are marked for severity, disposition and closed");
+ }
+ }
+ }
+ extraInfoLabel.setText("Select \"New Defect\" to add. Select icon in cell or right-click to update field.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "Exception validating defects. See log for details. " + ex);
+ }
+ // Need this cause it removes all error items of this namespace
+ return new Status(IStatus.OK, getClass().getSimpleName(), "");
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ if (getXViewer().getTree().getItemCount() == 0) {
+ return "";
+ }
+ StringBuffer html = new StringBuffer();
+ try {
+ html.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Tasks"));
+ html.append(AHTML.startBorderTable(100, normalColor, ""));
+ html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Date", "User", "Location", "Description",
+ "Severity", "Disposition", "Injection Activity", "Resolution", "Location", "Closted"}));
+ for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
+ html.append(AHTML.addRowMultiColumnTable(new String[] {item.getCreatedDate(XDate.MMDDYY),
+ item.getUser().getName(), item.getLocation(), item.getDescription(), item.getSeverity().name(),
+ item.getDisposition().name(), item.getInjectionActivity().name(), item.getResolution(),
+ item.isClosed() + ""}));
+ }
+ html.append(AHTML.endBorderTable());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ return "Defect Item Exception - " + ex.getLocalizedMessage();
+ }
+ return html.toString();
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public DefectXViewer getXViewer() {
+ return xViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return xViewer.getInput();
+ }
+
+ public IDirtiableEditor getEditor() {
+ return editor;
+ }
+
+ public void setEditor(IDirtiableEditor editor) {
+ this.editor = editor;
+ }
+
+ public IReviewArtifact getReviewArt() {
+ return reviewArt;
+ }
+
+ public void setReviewArt(IReviewArtifact reviewArt) {
+ this.reviewArt = reviewArt;
+ if (xViewer != null) {
+ loadTable();
+ }
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) {
+ setReviewArt((IReviewArtifact) artifact);
+ }
+
+ @Override
+ public void saveToArtifact() {
+ // DefectViewer uses artifact as storage mechanism; nothing to do here
+ }
+
+ @Override
+ public Result isDirty() {
+ // DefectViewer uses artifact as storage mechanism which already determines dirty
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ // Nothing to revert cause artifact will be reverted
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
+ if (transData.getBranchId() != AtsUtil.getAtsBranch().getId()) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ if (transData.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
+ loadTable();
+ } else {
+ refresh();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Control getErrorMessageControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getReviewArtifactTypeEventFilter());
+ }
+
+ @Override
+ public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
+ if (!artifactEvent.isHasEvent(reviewArt.getArtifact())) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ if (artifactEvent.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
+ loadTable();
+ } else {
+ refresh();
+ }
+ }
+ });
+ }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java
index aa6fec6fb2a..88a55ea832c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/XUserRoleViewer.java
@@ -77,447 +77,452 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
*/
public class XUserRoleViewer extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener {
- private UserRoleXViewer xViewer;
- private IDirtiableEditor editor;
- private IReviewArtifact reviewArt;
- public final static String normalColor = "#EEEEEE";
- private static ToolItem newUserRoleItem, deleteUserRoleItem;
- private Label extraInfoLabel;
- private ToolBar toolBar;
- private static Map<IReviewArtifact, Integer> tableHeight = new HashMap<IReviewArtifact, Integer>();
-
- public XUserRoleViewer() {
- super("Roles");
-
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- final Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- createTaskActionBar(mainComp);
-
- xViewer = new UserRoleXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xViewer.setContentProvider(new UserRoleContentProvider(xViewer));
- xViewer.setLabelProvider(new UserRoleLabelProvider(xViewer));
- xViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- refreshActionEnablement();
- }
- });
- new ActionContributionItem(xViewer.getCustomizeAction()).fill(toolBar, -1);
-
- if (toolkit != null) {
- toolkit.adapt(xViewer.getStatusLabel(), false, false);
- }
-
- refreshTableSize();
- // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
-
- final Sash sash = new Sash(parent, SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 3;
- sash.setLayoutData(gd);
- sash.setBackground(Displays.getSystemColor(SWT.COLOR_GRAY));
- sash.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- Rectangle treeRect = xViewer.getTree().getClientArea();
- int newHeight = treeRect.height + e.y;
- setTableHeight(newHeight);
- refreshTableSize();
- mainComp.layout();
- xViewer.refresh();
- if (getForm(mainComp) != null) {
- getForm(mainComp).reflow(true);
- }
- }
- });
-
- loadTable();
- }
-
- private void refreshTableSize() {
- Tree tree = xViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = getTableHeight();
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public ScrolledForm getForm(Composite composite) {
- ScrolledForm form = null;
- if (composite == null) {
- return null;
- }
- if (composite instanceof ScrolledForm) {
- return (ScrolledForm) composite;
- }
- if (!(composite instanceof ScrolledForm)) {
- form = getForm(composite.getParent());
- }
- return form;
- }
-
- private int getTableHeight() {
- if (reviewArt != null && tableHeight.containsKey(reviewArt)) {
- return tableHeight.get(reviewArt);
- }
- return 100;
- }
-
- private void setTableHeight(int newHeight) {
- if (reviewArt != null) {
- if (newHeight < 100) newHeight = 100;
- tableHeight.put(reviewArt, newHeight);
- }
- }
-
- public void createTaskActionBar(Composite parent) {
-
- // Button composite for state transitions, etc
- Composite bComp = new Composite(parent, SWT.NONE);
- // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
- bComp.setLayout(new GridLayout(2, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite actionComp = new Composite(bComp, SWT.NONE);
- actionComp.setLayout(new GridLayout());
- actionComp.setLayoutData(new GridData(GridData.END));
-
- toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- toolBar.setLayoutData(gd);
- ToolItem item = null;
-
- newUserRoleItem = new ToolItem(toolBar, SWT.PUSH);
- newUserRoleItem.setImage(ImageManager.getImage(FrameworkImage.USER_ADD));
- newUserRoleItem.setToolTipText("New Role");
- newUserRoleItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleNewUserRole();
- }
- });
-
- deleteUserRoleItem = new ToolItem(toolBar, SWT.PUSH);
- deleteUserRoleItem.setImage(ImageManager.getImage(FrameworkImage.X_RED));
- deleteUserRoleItem.setToolTipText("Delete Role");
- deleteUserRoleItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleDeleteUserRole(false);
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
- item.setToolTipText("Refresh Roles");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- loadTable();
- }
- });
-
- Composite labelComp = new Composite(bComp, SWT.NONE);
- labelComp.setLayout(new GridLayout());
- labelComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(labelComp, SWT.NONE);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
-
- refreshActionEnablement();
- }
-
- public void refreshActionEnablement() {
- if (deleteUserRoleItem != null && !deleteUserRoleItem.isDisposed()) {
- deleteUserRoleItem.setEnabled(isEditable() && getSelectedUserRoleItems().size() > 0);
- }
- if (newUserRoleItem != null && !newUserRoleItem.isDisposed()) {
- newUserRoleItem.setEnabled(isEditable());
- }
- }
-
- public void loadTable() {
- try {
- if (reviewArt != null && xViewer != null) {
- xViewer.set(reviewArt.getUserRoleManager().getUserRoles());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- refresh();
- }
-
- public void handleDeleteUserRole(boolean persist) {
- final List<UserRole> items = getSelectedUserRoleItems();
- if (items.isEmpty()) {
- AWorkbench.popup("ERROR", "No Roles Selected");
- return;
- }
- StringBuilder builder = new StringBuilder();
- for (UserRole userRole : items) {
- builder.append("\"" + userRole.toString() + "\"\n");
- }
-
- boolean delete =
- MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Delete Roles",
- "Are You Sure You Wish to Delete the Roles(s):\n\n" + builder.toString());
- if (delete) {
- try {
- SkynetTransaction transaction =
- new SkynetTransaction(reviewArt.getArtifact().getBranch(), "Delete Review Roles");
- removeUserRoleHelper(items, persist, transaction);
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- private void removeUserRoleHelper(List<UserRole> items, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- for (UserRole userRole : items) {
- reviewArt.getUserRoleManager().removeUserRole(userRole, persist, transaction);
- xViewer.remove(userRole);
- }
- loadTable();
- notifyXModifiedListeners();
- }
-
- public void handleNewUserRole() {
- try {
- SkynetTransaction transaction = new SkynetTransaction(reviewArt.getArtifact().getBranch(), "Add Review Roles");
- reviewArt.getUserRoleManager().addOrUpdateUserRole(new UserRole(), false, transaction);
- transaction.execute();
- notifyXModifiedListeners();
- loadTable();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @SuppressWarnings("rawtypes")
- public ArrayList<UserRole> getSelectedUserRoleItems() {
- ArrayList<UserRole> items = new ArrayList<UserRole>();
- if (xViewer == null) {
- return items;
- }
- if (xViewer.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) xViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((UserRole) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- return xViewer.getTree();
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- xViewer.dispose();
- }
-
- @Override
- public void setFocus() {
- xViewer.getTree().setFocus();
- }
-
- @Override
- public void refresh() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- xViewer.refresh();
- validate();
- refreshActionEnablement();
- }
-
- @Override
- public IStatus isValid() {
- try {
- if (isRequiredEntry() && xViewer.getTree().getItemCount() == 0) {
- extraInfoLabel.setText("At least one role entry is required. Select \"New Role\" to add.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
- return new Status(IStatus.ERROR, getClass().getSimpleName(), "At least one role entry is required");
- }
- IStatus result = reviewArt.isUserRoleValid(getClass().getSimpleName());
- if (!result.isOK()) {
- extraInfoLabel.setText(result.getMessage() + " - Select \"New Role\" to add. Select icon in cell to update value.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
- return result;
- }
- extraInfoLabel.setText("Select \"New Role\" to add. Select icon in cell to update value.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return new Status(IStatus.ERROR, getClass().getSimpleName(),
- "Exception validating roles. See log for details. " + ex.getLocalizedMessage(), ex);
- }
- // Need this cause it removes all error items of this namespace
- return new Status(IStatus.OK, getClass().getSimpleName(), "");
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public String toHTML(String labelFont) {
- StringBuffer html = new StringBuffer();
- try {
- html.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Tasks"));
- html.append(AHTML.startBorderTable(100, normalColor, ""));
- html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Role", "User", "Hours", "Major", "Minor",
- "Issues"}));
- for (UserRole item : reviewArt.getUserRoleManager().getUserRoles()) {
- html.append(AHTML.addRowMultiColumnTable(new String[] {item.getRole().name(), item.getUser().getName(),
- item.getHoursSpentStr(), reviewArt.getUserRoleManager().getNumMajor(item.getUser()) + "",
- reviewArt.getUserRoleManager().getNumMinor(item.getUser()) + "",
- reviewArt.getUserRoleManager().getNumIssues(item.getUser()) + ""}));
- }
- html.append(AHTML.endBorderTable());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- return "User Role Item Exception - " + ex.getLocalizedMessage();
- }
- return html.toString();
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- /**
- * @return Returns the xViewer.
- */
- public UserRoleXViewer getXViewer() {
- return xViewer;
- }
-
- @Override
- public Object getData() {
- return xViewer.getInput();
- }
-
- public IDirtiableEditor getEditor() {
- return editor;
- }
-
- public void setEditor(IDirtiableEditor editor) {
- this.editor = editor;
- }
-
- public IReviewArtifact getReviewArt() {
- return reviewArt;
- }
-
- public void setReviewArt(IReviewArtifact reviewArt) {
- this.reviewArt = reviewArt;
- if (xViewer != null) {
- loadTable();
- }
- }
-
- public void setArtifact(Artifact artifact, String attrName) {
- setReviewArt((IReviewArtifact) artifact);
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- // RoleViewer uses artifact as storage mechanism, nothing to save
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- // RoleViewer uses artifact as storage mechanism which already determines dirty
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- // Nothing to revert cause artifact will be reverted
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
- if (transData.getBranchId() != AtsUtil.getAtsBranch().getId()) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- if (transData.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
- loadTable();
- } else {
- refresh();
- }
- }
- });
- }
-
- @Override
- public Control getErrorMessageControl() {
- return labelWidget;
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getReviewArtifactTypeEventFilter());
- }
-
- @Override
- public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
- if (!artifactEvent.isHasEvent(reviewArt.getArtifact())) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- if (artifactEvent.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
- loadTable();
- } else {
- refresh();
- }
- }
- });
- }
+ private UserRoleXViewer xViewer;
+ private IDirtiableEditor editor;
+ private IReviewArtifact reviewArt;
+ public final static String normalColor = "#EEEEEE";
+ private static ToolItem newUserRoleItem, deleteUserRoleItem;
+ private Label extraInfoLabel;
+ private ToolBar toolBar;
+ private static Map<IReviewArtifact, Integer> tableHeight = new HashMap<IReviewArtifact, Integer>();
+
+ public XUserRoleViewer() {
+ super("Roles");
+
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ final Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ createTaskActionBar(mainComp);
+
+ xViewer = new UserRoleXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ xViewer.setContentProvider(new UserRoleContentProvider(xViewer));
+ xViewer.setLabelProvider(new UserRoleLabelProvider(xViewer));
+ xViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ refreshActionEnablement();
+ }
+ });
+ new ActionContributionItem(xViewer.getCustomizeAction()).fill(toolBar, -1);
+
+ if (toolkit != null) {
+ toolkit.adapt(xViewer.getStatusLabel(), false, false);
+ }
+
+ refreshTableSize();
+ // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
+
+ final Sash sash = new Sash(parent, SWT.HORIZONTAL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 3;
+ sash.setLayoutData(gd);
+ sash.setBackground(Displays.getSystemColor(SWT.COLOR_GRAY));
+ sash.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ Rectangle treeRect = xViewer.getTree().getClientArea();
+ int newHeight = treeRect.height + e.y;
+ setTableHeight(newHeight);
+ refreshTableSize();
+ mainComp.layout();
+ xViewer.refresh();
+ if (getForm(mainComp) != null) {
+ getForm(mainComp).reflow(true);
+ }
+ }
+ });
+
+ loadTable();
+ }
+
+ private void refreshTableSize() {
+ Tree tree = xViewer.getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = getTableHeight();
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public ScrolledForm getForm(Composite composite) {
+ ScrolledForm form = null;
+ if (composite == null) {
+ return null;
+ }
+ if (composite instanceof ScrolledForm) {
+ return (ScrolledForm) composite;
+ }
+ if (!(composite instanceof ScrolledForm)) {
+ form = getForm(composite.getParent());
+ }
+ return form;
+ }
+
+ private int getTableHeight() {
+ if (reviewArt != null && tableHeight.containsKey(reviewArt)) {
+ return tableHeight.get(reviewArt);
+ }
+ return 100;
+ }
+
+ private void setTableHeight(int newHeight) {
+ if (reviewArt != null) {
+ if (newHeight < 100) {
+ newHeight = 100;
+ }
+ tableHeight.put(reviewArt, newHeight);
+ }
+ }
+
+ public void createTaskActionBar(Composite parent) {
+
+ // Button composite for state transitions, etc
+ Composite bComp = new Composite(parent, SWT.NONE);
+ // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+ bComp.setLayout(new GridLayout(2, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite actionComp = new Composite(bComp, SWT.NONE);
+ actionComp.setLayout(new GridLayout());
+ actionComp.setLayoutData(new GridData(GridData.END));
+
+ toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ toolBar.setLayoutData(gd);
+ ToolItem item = null;
+
+ newUserRoleItem = new ToolItem(toolBar, SWT.PUSH);
+ newUserRoleItem.setImage(ImageManager.getImage(FrameworkImage.USER_ADD));
+ newUserRoleItem.setToolTipText("New Role");
+ newUserRoleItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleNewUserRole();
+ }
+ });
+
+ deleteUserRoleItem = new ToolItem(toolBar, SWT.PUSH);
+ deleteUserRoleItem.setImage(ImageManager.getImage(FrameworkImage.X_RED));
+ deleteUserRoleItem.setToolTipText("Delete Role");
+ deleteUserRoleItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDeleteUserRole(false);
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
+ item.setToolTipText("Refresh Roles");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ loadTable();
+ }
+ });
+
+ Composite labelComp = new Composite(bComp, SWT.NONE);
+ labelComp.setLayout(new GridLayout());
+ labelComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(labelComp, SWT.NONE);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+
+ refreshActionEnablement();
+ }
+
+ public void refreshActionEnablement() {
+ if (deleteUserRoleItem != null && !deleteUserRoleItem.isDisposed()) {
+ deleteUserRoleItem.setEnabled(isEditable() && getSelectedUserRoleItems().size() > 0);
+ }
+ if (newUserRoleItem != null && !newUserRoleItem.isDisposed()) {
+ newUserRoleItem.setEnabled(isEditable());
+ }
+ }
+
+ public void loadTable() {
+ try {
+ if (reviewArt != null && xViewer != null) {
+ xViewer.set(reviewArt.getUserRoleManager().getUserRoles());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ refresh();
+ }
+
+ public void handleDeleteUserRole(boolean persist) {
+ final List<UserRole> items = getSelectedUserRoleItems();
+ if (items.isEmpty()) {
+ AWorkbench.popup("ERROR", "No Roles Selected");
+ return;
+ }
+ StringBuilder builder = new StringBuilder();
+ for (UserRole userRole : items) {
+ builder.append("\"" + userRole.toString() + "\"\n");
+ }
+
+ boolean delete =
+ MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Delete Roles", "Are You Sure You Wish to Delete the Roles(s):\n\n" + builder.toString());
+ if (delete) {
+ try {
+ SkynetTransaction transaction =
+ new SkynetTransaction(reviewArt.getArtifact().getBranch(), "Delete Review Roles");
+ removeUserRoleHelper(items, persist, transaction);
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ private void removeUserRoleHelper(List<UserRole> items, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ for (UserRole userRole : items) {
+ reviewArt.getUserRoleManager().removeUserRole(userRole, persist, transaction);
+ xViewer.remove(userRole);
+ }
+ loadTable();
+ notifyXModifiedListeners();
+ }
+
+ public void handleNewUserRole() {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(reviewArt.getArtifact().getBranch(), "Add Review Roles");
+ reviewArt.getUserRoleManager().addOrUpdateUserRole(new UserRole(), false, transaction);
+ transaction.execute();
+ notifyXModifiedListeners();
+ loadTable();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ArrayList<UserRole> getSelectedUserRoleItems() {
+ ArrayList<UserRole> items = new ArrayList<UserRole>();
+ if (xViewer == null) {
+ return items;
+ }
+ if (xViewer.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) xViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((UserRole) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ return xViewer.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ xViewer.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ xViewer.getTree().setFocus();
+ }
+
+ @Override
+ public void refresh() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ xViewer.refresh();
+ validate();
+ refreshActionEnablement();
+ }
+
+ @Override
+ public IStatus isValid() {
+ try {
+ if (isRequiredEntry() && xViewer.getTree().getItemCount() == 0) {
+ extraInfoLabel.setText("At least one role entry is required. Select \"New Role\" to add.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ return new Status(IStatus.ERROR, getClass().getSimpleName(), "At least one role entry is required");
+ }
+ IStatus result = reviewArt.isUserRoleValid(getClass().getSimpleName());
+ if (!result.isOK()) {
+ extraInfoLabel.setText(result.getMessage() + " - Select \"New Role\" to add. Select icon in cell to update value.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ return result;
+ }
+ extraInfoLabel.setText("Select \"New Role\" to add. Select icon in cell to update value.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "Exception validating roles. See log for details. " + ex.getLocalizedMessage(), ex);
+ }
+ // Need this cause it removes all error items of this namespace
+ return new Status(IStatus.OK, getClass().getSimpleName(), "");
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ StringBuffer html = new StringBuffer();
+ try {
+ html.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Tasks"));
+ html.append(AHTML.startBorderTable(100, normalColor, ""));
+ html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Role", "User", "Hours", "Major", "Minor",
+ "Issues"}));
+ for (UserRole item : reviewArt.getUserRoleManager().getUserRoles()) {
+ html.append(AHTML.addRowMultiColumnTable(new String[] {item.getRole().name(), item.getUser().getName(),
+ item.getHoursSpentStr(), reviewArt.getUserRoleManager().getNumMajor(item.getUser()) + "",
+ reviewArt.getUserRoleManager().getNumMinor(item.getUser()) + "",
+ reviewArt.getUserRoleManager().getNumIssues(item.getUser()) + ""}));
+ }
+ html.append(AHTML.endBorderTable());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ return "User Role Item Exception - " + ex.getLocalizedMessage();
+ }
+ return html.toString();
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public UserRoleXViewer getXViewer() {
+ return xViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return xViewer.getInput();
+ }
+
+ public IDirtiableEditor getEditor() {
+ return editor;
+ }
+
+ public void setEditor(IDirtiableEditor editor) {
+ this.editor = editor;
+ }
+
+ public IReviewArtifact getReviewArt() {
+ return reviewArt;
+ }
+
+ public void setReviewArt(IReviewArtifact reviewArt) {
+ this.reviewArt = reviewArt;
+ if (xViewer != null) {
+ loadTable();
+ }
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) {
+ setReviewArt((IReviewArtifact) artifact);
+ }
+
+ @Override
+ public void saveToArtifact() {
+ // RoleViewer uses artifact as storage mechanism, nothing to save
+ }
+
+ @Override
+ public Result isDirty() {
+ // RoleViewer uses artifact as storage mechanism which already determines dirty
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ // Nothing to revert cause artifact will be reverted
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
+ if (transData.getBranchId() != AtsUtil.getAtsBranch().getId()) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ if (transData.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
+ loadTable();
+ } else {
+ refresh();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Control getErrorMessageControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getReviewArtifactTypeEventFilter());
+ }
+
+ @Override
+ public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
+ if (!artifactEvent.isHasEvent(reviewArt.getArtifact())) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ if (artifactEvent.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
+ loadTable();
+ } else {
+ refresh();
+ }
+ }
+ });
+ }
}
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 7def5d21df8..7218c683d55 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
@@ -48,6 +48,7 @@ Import-Package: com.lowagie.text;version="2.1.7",
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.access,
org.eclipse.osee.framework.core.model.cache,
org.eclipse.osee.framework.core.model.event,
org.eclipse.osee.framework.core.model.type,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java
new file mode 100644
index 00000000000..bc61ee0cfcc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.framework.ui.skynet.widgets;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+
+/**
+ * Used by XWidgets that perform external data storage
+ *
+ * @author Roberto E. Escobar
+ */
+public interface IArtifactStoredWidget {
+
+ /**
+ * Save data changes to artifact
+ *
+ * @throws Exception
+ */
+ public void saveToArtifact() throws OseeCoreException;
+
+ /**
+ * Revert changes to widget data back to what was in artifact
+ *
+ * @throws Exception
+ */
+ public void revert() throws OseeCoreException;
+
+ /**
+ * Return true if storage data different than widget data
+ *
+ * @throws Exception
+ */
+ public Result isDirty() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java
index ed172749987..50a203cf891 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java
@@ -19,34 +19,13 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
*
* @author Donald G. Dunne
*/
-public interface IArtifactWidget {
+public interface IArtifactWidget extends IArtifactStoredWidget {
- /**
- * Set artifact used as storage for this widget
- *
- * @throws Exception
- */
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException;
-
- /**
- * Save data changes to artifact
- *
- * @throws Exception
- */
- public void saveToArtifact() throws OseeCoreException;
-
- /**
- * Revert changes to widget data back to what was in artifact
- *
- * @throws Exception
- */
- public void revert() throws OseeCoreException;
-
- /**
- * Return true if storage data different than widget data
- *
- * @throws Exception
- */
- public Result isDirty() throws OseeCoreException;
+ /**
+ * Set artifact used as storage for this widget
+ *
+ * @throws Exception
+ */
+ public void setArtifact(Artifact artifact) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java
new file mode 100644
index 00000000000..2c303d2fdaf
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.framework.ui.skynet.widgets;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * Used by XWidgets that perform external data storage
+ *
+ * @author Roberto E. Escobar
+ */
+public interface IAttributeWidget extends IArtifactStoredWidget {
+
+ /**
+ * Set attributeType used as storage for this widget
+ *
+ * @throws OseeCoreException
+ */
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException;
+
+ /**
+ * Get attributeType used as storage for this widget
+ */
+ public String getAttributeType();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCheckBoxDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCheckBoxDam.java
index 52dcf9c6f8c..eb262e4a70d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCheckBoxDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCheckBoxDam.java
@@ -20,49 +20,55 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
/**
* @author Donald G. Dunne
*/
-public class XCheckBoxDam extends XCheckBox implements IArtifactWidget {
+public class XCheckBoxDam extends XCheckBox implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XCheckBoxDam(String displayLabel) {
- super(displayLabel);
- }
+ public XCheckBoxDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- super.set(artifact.getSoleAttributeValue(attributeTypeName, Boolean.FALSE));
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- artifact.setSoleAttributeValue(attributeTypeName, checkButton.getSelection());
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ super.set(artifact.getSoleAttributeValue(attributeTypeName, Boolean.FALSE));
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- if (checkButton != null && !checkButton.isDisposed()) {
- Boolean enteredValue = checkButton.getSelection();
- Boolean storedValue = artifact.getSoleAttributeValue(attributeTypeName, false);
- if (enteredValue.booleanValue() != storedValue.booleanValue()) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- }
- return Result.FalseResult;
- }
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ artifact.setSoleAttributeValue(attributeTypeName, checkButton.getSelection());
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ if (checkButton != null && !checkButton.isDisposed()) {
+ Boolean enteredValue = checkButton.getSelection();
+ Boolean storedValue = artifact.getSoleAttributeValue(attributeTypeName, false);
+ if (enteredValue.booleanValue() != storedValue.booleanValue()) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ }
+ return Result.FalseResult;
+ }
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
- }
- return status;
- }
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
+ }
+ return status;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboBooleanDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboBooleanDam.java
index 80a180ead0c..6e2af8bbf50 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboBooleanDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboBooleanDam.java
@@ -21,64 +21,73 @@ import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-public class XComboBooleanDam extends XCombo implements IArtifactWidget {
+public class XComboBooleanDam extends XCombo implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XComboBooleanDam(String displayLabel) {
- super(displayLabel);
- }
+ public XComboBooleanDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- Boolean result = artifact.getSoleAttributeValue(attrName, null);
- if (result == null)
- super.set("");
- else
- super.set(result ? "yes" : "no");
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- try {
- if (data == null || data.equals("")) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- String enteredValue = get();
- artifact.setSoleAttributeValue(attributeTypeName, (enteredValue != null && enteredValue.equals("yes")));
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ Boolean result = artifact.getSoleAttributeValue(attrName, null);
+ if (result == null) {
+ super.set("");
+ } else {
+ super.set(result ? "yes" : "no");
+ }
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- String enteredValue = get();
- boolean storedValue = artifact.getSoleAttributeValue(attributeTypeName);
- if (enteredValue.equals("yes") != storedValue) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (AttributeDoesNotExist ex) {
- if (!get().equals("")) return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (data == null || data.equals("")) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ String enteredValue = get();
+ artifact.setSoleAttributeValue(attributeTypeName, (enteredValue != null && enteredValue.equals("yes")));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ String enteredValue = get();
+ boolean storedValue = artifact.getSoleAttributeValue(attributeTypeName);
+ if (enteredValue.equals("yes") != storedValue) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (AttributeDoesNotExist ex) {
+ if (!get().equals("")) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ }
+ return Result.FalseResult;
+ }
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
- }
- return status;
- }
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
+ }
+ return status;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboDam.java
index bf3f42f6b58..42e20bb707b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XComboDam.java
@@ -22,66 +22,74 @@ import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-public class XComboDam extends XCombo implements IArtifactWidget {
+public class XComboDam extends XCombo implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XComboDam(String displayLabel) {
- super(displayLabel);
- }
+ public XComboDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- try {
- String value = artifact.getSoleAttributeValue(attributeTypeName);
- super.set(value.toString());
- } catch (AttributeDoesNotExist ex) {
- super.set("");
- }
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- try {
- if (!Strings.isValid(data)) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- String enteredValue = get();
- artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ try {
+ String value = artifact.getSoleAttributeValue(attributeTypeName);
+ super.set(value.toString());
+ } catch (AttributeDoesNotExist ex) {
+ super.set("");
+ }
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- String enteredValue = get();
- String storedValue = artifact.getSoleAttributeValue(attributeTypeName);
- if (!enteredValue.equals(storedValue)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (AttributeDoesNotExist ex) {
- if (!get().equals("")) return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (!Strings.isValid(data)) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ String enteredValue = get();
+ artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK() && !data.equals("")) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
- }
- return status;
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ String enteredValue = get();
+ String storedValue = artifact.getSoleAttributeValue(attributeTypeName);
+ if (!enteredValue.equals(storedValue)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (AttributeDoesNotExist ex) {
+ if (!get().equals("")) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ }
+ return Result.FalseResult;
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK() && !data.equals("")) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
+ }
+ return status;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java
index 67d0a6bc3e5..250219db231 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java
@@ -21,68 +21,74 @@ import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-public class XDateDam extends XDate implements IArtifactWidget {
+public class XDateDam extends XDate implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XDateDam(String displayLabel) {
- super(displayLabel);
- }
+ public XDateDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- Date value = artifact.getSoleAttributeValue(attributeTypeName, null);
- if (value != null) {
- super.setDate(value);
- }
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- try {
- if (date == null) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- Date enteredValue = getDate();
- artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ Date value = artifact.getSoleAttributeValue(attributeTypeName, null);
+ if (value != null) {
+ super.setDate(value);
+ }
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- Date enteredValue = getDate();
- Date storedValue = artifact.getSoleAttributeValue(attributeTypeName, null);
- if (enteredValue == null && storedValue == null) {
- return Result.FalseResult;
- }
- if (enteredValue == null && storedValue != null) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- if (enteredValue != null && storedValue == null) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- if (enteredValue.getTime() != storedValue.getTime()) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (date == null) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ Date enteredValue = getDate();
+ artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ Date enteredValue = getDate();
+ Date storedValue = artifact.getSoleAttributeValue(attributeTypeName, null);
+ if (enteredValue == null && storedValue == null) {
+ return Result.FalseResult;
+ }
+ if (enteredValue == null && storedValue != null) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ if (enteredValue != null && storedValue == null) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ if (enteredValue.getTime() != storedValue.getTime()) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ return Result.FalseResult;
+ }
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
- }
- return status;
- }
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
+ }
+ return status;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java
index d93e71db3bf..94be314424d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java
@@ -42,7 +42,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.progress.UIJob;
-public class XFlatDam extends XFlatWidget<String> implements IArtifactWidget {
+public class XFlatDam extends XFlatWidget<String> implements IAttributeWidget {
private Artifact artifact;
private String attributeTypeName;
private final Map<String, XWidget> xWidgets;
@@ -53,13 +53,20 @@ public class XFlatDam extends XFlatWidget<String> implements IArtifactWidget {
this.xWidgets = new LinkedHashMap<String, XWidget>();
this.artifact = null;
this.xModifiedListener = new XModifiedListener() {
+ @Override
public void widgetModified(XWidget widget) {
notifyXModifiedListeners();
};
};
}
- public void setArtifact(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
this.artifact = artifact;
this.attributeTypeName = attributeTypeName;
AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
@@ -143,7 +150,7 @@ public class XFlatDam extends XFlatWidget<String> implements IArtifactWidget {
@Override
public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
+ setAttributeType(artifact, attributeTypeName);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java
index f707c7d9892..01d3a55b707 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java
@@ -21,54 +21,60 @@ import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
/**
* @author Donald G. Dunne
*/
-public class XFloatDam extends XFloat implements IArtifactWidget {
+public class XFloatDam extends XFloat implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XFloatDam(String displayLabel) {
- super(displayLabel);
- }
+ public XFloatDam(String displayLabel) {
+ super(displayLabel);
+ }
- public XFloatDam(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- }
+ public XFloatDam(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- Double value = artifact.getSoleAttributeValue(attributeTypeName, null);
- super.set(value == null ? "" : NumberFormat.getInstance().format(value));
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- try {
- if (text == null || text.equals("")) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- Double enteredValue = getFloat();
- artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
- }
- } catch (NumberFormatException ex) {
- // do nothing
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ Double value = artifact.getSoleAttributeValue(attributeTypeName, null);
+ super.set(value == null ? "" : NumberFormat.getInstance().format(value));
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- Double enteredValue = getFloat();
- Double storedValue = artifact.getSoleAttributeValue(attributeTypeName, 0.0);
- if (enteredValue.doubleValue() != storedValue.doubleValue()) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (text == null || text.equals("")) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ Double enteredValue = getFloat();
+ artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ Double enteredValue = getFloat();
+ Double storedValue = artifact.getSoleAttributeValue(attributeTypeName, 0.0);
+ if (enteredValue.doubleValue() != storedValue.doubleValue()) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlabelMemberSelDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlabelMemberSelDam.java
index 15b4aa7562f..f0d78e77c08 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlabelMemberSelDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XHyperlabelMemberSelDam.java
@@ -26,78 +26,86 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-public class XHyperlabelMemberSelDam extends XHyperlabelMemberSelection implements IArtifactWidget {
+public class XHyperlabelMemberSelDam extends XHyperlabelMemberSelection implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XHyperlabelMemberSelDam(String displayLabel) {
- super(displayLabel);
- }
+ public XHyperlabelMemberSelDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- super.setSelectedUsers(getUsers());
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
- public Set<User> getUsers() {
- Set<User> users = new HashSet<User>();
- try {
- Matcher m =
- Pattern.compile("<userId>(.*?)</userId>").matcher(artifact.getSoleAttributeValue(attributeTypeName, ""));
- while (m.find()) {
- users.add(UserManager.getUserByUserId(m.group(1)));
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
+ super.setSelectedUsers(getUsers());
+ }
- return users;
- }
+ public Set<User> getUsers() {
+ Set<User> users = new HashSet<User>();
+ try {
+ Matcher m =
+ Pattern.compile("<userId>(.*?)</userId>").matcher(
+ artifact.getSoleAttributeValue(attributeTypeName, ""));
+ while (m.find()) {
+ users.add(UserManager.getUserByUserId(m.group(1)));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- try {
- String selectedStrValue = getSelectedStringValue();
- if (selectedStrValue == null || selectedStrValue.equals("")) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- artifact.setSoleAttributeValue(attributeTypeName, selectedStrValue);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
+ return users;
+ }
- public String getSelectedStringValue() throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- for (User user : getSelectedUsers()) {
- sb.append(AXml.addTagData("userId", user.getUserId()));
- }
- return sb.toString();
- }
+ @Override
+ public void saveToArtifact() {
+ try {
+ String selectedStrValue = getSelectedStringValue();
+ if (selectedStrValue == null || selectedStrValue.equals("")) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ artifact.setSoleAttributeValue(attributeTypeName, selectedStrValue);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- String enteredValue = getSelectedStringValue();
- String storedValue = artifact.getSoleAttributeValue(attributeTypeName);
- if (!enteredValue.equals(storedValue)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (AttributeDoesNotExist ex) {
- if (!artifact.getSoleAttributeValue(attributeTypeName, "").equals("")) return new Result(true,
- attributeTypeName + " is dirty");
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
+ public String getSelectedStringValue() throws OseeCoreException {
+ StringBuffer sb = new StringBuffer();
+ for (User user : getSelectedUsers()) {
+ sb.append(AXml.addTagData("userId", user.getUserId()));
+ }
+ return sb.toString();
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ String enteredValue = getSelectedStringValue();
+ String storedValue = artifact.getSoleAttributeValue(attributeTypeName);
+ if (!enteredValue.equals(storedValue)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (AttributeDoesNotExist ex) {
+ if (!artifact.getSoleAttributeValue(attributeTypeName, "").equals("")) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XIntegerDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XIntegerDam.java
index cb0c48e67ca..303971d0b00 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XIntegerDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XIntegerDam.java
@@ -18,61 +18,69 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-public class XIntegerDam extends XInteger implements IArtifactWidget {
+public class XIntegerDam extends XInteger implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XIntegerDam(String displayLabel) {
- super(displayLabel);
- }
+ public XIntegerDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- try {
- Integer value = artifact.getSoleAttributeValue(attributeTypeName);
- super.set(value.toString());
- } catch (AttributeDoesNotExist ex) {
- super.set("");
- }
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- try {
- if (text == null || text.equals("")) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- Integer enteredValue = getInteger();
- artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
- }
- } catch (NumberFormatException ex) {
- // do nothing
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ try {
+ Integer value = artifact.getSoleAttributeValue(attributeTypeName);
+ super.set(value.toString());
+ } catch (AttributeDoesNotExist ex) {
+ super.set("");
+ }
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- Integer enteredValue = getInteger();
- Integer storedValue = artifact.getSoleAttributeValue(attributeTypeName);
- if (enteredValue.doubleValue() != storedValue.doubleValue()) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (AttributeDoesNotExist ex) {
- if (!get().equals("")) return new Result(true, attributeTypeName + " is dirty");
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (text == null || text.equals("")) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ Integer enteredValue = getInteger();
+ artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ Integer enteredValue = getInteger();
+ Integer storedValue = artifact.getSoleAttributeValue(attributeTypeName);
+ if (enteredValue.doubleValue() != storedValue.doubleValue()) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (AttributeDoesNotExist ex) {
+ if (!get().equals("")) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelDam.java
index 28f3fcf06c8..d18d019b5fb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelDam.java
@@ -29,107 +29,124 @@ import org.eclipse.swt.widgets.Text;
*
* @author Donald G. Dunne
*/
-public class XLabelDam extends XWidget implements IArtifactWidget {
-
- private Artifact artifact;
- private String attributeTypeName;
- private Text valueTextWidget;
- private Composite parent;
-
- public XLabelDam(String displayLabel) {
- super(displayLabel);
- }
-
- @Override
- public Control getControl() {
- return valueTextWidget;
- }
-
- protected void createControls(Composite parent, int horizontalSpan) {
- this.parent = parent;
- if (horizontalSpan < 2) horizontalSpan = 2;
- // Create Data Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
- valueTextWidget = new Text(parent, SWT.NONE);
- valueTextWidget.setEditable(false);
- refresh();
- }
-
- public void setArtifact(Artifact artifact, String attrName) {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
-
- refresh();
- }
-
- @Override
- public void saveToArtifact() {
- // Do nothing cause labelDam is read-only
- }
-
- @Override
- public Result isDirty() {
- return Result.FalseResult;
- }
-
- public void refresh() {
- if (artifact != null && valueTextWidget != null && !valueTextWidget.isDisposed()) {
- try {
- valueTextWidget.setText(artifact.getAttributesToString(attributeTypeName));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- public void dispose() {
- if (labelWidget != null) labelWidget.dispose();
- if (valueTextWidget != null) valueTextWidget.dispose();
- if (parent != null && !parent.isDisposed()) parent.layout();
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public IStatus isValid() {
- return Status.OK_STATUS;
- }
-
- @Override
- public void setFocus() {
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String toHTML(String labelFont) {
- return "";
- }
-
- @Override
- public Object getData() {
- return valueTextWidget.getText();
- }
-
- @Override
- public void revert() {
- // Do nothing cause labelDam is read-only
- }
+public class XLabelDam extends XWidget implements IAttributeWidget {
+
+ private Artifact artifact;
+ private String attributeTypeName;
+ private Text valueTextWidget;
+ private Composite parent;
+
+ public XLabelDam(String displayLabel) {
+ super(displayLabel);
+ }
+
+ @Override
+ public Control getControl() {
+ return valueTextWidget;
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ this.parent = parent;
+ if (horizontalSpan < 2) {
+ horizontalSpan = 2;
+ }
+ // Create Data Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+ valueTextWidget = new Text(parent, SWT.NONE);
+ valueTextWidget.setEditable(false);
+ refresh();
+ }
+
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+
+ refresh();
+ }
+
+ @Override
+ public void saveToArtifact() {
+ // Do nothing cause labelDam is read-only
+ }
+
+ @Override
+ public Result isDirty() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void refresh() {
+ if (artifact != null && valueTextWidget != null && !valueTextWidget.isDisposed()) {
+ try {
+ valueTextWidget.setText(artifact.getAttributesToString(attributeTypeName));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if (labelWidget != null) {
+ labelWidget.dispose();
+ }
+ if (valueTextWidget != null) {
+ valueTextWidget.dispose();
+ }
+ if (parent != null && !parent.isDisposed()) {
+ parent.layout();
+ }
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public IStatus isValid() {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return "";
+ }
+
+ @Override
+ public Object getData() {
+ return valueTextWidget.getText();
+ }
+
+ @Override
+ public void revert() {
+ // Do nothing cause labelDam is read-only
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDam.java
index bfc9bfc3f36..4da6cfa77db 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDam.java
@@ -19,50 +19,56 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
/**
* @author Donald G. Dunne
*/
-public class XListDam extends XList implements IArtifactWidget {
+public class XListDam extends XList implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- /**
- * @param displayLabel
- */
- public XListDam(String displayLabel) {
- super(displayLabel);
- }
+ /**
+ * @param displayLabel
+ */
+ public XListDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- super.setSelected(getStoredStrs());
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- artifact.setAttributeValues(attributeTypeName, getSelectedStrs());
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ super.setSelected(getStoredStrs());
+ }
- public Collection<String> getStoredStrs() throws OseeCoreException {
- return artifact.getAttributesToStringList(attributeTypeName);
- }
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ artifact.setAttributeValues(attributeTypeName, getSelectedStrs());
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- Collection<String> enteredValues = getSelectedStrs();
- Collection<String> storedValues = getStoredStrs();
- if (!Collections.isEqual(enteredValues, storedValues)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
+ public Collection<String> getStoredStrs() throws OseeCoreException {
+ return artifact.getAttributesToStringList(attributeTypeName);
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ Collection<String> enteredValues = getSelectedStrs();
+ Collection<String> storedValues = getStoredStrs();
+ if (!Collections.isEqual(enteredValues, storedValues)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java
index 1048785715b..352d7aa9491 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java
@@ -30,77 +30,83 @@ import org.eclipse.osee.framework.ui.skynet.util.filteredTree.SimpleCheckFiltere
/**
* @author Roberto E. Escobar
*/
-public class XSelectFromMultiChoiceDam extends XSelectFromDialog<String> implements IArtifactWidget {
+public class XSelectFromMultiChoiceDam extends XSelectFromDialog<String> implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XSelectFromMultiChoiceDam(String displayLabel) {
- super(displayLabel);
- this.artifact = null;
- }
+ public XSelectFromMultiChoiceDam(String displayLabel) {
+ super(displayLabel);
+ this.artifact = null;
+ }
- public void setArtifact(Artifact artifact, String attributeTypeName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attributeTypeName;
- AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
- int minOccurrence = attributeType.getMinOccurrences();
- int maxOccurrence = attributeType.getMaxOccurrences();
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- setRequiredSelection(minOccurrence, maxOccurrence);
- setSelected(getStored());
- setRequiredEntry(true);
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attributeTypeName;
+ AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
+ int minOccurrence = attributeType.getMinOccurrences();
+ int maxOccurrence = attributeType.getMaxOccurrences();
- @Override
- public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
- SimpleCheckFilteredTreeDialog dialog =
- new SimpleCheckFilteredTreeDialog(getLabel(), "Select from the items below",
- new ArrayTreeContentProvider(), new LabelProvider(), new ArtifactNameSorter(),
- getMinSelectionRequired(), getMaxSelectionRequired());
- return dialog;
- }
+ setRequiredSelection(minOccurrence, maxOccurrence);
+ setSelected(getStored());
+ setRequiredEntry(true);
+ }
- public Collection<String> getStored() throws OseeCoreException {
- return artifact.getAttributesToStringList(attributeTypeName);
- }
+ @Override
+ public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
+ SimpleCheckFilteredTreeDialog dialog =
+ new SimpleCheckFilteredTreeDialog(getLabel(), "Select from the items below",
+ new ArrayTreeContentProvider(), new LabelProvider(), new ArtifactNameSorter(),
+ getMinSelectionRequired(), getMaxSelectionRequired());
+ return dialog;
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- Collection<String> enteredValues = getSelected();
- Collection<String> storedValues = getStored();
- if (!Collections.isEqual(enteredValues, storedValues)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
+ public Collection<String> getStored() throws OseeCoreException {
+ return artifact.getAttributesToStringList(attributeTypeName);
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ Collection<String> enteredValues = getSelected();
+ Collection<String> storedValues = getStored();
+ if (!Collections.isEqual(enteredValues, storedValues)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- artifact.setAttributeValues(attributeTypeName, getSelected());
- }
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- List<String> items = getSelected();
- for (String item : items) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, item);
- if (!status.isOK()) {
- break;
- }
- }
- }
- return status;
- }
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ artifact.setAttributeValues(attributeTypeName, getSelected());
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ List<String> items = getSelected();
+ for (String item : items) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, item);
+ if (!status.isOK()) {
+ break;
+ }
+ }
+ }
+ return status;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
index de6a7cdb5f2..9dceb47aae7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
@@ -42,7 +42,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.progress.UIJob;
-public class XStackedDam extends XStackedWidget<String> implements IArtifactWidget {
+public class XStackedDam extends XStackedWidget<String> implements IAttributeWidget {
private Artifact artifact;
private String attributeTypeName;
private final Map<String, XWidget> xWidgets;
@@ -53,13 +53,20 @@ public class XStackedDam extends XStackedWidget<String> implements IArtifactWidg
this.xWidgets = new LinkedHashMap<String, XWidget>();
this.artifact = null;
this.xModifiedListener = new XModifiedListener() {
+ @Override
public void widgetModified(XWidget widget) {
notifyXModifiedListeners();
};
};
}
- public void setArtifact(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
this.artifact = artifact;
this.attributeTypeName = attributeTypeName;
AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
@@ -143,7 +150,7 @@ public class XStackedDam extends XStackedWidget<String> implements IArtifactWidg
@Override
public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
+ setAttributeType(artifact, attributeTypeName);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java
index a6811264850..50898e392bd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java
@@ -17,52 +17,63 @@ import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
import org.eclipse.osee.framework.ui.plugin.util.Result;
-public class XTextDam extends XText implements IArtifactWidget {
+public class XTextDam extends XText implements IArtifactWidget, IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
+ private Artifact artifact;
+ private String attributeTypeName;
- public XTextDam(String displayLabel) {
- super(displayLabel);
- }
+ public XTextDam(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact, String attributeTypeName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attributeTypeName;
- super.set(artifact.getSoleAttributeValue(attributeTypeName, ""));
- }
+ @Override
+ public void setArtifact(Artifact artifact) throws OseeCoreException {
+ this.artifact = artifact;
+ }
- @Override
- public void saveToArtifact() throws OseeCoreException {
- String value = get();
- if (value == null || value.equals("")) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else if (!value.equals(artifact.getSoleAttributeValue(attributeTypeName, ""))) {
- artifact.setSoleAttributeValue(attributeTypeName, value);
- }
- }
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
- @Override
- public Result isDirty() throws OseeCoreException {
- String enteredValue = get();
- String storedValue = artifact.getSoleAttributeValue(attributeTypeName, "");
- if (!enteredValue.equals(storedValue)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attributeTypeName;
+ super.set(artifact.getSoleAttributeValue(attributeTypeName, ""));
+ }
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
- }
- return status;
- }
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ String value = get();
+ if (value == null || value.equals("")) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else if (!value.equals(artifact.getSoleAttributeValue(attributeTypeName, ""))) {
+ artifact.setSoleAttributeValue(attributeTypeName, value);
+ }
+ }
- @Override
- public void revert() throws OseeCoreException {
- setArtifact(artifact, attributeTypeName);
- }
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ String enteredValue = get();
+ String storedValue = artifact.getSoleAttributeValue(attributeTypeName, "");
+ if (!enteredValue.equals(storedValue)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
+ }
+ return status;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDescriptiveName.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDescriptiveName.java
index 356b7f00b02..43025682efb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDescriptiveName.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDescriptiveName.java
@@ -10,19 +10,20 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.widgets;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-public class XTextDescriptiveName extends XTextDam implements IArtifactWidget {
+public class XTextDescriptiveName extends XTextDam {
- public Artifact artifact;
+ public Artifact artifact;
- public XTextDescriptiveName(String displayLabel) {
- super(displayLabel);
- }
+ public XTextDescriptiveName(String displayLabel) {
+ super(displayLabel);
+ }
- public void setArtifact(Artifact artifact) throws Exception {
- this.artifact = artifact;
- super.setArtifact(artifact, "Name");
- }
+ @Override
+ public void setArtifact(Artifact artifact) throws OseeCoreException {
+ super.setAttributeType(artifact, "Name");
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetDecorator.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetDecorator.java
new file mode 100644
index 00000000000..b4b457ae574
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetDecorator.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * 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.framework.ui.skynet.widgets;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.osee.framework.core.model.access.PermissionStatus;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.swt.Displays;
+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.graphics.Image;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class XWidgetDecorator {
+ private final int decorationPosition = SWT.LEFT | SWT.BOTTOM;
+ private final Map<XWidget, Decorator> decoratorMap = new HashMap<XWidget, Decorator>();
+
+ public XWidgetDecorator() {
+ }
+
+ public void addWidget(XWidget xWidget) {
+ Control controlToDecorate = xWidget.getErrorMessageControl();
+ Decorator decorator = new Decorator(controlToDecorate, decorationPosition);
+ decoratorMap.put(xWidget, decorator);
+ }
+
+ public void update() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (Decorator decorator : decoratorMap.values()) {
+ decorator.update();
+ }
+ }
+ });
+ }
+
+ public void dispose() {
+ for (Decorator decorator : decoratorMap.values()) {
+ decorator.dispose();
+ }
+ decoratorMap.clear();
+ }
+
+ private final static class Decorator {
+ private ControlDecoration decoration;
+ private String description;
+ private int position;
+ private Image image;
+ private boolean isVisible;
+ private boolean requiresCreation;
+ private final Control control;
+
+ public Decorator(Control control, int position) {
+ this.control = control;
+ setPosition(position);
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ public void setPosition(int position) {
+ if (getPosition() != position) {
+ this.position = position;
+ this.requiresCreation = true;
+ }
+ }
+
+ public void setVisible(boolean isVisible) {
+ this.isVisible = isVisible;
+ }
+
+ public boolean isVisible() {
+ return isVisible;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public void dispose() {
+ if (decoration != null) {
+ decoration.dispose();
+ }
+ }
+
+ public void update() {
+ if (requiresCreation) {
+ if (decoration != null) {
+ decoration.dispose();
+ }
+ decoration = new ControlDecoration(control, position, control.getParent());
+ requiresCreation = false;
+ }
+
+ if (isVisible()) {
+ if (image != null) {
+ decoration.setImage(image);
+ }
+ decoration.setDescriptionText(description);
+ decoration.show();
+ } else {
+ decoration.setDescriptionText(null);
+ decoration.hide();
+ }
+ }
+ }
+
+ // public static interface DecorationProvider {
+ // int getPriority();
+ //
+ // void onUpdate(XWidget widget, Decorator decorator);
+ // }
+
+ // public void addProvider(DecorationProvider provider) {
+ //
+ // }
+
+ public void onUpdate(XWidget xWidget, Decorator decorator) {
+ // TODO separate onUpdate - make extensible
+ // TODO Add AccessControlService
+
+ if (xWidget instanceof IAttributeWidget) {
+ IAttributeWidget attributeWidget = (IAttributeWidget) xWidget;
+ String attributeType = attributeWidget.getAttributeType();
+ // Artifact artifact = null;
+ PermissionStatus permissionStatus = new PermissionStatus(true, "You are not cool enough");
+ // try {
+ // AccessDataQuery query = AccessControlManager.getAccessData(null);
+ // query.attributeTypeMatches(PermissionEnum.WRITE, artifact, attributeType, permissionStatus);
+ // } catch (OseeCoreException ex) {
+ // OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ // }
+
+ // Get Info from AccessControlService;
+ boolean isLocked = permissionStatus.matches();
+ String reason = permissionStatus.getReason();
+
+ Control control = xWidget.getControl();
+ if (Widgets.isAccessible(control)) {
+ xWidget.setEditable(!isLocked);
+ }
+ Label label = xWidget.getLabelWidget();
+ if (Widgets.isAccessible(label)) {
+ label.setEnabled(!isLocked);
+ }
+
+ Image image = ImageManager.getImage(FrameworkImage.LOCK_OVERLAY);
+
+ decorator.setImage(isLocked ? image : null);
+ decorator.setDescription(isLocked ? reason : null);
+ decorator.setVisible(isLocked);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayout.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayout.java
index f441b911438..f86e522ba20 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayout.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayout.java
@@ -30,6 +30,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.XWidgetParser;
import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.IAttributeWidget;
import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
import org.eclipse.osee.framework.ui.skynet.widgets.XText;
@@ -166,11 +167,19 @@ public class DynamicXWidgetLayout {
dynamicWidgetLayoutListener.widgetCreating(xWidget, toolkit, artifact, this, xModListener, isEditable);
}
- if (artifact != null && xWidget instanceof IArtifactWidget) {
- try {
- ((IArtifactWidget) xWidget).setArtifact(artifact, xWidgetLayoutData.getStorageName());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ if (artifact != null) {
+ if (xWidget instanceof IAttributeWidget) {
+ try {
+ ((IAttributeWidget) xWidget).setAttributeType(artifact, xWidgetLayoutData.getStorageName());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else if (xWidget instanceof IArtifactWidget) {
+ try {
+ ((IArtifactWidget) xWidget).setArtifact(artifact);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayoutData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayoutData.java
index 4a4b0ee9321..9593394ac2d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayoutData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DynamicXWidgetLayoutData.java
@@ -16,6 +16,7 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.IAttributeWidget;
import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
import org.eclipse.osee.framework.ui.skynet.widgets.XOptionHandler;
import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
@@ -24,203 +25,207 @@ import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
* @author Donald G. Dunne
*/
public class DynamicXWidgetLayoutData implements Cloneable {
- private static final XWidgetFactory xWidgetFactory = XWidgetFactory.getInstance();
- private static final int DEFAULT_HEIGHT = 9999;
- private String name = "Unknown";
- private String id = "";
- private String storageName = "";
- private String xWidgetName = UNKNOWN;
- private static String UNKNOWN = "Unknown";
- private XWidget xWidget;
- private int beginComposite = 0; // If >0, indicates new child composite with columns == value
- private int beginGroupComposite = 0; // If >0, indicates new child composite with columns == value
- private boolean endComposite, endGroupComposite; // indicated end of child composite
- private int height = DEFAULT_HEIGHT;
- private String toolTip;
- private DynamicXWidgetLayout dynamicXWidgetLayout;
- private String defaultValue;
- private String keyedBranchName;
- private final XOptionHandler xOptionHandler = new XOptionHandler();
- private Artifact artifact;
-
- public DynamicXWidgetLayoutData(DynamicXWidgetLayout dynamicXWidgetLayout, XOption... xOption) {
- this.dynamicXWidgetLayout = dynamicXWidgetLayout;
- xOptionHandler.add(XOption.EDITABLE);
- xOptionHandler.add(XOption.ALIGN_LEFT);
- xOptionHandler.add(xOption);
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public boolean isHeightSet() {
- return height != DEFAULT_HEIGHT;
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- public String getName() {
- return name.replaceFirst("^.*?\\.", "");
- }
-
- public String getStorageName() {
- return storageName;
- }
-
- public void setStorageName(String storageName) {
- this.storageName = storageName;
- }
-
- public boolean isRequired() {
- return xOptionHandler.contains(XOption.REQUIRED) || dynamicXWidgetLayout.isOrRequired(storageName) || dynamicXWidgetLayout.isXOrRequired(storageName);
- }
-
- public String getXWidgetName() {
- return xWidgetName;
- }
-
- public void setXWidgetName(String widget) {
- xWidgetName = widget;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- // TODO This method will need to be removed
- public XWidget getXWidget() throws OseeArgumentException {
- if (xWidget == null) {
- xWidget = xWidgetFactory.createXWidget(this);
- if (artifact != null && xWidget instanceof IArtifactWidget) {
- try {
- ((IArtifactWidget) xWidget).setArtifact(artifact, getStorageName());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- return xWidget;
- }
-
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public int getBeginComposite() {
- if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_10)) {
- return 10;
- }
- if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_8)) {
- return 8;
- }
- if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_6)) {
- return 6;
- }
- if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_4)) {
- return 4;
- }
- return beginComposite;
- }
-
- public int getBeginGroupComposite() {
- if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_10)) {
- return 10;
- }
- if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_8)) {
- return 8;
- }
- if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_6)) {
- return 6;
- }
- if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_4)) {
- return 4;
- }
- return beginGroupComposite;
- }
-
- public void setBeginComposite(int beginComposite) {
- this.beginComposite = beginComposite;
- }
-
- public void setBeginGroupComposite(int beginGroupComposite) {
- this.beginGroupComposite = beginGroupComposite;
- }
-
- public boolean isEndComposite() {
- return endComposite;
- }
-
- public boolean isEndGroupComposite() {
- return endGroupComposite;
- }
-
- public void setEndComposite(boolean endComposite) {
- this.endComposite = endComposite;
- }
-
- public void setEndGroupComposite(boolean endGroupComposite) {
- this.endGroupComposite = endGroupComposite;
- }
-
- public String getToolTip() {
- return toolTip;
- }
-
- public void setToolTip(String toolTip) {
- this.toolTip = toolTip;
- }
-
- public DynamicXWidgetLayout getDynamicXWidgetLayout() {
- return dynamicXWidgetLayout;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public void setKeyedBranchName(String keyedBranchName) {
- this.keyedBranchName = keyedBranchName;
- }
-
- public String getKeyedBranchName() {
- return keyedBranchName;
- }
-
- public void setDynamicXWidgetLayout(DynamicXWidgetLayout dynamicXWidgetLayout) {
- this.dynamicXWidgetLayout = dynamicXWidgetLayout;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public XOptionHandler getXOptionHandler() {
- return xOptionHandler;
- }
-
- public Artifact getArtifact() {
- return artifact;
- }
-
- public void setArtifact(Artifact artifact) {
- this.artifact = artifact;
- }
+ private static final XWidgetFactory xWidgetFactory = XWidgetFactory.getInstance();
+ private static final int DEFAULT_HEIGHT = 9999;
+ private String name = "Unknown";
+ private String id = "";
+ private String storageName = "";
+ private String xWidgetName = UNKNOWN;
+ private static String UNKNOWN = "Unknown";
+ private XWidget xWidget;
+ private int beginComposite = 0; // If >0, indicates new child composite with columns == value
+ private int beginGroupComposite = 0; // If >0, indicates new child composite with columns == value
+ private boolean endComposite, endGroupComposite; // indicated end of child composite
+ private int height = DEFAULT_HEIGHT;
+ private String toolTip;
+ private DynamicXWidgetLayout dynamicXWidgetLayout;
+ private String defaultValue;
+ private String keyedBranchName;
+ private final XOptionHandler xOptionHandler = new XOptionHandler();
+ private Artifact artifact;
+
+ public DynamicXWidgetLayoutData(DynamicXWidgetLayout dynamicXWidgetLayout, XOption... xOption) {
+ this.dynamicXWidgetLayout = dynamicXWidgetLayout;
+ xOptionHandler.add(XOption.EDITABLE);
+ xOptionHandler.add(XOption.ALIGN_LEFT);
+ xOptionHandler.add(xOption);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public boolean isHeightSet() {
+ return height != DEFAULT_HEIGHT;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ public String getName() {
+ return name.replaceFirst("^.*?\\.", "");
+ }
+
+ public String getStorageName() {
+ return storageName;
+ }
+
+ public void setStorageName(String storageName) {
+ this.storageName = storageName;
+ }
+
+ public boolean isRequired() {
+ return xOptionHandler.contains(XOption.REQUIRED) || dynamicXWidgetLayout.isOrRequired(storageName) || dynamicXWidgetLayout.isXOrRequired(storageName);
+ }
+
+ public String getXWidgetName() {
+ return xWidgetName;
+ }
+
+ public void setXWidgetName(String widget) {
+ xWidgetName = widget;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ // TODO This method will need to be removed
+ public XWidget getXWidget() throws OseeArgumentException {
+ if (xWidget == null) {
+ xWidget = xWidgetFactory.createXWidget(this);
+ if (artifact != null) {
+ try {
+ if (xWidget instanceof IAttributeWidget) {
+ ((IAttributeWidget) xWidget).setAttributeType(artifact, getStorageName());
+ } else if (xWidget instanceof IArtifactWidget) {
+ ((IArtifactWidget) xWidget).setArtifact(artifact);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ return xWidget;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public int getBeginComposite() {
+ if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_10)) {
+ return 10;
+ }
+ if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_8)) {
+ return 8;
+ }
+ if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_6)) {
+ return 6;
+ }
+ if (xOptionHandler.contains(XOption.BEGIN_COMPOSITE_4)) {
+ return 4;
+ }
+ return beginComposite;
+ }
+
+ public int getBeginGroupComposite() {
+ if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_10)) {
+ return 10;
+ }
+ if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_8)) {
+ return 8;
+ }
+ if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_6)) {
+ return 6;
+ }
+ if (xOptionHandler.contains(XOption.BEGIN_GROUP_COMPOSITE_4)) {
+ return 4;
+ }
+ return beginGroupComposite;
+ }
+
+ public void setBeginComposite(int beginComposite) {
+ this.beginComposite = beginComposite;
+ }
+
+ public void setBeginGroupComposite(int beginGroupComposite) {
+ this.beginGroupComposite = beginGroupComposite;
+ }
+
+ public boolean isEndComposite() {
+ return endComposite;
+ }
+
+ public boolean isEndGroupComposite() {
+ return endGroupComposite;
+ }
+
+ public void setEndComposite(boolean endComposite) {
+ this.endComposite = endComposite;
+ }
+
+ public void setEndGroupComposite(boolean endGroupComposite) {
+ this.endGroupComposite = endGroupComposite;
+ }
+
+ public String getToolTip() {
+ return toolTip;
+ }
+
+ public void setToolTip(String toolTip) {
+ this.toolTip = toolTip;
+ }
+
+ public DynamicXWidgetLayout getDynamicXWidgetLayout() {
+ return dynamicXWidgetLayout;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setKeyedBranchName(String keyedBranchName) {
+ this.keyedBranchName = keyedBranchName;
+ }
+
+ public String getKeyedBranchName() {
+ return keyedBranchName;
+ }
+
+ public void setDynamicXWidgetLayout(DynamicXWidgetLayout dynamicXWidgetLayout) {
+ this.dynamicXWidgetLayout = dynamicXWidgetLayout;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public XOptionHandler getXOptionHandler() {
+ return xOptionHandler;
+ }
+
+ public Artifact getArtifact() {
+ return artifact;
+ }
+
+ public void setArtifact(Artifact artifact) {
+ this.artifact = artifact;
+ }
} \ No newline at end of file

Back to the top