summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2012-03-26 13:24:20 (EDT)
committer Roberto E. Escobar2012-03-26 13:24:20 (EDT)
commit5fd00254490d6ab70b67f7d4b6c1f274c93e455e (patch)
tree46eeabf813e4663254dc192742258a9cc727e2f0
parent5a3c5603220bd8652c7661eb89594db32c46fe0b (diff)
downloadorg.eclipse.osee-5fd00254490d6ab70b67f7d4b6c1f274c93e455e.zip
org.eclipse.osee-5fd00254490d6ab70b67f7d4b6c1f274c93e455e.tar.gz
org.eclipse.osee-5fd00254490d6ab70b67f7d4b6c1f274c93e455e.tar.bz2
bug[ats_D312H]: Introduce comment fix
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandlerOperation.java42
2 files changed, 35 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
index 85a8e11..6609cc4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
@@ -64,7 +64,7 @@ public final class SkynetTransaction extends TransactionOperation<Branch> {
private final Set<Artifact> modifiedArtifacts = new HashSet<Artifact>();
private final Set<Artifact> alreadyProcessedArtifacts = new HashSet<Artifact>();
- private final String comment;
+ private String comment;
private User user;
private AccessPolicy access;
@@ -75,6 +75,10 @@ public final class SkynetTransaction extends TransactionOperation<Branch> {
this.comment = comment;
}
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
private int getNewAttributeId(Artifact artifact, Attribute<?> attribute) throws OseeCoreException {
return StoreSkynetTransactionOperation.getNewAttributeId(artifact, attribute);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandlerOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandlerOperation.java
index 8e2c002..6a19dff 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandlerOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandlerOperation.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.skynet.update;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
@@ -31,6 +32,7 @@ import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
@@ -70,7 +72,12 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
Branch destinationBranch = destinationParentArtifact.getFullBranch();
if (isUpdateFromParent(sourceBranch, destinationBranch)) {
- MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, UPDATE_FROM_PARENT_ERROR_MSG);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, UPDATE_FROM_PARENT_ERROR_MSG);
+ }
+ });
} else if (isAccessAllowed(sourceBranch, destinationBranch)) {
Set<Artifact> transferArtifacts = getArtifactSetToTransfer();
monitor.beginTask("Processing Artifact(s)", 2 + (transferArtifacts.size() * 4));
@@ -80,7 +87,6 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
final List<TransferObject> convertedArtifacts =
convertToTransferObjects(transferArtifacts, destinationParentArtifact.getBranch());
Displays.ensureInDisplayThread(new Runnable() {
-
@Override
public void run() {
userConfirmed.setValue(confirmUsersRequestAndProcess(convertedArtifacts));
@@ -92,8 +98,14 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
}
addArtifactsToNewTransaction(destinationParentArtifact, transferArtifacts, sourceBranch, monitor);
} else {
- MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, ACCESS_ERROR_MSG);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, ACCESS_ERROR_MSG);
+ }
+ });
}
+ monitor.done();
}
private Set<Artifact> getArtifactSetToTransfer() throws OseeCoreException {
@@ -159,9 +171,10 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
private void handleTransfers(Set<Artifact> transferArtifacts, Artifact destinationArtifact, IProgressMonitor monitor) throws OseeCoreException {
IOseeBranch destinationBranch = destinationArtifact.getBranch();
- SkynetTransaction transaction =
- TransactionManager.createTransaction(destinationBranch, "Introduced " + transferArtifacts.size() + " artifact(s)");
- Set<Artifact> reloadArtifacts = new LinkedHashSet<Artifact>();
+ SkynetTransaction transaction = TransactionManager.createTransaction(destinationBranch, Strings.EMPTY_STRING);
+
+ Set<Artifact> updated = new LinkedHashSet<Artifact>();
+ Set<Artifact> introduced = new LinkedHashSet<Artifact>();
//make sure all transfer artifacts are on the destination branch
for (Artifact sourceArtifact : transferArtifacts) {
@@ -169,7 +182,7 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
ArtifactQuery.checkArtifactFromId(sourceArtifact.getArtId(), destinationBranch,
DeletionFlag.EXCLUDE_DELETED);
if (onDestinationBranch == null) {
- handleIntroduceCase(sourceArtifact, destinationArtifact, reloadArtifacts, transaction);
+ handleIntroduceCase(sourceArtifact, destinationArtifact, introduced, transaction);
}
monitor.worked(1);
}
@@ -179,7 +192,7 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
Artifact onDestinationBranch =
ArtifactQuery.checkArtifactFromId(sourceArtifact.getArtId(), destinationBranch,
DeletionFlag.EXCLUDE_DELETED);
- handleUpdateCase(sourceArtifact, onDestinationBranch, reloadArtifacts, transaction);
+ handleUpdateCase(sourceArtifact, onDestinationBranch, updated, transaction);
monitor.worked(1);
}
@@ -189,16 +202,21 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
ArtifactQuery.checkArtifactFromId(sourceArtifact.getArtId(), destinationBranch,
DeletionFlag.EXCLUDE_DELETED);
Artifact parent = onDestinationBranch.getParent();
- if ((parent == null || parent.equals(CoreArtifactTokens.DefaultHierarchyRoot)) && !destinationArtifact.equals(onDestinationBranch)) {
+ if (CoreArtifactTokens.DefaultHierarchyRoot.equals(parent) && !destinationArtifact.equals(onDestinationBranch)) {
destinationArtifact.addChild(onDestinationBranch);
destinationArtifact.persist(transaction);
}
monitor.worked(1);
}
+ String resultComment =
+ Strings.buildStatment(Arrays.asList(String.format("Introduced %s", introduced.size()),
+ String.format("Updated %s", updated.size() - introduced.size())));
+
+ transaction.setComment(String.format("%s artifact(s)", resultComment));
transaction.execute();
monitor.worked(1);
- reloadCachedArtifacts(reloadArtifacts);
+ reloadCachedArtifacts(updated);
monitor.worked(1);
}
@@ -218,9 +236,9 @@ public class InterArtifactExplorerDropHandlerOperation extends AbstractOperation
reloadArtifacts.add(updatedArtifact);
}
- private void handleUpdateCase(Artifact sourceArtifact, Artifact destinationArtifact, Set<Artifact> reloadArtifacts, SkynetTransaction transaction) throws OseeCoreException {
+ private void handleUpdateCase(Artifact sourceArtifact, Artifact destinationArtifact, Set<Artifact> updated, SkynetTransaction transaction) throws OseeCoreException {
destinationArtifact.updateArtifactFromBranch(sourceArtifact.getBranch());
- reloadArtifacts.add(destinationArtifact);
+ updated.add(destinationArtifact);
destinationArtifact.persist(transaction);
}