diff options
author | ddunne | 2008-11-10 19:02:57 +0000 |
---|---|---|
committer | ddunne | 2008-11-10 19:02:57 +0000 |
commit | 9829455ba9d2ff65309a206d2d3223c19bc03218 (patch) | |
tree | 207be53f306354e6e61b69bc5ea3eedbd8efb936 | |
parent | 96c2477f2a47da8c92880e1eb2591c9395aa8dd8 (diff) | |
download | org.eclipse.osee-9829455ba9d2ff65309a206d2d3223c19bc03218.tar.gz org.eclipse.osee-9829455ba9d2ff65309a206d2d3223c19bc03218.tar.xz org.eclipse.osee-9829455ba9d2ff65309a206d2d3223c19bc03218.zip |
7 files changed, 85 insertions, 22 deletions
diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java index 2df4c67ef99..5a3ae12c889 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java @@ -199,15 +199,13 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtiableEdito result = ((StateMachineArtifact) ((SMAEditorInput) getEditorInput()).getArtifact()).isSMAEditorDirty(); if (result.isTrue()) return result; - if (smaMgr.getSma().isDirty(true)) { - return new Result(true, "Another relation is dirty"); - } + result = smaMgr.getSma().reportIsDirty(true); + return result; } catch (Exception ex) { OSEELog.logException(AtsPlugin.class, ex, true); return new Result(true, ex.getLocalizedMessage()); } - return Result.FalseResult; } @Override @@ -438,6 +436,17 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtiableEdito } }); + item = new ToolItem(toolBar, SWT.PUSH); + item.setImage(SkynetGuiPlugin.getInstance().getImage("dirty.gif")); + item.setToolTipText("Show what attribute or relation making editor dirty."); + item.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + Result result = smaMgr.getEditor().isDirtyResult(); + AWorkbench.popup("Dirty Report", result.isFalse() ? "Not Dirty" : "Dirty -> " + result.getText()); + } + }); + item = new ToolItem(toolBar, SWT.SEPARATOR); Text artifactInfoLabel = new Text(toolBarComposite, SWT.END); diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSimpleList.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSimpleList.java index 5c60e122e89..534ef5bf81a 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSimpleList.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSimpleList.java @@ -25,6 +25,7 @@ import org.eclipse.osee.ats.editor.SMAEditor; import org.eclipse.osee.framework.db.connection.exception.OseeCoreException; import org.eclipse.osee.framework.skynet.core.User; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; import org.eclipse.osee.framework.ui.plugin.util.Displays; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; @@ -83,8 +84,10 @@ public class ImportTasksFromSimpleList extends AbstractBlam { } try { final TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) artifact; - handleCreateTasks(assignees, titles, teamArt); - teamArt.persistAttributesAndRelations(); + SkynetTransaction transaction = new SkynetTransaction(AtsPlugin.getAtsBranch()); + handleCreateTasks(assignees, titles, teamArt, transaction); + teamArt.persistAttributesAndRelations(transaction); + transaction.execute(); } catch (Exception ex) { OSEELog.logException(AtsPlugin.class, ex, true); return; @@ -98,7 +101,7 @@ public class ImportTasksFromSimpleList extends AbstractBlam { }); } - private void handleCreateTasks(List<Artifact> assignees, List<String> titles, TeamWorkFlowArtifact teamArt) throws OseeCoreException { + private void handleCreateTasks(List<Artifact> assignees, List<String> titles, TeamWorkFlowArtifact teamArt, SkynetTransaction transaction) throws OseeCoreException { for (String title : titles) { TaskArtifact taskArt = teamArt.getSmaMgr().getTaskMgr().createNewTask(title, false); if (assignees != null && assignees.size() > 0) { @@ -110,6 +113,7 @@ public class ImportTasksFromSimpleList extends AbstractBlam { } taskArt.getSmaMgr().getStateMgr().setAssignees(users); } + taskArt.persistAttributesAndRelations(transaction); } } diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index 8bae0e6f034..47cc2ae9ad5 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -868,18 +868,28 @@ public class Artifact implements IAdaptable, Comparable<Artifact> { * @return Returns the dirty.
*/
public boolean isDirty() {
- return isDirty(false);
+ return reportIsDirty().isTrue();
+ }
+
+ public Result reportIsDirty() {
+ return reportIsDirty(false);
}
/**
* @return Returns the dirty.
*/
- public boolean isDirty(boolean includeLinks) {
- boolean dirtyVal = dirty || anAttributeIsDirty();
+ public Result reportIsDirty(boolean includeLinks) {
+ if (dirty) return new Result(true, "dirty flag == true");
+ Result result = reportAnAttributeIsDirty();
+ if (result.isTrue()) return result;
if (includeLinks) {
- dirtyVal |= RelationManager.hasDirtyLinks(this);
+ result = RelationManager.reportHasDirtyLinks(this);
}
- return dirtyVal;
+ return result;
+ }
+
+ public boolean isDirty(boolean includeLinks) {
+ return reportIsDirty(includeLinks).isTrue();
}
public boolean isReadOnly() {
@@ -892,12 +902,16 @@ public class Artifact implements IAdaptable, Comparable<Artifact> { }
private boolean anAttributeIsDirty() {
+ return reportAnAttributeIsDirty().isTrue();
+ }
+
+ private Result reportAnAttributeIsDirty() {
for (Attribute<?> attribute : internalGetAttributes()) {
if (attribute.isDirty()) {
- return true;
+ return new Result(true, "Attribute: " + attribute.getNameValueDescription());
}
}
- return false;
+ return Result.FalseResult;
}
public void revert() throws OseeCoreException {
@@ -1561,4 +1575,4 @@ public class Artifact implements IAdaptable, Comparable<Artifact> { public User getLastModifiedBy() throws OseeCoreException {
return UserManager.getUserByArtId(transactionId.getAuthorArtId());
}
-}
\ No newline at end of file +}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java index 30bfb85277c..8128c08d999 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java @@ -42,6 +42,7 @@ import org.eclipse.osee.framework.skynet.core.change.ModificationType; import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.transaction.RelationTransactionData;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
/**
* @author Ryan D. Brooks
@@ -332,6 +333,19 @@ public class RelationManager { return false;
}
+ public static Result reportHasDirtyLinks(Artifact artifact) {
+ List<RelationLink> selectedRelations = artifactToRelations.get(artifact);
+ if (selectedRelations == null) {
+ return Result.FalseResult;
+ }
+ for (RelationLink relation : selectedRelations) {
+ if (relation.isDirty()) {
+ return new Result(true, "Relation: " + relation.toString());
+ }
+ }
+ return Result.FalseResult;
+ }
+
/**
* @param transaction TODO
* @param artifact
diff --git a/org.eclipse.osee.framework.ui.skynet/images/dirty.gif b/org.eclipse.osee.framework.ui.skynet/images/dirty.gif Binary files differnew file mode 100644 index 00000000000..2532de21e31 --- /dev/null +++ b/org.eclipse.osee.framework.ui.skynet/images/dirty.gif diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditor.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditor.java index 9b4b36ab282..47de3f2266a 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditor.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditor.java @@ -150,25 +150,30 @@ public class ArtifactEditor extends MultiPageEditorPart implements IDirtiableEdi @Override
public boolean isDirty() {
- if (artifact.isDeleted()) return false;
+ return reportIsDirty().isTrue();
+ }
+
+ public Result reportIsDirty() {
+ if (artifact.isDeleted()) return Result.FalseResult;
try {
- boolean dirty = !artifact.isReadOnly() && artifact.isDirty(true);
- if (dirty) return true;
+ if (artifact.isReadOnly()) return Result.FalseResult;
+ Result result = artifact.reportIsDirty(true);
+ if (result.isTrue()) return result;
//TODO The new attribute composite dirty logic is always returning true ....
if (false) {
- Result result = newAttributeComposite.isDirty();
+ result = newAttributeComposite.isDirty();
System.out.println("New Attribute Composite - isDirt => " + result);
if (result.isTrue()) {
- return true;
+ return result;
}
}
} catch (Exception ex) {
OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
}
- return false;
+ return Result.FalseResult;
}
public void onDirtied() {
@@ -351,6 +356,17 @@ public class ArtifactEditor extends MultiPageEditorPart implements IDirtiableEdi }
});
+ ToolItem isDirty = new ToolItem(toolBar, SWT.NONE);
+ isDirty.setImage(SkynetGuiPlugin.getInstance().getImage("dirty.gif"));
+ isDirty.setToolTipText("Show what attribute or relation making editor dirty.");
+ isDirty.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ Result result = reportIsDirty();
+ AWorkbench.popup("Dirty Report", result.isFalse() ? "Not Dirty" : "Dirty -> " + result.getText());
+ }
+ });
+
if (OseeProperties.isDeveloper()) {
ToolItem snapshotSave = new ToolItem(toolBar, SWT.NONE);
snapshotSave.setImage(SkynetGuiPlugin.getInstance().getImage("snapshotSave.gif"));
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOperations.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOperations.java index a8f3d7ade64..72ad9c1a3a2 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOperations.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamOperations.java @@ -34,10 +34,11 @@ public class BlamOperations { private static Map<String, BlamOperation> blamMap;
public static BlamOperation getBlamOperation(String operationId) {
+ ensurePopulated();
return blamMap.get(operationId);
}
- public static Collection<BlamOperation> getBlamOperationsNameSort() {
+ public static Collection<BlamOperation> ensurePopulated() {
if (blamsSortedByName == null) {
blamsSortedByName = new ArrayList<BlamOperation>();
blamMap = new HashMap<String, BlamOperation>();
@@ -52,6 +53,11 @@ public class BlamOperations { return blamsSortedByName;
}
+ public static Collection<BlamOperation> getBlamOperationsNameSort() {
+ ensurePopulated();
+ return blamsSortedByName;
+ }
+
public static Collection<BlamOperation> getBlamOperations() {
List<BlamOperation> blamOperations = new ArrayList<BlamOperation>();
for (IConfigurationElement iConfigurationElement : ExtensionPoints.getExtensionElements(
|