diff options
author | Michael Valenta | 2004-08-25 17:54:28 +0000 |
---|---|---|
committer | Michael Valenta | 2004-08-25 17:54:28 +0000 |
commit | f7e2f5b01607768c56b73edd96a514955e2e83ef (patch) | |
tree | 07485bdb972fded67a0b564c432f34bc8e0f34f3 | |
parent | 20659e8b44873c2f2642d82158747ee6e0ffe4a6 (diff) | |
download | eclipse.platform.team-f7e2f5b01607768c56b73edd96a514955e2e83ef.tar.gz eclipse.platform.team-f7e2f5b01607768c56b73edd96a514955e2e83ef.tar.xz eclipse.platform.team-f7e2f5b01607768c56b73edd96a514955e2e83ef.zip |
Bug 41641 "create patch" does not remember last selections
3 files changed, 689 insertions, 590 deletions
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 304dc1f7b..107a19e17 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 @@ -12,7 +12,6 @@ package org.eclipse.team.internal.ccvs.ui.actions; import org.eclipse.core.resources.IResource; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.team.internal.ccvs.ui.Policy; import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard; @@ -31,7 +30,7 @@ public class GenerateDiffFileAction extends WorkspaceAction { public void execute(IAction action) { final String title = Policy.bind("GenerateCVSDiff.title"); //$NON-NLS-1$ final IResource[] resources = getSelectedResources(); - GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), resources[0]); + final GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(resources[0]); wizard.setWindowTitle(title); WizardDialog dialog = new WizardDialog(getShell(), wizard); dialog.setMinimumPageSize(350, 250); 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 87b1f39ea..4eec1dedd 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 @@ -670,7 +670,6 @@ Unmanage.unmanagingError=Errors occurred while disconnecting Unmanage.message=Are you sure you want to disconnect CVS from ''{0}''? Unmanage.messageN=Are you sure you want to disconnect CVS from these {0} projects? -Enter_a_valid_file_name_or_select_the_clipboard_option_1=Enter a valid file name or select the clipboard option Save_To_Clipboard_2=&Save to clipboard Save_In_File_System_3=Sa&ve in file system Browse..._4=Br&owse... @@ -1134,6 +1133,11 @@ ShowAnnotationAction.label=Show &Annotation ShowAnnotationAction.tooltip=Show Annotation GenerateDiffFileAction.label=Create &Patch... +GenerateDiffFileWizard.0=Please enter a valid location. +GenerateDiffFileWizard.2=Please enter a file name. +GenerateDiffFileWizard.3=The specified directory does not exist. +GenerateDiffFileWizard.4=Please select a location in the workspace. +GenerateDiffFileWizard.5=Please enter a valid filename. GenerateDiffFileAction.tooltip=Compare your workspace contents with the server and generate a diff file that can be used as a patch file. MergeUpdateAction.label=&Update 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 9ba3bb1ef..02e7ab9ea 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 @@ -52,13 +52,13 @@ import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Text; +import org.eclipse.team.internal.ccvs.core.client.Command; import org.eclipse.team.internal.ccvs.core.client.Diff; import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; import org.eclipse.team.internal.ccvs.ui.IHelpContextIds; import org.eclipse.team.internal.ccvs.ui.Policy; -import org.eclipse.ui.IWorkbench; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.internal.ide.misc.ContainerContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; @@ -67,595 +67,691 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; * A wizard for creating a patch file by running the CVS diff command. */ public class GenerateDiffFileWizard extends Wizard { - - private PatchFileSelectionPage mainPage; - private PatchFileCreationOptionsPage optionsPage; + + /** + * Page to select a patch file. Overriding validatePage was necessary to allow + * entering a file name that already exists. + */ + 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; + public final static int FILESYSTEM = 2; + public final static int WORKSPACE = 3; + + /** + * GUI controls for clipboard (cp), filesystem (fs) and workspace (ws). + */ + private Button cpRadio; + + private Button fsRadio; + protected Text fsPathText; + private Button fsBrowseButton; + + private Button wsRadio; + protected TreeViewer wsTreeViewer; + private Text wsFilenameText; + + + /** + * State information of this page, updated by the listeners. + */ + protected boolean pageValid; + protected IContainer wsSelectedContainer; + protected int selectedLocation; + + /** + * The default values store used to initialize the selections. + */ + private final DefaultValuesStore store; + + LocationPage(String pageName, String title, ImageDescriptor image, DefaultValuesStore store) { + super(pageName, title, image); + setPageComplete(false); + this.store= store; + } + + /** + * Allow the user to finish if a valid file has been entered. + */ + protected boolean validatePage() { + + switch (selectedLocation) { + case WORKSPACE: + pageValid= validateWorkspaceLocation(); + break; + case FILESYSTEM: + pageValid= validateFilesystemLocation(); + break; + case CLIPBOARD: + pageValid= true; + break; + } + + /** + * Avoid draw flicker by clearing error message + * if all is valid. + */ + if (pageValid) { + setMessage(null); + setErrorMessage(null); + } + setPageComplete(pageValid); + return pageValid; + } + + /** + * The following conditions must hold for the file system location + * to be valid: + * - the path must be valid and non-empty + * - the path must be absolute + * - the specified file must be of type file + * - the parent must exist (new folders can be created via the browse button) + */ + private boolean validateFilesystemLocation() { + final String pathString= fsPathText.getText().trim(); + if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { //$NON-NLS-1$ + setErrorMessage(Policy.bind("GenerateDiffFileWizard.0")); //$NON-NLS-1$ + return false; + } + + final File file= new File(pathString); + if (!file.isAbsolute()) { + setErrorMessage(Policy.bind("GenerateDiffFileWizard.0")); //$NON-NLS-1$ + return false; + } + + if (file.isDirectory()) { + setErrorMessage(Policy.bind("GenerateDiffFileWizard.2")); //$NON-NLS-1$ + return false; + } + + if (pathString.endsWith("/") || pathString.endsWith("\\")) { //$NON-NLS-1$//$NON-NLS-2$ + setErrorMessage(Policy.bind("GenerateDiffFileWizard.3")); //$NON-NLS-1$ + return false; + } + + final File parent= file.getParentFile(); + if (!(parent.exists() && parent.isDirectory())) { + setErrorMessage(Policy.bind("GenerateDiffFileWizard.3")); //$NON-NLS-1$ + return false; + } + return true; + } + + /** + * The following conditions must hold for the file system location to be valid: + * - a parent must be selected in the workspace tree view + * - the resource name must be valid + */ + private boolean validateWorkspaceLocation() { + if (wsSelectedContainer == null) { + setErrorMessage(Policy.bind("GenerateDiffFileWizard.4")); //$NON-NLS-1$ + return false; + } + final String filename= wsFilenameText.getText().trim(); + if (!new Path("").isValidSegment(filename)) { //$NON-NLS-1$ + setErrorMessage(Policy.bind("GenerateDiffFileWizard.5")); //$NON-NLS-1$ + return false; + } + return true; + } + + /** + * Answers a full path to a file system file or <code>null</code> if the user + * selected to save the patch in the clipboard. + */ + public File getFile() { + if (pageValid && selectedLocation == FILESYSTEM) { + return new File(fsPathText.getText().trim()); + } + if (pageValid && selectedLocation == WORKSPACE) { + final String filename= wsFilenameText.getText().trim(); + final IFile file= wsSelectedContainer.getFile(new Path(filename)); + return file.getLocation().toFile(); + } + return null; + } + + /** + * Get the selected workspace resource if the patch is to be saved in the + * workspace, or null otherwise. + */ + public IResource getResource() { + if (pageValid && selectedLocation == WORKSPACE) { + final String filename= wsFilenameText.getText().trim(); + return wsSelectedContainer.getFile(new Path(filename)); + } + return null; + } + + /** + * Allow the user to chose to save the patch to the workspace or outside + * of the workspace. + */ + public void createControl(Composite parent) { + + final Composite composite= new Composite(parent, SWT.NULL); + GridLayout layout= new GridLayout(); + composite.setLayout(layout); + composite.setLayoutData(new GridData()); + setControl(composite); + initializeDialogUnits(composite); + + // set F1 help + WorkbenchHelp.setHelp(composite, IHelpContextIds.PATCH_SELECTION_PAGE); + + setupClipboardControls(composite); + setupFilesystemControls(composite); + setupWorkspaceControls(composite); + + initializeDefaultValues(); + + /** + * Ensure the page is in a valid state. + */ + if (!validatePage()) { + store.storeRadioSelection(CLIPBOARD); + initializeDefaultValues(); + validatePage(); + } + pageValid= true; + + updateEnablements(); + setupListeners(); + } + + + /** + * Setup the controls for the workspace option. + */ + private void setupWorkspaceControls(Composite composite) { + wsRadio= new Button(composite, SWT.RADIO); + wsRadio.setText(Policy.bind("Save_In_Workspace_7")); //$NON-NLS-1$ + + new Label(composite, SWT.LEFT).setText(Policy.bind("Select_a_folder_then_type_in_the_file_name__8")); //$NON-NLS-1$ + + 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; + wsTreeViewer.getTree().setLayoutData(gd); + + final ContainerContentProvider cp = new ContainerContentProvider(); + cp.showClosedProjects(false); + wsTreeViewer.setContentProvider(cp); + wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); + wsTreeViewer.setInput(ResourcesPlugin.getWorkspace()); + + 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)); + + final Label label = new Label(group, SWT.NONE); + label.setText(Policy.bind("Fi&le_name__9")); //$NON-NLS-1$ + + wsFilenameText = new Text(group,SWT.BORDER); + wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + } + + /** + * Setup the controls for the file system option. + */ + 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); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginWidth = 0; + nameGroup.setLayout(layout); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); + nameGroup.setLayoutData(data); + + fsPathText= new Text(nameGroup, SWT.BORDER); + GridData gd= new GridData(GridData.FILL_HORIZONTAL); + fsPathText.setLayoutData(gd); + + 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); + } + + /** + * Setup the controls for the clipboard option. + */ + private void setupClipboardControls(final Composite composite) { + cpRadio= new Button(composite, SWT.RADIO); + cpRadio.setText(Policy.bind("Save_To_Clipboard_2")); //$NON-NLS-1$ + } + + + /** + * Initialize the controls with the saved default values which are + * obtained from the DefaultValuesStore. + */ + private void initializeDefaultValues() { - private IResource resource; + selectedLocation= store.getRadioSelection(); + wsSelectedContainer= store.getWorkspaceSelection(); + + /** + * Radio buttons + */ + cpRadio.setSelection(selectedLocation == CLIPBOARD); + fsRadio.setSelection(selectedLocation == FILESYSTEM); + wsRadio.setSelection(selectedLocation == WORKSPACE); + + /** + * Text fields. + */ + fsPathText.setText(store.getFilesystemPath()); + wsFilenameText.setText(store.getWorkspaceFilename()); + + /** + * Tree viewer. + */ + if (wsSelectedContainer != null) { + final ISelection selection= new StructuredSelection(wsSelectedContainer); + wsTreeViewer.setSelection(selection, true); + } + } + + /** + * Setup all the listeners for the controls. + */ + private void setupListeners() { - /** - * Page to select a patch file. Overriding validatePage was necessary to allow - * entering a file name that already exists. - */ - private class PatchFileSelectionPage extends WizardPage { - - private final class DefaultValuesStore { - - private static final String PREF_LAST_SELECTION= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.selection"; //$NON-NLS-1$ - private static final String PREF_LAST_FS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.fs.path"; //$NON-NLS-1$ - private static final String PREF_LAST_WS_FILENAME= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.ws.filename"; //$NON-NLS-1$ - private static final String PREF_LAST_WS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.ws.path"; //$NON-NLS-1$ - - public int getDefaultSelection() { - try { - final int value= getDialogSettings().getInt(PREF_LAST_SELECTION); - return value == CLIPBOARD || value == FILESYSTEM || value == WORKSPACE ? value : CLIPBOARD; - } catch (NumberFormatException e) { - return CLIPBOARD; - } - } - - public String getDefaultFilesystemPath() { - final String lastPath = getDialogSettings().get(PREF_LAST_FS_PATH); - return lastPath != null ? lastPath : ""; //$NON-NLS-1$ - } - - public String getDefaultWorkspaceFilename() { - final String filename= getDialogSettings().get(PREF_LAST_WS_FILENAME); - return filename != null ? filename : ""; //$NON-NLS-1$ - } - - public IContainer getDefaultWorkspaceSelection() { - final String value= getDialogSettings().get(PREF_LAST_WS_PATH); - if ( value != null ) { - final IPath path= new Path(value); - final IResource container= ResourcesPlugin.getWorkspace().getRoot().findMember( path ); - if (container instanceof IContainer) { - return (IContainer)container; - } - } - return null; - } - - public void storeDefaultSelection(int defaultSelection) { - getDialogSettings().put(PREF_LAST_SELECTION, defaultSelection); - } - - public void storeDefaultFilesystemPath(String path) { - getDialogSettings().put(PREF_LAST_FS_PATH, path); - } - - public void storeDefaultWorkspacePath(String path) { - getDialogSettings().put(PREF_LAST_WS_PATH, path); - } - - public void storeDefaultWorkspaceFilename(String filename) { - getDialogSettings().put(PREF_LAST_WS_FILENAME, filename); - } - - private IDialogSettings getDialogSettings() { - return CVSUIPlugin.getPlugin().getDialogSettings(); - } - } - - private final DefaultValuesStore defaultValuesStore; - - protected Text filenameCombo; - private Button browseButton; - - protected TreeViewer treeViewer; - private IContainer selectedContainer; - private Text workspaceFilename; - private Button saveInFilesystem; - private Button saveInWorkspace; - private Button saveToClipboard; - - public final int CLIPBOARD = 1; - public final int FILESYSTEM = 2; - public final int WORKSPACE = 3; - - // sizing constants - private static final int SIZING_SELECTION_PANE_HEIGHT = 125; - private static final int SIZING_SELECTION_PANE_WIDTH = 200; - - PatchFileSelectionPage(String pageName, String title, ImageDescriptor image) { - super(pageName, title, image); - setPageComplete(false); - defaultValuesStore = new DefaultValuesStore(); - } - - /** - * Allow the user to finish if a valid file has been entered. - */ - protected boolean validatePage() { - boolean valid = false; - int selected = getSaveType(); - - switch (selected) { - case WORKSPACE: - if (selectedContainer != null && getWorkspaceFile() != null) { - valid = true; - defaultValuesStore.storeDefaultWorkspaceFilename(workspaceFilename.getText()); - final String path= selectedContainer.getFullPath().toOSString(); - defaultValuesStore.storeDefaultWorkspacePath(path); - } - break; - case FILESYSTEM: - final String filename = getFilesystemFile(); - final File file = new File(filename); - valid = isValidFile(file); - if (valid) { - defaultValuesStore.storeDefaultFilesystemPath(filename); - } - break; - case CLIPBOARD: - valid = true; - break; - } - - // Avoid draw flicker by clearing error message - // if all is valid. - if (valid) { - setMessage(null); - setErrorMessage(null); - defaultValuesStore.storeDefaultSelection(selected); - } else { - setErrorMessage(Policy.bind("Enter_a_valid_file_name_or_select_the_clipboard_option_1")); //$NON-NLS-1$ - } - setPageComplete(valid); - return valid; - } + cpRadio.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + selectedLocation= CLIPBOARD; + validatePage(); + updateEnablements(); + } + }); + fsRadio.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + selectedLocation= FILESYSTEM; + validatePage(); + updateEnablements(); + } + }); + + wsRadio.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + selectedLocation= WORKSPACE; + validatePage(); + updateEnablements(); + } + }); + + fsPathText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + validatePage(); + } + }); + + fsBrowseButton.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + final FileDialog dialog = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE); + if (pageValid) { + final File file= new File(fsPathText.getText()); + dialog.setFilterPath(file.getParent()); + } + dialog.setText(Policy.bind("Save_Patch_As_5")); //$NON-NLS-1$ + dialog.setFileName(Policy.bind("patch.txt_6")); //$NON-NLS-1$ + final String path = dialog.open(); + if (path != null) { + fsPathText.setText(new Path(path).toOSString()); + } + } + }); + + wsTreeViewer.addSelectionChangedListener( + new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection s = (IStructuredSelection)event.getSelection(); + wsSelectedContainer = ((IContainer) s.getFirstElement()); + validatePage(); + } + }); + + wsTreeViewer.addDoubleClickListener( + new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + ISelection s= event.getSelection(); + if (s instanceof IStructuredSelection) { + Object item = ((IStructuredSelection)s).getFirstElement(); + if (wsTreeViewer.getExpandedState(item)) + wsTreeViewer.collapseToLevel(item, 1); + else + wsTreeViewer.expandToLevel(item, 1); + } + } + }); + + wsFilenameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + validatePage(); + } + }); + } - protected boolean isValidFile(File file) { - if (!file.isAbsolute()) return false; - if (file.isDirectory()) return false; - File parent = file.getParentFile(); - if (parent==null) return false; - if (!parent.exists()) return false; - if (!parent.isDirectory()) return false; - return true; - } - /** - * Answers a full path to a file system file or <code>null</code> if the user - * selected to save the patch in the workspace. - */ - public String getFilesystemFile() { - if(saveInFilesystem.getSelection()) { - return filenameCombo.getText(); - } - return null; - } - - /** - * Answers a workspace file or <code>null</code> if the user selected to save - * the patch outside of the workspace. - */ - public IFile getWorkspaceFile() { - if(saveInWorkspace.getSelection() && selectedContainer != null) { - String filename = workspaceFilename.getText(); - if(filename==null || filename.length() == 0) { - return null; - } - return selectedContainer.getFile(new Path(workspaceFilename.getText())); - } - return null; - } + /** + * Enable and disable controls based on the selected radio button. + */ + protected void updateEnablements() { + fsBrowseButton.setEnabled(selectedLocation == FILESYSTEM); + fsPathText.setEnabled(selectedLocation == FILESYSTEM); + wsTreeViewer.getTree().setEnabled(selectedLocation == WORKSPACE); + wsFilenameText.setEnabled(selectedLocation == WORKSPACE); + } + + public int getSelectedLocation() { + return selectedLocation; + } + } + + /** + * Page to select the options for creating the patch. + */ + private class OptionsPage extends WizardPage { + + private Button recurseOption; + private Button contextDiffOption; + private Button unifiedDiffOption; + private Button regularDiffOption; + private Button includeNewFilesOptions; + + /** + * Constructor for PatchFileCreationOptionsPage. + */ + protected OptionsPage(String pageName) { + super(pageName); + } + + /** + * Constructor for PatchFileCreationOptionsPage. + */ + protected OptionsPage(String pageName, String title, ImageDescriptor titleImage) { + super(pageName, title, titleImage); + } + + /* + * @see IDialogPage#createControl(Composite) + */ + public void createControl(Composite parent) { + Composite composite= new Composite(parent, SWT.NULL); + GridLayout layout= new GridLayout(); + composite.setLayout(layout); + composite.setLayoutData(new GridData()); + setControl(composite); + + // set F1 help + WorkbenchHelp.setHelp(composite, IHelpContextIds.PATCH_OPTIONS_PAGE); + + recurseOption = new Button(composite, SWT.CHECK); + recurseOption.setText(Policy.bind("Do_not_recurse_into_sub-folders_10")); //$NON-NLS-1$ + recurseOption.setSelection(true); + + includeNewFilesOptions = new Button(composite, SWT.CHECK); + includeNewFilesOptions.setText(Policy.bind("Do_not_include_new_files_in_patch_11")); //$NON-NLS-1$ + includeNewFilesOptions.setSelection(true); + + Group diffTypeGroup = new Group(composite, SWT.NONE); + layout = new GridLayout(); + layout.marginHeight = 0; + diffTypeGroup.setLayout(layout); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); + diffTypeGroup.setLayoutData(data); + diffTypeGroup.setText(Policy.bind("Diff_output_format_12")); //$NON-NLS-1$ + + unifiedDiffOption = new Button(diffTypeGroup, SWT.RADIO); + unifiedDiffOption.setText(Policy.bind("Unified_(format_required_by_Compare_With_Patch_feature)_13")); //$NON-NLS-1$ + unifiedDiffOption.setSelection(true); + contextDiffOption = new Button(diffTypeGroup, SWT.RADIO); + contextDiffOption.setText(Policy.bind("Context_14")); //$NON-NLS-1$ + regularDiffOption = new Button(diffTypeGroup, SWT.RADIO); + regularDiffOption.setText(Policy.bind("Standard_15")); //$NON-NLS-1$ + } + + /** + * Answers if the difference operation should be run recursively. + */ + public boolean isRecursive() { + return !recurseOption.getSelection(); + } + + /** + * Return the list of Diff command options configured on this page. + */ + public LocalOption[] getOptions() { + List options = new ArrayList(5); + if(includeNewFilesOptions.getSelection()) { + options.add(Diff.INCLUDE_NEWFILES); + } + if(!recurseOption.getSelection()) { + options.add(Command.DO_NOT_RECURSE); + } + if(unifiedDiffOption.getSelection()) { + options.add(Diff.UNIFIED_FORMAT); + } else if(contextDiffOption.getSelection()) { + options.add(Diff.CONTEXT_FORMAT); + } + return (LocalOption[]) options.toArray(new LocalOption[options.size()]); + } + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + recurseOption.setFocus(); + } + } + } + + /** + * Class to retrieve and store the default selected values. + */ + private final class DefaultValuesStore { + + private static final String PREF_LAST_SELECTION= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.selection"; //$NON-NLS-1$ + private static final String PREF_LAST_FS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.fs.path"; //$NON-NLS-1$ + private static final String PREF_LAST_WS_FILENAME= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.ws.filename"; //$NON-NLS-1$ + private static final String PREF_LAST_WS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.ws.path"; //$NON-NLS-1$ + + private final IDialogSettings dialogSettings; + + public DefaultValuesStore() { + dialogSettings= CVSUIPlugin.getPlugin().getDialogSettings(); + } + + public int getRadioSelection() { + int value= LocationPage.CLIPBOARD; + try { + value= dialogSettings.getInt(PREF_LAST_SELECTION); + } catch (NumberFormatException e) { + } + + switch (value) { + case LocationPage.FILESYSTEM: + case LocationPage.WORKSPACE: + case LocationPage.CLIPBOARD: + return value; + default: + return LocationPage.CLIPBOARD; + } + } + + public String getFilesystemPath() { + final String path= dialogSettings.get(PREF_LAST_FS_PATH); + return path != null ? path : ""; //$NON-NLS-1$ + } + + public String getWorkspaceFilename() { + final String filename= dialogSettings.get(PREF_LAST_WS_FILENAME); + return filename != null ? filename : ""; //$NON-NLS-1$ + } + + public IContainer getWorkspaceSelection() { + final String value= dialogSettings.get(PREF_LAST_WS_PATH); + if ( value != null ) { + final IPath path= new Path(value); + final IResource container= ResourcesPlugin.getWorkspace().getRoot().findMember(path); + if (container instanceof IContainer) { + return (IContainer)container; + } + } + return null; + } + + public void storeRadioSelection(int defaultSelection) { + dialogSettings.put(PREF_LAST_SELECTION, defaultSelection); + } + + public void storeFilesystemPath(String path) { + dialogSettings.put(PREF_LAST_FS_PATH, path); + } + + public void storeWorkspacePath(String path) { + dialogSettings.put(PREF_LAST_WS_PATH, path); + } + + public void storeWorkspaceFilename(String filename) { + dialogSettings.put(PREF_LAST_WS_FILENAME, filename); + } + } + + + private LocationPage locationPage; + private OptionsPage optionsPage; + + private final IResource resource; + private final DefaultValuesStore defaultValuesStore; + + + public GenerateDiffFileWizard(IResource resource) { + super(); + this.resource = resource; + setWindowTitle(Policy.bind("GenerateCVSDiff.title")); //$NON-NLS-1$ + initializeDefaultPageImageDescriptor(); + defaultValuesStore= new DefaultValuesStore(); + } + + public void addPages() { + String pageTitle = Policy.bind("GenerateCVSDiff.pageTitle"); //$NON-NLS-1$ + String pageDescription = Policy.bind("GenerateCVSDiff.pageDescription"); //$NON-NLS-1$ + locationPage = new LocationPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF), defaultValuesStore); + locationPage.setDescription(pageDescription); + addPage(locationPage); + + pageTitle = Policy.bind("Advanced_options_19"); //$NON-NLS-1$ + pageDescription = Policy.bind("Configure_the_options_used_for_the_CVS_diff_command_20"); //$NON-NLS-1$ + optionsPage = new OptionsPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF)); + optionsPage.setDescription(pageDescription); + addPage(optionsPage); + } - /** - * Allow the user to chose to save the patch to the workspace or outside - * of the workspace. - */ - public void createControl(Composite parent) { - - Composite composite= new Composite(parent, SWT.NULL); - GridLayout layout= new GridLayout(); - composite.setLayout(layout); - composite.setLayoutData(new GridData()); - setControl(composite); - initializeDialogUnits(composite); + + /** + * Declares the wizard banner iamge descriptor + */ + protected void initializeDefaultPageImageDescriptor() { + final String iconPath= "icons/full/"; //$NON-NLS-1$ + try { + final URL installURL = CVSUIPlugin.getPlugin().getBundle().getEntry("/"); //$NON-NLS-1$ + final URL url = new URL(installURL, iconPath + "wizards/newconnect_wiz.gif"); //$NON-NLS-1$ + ImageDescriptor desc = ImageDescriptor.createFromURL(url); + setDefaultPageImageDescriptor(desc); + } catch (MalformedURLException e) { + // Should not happen. Ignore. + } + } + + /* (Non-javadoc) + * Method declared on IWizard. + */ + public boolean needsProgressMonitor() { + return true; + } + + /** + * Completes processing of the wizard. If this method returns <code> + * true</code>, the wizard will close; otherwise, it will stay active. + */ + public boolean performFinish() { + + final int location= locationPage.getSelectedLocation(); + final boolean toClipboard= location == LocationPage.CLIPBOARD; + final File file= toClipboard ? null : locationPage.getFile(); - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.PATCH_SELECTION_PAGE); - - // Clipboard - saveToClipboard= new Button(composite, SWT.RADIO); - saveToClipboard.setText(Policy.bind("Save_To_Clipboard_2")); //$NON-NLS-1$ - - // File System - saveInFilesystem= new Button(composite, SWT.RADIO); - saveInFilesystem.setText(Policy.bind("Save_In_File_System_3")); //$NON-NLS-1$ - - Composite nameGroup = new Composite(composite,SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - nameGroup.setLayout(layout); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - nameGroup.setLayoutData(data); - - filenameCombo= new Text(nameGroup, SWT.BORDER); - GridData gd= new GridData(GridData.FILL_HORIZONTAL); - filenameCombo.setLayoutData(gd); - filenameCombo.setText(defaultValuesStore.getDefaultFilesystemPath()); - - browseButton = new Button(nameGroup, SWT.NULL); - browseButton.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); - browseButton.setLayoutData(data); - - // Workspace - saveInWorkspace= new Button(composite, SWT.RADIO); - saveInWorkspace.setText(Policy.bind("Save_In_Workspace_7")); //$NON-NLS-1$ - - createTreeViewer(composite); - - final int selected = defaultValuesStore.getDefaultSelection(); - saveToClipboard.setSelection(selected == CLIPBOARD); - saveInFilesystem.setSelection(selected == FILESYSTEM); - saveInWorkspace.setSelection(selected == WORKSPACE); - - validatePage(); - updateEnablements(); - - /** - * Add listeners. - */ - saveToClipboard.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - validatePage(); - updateEnablements(); - } - }); - saveInFilesystem.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - validatePage(); - updateEnablements(); - } - }); - - saveInWorkspace.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - validatePage(); - updateEnablements(); - } - }); - - filenameCombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - validatePage(); - } - }); - - browseButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog d = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE); - if (isValidFile(new File(filenameCombo.getText()))) { - d.setFilterPath(filenameCombo.getText()); - } - d.setText(Policy.bind("Save_Patch_As_5")); //$NON-NLS-1$ - d.setFileName(Policy.bind("patch.txt_6")); //$NON-NLS-1$ - String file = d.open(); - if(file!=null) { - IPath path = new Path(file); - setFilesystemFilename(path.toOSString()); - } - } - }); - - } - - /** - * Sets the file name in the file system text. - */ - protected void setFilesystemFilename(String filename) { - filenameCombo.setText(filename); - } - - /** - * Create the tree viewer that shows the container available in the workspace. The user - * can then enter a filename in the text box below the viewer. - */ - protected void createTreeViewer(Composite parent) { - // Create tree viewer inside drill down. - new Label(parent, SWT.LEFT).setText(Policy.bind("Select_a_folder_then_type_in_the_file_name__8")); //$NON-NLS-1$ - - treeViewer = new TreeViewer(parent, SWT.BORDER); - ContainerContentProvider cp = new ContainerContentProvider(); - cp.showClosedProjects(false); - GridData data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL | - GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); - - data.widthHint = SIZING_SELECTION_PANE_WIDTH; - data.heightHint = SIZING_SELECTION_PANE_HEIGHT; - - treeViewer.getTree().setLayoutData(data); - treeViewer.setContentProvider(cp); - treeViewer.setLabelProvider(new WorkbenchLabelProvider()); - - // This has to be done after the viewer has been laid out - treeViewer.setInput(ResourcesPlugin.getWorkspace()); - selectedContainer= defaultValuesStore.getDefaultWorkspaceSelection(); - if (selectedContainer != null) { - treeViewer.setSelection(new StructuredSelection(selectedContainer)); - } - - // name group - Composite nameGroup = new Composite(parent,SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - nameGroup.setLayout(layout); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - nameGroup.setLayoutData(data); - - Label label = new Label(nameGroup,SWT.NONE); - label.setText(Policy.bind("Fi&le_name__9")); //$NON-NLS-1$ - - // resource name entry field - workspaceFilename = new Text(nameGroup,SWT.BORDER); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - workspaceFilename.setLayoutData(data); - workspaceFilename.setText(defaultValuesStore.getDefaultWorkspaceFilename()); - - /** - * Add listeners. - */ - treeViewer.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection s = (IStructuredSelection)event.getSelection(); - containerSelectionChanged((IContainer) s.getFirstElement()); // allow null - validatePage(); - } - }); - - treeViewer.addDoubleClickListener( - new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - ISelection s= event.getSelection(); - if (s instanceof IStructuredSelection) { - Object item = ((IStructuredSelection)s).getFirstElement(); - if (treeViewer.getExpandedState(item)) - treeViewer.collapseToLevel(item, 1); - else - treeViewer.expandToLevel(item, 1); - } - } - }); - - workspaceFilename.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - validatePage(); - } - }); - } - - /** - * Enable and disable controls based on the selected radio button. - */ - protected void updateEnablements() { - int type = getSaveType(); - - browseButton.setEnabled(type==FILESYSTEM); - filenameCombo.setEnabled(type==FILESYSTEM); - treeViewer.getTree().setEnabled(type==WORKSPACE); - workspaceFilename.setEnabled(type==WORKSPACE); - } - - /** - * Answers the type of the patch file destination. - */ - public int getSaveType() { - if(saveInFilesystem.getSelection()) { - return FILESYSTEM; - } else if(saveToClipboard.getSelection()) { - return CLIPBOARD; - } else { - return WORKSPACE; - } - } - - /** - * Remember the container selected in the tree viewer. - */ - public void containerSelectionChanged(IContainer container) { - selectedContainer = container; - } - } - // end of PatchFileSelectionPage - - /** - * Page to select the options for creating the patch. - */ - public class PatchFileCreationOptionsPage extends WizardPage { - - private Button recurseOption; - private Button contextDiffOption; - private Button unifiedDiffOption; - private Button regularDiffOption; - private Button includeNewFilesOptions; - - /** - * Constructor for PatchFileCreationOptionsPage. - */ - protected PatchFileCreationOptionsPage(String pageName) { - super(pageName); - } - - /** - * Constructor for PatchFileCreationOptionsPage. - */ - protected PatchFileCreationOptionsPage(String pageName, String title, ImageDescriptor titleImage) { - super(pageName, title, titleImage); - } - - /* - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite composite= new Composite(parent, SWT.NULL); - GridLayout layout= new GridLayout(); - composite.setLayout(layout); - composite.setLayoutData(new GridData()); - setControl(composite); - - // set F1 help - WorkbenchHelp.setHelp(composite, IHelpContextIds.PATCH_OPTIONS_PAGE); - - recurseOption = new Button(composite, SWT.CHECK); - recurseOption.setText(Policy.bind("Do_not_recurse_into_sub-folders_10")); //$NON-NLS-1$ - recurseOption.setSelection(true); - - includeNewFilesOptions = new Button(composite, SWT.CHECK); - includeNewFilesOptions.setText(Policy.bind("Do_not_include_new_files_in_patch_11")); //$NON-NLS-1$ - includeNewFilesOptions.setSelection(true); - - Group diffTypeGroup = new Group(composite, SWT.NONE); - layout = new GridLayout(); - layout.marginHeight = 0; - diffTypeGroup.setLayout(layout); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - diffTypeGroup.setLayoutData(data); - diffTypeGroup.setText(Policy.bind("Diff_output_format_12")); //$NON-NLS-1$ - - unifiedDiffOption = new Button(diffTypeGroup, SWT.RADIO); - unifiedDiffOption.setText(Policy.bind("Unified_(format_required_by_Compare_With_Patch_feature)_13")); //$NON-NLS-1$ - unifiedDiffOption.setSelection(true); - contextDiffOption = new Button(diffTypeGroup, SWT.RADIO); - contextDiffOption.setText(Policy.bind("Context_14")); //$NON-NLS-1$ - regularDiffOption = new Button(diffTypeGroup, SWT.RADIO); - regularDiffOption.setText(Policy.bind("Standard_15")); //$NON-NLS-1$ - } - - /** - * Answers if the difference operation should be run recursively. - */ - public boolean isRecursive() { - return !recurseOption.getSelection(); - } - - /** - * Return the list of Diff command options configured on this page. - */ - public LocalOption[] getOptions() { - List options = new ArrayList(5); - if(includeNewFilesOptions.getSelection()) { - options.add(Diff.INCLUDE_NEWFILES); - } - if(!recurseOption.getSelection()) { - options.add(Diff.DO_NOT_RECURSE); - } - if(unifiedDiffOption.getSelection()) { - options.add(Diff.UNIFIED_FORMAT); - } else if(contextDiffOption.getSelection()) { - options.add(Diff.CONTEXT_FORMAT); - } - return (LocalOption[]) options.toArray(new LocalOption[options.size()]); - } - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - recurseOption.setFocus(); - } - } - } - // end of PatchFileCreationOptionsPage - - public GenerateDiffFileWizard(IStructuredSelection selection, IResource resource) { - super(); - this.resource = resource; - setWindowTitle(Policy.bind("GenerateCVSDiff.title")); //$NON-NLS-1$ - initializeDefaultPageImageDescriptor(); - } - - public void addPages() { - String pageTitle = Policy.bind("GenerateCVSDiff.pageTitle"); //$NON-NLS-1$ - String pageDescription = Policy.bind("GenerateCVSDiff.pageDescription"); //$NON-NLS-1$ - mainPage = new PatchFileSelectionPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF)); - mainPage.setDescription(pageDescription); - addPage(mainPage); - - pageTitle = Policy.bind("Advanced_options_19"); //$NON-NLS-1$ - pageDescription = Policy.bind("Configure_the_options_used_for_the_CVS_diff_command_20"); //$NON-NLS-1$ - optionsPage = new PatchFileCreationOptionsPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF)); - optionsPage.setDescription(pageDescription); - addPage(optionsPage); - } - - /** - * Initializes this creation wizard using the passed workbench and - * object selection. - * - * @param workbench the current workbench - * @param selection the current object selection - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - } - /** - * Declares the wizard banner iamge descriptor - */ - protected void initializeDefaultPageImageDescriptor() { - String iconPath; - iconPath = "icons/full/"; //$NON-NLS-1$ - try { - URL installURL = CVSUIPlugin.getPlugin().getBundle().getEntry("/"); //$NON-NLS-1$ - URL url = new URL(installURL, iconPath + "wizards/newconnect_wiz.gif"); //$NON-NLS-1$ - ImageDescriptor desc = ImageDescriptor.createFromURL(url); - setDefaultPageImageDescriptor(desc); - } catch (MalformedURLException e) { - // Should not happen. Ignore. - } - } - - /* (Non-javadoc) - * Method declared on IWizard. - */ - public boolean needsProgressMonitor() { - return true; - } - /** - * Completes processing of the wizard. If this method returns <code> - * true</code>, the wizard will close; otherwise, it will stay active. - */ - public boolean performFinish() { - String fs = mainPage.getFilesystemFile(); - IFile ws = mainPage.getWorkspaceFile(); - int type = mainPage.getSaveType(); - - try { - if(type != mainPage.CLIPBOARD) { - File file = new File(fs!=null ? fs : ws.getLocation().toOSString()); - if (file.exists()) { - // prompt then delete - String title = Policy.bind("GenerateCVSDiff.overwriteTitle"); //$NON-NLS-1$ - String msg = Policy.bind("GenerateCVSDiff.overwriteMsg"); //$NON-NLS-1$ - final MessageDialog dialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0); - - dialog.open(); - - if (dialog.getReturnCode() != 0) { - // cancel - return false; - } - } - getContainer().run(true, true, new GenerateDiffFileOperation(resource, file, false, optionsPage.getOptions(), getShell())); - if(type==mainPage.WORKSPACE) { - ws.getParent().refreshLocal(IResource.DEPTH_ONE, null); - } - } else { - getContainer().run(true, true, new GenerateDiffFileOperation(resource, null, true, optionsPage.getOptions(), getShell())); - } - return true; - } catch (InterruptedException e1) { - return true; - } catch(CoreException e) { - CVSUIPlugin.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e); //$NON-NLS-1$ - return false; - } catch (InvocationTargetException e2) { - CVSUIPlugin.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e2); //$NON-NLS-1$ - return false; - } - } + /** + * Ask the user to overwrite the file if it already exists. + */ + if (file != null && file.exists()) { + final String title = Policy.bind("GenerateCVSDiff.overwriteTitle"); //$NON-NLS-1$ + final String msg = Policy.bind("GenerateCVSDiff.overwriteMsg"); //$NON-NLS-1$ + final MessageDialog dialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0); + dialog.open(); + if (dialog.getReturnCode() != 0) + return false; + } + + /** + * Perform diff operation. + */ + try { + getContainer().run(true, true, new GenerateDiffFileOperation(resource, file, toClipboard, optionsPage.getOptions(), getShell())); + } catch (InterruptedException e1) { + return true; + } catch (InvocationTargetException e2) { + CVSUIPlugin.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e2); //$NON-NLS-1$ + return false; + } + + /** + * Refresh workspace if necessary and save default selection. + */ + switch (location) { + + case LocationPage.WORKSPACE: + defaultValuesStore.storeRadioSelection(LocationPage.WORKSPACE); + final IResource workspaceResource= locationPage.getResource(); + defaultValuesStore.storeWorkspacePath(workspaceResource.getParent().getFullPath().toString()); + defaultValuesStore.storeWorkspaceFilename(workspaceResource.getName()); + try { + workspaceResource.getParent().refreshLocal(IResource.DEPTH_ONE, null); + } catch(CoreException e) { + CVSUIPlugin.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e); //$NON-NLS-1$ + return false; + } + break; + + case LocationPage.FILESYSTEM: + defaultValuesStore.storeFilesystemPath(file.getPath()); + defaultValuesStore.storeRadioSelection(LocationPage.FILESYSTEM); + break; + + case LocationPage.CLIPBOARD: + defaultValuesStore.storeRadioSelection(LocationPage.CLIPBOARD); + break; + + default: + return false; + } + return true; + } } |