diff options
author | Michael Valenta | 2002-06-07 16:20:32 +0000 |
---|---|---|
committer | Michael Valenta | 2002-06-07 16:20:32 +0000 |
commit | 2956e2b7af095b21cda833ca4f313471d1b62364 (patch) | |
tree | 554b62f20d432f5f68cc80d9c7b6a0dee32d337a | |
parent | 702644a55426b6c49769b0ef10171fbead5125d5 (diff) | |
download | eclipse.platform.team-2956e2b7af095b21cda833ca4f313471d1b62364.tar.gz eclipse.platform.team-2956e2b7af095b21cda833ca4f313471d1b62364.tar.xz eclipse.platform.team-2956e2b7af095b21cda833ca4f313471d1b62364.zip |
14770: Prompt when discarding location should tell you which projects
7 files changed, 78 insertions, 59 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java index fd44cefaf..798ee732f 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java @@ -252,7 +252,8 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { Policy.bind("CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository_2"), //$NON-NLS-1$ Policy.bind("CVSRepositoryPropertiesPage.sharedProject", location.toString()), //$NON-NLS-1$ (IProject[]) projects.toArray(new IProject[projects.size()]), - true); + true, + DetailsDialogWithProjects.DLG_IMG_WARNING); int r = dialog.open(); if (r != dialog.OK) { result[0] = false; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java index b9f4ea25d..7077051f8 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java @@ -102,7 +102,8 @@ public class RemoveRootAction extends TeamAction { Policy.bind("RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2", location), //$NON-NLS-1$ Policy.bind("RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4"), //$NON-NLS-1$ (IProject[]) shared.toArray(new IProject[shared.size()]), - false); + false, + DetailsDialogWithProjects.DLG_IMG_ERROR); dialog.open(); } }); 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 2a9e6b378..f2eb265b4 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 @@ -677,7 +677,7 @@ ConfigureTagsFromRepoViewError_retreiving_root_folders_from_repository_2=Error r ConfigureTagsFromRepoViewConfiguring_branch_tags_3=Configuring branch tags ConfigureTagsFromRepoViewOnFolderConfiguring_branch_tags_1=Configuring branch tags RemoteRootAction.Unable_to_Discard_Location_1=Unable to Discard Location -RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2=Projects in the local workspace are shared with {0} +RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2=Projects in the local workspace are shared with {0}. This location cannot be discarded until all local projects are disconnected from it. RemoveRootAction.removeRoot_3=RemoveRootAction.removeRoot RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4=The projects that are shared with the above repository are: diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java index e29abf44c..5434a16cb 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java @@ -12,10 +12,12 @@ package org.eclipse.team.internal.ui; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; 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.Control; @@ -57,6 +59,11 @@ abstract public class DetailsDialog extends Dialog { private boolean detailsCreated = false; /** + * The key for the image to be displayed (one of the image constants on Dialog) + */ + private String imageKey = null; + + /** * Creates a details pane dialog. * Note that the dialog will have no visual representation (no widgets) * until it is told to open. @@ -120,8 +127,44 @@ abstract public class DetailsDialog extends Dialog { final protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite)super.createDialogArea(parent); - - createMainDialogArea(composite); + + // create image + Image image = JFaceResources.getImageRegistry().get(getImageKey()); + if (image != null) { + // create a composite to split the dialog area in two + Composite top = new Composite(composite, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.numColumns = 2; + top.setLayout(layout); + top.setLayoutData(new GridData(GridData.FILL_BOTH)); + top.setFont(parent.getFont()); + + // add the image to the left of the composite + Label label = new Label(top, 0); + image.setBackground(label.getBackground()); + label.setImage(image); + label.setLayoutData(new GridData( + GridData.HORIZONTAL_ALIGN_CENTER | + GridData.VERTICAL_ALIGN_CENTER)); + + // add a composite to the right to contain the custom components + Composite right = new Composite(top, SWT.NONE); + layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + right.setLayout(layout); + right.setLayoutData(new GridData(GridData.FILL_BOTH)); + right.setFont(parent.getFont()); + createMainDialogArea(right); + } else { + createMainDialogArea(composite); + } errorMessageLabel = new Label(composite, SWT.NONE); errorMessageLabel.setLayoutData(new GridData( @@ -193,4 +236,22 @@ abstract public class DetailsDialog extends Dialog { protected boolean includeCancelButton() { return true; } + /** + * Returns the imageKey. + * @return String + */ + protected String getImageKey() { + return imageKey; + } + + + /** + * Sets the imageKey. + * @param imageKey The imageKey to set + */ + protected void setImageKey(String imageKey) { + this.imageKey = imageKey; + } + + } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java index d3b47601f..a120c3ffe 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java @@ -44,8 +44,9 @@ public class DetailsDialogWithProjects extends DetailsDialog { * @param parentShell * @param dialogTitle */ - public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton) { + public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton, String imageKey) { super(parentShell, dialogTitle); + setImageKey(imageKey); this.message = dialogMessage; this.detailsTitle = detailsTitle; this.projects = projects; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java index cc361b3ab..a9ead7929 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java @@ -50,6 +50,7 @@ public class DiscardSiteAction extends TargetAction { public AlreadyMappedDialog(Shell shell, IProject[] projects) { super(shell, Policy.bind("SiteExplorerView.unmapDialogTitle")); //$NON-NLS-1$ + setImageKey(DLG_IMG_WARNING); this.projects = projects; } @@ -85,28 +86,8 @@ public class DiscardSiteAction extends TargetAction { return composite; } - protected void createMainDialogArea(Composite top) { - Composite parent = new Composite(top, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 2; - parent.setLayout(layout); - parent.setLayoutData(new GridData(GridData.FILL_BOTH)); - parent.setFont(parent.getFont()); - - // create image - Image image = getImage(DLG_IMG_WARNING); - if (image != null) { - Label label = new Label(parent, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData(new GridData( - GridData.HORIZONTAL_ALIGN_CENTER | - GridData.VERTICAL_ALIGN_BEGINNING)); - } - - Label label = new Label(parent, SWT.WRAP); + protected void createMainDialogArea(Composite composite) { + Label label = new Label(composite, SWT.WRAP); label.setText(Policy.bind("SiteExplorerView.projectsAlreadyMapped")); //$NON-NLS-1$ GridData data = new GridData( GridData.GRAB_HORIZONTAL | @@ -115,16 +96,9 @@ public class DiscardSiteAction extends TargetAction { GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); - label.setFont(parent.getFont()); + label.setFont(composite.getFont()); - unmap = new Button(parent, SWT.CHECK); - data = new GridData( - GridData.GRAB_HORIZONTAL | - GridData.GRAB_VERTICAL | - GridData.HORIZONTAL_ALIGN_FILL | - GridData.VERTICAL_ALIGN_CENTER); - data.horizontalSpan = 2; - unmap.setLayoutData(data); + unmap = new Button(composite, SWT.CHECK); unmap.setText(Policy.bind("SiteExplorerView.unmapProjectsAndDisconnect")); //$NON-NLS-1$ unmap.setSelection(false); unmap.addListener(SWT.Selection, new Listener() { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java index 80ce5e052..0e2577ed4 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java @@ -53,6 +53,7 @@ public class GetAction extends TargetAction { public OutgoingChangesDialog(Shell shell, IResource[] outgoingChanges) { super(shell, Policy.bind("GetAction.confirmFileOverwriteTitle")); //$NON-NLS-1$ + setImageKey(DLG_IMG_QUESTION); this.outgoingChanges = outgoingChanges; } @@ -81,27 +82,7 @@ public class GetAction extends TargetAction { return composite; } - protected void createMainDialogArea(Composite top) { - Composite parent = new Composite(top, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 2; - parent.setLayout(layout); - parent.setLayoutData(new GridData(GridData.FILL_BOTH)); - parent.setFont(parent.getFont()); - - // create image - Image image = getImage(DLG_IMG_QUESTION); - if (image != null) { - Label label = new Label(parent, 0); - image.setBackground(label.getBackground()); - label.setImage(image); - label.setLayoutData(new GridData( - GridData.HORIZONTAL_ALIGN_CENTER | - GridData.VERTICAL_ALIGN_BEGINNING)); - } - + protected void createMainDialogArea(Composite parent) { Label label = new Label(parent, SWT.WRAP); label.setText(Policy.bind("GetAction.confirmFileOverwrite")); //$NON-NLS-1$ GridData data = new GridData( |