Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-03-13 20:05:49 +0000
committerMichael Valenta2002-03-13 20:05:49 +0000
commit969f30c4eef8cf5203fa43e3ee8aed2241663bc3 (patch)
tree4cec67688ef2abe7c8e70f50059b3e4f80716008
parentbda1df7b7ad295e850e86591a5819fe0e38d506d (diff)
downloadeclipse.platform.team-969f30c4eef8cf5203fa43e3ee8aed2241663bc3.tar.gz
eclipse.platform.team-969f30c4eef8cf5203fa43e3ee8aed2241663bc3.tar.xz
eclipse.platform.team-969f30c4eef8cf5203fa43e3ee8aed2241663bc3.zip
8970: "Branch" dialog - suggest make multipage
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardBranchPage.java (renamed from bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardPage.java)71
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardMethodPage.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardVersionPage.java98
6 files changed, 273 insertions, 76 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 537701b93..88d0e2e3e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -532,13 +532,20 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
* Use specialiazed tagging to move all local changes (including additions and
* deletions) to the specified branch.
*/
- public void makeBranch(IResource[] resources, CVSTag versionTag, CVSTag branchTag, boolean moveToBranch, IProgressMonitor monitor) throws TeamException {
+ public void makeBranch(IResource[] resources, CVSTag versionTag, CVSTag branchTag, boolean moveToBranch, boolean eclipseWay, IProgressMonitor monitor) throws TeamException {
// Determine the total amount of work
int totalWork = 10 + (versionTag!= null ? 60 : 40) + (moveToBranch ? 20 : 0);
monitor.beginTask(Policy.bind("CVSTeamProvider.makeBranch"), totalWork); //$NON-NLS-1$
try {
+ // Determine which tag command to used depending on whether the Eclipse specific
+ // method of branching is requested
+ Tag tagCommand = Command.TAG;
+ if (eclipseWay) {
+ tagCommand = Command.CUSTOM_TAG;
+ }
+
// Build the arguments list
String[] arguments = getValidArguments(resources, Command.NO_LOCAL_OPTIONS);
@@ -550,7 +557,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
IStatus status;
if (versionTag != null) {
// Version using tag and braqnch using rtag
- status = Command.CUSTOM_TAG.execute(s,
+ status = tagCommand.execute(s,
Command.NO_GLOBAL_OPTIONS,
Command.NO_LOCAL_OPTIONS,
versionTag,
@@ -559,7 +566,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
Policy.subMonitorFor(monitor, 40));
if (status.getCode() != CVSStatus.SERVER_ERROR) {
// XXX Could use RTAG here when it works
- status = Command.CUSTOM_TAG.execute(s,
+ status = tagCommand.execute(s,
Command.NO_GLOBAL_OPTIONS,
Command.NO_LOCAL_OPTIONS,
branchTag,
@@ -569,7 +576,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
}
} else {
// Just branch using tag
- status = Command.CUSTOM_TAG.execute(s,
+ status = tagCommand.execute(s,
Command.NO_GLOBAL_OPTIONS,
Command.NO_LOCAL_OPTIONS,
branchTag,
@@ -588,7 +595,11 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
// Set the tag of the local resources to the branch tag (The update command will not
// properly update "cvs added" and "cvs removed" resources so a custom visitor is used
if (moveToBranch) {
- setTag(resources, branchTag, Policy.subMonitorFor(monitor, 20));
+ if (eclipseWay) {
+ setTag(resources, branchTag, Policy.subMonitorFor(monitor, 20));
+ } else {
+ update(resources, Command.NO_LOCAL_OPTIONS, branchTag, null, Policy.subMonitorFor(monitor, 20));
+ }
}
} finally {
monitor.done();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 291790cfe..8e2c58741 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -25,11 +25,20 @@ BranchWizard.createABranch=Create a Branch
BranchWizard.title=Create Branch
BranchWizard.errorTagging=Error Tagging Resources
-BranchWizardPage.description=Enter the name of the branch tag to create, and specify whether you wish to begin working in the branch.\n\nIf you choose to begin working in the branch, your selected workspace resources will be updated to point to the new branch.
-BranchWizardPage.branchName=Branch Name:
-BranchWizardPage.startWorking=Start working in the branch
-BranchWizardPage.specifyVersion=Version the project before creating the branch
-BranchWizardPage.versionName=Version Name:
+BranchWizardVersionPage.description=It is recommended that you version before branching. Versioning will provide a starting point for merging the branch back to the source branch.
+BranchWizardVersionPage.specifyVersion=Version the project before creating the branch
+BranchWizardVersionPage.versionName=Version Name:
+
+BranchWizardBranchPage.description=Enter the name of the branch tag to create, and specify whether you wish to begin working in the branch. If you choose to begin working in the branch, your selected workspace resources will be updated to point to the new branch.
+BranchWizardBranchPage.branchName=Branch Name:
+BranchWizardBranchPage.startWorking=Start working in the branch
+
+BranchWizardMethodPage.description=Choose the method to use when tagging and updating
+BranchWizardMethodPage.eclipseWay=Eclipse specific method
+BranchWizardMethodPage.cvsWay=General CVS method
+BranchWizardMethodPage.eclipseDescription=The Eclipse specific method tags all managed resource with a remote counterpart, including those that have been removed locally and ignores resources that have been added to cvs control but not committed. On update, both removed and added files are moved to the branch.
+BranchWizardMethodPage.cvsDescription=The CVS method does not tag managed resources that have been deleted. Therefore, these resources will not exists in the branch and will not result in incoming deletions when the branch is merged back to the source branch. Resources that have been added to cvs control but not committed will result in an error.
+
CVSCatchupReleaseViewer.commit=&Commit
CVSCatchupReleaseViewer.update=&Update from Repository
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
index 6ef9f4342..9885c2284 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
@@ -20,6 +20,10 @@ import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
@@ -28,7 +32,6 @@ import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
@@ -37,7 +40,9 @@ import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
public class BranchWizard extends Wizard {
- BranchWizardPage mainPage;
+ BranchWizardVersionPage versionPage;
+ BranchWizardBranchPage branchPage;
+ BranchWizardMethodPage methodPage;
IResource[] resources;
public BranchWizard() {
@@ -46,8 +51,12 @@ public class BranchWizard extends Wizard {
}
public void addPages() {
- mainPage = new BranchWizardPage("branchPage", Policy.bind("BranchWizard.createABranch"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_BRANCH));
- addPage(mainPage);
+ versionPage = new BranchWizardVersionPage("versionPage", Policy.bind("BranchWizard.createABranch"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_BRANCH));
+ addPage(versionPage);
+ branchPage = new BranchWizardBranchPage("branchPage", Policy.bind("BranchWizard.createABranch"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_BRANCH));
+ addPage(branchPage);
+ methodPage = new BranchWizardMethodPage("methodPage", Policy.bind("BranchWizard.createABranch"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_BRANCH));
+ addPage(methodPage);
}
public boolean performFinish() {
final boolean[] result = new boolean[] {false};
@@ -55,13 +64,14 @@ public class BranchWizard extends Wizard {
getContainer().run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
- String tagString = mainPage.getBranchTag();
- boolean update = mainPage.getUpdate();
- String versionString = mainPage.getVersionTag();
+ String tagString = branchPage.getBranchTag();
+ boolean update = branchPage.getUpdate();
+ String versionString = versionPage.getVersionTag();
CVSTag versionTag = null;
if (versionString != null) {
versionTag = new CVSTag(versionString, CVSTag.VERSION);
}
+ boolean eclipseWay = methodPage.getEclipseWay();
// To do: use the wizard's progress monitor
RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
@@ -78,7 +88,7 @@ public class BranchWizard extends Wizard {
ICVSRepositoryLocation root = provider.getCVSWorkspaceRoot().getRemoteLocation();
CVSTag tag = new CVSTag(tagString, CVSTag.BRANCH);
try {
- provider.makeBranch(providerResources, versionTag, tag, update, subMonitor);
+ provider.makeBranch(providerResources, versionTag, tag, update, eclipseWay, subMonitor);
if (versionTag != null) {
for (int i = 0; i < providerResources.length; i++) {
ICVSRemoteFolder remoteResource = (ICVSRemoteFolder) CVSWorkspaceRoot.getRemoteResourceFor(providerResources[i]);
@@ -136,4 +146,25 @@ public class BranchWizard extends Wizard {
}
return result;
}
+
+ /**
+ * A helper method used by pages to display indented descriptions
+ */
+ protected static Composite createDescriptionComposite(Composite parent, int parentColumns) {
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ // GridLayout
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 10;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+
+ // GridData
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = parentColumns;
+ composite.setLayoutData(data);
+ return composite;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardBranchPage.java
index a19fe4241..720a3440e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardBranchPage.java
@@ -6,10 +6,10 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
*/
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
@@ -19,16 +19,13 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.Policy;
-public class BranchWizardPage extends CVSWizardPage {
+public class BranchWizardBranchPage extends CVSWizardPage {
boolean update;
String branchTag;
- String versionTag;
- boolean doVersion;
-
- Text versionText;
+
Text branchText;
- public BranchWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ public BranchWizardBranchPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
}
/*
@@ -38,7 +35,7 @@ public class BranchWizardPage extends CVSWizardPage {
Composite composite = createComposite(parent, 2);
Label label = new Label(composite, SWT.WRAP);
- label.setText(Policy.bind("BranchWizardPage.description"));
+ label.setText(Policy.bind("BranchWizardBranchPage.description"));
GridData data = new GridData();
data.horizontalSpan = 2;
data.widthHint = 350;
@@ -47,7 +44,7 @@ public class BranchWizardPage extends CVSWizardPage {
createLabel(composite, "");
createLabel(composite, "");
- createLabel(composite, Policy.bind("BranchWizardPage.branchName"));
+ createLabel(composite, Policy.bind("BranchWizardBranchPage.branchName"));
branchText = createTextField(composite);
branchText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event event) {
@@ -63,58 +60,27 @@ public class BranchWizardPage extends CVSWizardPage {
data = new GridData();
data.horizontalSpan = 2;
check.setLayoutData(data);
- check.setText(Policy.bind("BranchWizardPage.startWorking"));
+ check.setText(Policy.bind("BranchWizardBranchPage.startWorking"));
check.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
update = check.getSelection();
}
});
- check.setSelection(true);
+ check.setSelection(true);
update = true;
-
- createLabel(composite, "");
- createLabel(composite, "");
-
- final Button specifyVersion = new Button(composite, SWT.CHECK);
- data = new GridData();
- data.horizontalSpan = 2;
- specifyVersion.setLayoutData(data);
- specifyVersion.setText(Policy.bind("BranchWizardPage.specifyVersion"));
- specifyVersion.setSelection(true);
- doVersion = true;
-
- createLabel(composite, Policy.bind("BranchWizardPage.versionName"));
- versionText = createTextField(composite);
- versionText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- versionTag = versionText.getText();
- updateEnablement();
- }
- });
- specifyVersion.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- doVersion = specifyVersion.getSelection();
- versionText.setEnabled(doVersion);
- updateEnablement();
- }
- });
-
+
setControl(composite);
updateEnablement();
}
+
public String getBranchTag() {
return branchTag;
}
+
public boolean getUpdate() {
return update;
}
- public String getVersionTag() {
- if (doVersion) {
- return versionTag;
- } else {
- return null;
- }
- }
+
private void updateEnablement() {
String branch = branchText.getText();
if (branch.length() == 0) {
@@ -130,17 +96,6 @@ public class BranchWizardPage extends CVSWizardPage {
setPageComplete(false);
return;
}
-
- if (doVersion) {
- status = CVSTag.validateTagName(versionText.getText());
- if (status.isOK()) {
- setErrorMessage(null);
- } else {
- setErrorMessage(status.getMessage());
- setPageComplete(false);
- return;
- }
- }
setPageComplete(true);
}
-}
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardMethodPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardMethodPage.java
new file mode 100644
index 000000000..bb057746d
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardMethodPage.java
@@ -0,0 +1,93 @@
+package org.eclipse.team.internal.ccvs.ui.wizards;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.team.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+
+public class BranchWizardMethodPage extends CVSWizardPage {
+ boolean eclipseWay = true;
+
+ public BranchWizardMethodPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+ /*
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent, 2);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(Policy.bind("BranchWizardMethodPage.description")); //$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ data.widthHint = 350;
+ label.setLayoutData(data);
+
+ createLabel(composite, "");
+ createLabel(composite, "");
+
+ Button eclipseWay = new Button(composite, SWT.RADIO);
+ eclipseWay.setText(Policy.bind("BranchWizardMethodPage.eclipseWay")); //$NON-NLS-1$
+ eclipseWay.setSelection(this.eclipseWay);
+ eclipseWay.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ BranchWizardMethodPage.this.eclipseWay = true;
+ }
+ });
+ data = new GridData();
+ data.horizontalSpan = 2;
+ eclipseWay.setLayoutData(data);
+
+ Composite eclipseDescriptionComposite = BranchWizard.createDescriptionComposite(composite, 2);
+ Label eclipseDescription = new Label(eclipseDescriptionComposite, SWT.WRAP);
+ eclipseDescription.setText(Policy.bind("BranchWizardMethodPage.eclipseDescription")); //$NON-NLS-1$
+ data = new GridData();
+ data.widthHint = 350;
+ eclipseDescription.setLayoutData(data);
+
+ Button cvsWay = new Button(composite, SWT.RADIO);
+ cvsWay.setText(Policy.bind("BranchWizardMethodPage.cvsWay")); //$NON-NLS-1$
+ cvsWay.setSelection( ! this.eclipseWay);
+ cvsWay.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ BranchWizardMethodPage.this.eclipseWay = false;
+ }
+ });
+ data = new GridData();
+ data.horizontalSpan = 2;
+ cvsWay.setLayoutData(data);
+
+ Composite cvsDescriptionComposite = BranchWizard.createDescriptionComposite(composite, 2);
+ Label cvsDescription = new Label(cvsDescriptionComposite, SWT.WRAP);
+ cvsDescription.setText(Policy.bind("BranchWizardMethodPage.cvsDescription")); //$NON-NLS-1$
+ data = new GridData();
+ data.widthHint = 350;
+ cvsDescription.setLayoutData(data);
+
+ setControl(composite);
+ updateEnablement();
+ }
+
+ public boolean getEclipseWay() {
+ return eclipseWay;
+ }
+
+ private void updateEnablement() {
+ setPageComplete(true);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardVersionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardVersionPage.java
new file mode 100644
index 000000000..af15b3a03
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizardVersionPage.java
@@ -0,0 +1,98 @@
+package org.eclipse.team.internal.ccvs.ui.wizards;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.team.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+
+public class BranchWizardVersionPage extends CVSWizardPage {
+ String versionTag;
+ boolean doVersion;
+
+ Text versionText;
+
+ public BranchWizardVersionPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+ /*
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent, 2);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(Policy.bind("BranchWizardVersionPage.description"));
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ data.widthHint = 350;
+ label.setLayoutData(data);
+
+ createLabel(composite, "");
+ createLabel(composite, "");
+
+ final Button specifyVersion = new Button(composite, SWT.CHECK);
+ data = new GridData();
+ data.horizontalSpan = 2;
+ specifyVersion.setLayoutData(data);
+ specifyVersion.setText(Policy.bind("BranchWizardVersionPage.specifyVersion"));
+ specifyVersion.setSelection(true);
+ doVersion = true;
+
+ createLabel(composite, Policy.bind("BranchWizardVersionPage.versionName"));
+ versionText = createTextField(composite);
+ versionText.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event event) {
+ versionTag = versionText.getText();
+ updateEnablement();
+ }
+ });
+ specifyVersion.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ doVersion = specifyVersion.getSelection();
+ versionText.setEnabled(doVersion);
+ updateEnablement();
+ }
+ });
+
+ setControl(composite);
+ updateEnablement();
+ }
+
+ public String getVersionTag() {
+ if (doVersion) {
+ return versionTag;
+ } else {
+ return null;
+ }
+ }
+
+ private void updateEnablement() {
+ if (doVersion) {
+ IStatus status = CVSTag.validateTagName(versionText.getText());
+ if (status.isOK()) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(status.getMessage());
+ setPageComplete(false);
+ return;
+ }
+ } else {
+ setErrorMessage(null);
+ }
+ setPageComplete(true);
+ }
+}

Back to the top