Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-07-10 18:12:45 +0000
committerMichael Valenta2007-07-10 18:12:45 +0000
commit7733fd9b82f78185b07a084276113e7eecaeee83 (patch)
tree3ee3bf72a6a0190da5fa4776a120e8061666ca38
parent6a7e6f8172d9661b2d78fa8ea85ea6d8159c1da9 (diff)
downloadeclipse.platform.team-7733fd9b82f78185b07a084276113e7eecaeee83.tar.gz
eclipse.platform.team-7733fd9b82f78185b07a084276113e7eecaeee83.tar.xz
eclipse.platform.team-7733fd9b82f78185b07a084276113e7eecaeee83.zip
Bug 166333 [Wizards] Show diff in CVS commit dialog
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java103
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java69
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/syncpane_co.gifbin0 -> 235 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/syncpane_co.gifbin0 -> 604 bytes
6 files changed, 174 insertions, 15 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties
index 4453c9799..bff5d9434 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/actions.properties
@@ -86,3 +86,8 @@ SharingCommitAction.label=Commit
SharingCommitAction.tooltip=Commit All Changes...
SharingCommitAction.description=Commit All Changes...
SharingCommitAction.image=checkin_action.gif
+
+ComnitWizardComparePaneToggle.label=Show Changes
+ComnitWizardComparePaneToggle.tooltip=Show file content changes pane
+ComnitWizardComparePaneToggle.description=Show file content changes pane
+ComnitWizardComparePaneToggle.image=syncpane_co.gif
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
index 1ff743d2c..7beb693a9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
@@ -165,8 +165,9 @@ public class CommitWizard extends ResizableWizard {
public CommitWizard(final IResource [] resources) throws CVSException {
- super(CVSUIMessages.CommitWizard_3, CVSUIPlugin.getPlugin().getDialogSettings());
+ super(CVSUIMessages.CommitWizard_3, CVSUIPlugin.getPlugin().getDialogSettings());
+ setNeedsProgressMonitor(true);
setWindowTitle(CVSUIMessages.CommitWizard_2);
setDefaultPageImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION));
@@ -294,8 +295,17 @@ public class CommitWizard extends ResizableWizard {
return false;
}
+ fCommitPage.finish();
return super.performFinish();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.wizards.ResizableWizard#performCancel()
+ */
+ public boolean performCancel() {
+ fCommitPage.finish();
+ return super.performCancel();
+ }
public void addPages() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
index 9ff9df224..103dfbf14 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
@@ -11,10 +11,12 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
+import org.eclipse.compare.*;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -23,6 +25,7 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -46,7 +49,14 @@ import org.eclipse.ui.part.PageBook;
*/
public class CommitWizardCommitPage extends WizardPage implements IPropertyChangeListener {
- private final CommitCommentArea fCommentArea;
+ public static final String SHOW_COMPARE = "ShowCompare"; //$NON-NLS-1$
+ private static final String H_WEIGHT_1 = "HWeight1"; //$NON-NLS-1$
+ private static final String H_WEIGHT_2 = "HWeight2"; //$NON-NLS-1$
+ private static final String V_WEIGHT_1 = "VWeight1"; //$NON-NLS-1$
+ private static final String V_WEIGHT_2 = "VWeight2"; //$NON-NLS-1$
+
+
+ private final CommitCommentArea fCommentArea;
private ISynchronizePageConfiguration fConfiguration;
@@ -59,6 +69,11 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
private boolean fIsEmpty;
+ private CompareViewerSwitchingPane compareViewerPane;
+ private SashForm horizontalSash;
+ private SashForm verticalSash;
+ private boolean showCompare;
+
public CommitWizardCommitPage(IResource [] resources, CommitWizard wizard) {
super(CVSUIMessages.CommitWizardCommitPage_0);
@@ -85,9 +100,53 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
// set F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.COMMIT_COMMENT_PAGE);
- createCommentArea(composite, converter);
- createChangesArea(composite, converter);
+ horizontalSash = new SashForm(composite, SWT.HORIZONTAL);
+ horizontalSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ verticalSash = new SashForm(horizontalSash, SWT.VERTICAL);
+ verticalSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ createCommentArea(verticalSash, converter);
+
+ createChangesArea(verticalSash, converter);
+
+ compareViewerPane = new CompareViewerSwitchingPane(horizontalSash, SWT.BORDER | SWT.FLAT) {
+ protected Viewer getViewer(Viewer oldViewer, Object input) {
+ CompareConfiguration cc = new CompareConfiguration();
+ cc.setLeftEditable(false);
+ cc.setRightEditable(false);
+
+ return CompareUI.findContentViewer(oldViewer, input, this, cc);
+ }
+ };
+ compareViewerPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ IDialogSettings section = getDialogSettings().getSection(CVSUIMessages.CommitWizard_3);
+ showCompare = section.getBoolean(SHOW_COMPARE);
+ int vWeight1 = 50;
+ int vWeight2 = 50;
+ try {
+ vWeight1 = section.getInt(V_WEIGHT_1);
+ vWeight2 = section.getInt(V_WEIGHT_2);
+ } catch (NumberFormatException e) {
+ }
+
+ int hWeight1 = 35;
+ int hWeight2 = 65;
+ try {
+ hWeight1 = section.getInt(H_WEIGHT_1);
+ hWeight2 = section.getInt(H_WEIGHT_2);
+ } catch (NumberFormatException e) {
+ }
+
+ if (!showCompare) {
+ horizontalSash.setMaximizedControl(verticalSash);
+ }
+
+ verticalSash.setWeights(new int[] {vWeight1, vWeight2});
+ horizontalSash.setWeights(new int[] {hWeight1, hWeight2});
+
//fSashForm.setWeights(weights);
Dialog.applyDialogFont(parent);
setControl(composite);
@@ -97,13 +156,20 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
validatePage(false);
}
+ public void setCompareInput(final Object input) {
+ compareViewerPane.setInput(input);
+ }
+
private void createCommentArea(Composite parent, PixelConverter converter) {
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(GridLayoutFactory.fillDefaults().margins(0, 0).create());
- fCommentArea.createArea(parent);
- fCommentArea.getComposite().setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true));
+ fCommentArea.createArea(c);
+ GridData gd = SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true);
+ fCommentArea.getComposite().setLayoutData(gd);
fCommentArea.addPropertyChangeListener(this);
- createPlaceholder(parent);
+ createPlaceholder(c);
}
private void createChangesArea(Composite parent, PixelConverter converter) {
@@ -132,8 +198,6 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_NONE));
composite.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, SWT.FILL, SWT.FILL, true, true));
- createPlaceholder(composite);
-
Control c = createChangesPage(composite, participant);
c.setLayoutData(SWTUtils.createHVFillGridData());
}
@@ -370,6 +434,29 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
}
return false;
}
+
+ public void finish() {
+ int[] hWeights = horizontalSash.getWeights();
+ int[] vWeights = verticalSash.getWeights();
+ IDialogSettings section = getDialogSettings().getSection(CVSUIMessages.CommitWizard_3);
+ if (showCompare) {
+ section.put(H_WEIGHT_1, hWeights[0]);
+ section.put(H_WEIGHT_2, hWeights[1]);
+ }
+ section.put(V_WEIGHT_1, vWeights[0]);
+ section.put(V_WEIGHT_2, vWeights[1]);
+ section.put(SHOW_COMPARE, showCompare);
+ }
+
+ public void showComparePane(boolean showCompare) {
+ this.showCompare = showCompare;
+ if (showCompare) {
+ horizontalSash.setMaximizedControl(null);
+ } else {
+ horizontalSash.setMaximizedControl(verticalSash);
+ }
+
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
index 5996b8b6d..2a71778db 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
@@ -15,21 +15,25 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.ui.CVSDecoration;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantLabelDecorator;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.*;
/**
* A participant that uses our decorator instead of the standard one.
*/
public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant {
-
+
/**
* The actions to be displayed in the context menu.
*/
@@ -68,8 +72,11 @@ public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant {
return decoration;
}
}
+
+ protected static final String ACTION_GROUP = "org.eclipse.tam.cvs.ui.CommitActions"; //$NON-NLS-1$
final CommitWizard fWizard;
+ protected Action showComparePaneAction;
public CommitWizardParticipant(ISynchronizeScope scope, CommitWizard wizard) {
super(scope);
@@ -83,17 +90,19 @@ public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant {
public ChangeSetCapability getChangeSetCapability() {
return null; // we don't want that button
}
+
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
*/
- protected void initializeConfiguration( ISynchronizePageConfiguration configuration) {
+ protected void initializeConfiguration( final ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ISynchronizePageConfiguration.LAYOUT_GROUP});
+ configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ACTION_GROUP, ISynchronizePageConfiguration.LAYOUT_GROUP});
configuration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU);
configuration.addMenuGroup(
ISynchronizePageConfiguration.P_CONTEXT_MENU,
CONTEXT_MENU_CONTRIBUTION_GROUP_3);
configuration.addActionContribution(new ActionContribution());
+ configuration.setRunnableContext(fWizard.getContainer());
// Wrap the container so that we can update the enablements after the runnable
// (i.e. the container resets the state to what it was at the beginning of the
@@ -110,11 +119,59 @@ public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant {
});
configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE);
configuration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE);
+ configuration.addActionContribution(new SynchronizePageActionGroup() {
+ public void initialize(ISynchronizePageConfiguration configuration) {
+ super.initialize(configuration);
+ showComparePaneAction = new Action(null, Action.AS_CHECK_BOX) {
+ public void run() {
+ fWizard.getCommitPage().showComparePane(this.isChecked());
+ }
+ };
+ Utils.initAction(showComparePaneAction, "ComnitWizardComparePaneToggle.", Policy.getActionBundle()); //$NON-NLS-1$
+ showComparePaneAction.setChecked(isComparePaneVisible());
+ appendToGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ACTION_GROUP, showComparePaneAction);
+ }
+ });
+ configuration.setProperty(SynchronizePageConfiguration.P_OPEN_ACTION, new Action() {
+ public void run() {
+ ISelection selection = configuration.getSite().getSelectionProvider().getSelection();
+ if(selection instanceof IStructuredSelection) {
+ final Object obj = ((IStructuredSelection) selection).getFirstElement();
+ if (obj instanceof SyncInfoModelElement) {
+ try {
+ fWizard.getContainer().run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ ((SyncInfoModelElement)obj).cacheContents(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ fWizard.getContainer().getShell().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ fWizard.getCommitPage().showComparePane(true);
+ showComparePaneAction.setChecked(true);
+ fWizard.getCommitPage().setCompareInput(obj);
+ }
+ });
+ }
+ });
+ } catch (InvocationTargetException e) {
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ }
+ });
}
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#doesSupportSynchronize()
*/
public boolean doesSupportSynchronize() {
return false;
}
+
+ private boolean isComparePaneVisible() {
+ return fWizard.getDialogSettings().getSection(CVSUIMessages.CommitWizard_3).getBoolean(CommitWizardCommitPage.SHOW_COMPARE);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/syncpane_co.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/syncpane_co.gif
new file mode 100644
index 000000000..7da48249e
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/syncpane_co.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/syncpane_co.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/syncpane_co.gif
new file mode 100644
index 000000000..2644c2ad6
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/syncpane_co.gif
Binary files differ

Back to the top