diff options
author | ddunne | 2009-04-09 23:10:06 +0000 |
---|---|---|
committer | ddunne | 2009-04-09 23:10:06 +0000 |
commit | 3301e40e37c5cbf70bd2224ce881f27e9db22502 (patch) | |
tree | d3d4a344c0baed2557f6b01fced2be4464d8ec6c /org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui | |
parent | 99b267202769a6fb2e527e18af676d211a6775ee (diff) | |
download | org.eclipse.osee-3301e40e37c5cbf70bd2224ce881f27e9db22502.tar.gz org.eclipse.osee-3301e40e37c5cbf70bd2224ce881f27e9db22502.tar.xz org.eclipse.osee-3301e40e37c5cbf70bd2224ce881f27e9db22502.zip |
Diffstat (limited to 'org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui')
3 files changed, 64 insertions, 42 deletions
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java index b27edea7c6b..df80aa90afe 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java @@ -49,21 +49,20 @@ public abstract class CommitHandler extends CommandHandler { this.useParentBranch = useParentBranch;
}
- public static boolean commitBranch(ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
+ public static boolean commitBranch(final ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
final Branch sourceBranch = conflictManager.getFromBranch();
final Branch destinationBranch = conflictManager.getToBranch();
final TransactionId transactionId = TransactionIdManager.getStartEndPoint(sourceBranch).getKey();
boolean branchCommitted = false;
- int numRemainingConflicts = conflictManager.getRemainingConflicts().size();
- if (numRemainingConflicts > 0) {
+ if (conflictManager.getRemainingConflicts().size() > 0) {
String message =
"Commit stopped due to unresolved conflicts\n\nPossible Resolutions:\n Cancel commit and resolve at a later time\n Launch the Merge Manager to resolve conflicts";
final String fMessage;
final String[] choices;
if (AccessControlManager.isOseeAdmin()) {
fMessage = message + "\n Force the commit";
- choices = new String[] {"Cancel", "Launch Merge Manager", "Force Commit"};
+ choices = new String[] {"Cancel", "Launch Merge Manager", "Force Commit (Admin Only)"};
} else {
fMessage = message;
choices = new String[] {"Cancel", "Launch Merge Manager"};
@@ -90,9 +89,9 @@ public abstract class CommitHandler extends CommandHandler { final StringBuilder message =
new StringBuilder(
"Commit branch\n\n\"" + sourceBranch + "\"\n\n onto destination branch\n\n\"" + destinationBranch + "\"\n");
- int numOriginalConfilcts = conflictManager.getOriginalConflicts().size();
- if (numOriginalConfilcts > 0) {
- message.append("\nwith " + numOriginalConfilcts + " conflicts resolved.\n");
+ int numOriginalConflicts = conflictManager.getOriginalConflicts().size();
+ if (numOriginalConflicts > 0) {
+ message.append("\nwith " + numOriginalConflicts + " conflicts resolved.\n");
} else {
message.append("\n(no conflicts found)\n");
}
@@ -101,13 +100,24 @@ public abstract class CommitHandler extends CommandHandler { final MutableInteger dialogResult = new MutableInteger(0);
Display.getDefault().syncExec(new Runnable() {
public void run() {
- MessageDialog dialog =
- new MessageDialog(Display.getCurrent().getActiveShell(), "Commit Branch", null,
- message.toString(), MessageDialog.QUESTION, new String[] {"Ok", "Launch Merge Manager",
- "Cancel"}, 0);
- dialogResult.setValue(dialog.open());
- if (dialogResult.getValue() == 1) {
- MergeView.openView(sourceBranch, destinationBranch, transactionId);
+ try {
+ if (conflictManager.getOriginalConflicts().size() == 0) {
+ MessageDialog dialog =
+ new MessageDialog(Display.getCurrent().getActiveShell(), "Commit Branch", null,
+ message.toString(), MessageDialog.QUESTION, new String[] {"Ok", "Cancel"}, 0);
+ dialogResult.setValue(dialog.open());
+ } else {
+ MessageDialog dialog =
+ new MessageDialog(Display.getCurrent().getActiveShell(), "Commit Branch", null,
+ message.toString(), MessageDialog.QUESTION, new String[] {"Ok",
+ "Launch Merge Manager", "Cancel"}, 0);
+ dialogResult.setValue(dialog.open());
+ if (dialogResult.getValue() == 1) {
+ MergeView.openView(sourceBranch, destinationBranch, transactionId);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
}
}
});
@@ -123,19 +133,21 @@ public abstract class CommitHandler extends CommandHandler { @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
-
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+
List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
Branch sourceBranch = branches.iterator().next();
-
+
try {
Branch destinationBranch = null;
if (useParentBranch) {
destinationBranch = sourceBranch.getParentBranch();
} else {
- destinationBranch = BranchManager.getBranch(Integer.parseInt(event.getParameter(BranchViewPresentationPreferences.BRANCH_ID)));
+ destinationBranch =
+ BranchManager.getBranch(Integer.parseInt(event.getParameter(BranchViewPresentationPreferences.BRANCH_ID)));
}
- Jobs.startJob(new CommitJob(sourceBranch, destinationBranch, Boolean.parseBoolean(event.getParameter(CommitBranchParameter.ARCHIVE_PARENT_BRANCH))));
+ Jobs.startJob(new CommitJob(sourceBranch, destinationBranch,
+ Boolean.parseBoolean(event.getParameter(CommitBranchParameter.ARCHIVE_PARENT_BRANCH))));
} catch (OseeCoreException ex) {
OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
}
@@ -145,27 +157,27 @@ public abstract class CommitHandler extends CommandHandler { @Override
public boolean isEnabledWithException() throws OseeCoreException {
boolean enabled = false;
-
+
IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
-
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+
List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
-
- if(branches.size() == 1){
+
+ if (branches.size() == 1) {
Branch branch = branches.iterator().next();
enabled = useParentBranchValid(branch) || (!useParentBranch && AccessControlManager.isOseeAdmin());
}
return enabled;
}
-
- protected boolean useParentBranchValid(Branch branch){
- return branch.hasParentBranch() && useParentBranch && ! branch.isChangeManaged() && !branch.isArchived();
+
+ protected boolean useParentBranchValid(Branch branch) {
+ return branch.hasParentBranch() && useParentBranch && !branch.isChangeManaged() && !branch.isArchived();
}
private class CommitJob extends Job {
- private Branch sourceBranch;
- private Branch destinationBranch;
- private boolean archiveSourceBranch;
+ private final Branch sourceBranch;
+ private final Branch destinationBranch;
+ private final boolean archiveSourceBranch;
/**
* @param name
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java index 513f88a946b..a4ad4d96d23 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java @@ -53,7 +53,7 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis OseeEventManager.addListener(this); } - + @Override public void dispose() { super.dispose(); @@ -84,7 +84,7 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis xBranchWidget = new XBranchWidget(); xBranchWidget.setDisplayLabel(false); xBranchWidget.createWidgets(parent, 1); - + branchViewPresentationPreferences = new BranchViewPresentationPreferences(this); xBranchWidget.loadData(); @@ -109,7 +109,7 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis public String getActionDescription() { return ""; } - + /** * Reveal a branch in the viewer and select it. */ @@ -133,7 +133,7 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis @Override public void handleBranchEvent(Sender sender, BranchEventType branchModType, final int branchId) { - if (branchModType == BranchEventType.Committed || branchModType == BranchEventType.Added) { + if (branchModType == BranchEventType.Committed || branchModType == BranchEventType.Added || branchModType == BranchEventType.Deleted) { Displays.ensureInDisplayThread(new Runnable() { public void run() { try { @@ -152,7 +152,7 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis @Override public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) { } - + /* (non-Javadoc) * @see org.eclipse.osee.framework.skynet.core.event.ITransactionsDeletedEventListener#handleTransactionsDeletedEvent(org.eclipse.osee.framework.skynet.core.event.Sender, int[]) */ @@ -189,14 +189,14 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis BranchViewPresentationPreferences.SHOW_MERGE_BRANCHES, showMergeBranches); } } - + public void changeArchivedBranchPresentation(boolean showArchivedBranches) { if (branchViewPresentationPreferences != null) { branchViewPresentationPreferences.getViewPreference().putBoolean( BranchViewPresentationPreferences.SHOW_ARCHIVED_BRANCHES, showArchivedBranches); } } - + public void changeFavoritesFirstPresentation(boolean showArchivedBranches) { if (branchViewPresentationPreferences != null) { branchViewPresentationPreferences.getViewPreference().putBoolean( @@ -205,35 +205,40 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis } /** - * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part of the regular API. + * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part + * of the regular API. */ protected void setPresentation(boolean flat) { xBranchWidget.setPresentation(flat); } /** - * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part of the regular API. + * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part + * of the regular API. */ protected void setFavoritesFirst(boolean favoritesFirst) { xBranchWidget.setFavoritesFirst(favoritesFirst); } /** - * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part of the regular API. + * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part + * of the regular API. */ protected void setShowMergeBranches(boolean showMergeBranches) { xBranchWidget.setShowMergeBranches(showMergeBranches); } /** - * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part of the regular API. + * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part + * of the regular API. */ protected void setShowTransactions(boolean showTransactions) { xBranchWidget.setShowTransactions(showTransactions); } /** - * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part of the regular API. + * This method is called by BranchViewPresentationPreferences to change the branch view data presentation. Not part + * of the regular API. */ protected void setShowArchivedBranches(boolean showArchivedBranches) { xBranchWidget.setShowArchivedBranches(showArchivedBranches); diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java index 3b438bf2bfc..ae903c20dc7 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java @@ -22,7 +22,10 @@ import org.eclipse.osee.framework.core.enums.ConflictType; import org.eclipse.osee.framework.db.connection.exception.MergeChangesInArtifactException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.HttpBranchCreation;
import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.skynet.core.event.MergeBranchEventType;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.mergeWizard.ConflictResolutionWizard;
@@ -182,6 +185,8 @@ public class MergeXViewer extends XViewer { MergeUtility.showInformationalConflict(shell);
} else {
conflict.handleResolvedSelection();
+ OseeEventManager.kickMergeBranchEvent(HttpBranchCreation.class, MergeBranchEventType.ConflictResolved,
+ conflict.getMergeBranchID());
}
}
|