### Eclipse Workspace Patch 1.0 #P org.eclipse.compare Index: compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java,v retrieving revision 1.31 diff -u -r1.31 PreviewPatchPage.java --- compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java 21 Oct 2005 19:52:00 -0000 1.31 +++ compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java 16 Mar 2006 23:55:24 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.DecoratingLabelProvider; @@ -135,13 +136,15 @@ GridLayout layout= new GridLayout(); layout.numColumns= 1; + layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); final GridData data= new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(data); //add controls to composite as necessary Label label= new Label(composite, SWT.LEFT|SWT.WRAP); - label.setText(NLS.bind(PatchMessages.Diff_2Args, new String[] {PatchMessages.PreviewPatchPage_SelectProject, rpSelectedProject.getName()})); + label.setText(NLS.bind(PatchMessages.PreviewPatchPage_SelectProject, rpSelectedProject.getName())); final GridData data2= new GridData(SWT.FILL, SWT.BEGINNING, true, false); label.setLayoutData(data2); @@ -159,6 +162,8 @@ setupListeners(); + Dialog.applyDialogFont(composite); + return parent; } @@ -281,6 +286,8 @@ setControl(composite); + initializeDialogUnits(parent); + buildPatchOptionsGroup(composite); Splitter splitter= new Splitter(composite, SWT.VERTICAL); @@ -296,19 +303,11 @@ return CompareUI.findContentViewer(oldViewer, (ICompareInput) input, this, fCompareConfiguration); } }; - GridData gd= new GridData(); - gd.verticalAlignment= GridData.FILL; - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= true; - gd.grabExcessVerticalSpace= true; - fHunkViewer.setLayoutData(gd); + fHunkViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); //create Match Project button fMatchProject= new Button(composite, SWT.PUSH); - gd= new GridData(); - gd.verticalAlignment= GridData.BEGINNING; - gd.horizontalAlignment= GridData.END; - fMatchProject.setLayoutData(gd); + fMatchProject.setLayoutData(new GridData(SWT.END, GridData.BEGINNING, false, false)); fMatchProject.setText(PatchMessages.PreviewPatchPage_MatchProjects); fMatchProject.setEnabled(false); @@ -408,7 +407,7 @@ Group group= new Group(parent, SWT.NONE); group.setText(PatchMessages.PreviewPatchPage_PatchOptions_title); - gl= new GridLayout(); gl.numColumns= 4; gl.marginHeight= 0; + gl= new GridLayout(); gl.numColumns= 4; group.setLayout(gl); group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL|GridData.GRAB_HORIZONTAL)); @@ -470,6 +469,9 @@ } ); gd= new GridData(GridData.VERTICAL_ALIGN_CENTER); + int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); + Point minSize = b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + gd.widthHint = Math.max(widthHint, minSize.x); b.setLayoutData(gd); addSpacer(group); Index: compare/org/eclipse/compare/internal/patch/PatchMessages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchMessages.properties,v retrieving revision 1.25 diff -u -r1.25 PatchMessages.properties --- compare/org/eclipse/compare/internal/patch/PatchMessages.properties 21 Oct 2005 19:52:00 -0000 1.25 +++ compare/org/eclipse/compare/internal/patch/PatchMessages.properties 16 Mar 2006 23:55:24 -0000 @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2004 IBM Corporation and others. +# Copyright (c) 2000, 2006 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -38,7 +38,7 @@ InputPatchPage_ChooseFileButton_text=&Browse... InputPatchPage_UseClipboardButton_text=&Clipboard InputPatchPage_UseWorkspaceButton_text=&Workspace -InputPatchPage_WorkspaceSelectPatch_text=&Select the location of the patch +InputPatchPage_WorkspaceSelectPatch_text=&Select the location of the patch: InputPatchPage_NothingSelected_message=Select a file or folder to be patched InputPatchPage_ClipboardIsEmpty_message=Clipboard is empty InputPatchPage_NoTextInClipboard_message=Clipboard does not contain text @@ -68,7 +68,7 @@ PreviewPatchPage_Target=(target: {0}) PreviewPatchPage_Left_title= Original PreviewPatchPage_Right_title= Result -PreviewPatchPage_PatchOptions_title=Patch Options +PreviewPatchPage_PatchOptions_title=Patch options PreviewPatchPage_IgnoreSegments_text=&Ignore leading path name segments: PreviewPatchPage_ReversePatch_text=&Reverse patch PreviewPatchPage_FuzzFactor_text=&Maximum fuzz factor: @@ -80,7 +80,7 @@ PreviewPatchPage_NoMatch_error=(no match) PreviewPatchPage_MatchProjects=Match &Project... PreviewPatchPage_RetargetPatch=Retarget Patch -PreviewPatchPage_SelectProject=Select the project in your workspace that corresponds to project +PreviewPatchPage_SelectProject=Select the project in your workspace that corresponds to project ''{0}'': PreviewPatchPage_FileIsReadOnly_error=(file is read-only) PreviewPatchPage_GuessFuzz_text= &Guess PreviewPatchPage_GuessFuzzProgress_text= Guessing Fuzz Factor... Index: compare/org/eclipse/compare/internal/patch/InputPatchPage.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java,v retrieving revision 1.28 diff -u -r1.28 InputPatchPage.java --- compare/org/eclipse/compare/internal/patch/InputPatchPage.java 21 Oct 2005 19:51:59 -0000 1.28 +++ compare/org/eclipse/compare/internal/patch/InputPatchPage.java 16 Mar 2006 23:55:24 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -44,6 +45,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.ShellAdapter; import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -89,6 +91,7 @@ private Button fUsePatchFileButton; private Button fUseWorkspaceButton; + private Label fWorkspaceSelectLabel; private TreeViewer fTreeViewer; private PatchWizard fPatchWizard; @@ -143,6 +146,8 @@ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); setControl(composite); + initializeDialogUnits(parent); + buildPatchFileGroup(composite); //see if there are any better options presently selected @@ -277,6 +282,7 @@ } private void setEnableWorkspacePatch(boolean enable) { + fWorkspaceSelectLabel.setEnabled(enable); fTreeViewer.getTree().setEnabled(enable); } @@ -303,14 +309,17 @@ fUsePatchFileButton.setText(PatchMessages.InputPatchPage_FileButton_text); fPatchFileNameField= new Combo(composite, SWT.BORDER); - //gd.horizontalIndent= 8; gd= new GridData(GridData.FILL_HORIZONTAL); gd.widthHint= SIZING_TEXT_FIELD_WIDTH; fPatchFileNameField.setLayoutData(gd); fPatchFileBrowseButton= new Button(composite, SWT.PUSH); fPatchFileBrowseButton.setText(PatchMessages.InputPatchPage_ChooseFileButton_text); - fPatchFileBrowseButton.setLayoutData(new GridData()); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); + Point minSize = fPatchFileBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + data.widthHint = Math.max(widthHint, minSize.x); + fPatchFileBrowseButton.setLayoutData(data); //3rd row fUseWorkspaceButton= new Button(composite, SWT.RADIO); @@ -389,23 +398,18 @@ } private void addWorkspaceControls(Composite composite) { - Composite newComp = new Composite(composite, SWT.NONE); GridLayout layout= new GridLayout(1, false); - layout.marginWidth = 15; - layout.marginHeight = 0; - layout.marginLeft = 5; + layout.marginLeft = 16; //align w/ lable of check button newComp.setLayout(layout); newComp.setLayoutData(new GridData(GridData.FILL_BOTH)); - new Label(newComp, SWT.LEFT).setText(PatchMessages.InputPatchPage_WorkspaceSelectPatch_text); - + fWorkspaceSelectLabel = new Label(newComp, SWT.LEFT); + fWorkspaceSelectLabel.setText(PatchMessages.InputPatchPage_WorkspaceSelectPatch_text); + fTreeViewer= new TreeViewer(newComp, SWT.BORDER); - final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true); - gd.widthHint= 0; - gd.heightHint= 0; - fTreeViewer.getTree().setLayoutData(gd); + fTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); fTreeViewer.setContentProvider(new WorkbenchContentProvider());