diff --git a/rse/plugins/org.eclipse.rse.files.ui/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.files.ui/META-INF/MANIFEST.MF index 514a3b4639e..bf0873384b4 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.files.ui/META-INF/MANIFEST.MF @@ -27,12 +27,11 @@ Export-Package: org.eclipse.rse.files.ui, org.eclipse.rse.files.ui.resources, org.eclipse.rse.files.ui.widgets, org.eclipse.rse.internal.files.ui;x-internal:=true, - org.eclipse.rse.internal.files.ui.actions;x-internal:=true, + org.eclipse.rse.internal.files.ui.actions;x-internal:=true, org.eclipse.rse.internal.files.ui.propertypages;x-internal:=true, org.eclipse.rse.internal.files.ui.resources;x-internal:=true, org.eclipse.rse.internal.files.ui.search;x-internal:=true, org.eclipse.rse.internal.files.ui.view;x-internal:=true, - org.eclipse.rse.internal.files.ui.widgets;x-internal:=true, org.eclipse.rse.internal.files.ui.wizards;x-internal:=true Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/AddToArchiveForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/AddToArchiveForm.java deleted file mode 100644 index d253738f141..00000000000 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/AddToArchiveForm.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 2006 IBM Corporation. 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 http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.rse.internal.files.ui.widgets; -import org.eclipse.rse.internal.files.ui.FileResources; -import org.eclipse.rse.ui.SystemWidgetHelpers; -import org.eclipse.rse.ui.messages.ISystemMessageLine; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - - -/** - * @author mjberger - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class AddToArchiveForm extends CombineForm -{ - - protected Button savePathInfoCheckBox; - protected Combo relativeToCombo; - protected String[] _relativePathList = null; - protected String relativePath = ""; //$NON-NLS-1$ - protected boolean saveFullPathInfo = false; - - public AddToArchiveForm( - ISystemMessageLine msgLine, - Object caller, - boolean fileMode) - { - super(msgLine, caller, fileMode); - } - - public AddToArchiveForm( - ISystemMessageLine msgLine, - Object caller, - boolean fileMode, - boolean prePopSelection) - { - super(msgLine, caller, fileMode, prePopSelection); - } - - public AddToArchiveForm( - ISystemMessageLine msgLine, - Object caller, - boolean fileMode, - boolean prePopSelection, - String[] relativePaths) -{ - super(msgLine, caller, fileMode, prePopSelection); - _relativePathList = relativePaths; - enableRelativePathFeature(relativePaths != null); -} - - public void setRelativePathList(String[] relativePathList) - { - if (relativePathList != null) - { - _relativePathList = relativePathList; - if (relativeToCombo != null) relativeToCombo.setItems(relativePathList); - enableRelativePathFeature(true); - } - else - { - enableRelativePathFeature(false); - } - } - - protected void enableRelativePathFeature(boolean enable) - { - if (relativeToCombo != null) relativeToCombo.setEnabled(enable); - if (savePathInfoCheckBox != null) savePathInfoCheckBox.setEnabled(enable); - } - - /** - * In this method, we populate the given SWT container with widgets and return the container - * to the caller. - * @param parent The parent composite - */ - public Control createContents(Shell shell, Composite parent) - { - Control control = super.createContents(shell, parent); - - Composite composite = SystemWidgetHelpers.createComposite(parent, 1); - - savePathInfoCheckBox = SystemWidgetHelpers.createCheckBox(composite, null, FileResources.RESID_ADDTOARCHIVE_SAVEPATH_LABEL, FileResources.RESID_ADDTOARCHIVE_SAVEPATH_TOOLTIP); - relativeToCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite, null, FileResources.RESID_ADDTOARCHIVE_RELATIVETO_LABEL, FileResources.RESID_ADDTOARCHIVE_RELATIVETO_LABEL); - - enableRelativePathFeature(_relativePathList != null); - - if (_relativePathList != null) - { - relativeToCombo.setItems(_relativePathList); - relativeToCombo.setEnabled(false); - } - - savePathInfoCheckBox.addSelectionListener(new SelectionListener() { - - public void widgetDefaultSelected(SelectionEvent e) { - setPageComplete(); - relativeToCombo.setEnabled(savePathInfoCheckBox.getSelection()); - if (!savePathInfoCheckBox.getSelection()) relativePath = ""; //$NON-NLS-1$ - setSaveFullPathInfo(); - } - public void widgetSelected(SelectionEvent e) { - setPageComplete(); - relativeToCombo.setEnabled(savePathInfoCheckBox.getSelection()); - if (!savePathInfoCheckBox.getSelection()) relativePath = ""; //$NON-NLS-1$ - setSaveFullPathInfo(); - } - }); - - relativeToCombo.addModifyListener(new ModifyListener() { - - public void modifyText(ModifyEvent e) { - relativePath = relativeToCombo.getText(); - setPageComplete(); - } - }); - - return control; - } - - public boolean isPageComplete() - { - boolean pathInfoChecked = (savePathInfoCheckBox != null && savePathInfoCheckBox.getSelection()); - boolean relPathSelectionMade = relativePath != null && !relativePath.equals(""); //$NON-NLS-1$ - boolean relPathComplete = savePathInfoCheckBox == null || !savePathInfoCheckBox.getEnabled(); - if (!relPathComplete) - { - if (pathInfoChecked) - { - relPathComplete = relPathSelectionMade; - } - else relPathComplete = true; - } - return super.isPageComplete() && relPathComplete; - } - - protected void setSaveFullPathInfo() - { - saveFullPathInfo = savePathInfoCheckBox != null && - savePathInfoCheckBox.getEnabled() && - savePathInfoCheckBox.getSelection(); - } - - public String getRelativePath() - { - return relativePath; - } - - public boolean getSaveFullPathInfo() - { - return saveFullPathInfo; - } -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/CombineForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/CombineForm.java deleted file mode 100644 index 44a03336ff2..00000000000 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/CombineForm.java +++ /dev/null @@ -1,452 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2003, 2007 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 http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - ********************************************************************************/ - -package org.eclipse.rse.internal.files.ui.widgets; -import java.util.ArrayList; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.SystemFilterSimple; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm; -import org.eclipse.rse.internal.files.ui.FileResources; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; -import org.eclipse.rse.ui.SystemWidgetHelpers; -import org.eclipse.rse.ui.messages.ISystemMessageLine; -import org.eclipse.rse.ui.validators.ValidatorArchiveName; -import org.eclipse.rse.ui.validators.ValidatorFileName; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.rse.ui.view.ISystemViewElementAdapter; -import org.eclipse.rse.ui.view.SystemAdapterHelpers; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - - -/** - * A dialog to select or enter archive files. - */ -public class CombineForm extends SystemSelectRemoteFileOrFolderForm -{ - - protected Text fileNameText; - protected Combo fileTypeCombo; - protected Label nameAndTypeLabel; - protected String fileName, fileType, initialFileName; - protected ValidatorFileName validator; - protected ValidatorArchiveName arcvalidator; - protected boolean prePop; - protected String nameAndTypePrompt = ""; //$NON-NLS-1$ - protected String[] disallowedExtensions; - - /** - * Constructor for ExtractToForm - */ - public CombineForm(ISystemMessageLine msgLine, Object caller, boolean fileMode) - { - super(msgLine, caller, fileMode); - validator = new ValidatorFileName(); - arcvalidator = new ValidatorArchiveName(); - prePop = false; - } - - public CombineForm(ISystemMessageLine msgLine, Object caller, boolean fileMode, boolean prePopSelection) - { - super(msgLine, caller, fileMode); - - validator = new ValidatorFileName(); - arcvalidator = new ValidatorArchiveName(); - prePop = prePopSelection; - } - - /** - * In this method, we populate the given SWT container with widgets and return the container - * to the caller. - * @param parent The parent composite - */ - public Control createContents(Shell shell, Composite parent) - { - Control control = super.createContents(shell, parent); - - Composite composite = SystemWidgetHelpers.createComposite(parent, 1); - - nameAndTypeLabel = SystemWidgetHelpers.createLabel(composite, nameAndTypePrompt); - Composite subcomp1 = SystemWidgetHelpers.createComposite(composite, 2); - fileNameText = SystemWidgetHelpers.createLabeledTextField( - subcomp1, null, FileResources.RESID_COMBINE_NAME_LABEL, FileResources.RESID_COMBINE_NAME_TOOLTIP); - fileTypeCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(subcomp1, null, FileResources.RESID_COMBINE_TYPE_LABEL, FileResources.RESID_COMBINE_TYPE_TOOLTIP); - - String[] allowedExtensions = getAllowedArchiveExtensions(); - - if (allowedExtensions != null && allowedExtensions.length != 0) { - fileTypeCombo.setItems(allowedExtensions); - fileTypeCombo.select(0); - fileType = fileTypeCombo.getText(); - } - - fileNameText.addModifyListener(new ModifyListener() { - - public void modifyText(ModifyEvent e) { - fileName = fileNameText.getText(); - setPageComplete(); - if (fileName.indexOf(".") != -1) //$NON-NLS-1$ - { - SystemMessage isValidMsg = arcvalidator.validate(fileName); - if (isValidMsg == null) - { - int i = fileName.lastIndexOf("."); //$NON-NLS-1$ - fileType = fileName.substring(i+1); - fileTypeCombo.setText(fileType); - } - } - } - }); - - fileTypeCombo.addModifyListener(new ModifyListener() { - - public void modifyText(ModifyEvent e) { - fileType = fileTypeCombo.getText(); - setPageComplete(); - } - }); - - if (fileName != null) - { - fileNameText.setText(fileName); - } - - return control; - } - - protected String[] getAllowedArchiveExtensions() { - - String[] allExtensions = ArchiveHandlerManager.getInstance().getRegisteredExtensions(); - - ArrayList list = new ArrayList(); - - for (int i = 0; i < allExtensions.length; i++) { - - String extension = allExtensions[i]; - - boolean keep = true; - - for (int j = 0; j < disallowedExtensions.length; j++) { - - if (disallowedExtensions[j].toLowerCase().equals(extension)) { - - keep = false; - break; - } - } - - if (keep) { - list.add(extension); - } - } - - String[] allowedExtensions = new String[list.size()]; - - for (int i = 0; i < list.size(); i++) { - allowedExtensions[i] = (String)(list.get(i)); - } - - return allowedExtensions; - } - - public String[] getDisallowedArchiveExtensions() { - return disallowedExtensions; - } - - /** - * Sets the extensions to disallow. - * @param extensions the archive extensions that will not be allowed. - */ - public void setDisallowedArchiveExtensions(String[] extensions) { - this.disallowedExtensions = extensions; - } - - /** - * Completes processing of the dialog. - * Intercept of parent method. - * - * @return true if no errors - */ - public boolean verify() - { - // This method added by Phil to issue warning msg for existing member - boolean ok = super.verify(); - - if (ok) - { - /* - IRemoteFile file = (IRemoteFile)getSelectedObject(); - - IRemoteFile saveasFile = null; - - try - { - saveasFile = file.getParentRemoteFileSubSystem().getRemoteFileObject(file, getFileName()); - } - catch (Exception e) - { - } - */ - } - return ok; - } - - public boolean isPageComplete() - { - String nameToCheck = null; - - if (fileName == null) { - nameToCheck = ""; //$NON-NLS-1$ - } - else { - nameToCheck = fileName; - } - - SystemMessage errMsg = validator.validate(nameToCheck); - - if (errMsg != null) - { - setErrorMessage(errMsg); - return false; - } - else - { - clearErrorMessage(); - } - - return fileTypeCombo != null && - fileTypeCombo.getText().length() > 0 && - fileNameText != null && - fileNameText.getText().length() > 0 && - super.isPageComplete(); - } - - public String getFileName() { - - if (fileName.endsWith("." + fileType)) { //$NON-NLS-1$ - return fileName; - } - else { - return fileName + "." + fileType; //$NON-NLS-1$ - } - } - - /** - * Returns the implementation of ISystemViewElement for the given - * object. Returns null if the adapter is not defined or the - * object is not adaptable. - */ - protected ISystemViewElementAdapter getViewAdapter(Object o) - { - return SystemAdapterHelpers.getViewAdapter(o); - } - - /** - * Returns the implementation of ISystemRemoteElement for the given - * object. Returns null if this object does not adaptable to this. - */ - protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) - { - return SystemAdapterHelpers.getRemoteAdapter(o); - } - - /** - * User selected something in the tree. - * This is an intercept of the parent's method so we can process a member selection, and - * copy the selected member's name to the entry field. - */ - public void selectionChanged(SelectionChangedEvent e) - { - super.selectionChanged(e); - clearErrorMessage(); - ISelection selection = e.getSelection(); - Object selectedObject = getFirstSelection(e.getSelection()); - if (selectedObject != null && selectedObject instanceof IRemoteFile) - { - IRemoteFile remoteFile = (IRemoteFile)selectedObject; - - ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject); - if ((remoteAdapter != null)) - { - Object parentFile = remoteFile; - - remoteAdapter = getRemoteAdapter(parentFile); - if (remoteAdapter != null) - { - String fullPath = remoteAdapter.getAbsoluteName(parentFile); - setNameText(fullPath); - outputObjects = new Object[] {parentFile}; - setPageComplete(); - SystemMessage selectionMsg = null; - if (selectionValidator != null) - selectionMsg = selectionValidator.isValid(outputConnection, getSelections(selection), getRemoteAdapters(selection)); - - if (selectionMsg != null) - { - valid = false; - setErrorMessage(selectionMsg); - setPageComplete(); - } - } - } - } - } - - public void setPreSelection(IRemoteFile selection) - { - if (selection.isDirectory()) - { - super.setPreSelection(selection); - } - else if (selection.isFile()) - { - IRemoteFile parentFile = selection.getParentRemoteFile(); - - if (parentFile.isDirectory()) - { - super.setPreSelection(parentFile); - } - } - if (prePop) - { - String file = selection.getName(); - int i = file.lastIndexOf("."); //$NON-NLS-1$ - if (i == -1) - { - fileName = file; - fileType = ""; //$NON-NLS-1$ - } - else - { - fileName = file.substring(0,i); - fileType = selection.getExtension(); - } - } - else - { - fileName = ""; //$NON-NLS-1$ - } - } - - /** - * Set the root folder from which to start listing folders or files. - * This version identifies the folder via a connection object and absolute path. - * There is another overload that identifies the folder via a single IRemoteFile object. - * - * @param connection The connection to the remote system containing the root folder - * @param folderAbsolutePath The fully qualified folder to start listing from (eg: "\folder1\folder2") - * - * @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString - */ - public void setRootFolder(IHost connection, String folderAbsolutePath) - { - setDefaultConnection(connection); - setShowNewConnectionPrompt(true); - setAutoExpandDepth(0); - - IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(connection); - IRemoteFileSubSystemConfiguration ssf = ss.getParentRemoteFileSubSystemConfiguration(); - RemoteFileFilterString rffs = new RemoteFileFilterString(ssf); - rffs.setShowFiles(fileMode); // no files if in folders mode - rffs.setShowSubDirs(!fileMode || !filesOnlyMode); // yes folders, always, for now - if (fileTypes != null) - rffs.setFile(fileTypes); - - // set the default filters we will show when the user expands a connection... - String filterName = null; - SystemFilterSimple filter = null; - int filterCount = showRootFilter ? 2 : 1; - if (preSelectRoot) - filterCount = 1; - ISystemFilter[] filters = new ISystemFilter[filterCount]; - int idx = 0; - - // filter one: "Root files"/"Root folders" or "Drives" - if (showRootFilter) - { - if (ssf.isUnixStyle()) - { - if (!preSelectRoot) - { - // "Root files" or "Folders" - filterName = fileMode ? SystemFileResources.RESID_FILTER_ROOTFILES : SystemFileResources.RESID_FILTER_ROOTFOLDERS; - //rffs.setPath(ssf.getSeparator()); // defect 43492. Show the root not the contents of the root - } - else - { - filterName = SystemFileResources.RESID_FILTER_ROOTS; // "Roots" - } - } - else - filterName = fileMode ? SystemFileResources.RESID_FILTER_DRIVES : SystemFileResources.RESID_FILTER_DRIVES; - filter = new SystemFilterSimple(filterName); - filter.setParent(ss); - filter.setFilterString(rffs.toString()); - filters[idx++] = filter; - //System.out.println("FILTER 1: " + filter.getFilterString()); - if (preSelectRoot) - { - preSelectFilter = filter; - preSelectFilterChild = folderAbsolutePath; - //RSEUIPlugin.logInfo("in setRootFolder. Given: " + folderAbsolutePath); - } - } - - if (!preSelectRoot) - { - - // filter two: "\folder1\folder2" - rffs.setPath(folderAbsolutePath); - - filter = new SystemFilterSimple(rffs.toStringNoSwitches()); - filter.setParent(ss); - filter.setFilterString(rffs.toString()); - filters[idx] = filter; - - preSelectFilter = filter; - //RSEUIPlugin.logInfo("FILTER 2: " + filter.getFilterString()); - } - inputProvider.setFilterString(null); // undo what ctor did - inputProvider.setQuickFilters(filters); - } - - public void setPrePopSelection(boolean prePopSelection) - { - prePop = prePopSelection; - } - - public void setNameAndTypePrompt(String prompt) - { - nameAndTypePrompt = prompt; - } -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/ExtractToForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/ExtractToForm.java deleted file mode 100644 index 82494b8179e..00000000000 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/ExtractToForm.java +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2003, 2007 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 http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin - ********************************************************************************/ - -package org.eclipse.rse.internal.files.ui.widgets; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.SystemFilterSimple; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; -import org.eclipse.rse.ui.messages.ISystemMessageLine; -import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; -import org.eclipse.rse.ui.view.ISystemViewElementAdapter; -import org.eclipse.rse.ui.view.SystemAdapterHelpers; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - - -/** - * @author mjberger - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class ExtractToForm extends SystemSelectRemoteFileOrFolderForm -{ - - private String fileName; - - /** - * Constructor for ExtractToForm - */ - public ExtractToForm(ISystemMessageLine msgLine, Object caller, boolean fileMode) - { - super(msgLine, caller, fileMode); - } - - /** - * In this method, we populate the given SWT container with widgets and return the container - * to the caller. - * @param parent The parent composite - */ - public Control createContents(Shell shell, Composite parent) - { - Control control = super.createContents(shell, parent); - -// Composite composite = SystemWidgetHelpers.createComposite(parent, 2); -// SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_NEWFILE_NAME_ROOT_LABEL); -// fileNameText = SystemWidgetHelpers.createTextField(composite, null); - -// fileNameText = SystemWidgetHelpers.createLabeledTextField( -// composite, null, RSEUIPlugin.getResourceBundle(), ISystemConstants.RESID_EXTRACTTO_NAME_ROOT); - - -// fileNameText.addModifyListener(new ModifyListener() { -// public void modifyText(ModifyEvent e) { -// fileName = fileNameText.getText(); -// setPageComplete(); -// } -// }); - -// if (fileName != null) -// { -// fileNameText.setText(fileName); -// } - - return control; - } - - /** - * Completes processing of the dialog. - * Intercept of parent method. - * - * @return true if no errors - */ - public boolean verify() - { - // This method added by Phil to issue warning msg for existing member - //System.out.println("Inside verify"); - boolean ok = super.verify(); -/* if (ok) - { - IRemoteFile file = (IRemoteFile) getSelectedObject(); - IRemoteFile saveasFile = null; - try - { - saveasFile = file.getParentRemoteFileSubSystem().getRemoteFileObject(file, fileName); - } - catch (Exception e) - { - } - - //System.out.println("...saveasMbr null? "+ (saveasMbr==null)); - if (saveasFile != null && saveasFile.exists()) - { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_UPLOAD_FILE_EXISTS); - msg.makeSubstitution(fileName); - SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg); - ok = dlg.openQuestionNoException(); - } - - }*/ - return ok; - } - - public boolean isPageComplete() - { - /* - String errMsg = null; //validator.isValid(fileName); - - if (errMsg != null) - { - setErrorMessage(errMsg); - return false; - } - else - */ - { - if (valid) clearErrorMessage(); - return valid; - } - - } - - public String getFileName() - { - return fileName; - } - - /** - * Returns the implementation of ISystemViewElement for the given - * object. Returns null if the adapter is not defined or the - * object is not adaptable. - */ - protected ISystemViewElementAdapter getViewAdapter(Object o) - { - return SystemAdapterHelpers.getViewAdapter(o); - } - - /** - * Returns the implementation of ISystemRemoteElement for the given - * object. Returns null if this object does not adaptable to this. - */ - protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) - { - return SystemAdapterHelpers.getRemoteAdapter(o); - } - - /** - * User selected something in the tree. - * This is an intercept of the parent's method so we can process a member selection, and - * copy the selected member's name to the entry field. - */ - public void selectionChanged(SelectionChangedEvent e) - { - super.selectionChanged(e); - valid = true; - ISelection selection = e.getSelection(); - Object selectedObject = getFirstSelection(selection); - if (selectedObject != null && selectedObject instanceof IRemoteFile) - { - IRemoteFile remoteFile = (IRemoteFile)selectedObject; - fileName = remoteFile.getName(); - if (remoteFile.isRoot()) - { - if (fileName.endsWith("\\")) fileName = fileName.substring(0,2); //$NON-NLS-1$ - } - ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject); - if ((remoteAdapter != null)) - { - - Object parentFile = remoteFile; - - remoteAdapter = getRemoteAdapter(parentFile); - if (remoteAdapter != null) - { - String fullPath = remoteAdapter.getAbsoluteName(parentFile); - setNameText(fullPath); - outputObjects = new Object[] {parentFile}; - - SystemMessage selectionMsg = null; - - if (selectionValidator != null) - selectionMsg = selectionValidator.isValid(outputConnection, getSelections(selection), getRemoteAdapters(selection)); - - if (selectionMsg != null) - { - valid = false; - setErrorMessage(selectionMsg); - } - setPageComplete(); - } - } - } - else if (selectedObject != null) - { - valid = false; - setPageComplete(); - } - } - - public void setPreSelection(IRemoteFile selection) - { - if (selection.isDirectory()) - { - super.setPreSelection(selection); - } - else if (selection.isFile()) - { - IRemoteFile parentFile = selection.getParentRemoteFile(); - - if (parentFile.isDirectory()) - { - super.setPreSelection(parentFile); - } - - fileName = parentFile.getName(); - } - } - - /** - * Set the root folder from which to start listing folders or files. - * This version identifies the folder via a connection object and absolute path. - * There is another overload that identifies the folder via a single IRemoteFile object. - * - * @param connection The connection to the remote system containing the root folder - * @param folderAbsolutePath The fully qualified folder to start listing from (eg: "\folder1\folder2") - * - * @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString - */ - public void setRootFolder(IHost connection, String folderAbsolutePath) - { - setDefaultConnection(connection); - setShowNewConnectionPrompt(true); - setAutoExpandDepth(0); - - IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(connection); - IRemoteFileSubSystemConfiguration ssf = ss.getParentRemoteFileSubSystemConfiguration(); - RemoteFileFilterString rffs = new RemoteFileFilterString(ssf); - rffs.setShowFiles(fileMode); // no files if in folders mode - rffs.setShowSubDirs(!fileMode || !filesOnlyMode); // yes folders, always, for now - if (fileTypes != null) - rffs.setFile(fileTypes); - - // set the default filters we will show when the user expands a connection... - String filterName = null; - SystemFilterSimple filter = null; - int filterCount = showRootFilter ? 2 : 1; - if (preSelectRoot) - filterCount = 1; - ISystemFilter[] filters = new ISystemFilter[filterCount]; - int idx = 0; - - // filter one: "Root files"/"Root folders" or "Drives" - if (showRootFilter) - { - if (ssf.isUnixStyle()) - { - if (!preSelectRoot) - { - // "Root files" or "Folders" - filterName = fileMode ? SystemFileResources.RESID_FILTER_ROOTFILES : SystemFileResources.RESID_FILTER_ROOTFOLDERS; - //rffs.setPath(ssf.getSeparator()); // defect 43492. Show the root not the contents of the root - } - else - { - filterName = SystemFileResources.RESID_FILTER_ROOTS; // "Roots" - } - } - else - filterName = fileMode ? SystemFileResources.RESID_FILTER_DRIVES : SystemFileResources.RESID_FILTER_DRIVES; - filter = new SystemFilterSimple(filterName); - filter.setParent(ss); - filter.setFilterString(rffs.toString()); - filters[idx++] = filter; - //System.out.println("FILTER 1: " + filter.getFilterString()); - if (preSelectRoot) - { - preSelectFilter = filter; - preSelectFilterChild = folderAbsolutePath; - //RSEUIPlugin.logInfo("in setRootFolder. Given: " + folderAbsolutePath); - } - } - - if (!preSelectRoot) - { - - // filter two: "\folder1\folder2" - rffs.setPath(folderAbsolutePath); - - filter = new SystemFilterSimple(rffs.toStringNoSwitches()); - filter.setParent(ss); - filter.setFilterString(rffs.toString()); - filters[idx] = filter; - - preSelectFilter = filter; - //RSEUIPlugin.logInfo("FILTER 2: " + filter.getFilterString()); - } - inputProvider.setFilterString(null); // undo what ctor did - inputProvider.setQuickFilters(filters); - } - -} \ No newline at end of file