diff options
author | Michael Valenta | 2004-09-08 17:46:40 +0000 |
---|---|---|
committer | Michael Valenta | 2004-09-08 17:46:40 +0000 |
commit | 52b802eba40c9d66d012c39c00f03910933c5adf (patch) | |
tree | df369bf3d46054b7cfcdc13a32159ca4a62b9fb0 | |
parent | fa70fd4457186446b910fe93be1f3f2e911da814 (diff) | |
download | eclipse.platform.team-I20040913.tar.gz eclipse.platform.team-I20040913.tar.xz eclipse.platform.team-I20040913.zip |
9 files changed, 74 insertions, 82 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java index e301daeda..d7204ad1e 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java @@ -44,7 +44,7 @@ public class DateTagDialog extends Dialog { } public void createArea(Composite parent) { - Composite composite = createComposite(parent, 4); + Composite composite = createComposite(parent, 4, false); initializeDialogUnits(composite); createLabel(composite, Policy.bind("DateTagDialog.0"), 1); //$NON-NLS-1$ fromMonthCombo = new Combo(composite, SWT.READ_ONLY); @@ -119,7 +119,7 @@ public class DateTagDialog extends Dialog { * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite) */ public void createArea(Composite parent) { - Composite composite = createComposite(parent, 2); + Composite composite = createComposite(parent, 2, false); initializeDialogUnits(composite); includeTime = createCheckbox(composite, Policy.bind("DateTagDialog.1"), 2); //$NON-NLS-1$ createLabel(composite, Policy.bind("DateTagDialog.2"), 1); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java index 9f5ce0814..360efd7e4 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java @@ -10,12 +10,20 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -38,10 +46,6 @@ public class ListSelectionArea extends DialogArea { private Object[] previousCheckedElements; - // sizing constants - private final static int SIZING_SELECTION_WIDGET_HEIGHT = 250; - private final static int SIZING_SELECTION_WIDGET_WIDTH = 300; - public static final String LIST_SELECTION = "ListSelection"; //$NON-NLS-1$ /** @@ -67,17 +71,20 @@ public class ListSelectionArea extends DialogArea { * @see org.eclipse.team.internal.ccvs.ui.DialogArea#createArea(org.eclipse.swt.widgets.Composite) */ public void createArea(Composite parent) { - Dialog.applyDialogFont(parent); - Composite composite = createComposite(parent, 1); + + Dialog.applyDialogFont(parent); + + final Composite composite = createComposite(parent, 1, true); + initializeDialogUnits(composite); if (message != null) createWrappingLabel(composite, message, 1); listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; - data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + data.heightHint = 0; // It will expand to the size of the wizard page! + data.widthHint = 0; listViewer.getTable().setLayoutData(data); listViewer.setLabelProvider(labelProvider); @@ -124,12 +131,8 @@ public class ListSelectionArea extends DialogArea { */ private void addSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.RIGHT); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - buttonComposite.setLayout(layout); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL); - data.grabExcessHorizontalSpace = true; - composite.setData(data); + buttonComposite.setLayout(new GridLayout(2, false)); + buttonComposite.setData(new GridData(SWT.END, SWT.BEGINNING, true, false)); Button selectButton = createButton(buttonComposite, Policy.bind("ListSelectionArea.selectAll"), GridData.HORIZONTAL_ALIGN_FILL); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java index bc15b2e61..f4ac26252 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java @@ -95,10 +95,9 @@ public class WorkingSetSelectionArea extends DialogArea { */ public void createArea(Composite parent) { Dialog.applyDialogFont(parent); - Composite composite = createComposite(parent, 2); + final Composite composite = createComposite(parent, 2, false); initializeDialogUnits(composite); - GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); - composite.setLayoutData(data); + composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.numColumns = 2; @@ -122,8 +121,8 @@ public class WorkingSetSelectionArea extends DialogArea { // Create the combo/button which allows working set selection mruList = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); - data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); - data.horizontalIndent=15; + GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true); + data.horizontalIndent= 15; mruList.setLayoutData(data); selectButton = createButton(composite, Policy.bind("WorkingSetSelectionArea.workingSetOther"), GridData.HORIZONTAL_ALIGN_FILL); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java index 107a19e17..21197ffe1 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java @@ -23,6 +23,10 @@ import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard; * by a create patch command in the compare viewer. */ public class GenerateDiffFileAction extends WorkspaceAction { + + // The initial size of this wizard. + private final static int INITIAL_WIDTH = 300; + private final static int INITIAL_HEIGHT = 350; /** (Non-javadoc) * Method declared on IActionDelegate. @@ -33,7 +37,7 @@ public class GenerateDiffFileAction extends WorkspaceAction { final GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(resources[0]); wizard.setWindowTitle(title); WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.setMinimumPageSize(350, 250); + dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT); dialog.open(); } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java index 45829c5ac..05337905d 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java @@ -18,6 +18,8 @@ import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource; import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; @@ -38,7 +40,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; * refreshed. */ public class RefreshRemoteProjectSelectionPage extends CVSWizardPage { - + private Dialog parentDialog; private ICVSRemoteResource[] rootFolders; private ListSelectionArea listArea; @@ -94,8 +96,12 @@ public class RefreshRemoteProjectSelectionPage extends CVSWizardPage { * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { - Composite composite = createComposite(parent, 1); + + final Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(1, false)); + setControl(composite); + // set F1 help WorkbenchHelp.setHelp(composite, IHelpContextIds.REFRESH_REMOTE_PROJECT_SELECTION_PAGE); @@ -105,6 +111,7 @@ public class RefreshRemoteProjectSelectionPage extends CVSWizardPage { new WorkbenchLabelProvider(), Policy.bind("RefreshRemoteProjectSelectionPage.selectRemoteProjects")); //$NON-NLS-1$ listArea.createArea(composite); + listArea.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { updateEnablement(); @@ -151,7 +158,6 @@ public class RefreshRemoteProjectSelectionPage extends CVSWizardPage { ICVSRemoteResource resource = resources[i]; listArea.getViewer().setChecked(resource, true); } - } } @@ -168,5 +174,4 @@ public class RefreshRemoteProjectSelectionPage extends CVSWizardPage { Object[] checked = listArea.getViewer().getCheckedElements(); return (ICVSRemoteResource[]) Arrays.asList(checked).toArray(new ICVSRemoteResource[checked.length]); } - } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java index 27fa4ca9f..0fa12b6ea 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java @@ -32,11 +32,17 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; import org.eclipse.team.internal.ccvs.ui.Policy; + + /** * Wizard for refreshing the tags for a CVS repository location */ public class RefreshRemoteProjectWizard extends Wizard { - + + // The initial size of this wizard. + private final static int INITIAL_WIDTH = 300; + private final static int INITIAL_HEIGHT = 350; + private Dialog parentDialog; private ICVSRepositoryLocation root; private ICVSRemoteResource[] rootFolders; @@ -64,6 +70,11 @@ public class RefreshRemoteProjectWizard extends Wizard { } RefreshRemoteProjectWizard wizard = new RefreshRemoteProjectWizard(root, rootFolders[0]); WizardDialog dialog = new WizardDialog(shell, wizard); + /** + * This is the only place where a size hint > 0 is required. The wizard + * page should in general have hints of 0 (and grab excessive space). + */ + dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT); wizard.setParentDialog(dialog); return (dialog.open() == Window.OK); } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java index 54e0afb0e..871c96a45 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java @@ -49,6 +49,7 @@ import org.eclipse.ui.views.navigator.ResourceSorter; * for widget creation. */ public abstract class CVSWizardPage extends WizardPage { + protected static final int LABEL_WIDTH_HINT = 400; protected static final int LABEL_INDENT_WIDTH = 32; protected static final int LIST_HEIGHT_HINT = 100; @@ -120,18 +121,9 @@ public abstract class CVSWizardPage extends WizardPage { * @return the newly-created coposite */ protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); + final Composite composite = new Composite(parent, SWT.NULL); + composite.setLayout(new GridLayout(numColumns, false)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); return composite; } /** @@ -181,11 +173,8 @@ public abstract class CVSWizardPage extends WizardPage { protected Label createWrappingLabel(Composite parent, String text, int indent, int horizontalSpan) { Label label = new Label(parent, SWT.LEFT | SWT.WRAP); label.setText(text); - GridData data = new GridData(); - data.horizontalSpan = horizontalSpan; - data.horizontalAlignment = GridData.FILL; + GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false); data.horizontalIndent = indent; - data.grabExcessHorizontalSpace = true; data.widthHint = LABEL_WIDTH_HINT; label.setLayoutData(data); return label; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java index 02e7ab9ea..c87db7657 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java @@ -75,12 +75,6 @@ public class GenerateDiffFileWizard extends Wizard { private class LocationPage extends WizardPage { /** - * Sizing constants. - */ - private static final int SIZING_SELECTION_PANE_HEIGHT = 125; - private static final int SIZING_SELECTION_PANE_WIDTH = 200; - - /** * The possible locations to save a patch. */ public final static int CLIPBOARD = 1; @@ -240,9 +234,7 @@ public class GenerateDiffFileWizard extends Wizard { public void createControl(Composite parent) { final Composite composite= new Composite(parent, SWT.NULL); - GridLayout layout= new GridLayout(); - composite.setLayout(layout); - composite.setLayoutData(new GridData()); + composite.setLayout(new GridLayout()); setControl(composite); initializeDialogUnits(composite); @@ -281,8 +273,8 @@ public class GenerateDiffFileWizard extends Wizard { wsTreeViewer = new TreeViewer(composite, SWT.BORDER); final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true); - gd.widthHint = SIZING_SELECTION_PANE_WIDTH; - gd.heightHint = SIZING_SELECTION_PANE_HEIGHT; + gd.widthHint= 0; + gd.heightHint= 0; wsTreeViewer.getTree().setLayoutData(gd); final ContainerContentProvider cp = new ContainerContentProvider(); @@ -291,13 +283,14 @@ public class GenerateDiffFileWizard extends Wizard { wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); wsTreeViewer.setInput(ResourcesPlugin.getWorkspace()); - final Composite group = new Composite(composite,SWT.NONE); + final Composite group = new Composite(composite, SWT.NONE); final GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; group.setLayout(layout); - group.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); final Label label = new Label(group, SWT.NONE); + label.setLayoutData(new GridData()); label.setText(Policy.bind("Fi&le_name__9")); //$NON-NLS-1$ wsFilenameText = new Text(group,SWT.BORDER); @@ -310,6 +303,7 @@ public class GenerateDiffFileWizard extends Wizard { private void setupFilesystemControls(final Composite composite) { GridLayout layout; fsRadio= new Button(composite, SWT.RADIO); + fsRadio.setText(Policy.bind("Save_In_File_System_3")); //$NON-NLS-1$ final Composite nameGroup = new Composite(composite,SWT.NONE); @@ -317,7 +311,7 @@ public class GenerateDiffFileWizard extends Wizard { layout.numColumns = 2; layout.marginWidth = 0; nameGroup.setLayout(layout); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); + final GridData data = new GridData(SWT.FILL, SWT.FILL, false, false); nameGroup.setLayoutData(data); fsPathText= new Text(nameGroup, SWT.BORDER); @@ -326,10 +320,6 @@ public class GenerateDiffFileWizard extends Wizard { fsBrowseButton = new Button(nameGroup, SWT.NULL); fsBrowseButton.setText(Policy.bind("Browse..._4")); //$NON-NLS-1$ - data = new GridData(GridData.HORIZONTAL_ALIGN_END); - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); - data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - fsBrowseButton.setLayoutData(data); } /** diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java index d21b95768..536f8ccf3 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java @@ -29,8 +29,6 @@ import org.eclipse.swt.widgets.*; */ public abstract class DialogArea { - protected static final int LABEL_WIDTH_HINT = 400; - protected Dialog parentDialog; protected FontMetrics fontMetrics; protected IDialogSettings settings; @@ -149,7 +147,7 @@ public abstract class DialogArea { data.horizontalSpan = horizontalSpan; data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; - data.widthHint = LABEL_WIDTH_HINT; + data.widthHint= 0; label.setLayoutData(data); return label; } @@ -164,26 +162,19 @@ public abstract class DialogArea { } /** * Creates composite control and sets the default layout data. - * * @param parent the parent of the new composite * @param numColumns the number of columns for the new composite + * @param grab specify whether the composite should grab for excessive space in both directions. * @return the newly-created coposite */ - protected Composite createComposite(Composite parent, int numColumns) { - Composite composite = new Composite(parent, SWT.NULL); - Font font = parent.getFont(); + protected Composite createComposite(Composite parent, int numColumns, boolean grab) { + final Composite composite = new Composite(parent, SWT.NULL); + final Font font = parent.getFont(); composite.setFont(font); - // GridLayout - GridLayout layout = new GridLayout(); - layout.numColumns = numColumns; - composite.setLayout(layout); - - // GridData - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); + composite.setLayout(new GridLayout(numColumns, false)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, grab, grab)); + return composite; } |