mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-28 10:43:31 +02:00
[189973] removing obsolete code
This commit is contained in:
parent
0200895010
commit
92a0caff4e
12 changed files with 1 additions and 1994 deletions
|
@ -1,91 +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.files.ui.dialogs;
|
|
||||||
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
|
|
||||||
import org.eclipse.rse.internal.files.ui.widgets.AddToArchiveForm;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
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 AddToArchiveDialog extends CombineDialog {
|
|
||||||
|
|
||||||
private String[] _relativePaths;
|
|
||||||
|
|
||||||
public AddToArchiveDialog(Shell shell)
|
|
||||||
{
|
|
||||||
super(shell);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "atad0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddToArchiveDialog(Shell shell, String title) {
|
|
||||||
super(shell, title);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "atad0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddToArchiveDialog(Shell shell, String title, String[] relativePaths)
|
|
||||||
{
|
|
||||||
super(shell, title);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "atad0000"); //$NON-NLS-1$
|
|
||||||
_relativePaths = relativePaths;
|
|
||||||
((AddToArchiveForm)form).setRelativePathList(_relativePaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddToArchiveDialog(
|
|
||||||
Shell shell,
|
|
||||||
String title,
|
|
||||||
boolean prePopSelection)
|
|
||||||
{
|
|
||||||
super(shell, title, prePopSelection);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "atad0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddToArchiveDialog(
|
|
||||||
Shell shell,
|
|
||||||
String title,
|
|
||||||
boolean prePopSelection,
|
|
||||||
String[] relativePaths)
|
|
||||||
{
|
|
||||||
super(shell, title, prePopSelection);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "atad0000"); //$NON-NLS-1$
|
|
||||||
_relativePaths = relativePaths;
|
|
||||||
((AddToArchiveForm)form).setRelativePathList(_relativePaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode)
|
|
||||||
{
|
|
||||||
super.getForm(fileMode);
|
|
||||||
form = new AddToArchiveForm(getMessageLine(), this, fileMode, prePop, _relativePaths);
|
|
||||||
return form;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getSaveFullPathInfo()
|
|
||||||
{
|
|
||||||
return ((AddToArchiveForm)form).getSaveFullPathInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRelativePath()
|
|
||||||
{
|
|
||||||
return ((AddToArchiveForm)form).getRelativePath();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,143 +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) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.files.ui.dialogs;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
|
|
||||||
import org.eclipse.rse.internal.files.ui.widgets.CombineForm;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A dialog to select or enter archive files.
|
|
||||||
*/
|
|
||||||
public class CombineDialog extends SystemSelectRemoteFileOrFolderDialog {
|
|
||||||
|
|
||||||
protected CombineForm form;
|
|
||||||
protected boolean prePop = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
* @param shell the parent shell.
|
|
||||||
*/
|
|
||||||
public CombineDialog(Shell shell)
|
|
||||||
{
|
|
||||||
super(shell, false);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "cmbd0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor when you want to supply your own title.
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
* @param title The title to give the dialog
|
|
||||||
*/
|
|
||||||
public CombineDialog(Shell shell, String title)
|
|
||||||
{
|
|
||||||
super(shell, title, false);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "cmbd0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor when you want to supply your own title.
|
|
||||||
*
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
* @param title The title to give the dialog
|
|
||||||
* @param prePopSelection Whether or not the destination name
|
|
||||||
* and type will be prepopulated with the selection, or given
|
|
||||||
* a generic name and type.
|
|
||||||
*/
|
|
||||||
public CombineDialog(Shell shell, String title, boolean prePopSelection)
|
|
||||||
{
|
|
||||||
super(shell, title, false);
|
|
||||||
prePop = prePopSelection;
|
|
||||||
if (form != null) form.setPrePopSelection(prePop);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "cmbd0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor when you want to supply your own title.
|
|
||||||
*
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
* @param title The title to give the dialog
|
|
||||||
* @param prePopSelection Whether or not the destination name
|
|
||||||
* and type will be prepopulated with the selection, or given
|
|
||||||
* a generic name and type.
|
|
||||||
* @param relativePaths The relative paths to be inserted as choices
|
|
||||||
* in the relative path combo box. Null if you wish to disable this feature.
|
|
||||||
*/
|
|
||||||
public CombineDialog(Shell shell, String title, boolean prePopSelection, String[] relativePaths)
|
|
||||||
{
|
|
||||||
super(shell, title, false);
|
|
||||||
prePop = prePopSelection;
|
|
||||||
if (form != null) form.setPrePopSelection(prePop);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "cmbd0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode)
|
|
||||||
{
|
|
||||||
form = new CombineForm(getMessageLine(), this, fileMode, prePop);
|
|
||||||
super.getForm(fileMode);
|
|
||||||
return form;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getOutputObject()
|
|
||||||
{
|
|
||||||
String fileName = form.getFileName();
|
|
||||||
|
|
||||||
IRemoteFile file = (IRemoteFile) super.getOutputObject();
|
|
||||||
|
|
||||||
// if a file was selected, get reference to its parent
|
|
||||||
if (file.isFile()) {
|
|
||||||
file = file.getParentRemoteFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// return a remote file that is the child of the parent folder
|
|
||||||
return file.getParentRemoteFileSubSystem().getRemoteFileObject(file, fileName, new NullProgressMonitor());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShowLocationPrompt(boolean show)
|
|
||||||
{
|
|
||||||
form.setShowLocationPrompt(show);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocationPrompt(String prompt)
|
|
||||||
{
|
|
||||||
form.setLocationPrompt(prompt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNameAndTypePrompt(String prompt)
|
|
||||||
{
|
|
||||||
form.setNameAndTypePrompt(prompt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the extensions to disallow.
|
|
||||||
* @param extensions the archive extensions that will not be allowed.
|
|
||||||
*/
|
|
||||||
public void setDisallowedArchiveExtensions(String[] extensions) {
|
|
||||||
form.setDisallowedArchiveExtensions(extensions);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +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) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.files.ui.dialogs;
|
|
||||||
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
|
|
||||||
import org.eclipse.rse.internal.files.ui.widgets.ExtractToForm;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
public class ExtractToDialog extends SystemSelectRemoteFileOrFolderDialog {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ExtractToForm form;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public ExtractToDialog(Shell shell)
|
|
||||||
{
|
|
||||||
super(shell, false);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "exdi0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Constructor when you want to supply your own title.
|
|
||||||
*
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
* @param title The title to give the dialog
|
|
||||||
*/
|
|
||||||
public ExtractToDialog(Shell shell, String title)
|
|
||||||
{
|
|
||||||
super(shell, title, false);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "exdi0000"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode)
|
|
||||||
{
|
|
||||||
form = new ExtractToForm(getMessageLine(), this, fileMode);
|
|
||||||
super.getForm(fileMode);
|
|
||||||
return form;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getOutputObject()
|
|
||||||
{
|
|
||||||
IRemoteFile file = (IRemoteFile) super.getOutputObject();
|
|
||||||
if (file.exists())
|
|
||||||
{
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,112 +0,0 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 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.files.ui.dialogs;
|
|
||||||
|
|
||||||
import org.eclipse.rse.files.ui.widgets.SystemEnterOrSelectRemoteFileForm;
|
|
||||||
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
|
|
||||||
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A dialog for either selecting or entering a file name.
|
|
||||||
* Use {@link #getRemotePath()} to get the absolute remote path of what the user selected or entered.
|
|
||||||
* Note that if the user enters a file name, then the output object will be its parent folder, since
|
|
||||||
* the file with that name may not exist.
|
|
||||||
*/
|
|
||||||
public class SystemEnterOrSelectRemoteFileDialog extends SystemSelectRemoteFileOrFolderDialog {
|
|
||||||
|
|
||||||
private SystemEnterOrSelectRemoteFileForm form;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the dialog with the parent shell.
|
|
||||||
* @param shell the parent shell.
|
|
||||||
*/
|
|
||||||
public SystemEnterOrSelectRemoteFileDialog(Shell shell) {
|
|
||||||
super(shell, true);
|
|
||||||
setMultipleSelectionMode(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a dialog under the parent shell with the given title.
|
|
||||||
* @param shell the parent shell.
|
|
||||||
* @param title the title for the dialog.
|
|
||||||
*/
|
|
||||||
public SystemEnterOrSelectRemoteFileDialog(Shell shell, String title) {
|
|
||||||
super(shell, title, true);
|
|
||||||
setMultipleSelectionMode(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Always returns false.
|
|
||||||
* @see org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog#getMultipleSelectionMode()
|
|
||||||
*/
|
|
||||||
public boolean getMultipleSelectionMode() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Has no effect. Multiple selection mode is not allowed.
|
|
||||||
* @see org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog#setMultipleSelectionMode(boolean)
|
|
||||||
*/
|
|
||||||
public void setMultipleSelectionMode(boolean multiple) {
|
|
||||||
super.setMultipleSelectionMode(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the select or enter file form. Sets the verbiage of the form.
|
|
||||||
* @see org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog#getForm(boolean)
|
|
||||||
*/
|
|
||||||
protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode) {
|
|
||||||
form = new SystemEnterOrSelectRemoteFileForm(getMessageLine(), this, fileMode);
|
|
||||||
form.setMessage(SystemFileResources.RESID_ENTER_OR_SELECT_FILE_VERBIAGE_LABEL);
|
|
||||||
setOutputObject(null);
|
|
||||||
return form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the remote path.
|
|
||||||
* @return the remote path.
|
|
||||||
*/
|
|
||||||
public String getRemotePath() {
|
|
||||||
IRemoteFile file = (IRemoteFile)getOutputObject();
|
|
||||||
|
|
||||||
String absPath = file.getAbsolutePath();
|
|
||||||
|
|
||||||
// if the output is a file, then return the absolute path.
|
|
||||||
if (file.isFile()) {
|
|
||||||
return absPath;
|
|
||||||
}
|
|
||||||
// if the output is a folder, then file name is available in the text field
|
|
||||||
// of the form, so append the file name to the folder path
|
|
||||||
else {
|
|
||||||
String fileName = form.getFileName();
|
|
||||||
String sep = file.getSeparator();
|
|
||||||
|
|
||||||
// add separator if necessary
|
|
||||||
if (!absPath.endsWith(sep)) {
|
|
||||||
absPath += sep;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add file name if necessary
|
|
||||||
absPath += fileName;
|
|
||||||
|
|
||||||
return absPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 2002, 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.files.ui.widgets;
|
|
||||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Form class for selecting a file based on the SaveAS
|
|
||||||
*/
|
|
||||||
public class FileSelectionForm extends SaveAsForm
|
|
||||||
{
|
|
||||||
public static final String Copyright =
|
|
||||||
"(C) Copyright IBM Corp. 2003 All Rights Reserved."; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for FileSelectionForm
|
|
||||||
*/
|
|
||||||
public FileSelectionForm(
|
|
||||||
ISystemMessageLine msgLine,
|
|
||||||
Object caller,
|
|
||||||
boolean fileMode)
|
|
||||||
{
|
|
||||||
super(msgLine, caller, fileMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Completes processing of the dialog.
|
|
||||||
* Intercept of parent method.
|
|
||||||
*
|
|
||||||
* @return true if no errors
|
|
||||||
*/
|
|
||||||
public boolean verify()
|
|
||||||
{
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPageComplete()
|
|
||||||
{
|
|
||||||
//String errMsg = validator.isValid(fileName);
|
|
||||||
|
|
||||||
//if (errMsg != null)
|
|
||||||
//{
|
|
||||||
// setErrorMessage(errMsg);
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// clearErrorMessage();
|
|
||||||
//}
|
|
||||||
|
|
||||||
return fileNameText != null
|
|
||||||
&& fileNameText.getText().length() > 0;
|
|
||||||
//&& super.isPageComplete();
|
|
||||||
}
|
|
||||||
public String getFileName()
|
|
||||||
{
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,227 +0,0 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 2006, 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.files.ui.widgets;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
|
||||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|
||||||
import org.eclipse.rse.ui.validators.ValidatorFileName;
|
|
||||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
|
||||||
import org.eclipse.rse.ui.view.SystemAdapterHelpers;
|
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
|
|
||||||
|
|
||||||
public class SystemEnterOrSelectRemoteFileForm extends SystemSelectRemoteFileOrFolderForm {
|
|
||||||
|
|
||||||
// text field for file name
|
|
||||||
protected Text fileNameText;
|
|
||||||
|
|
||||||
// initial file name
|
|
||||||
protected String fileName, initialFileName;
|
|
||||||
|
|
||||||
// file name validator
|
|
||||||
protected ValidatorFileName validator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for form to enter or select a file.
|
|
||||||
* @param msgLine A GUI widget capable of writing error messages to.
|
|
||||||
* @param caller The wizardpage or dialog hosting this form.
|
|
||||||
* @param fileMode true if in select-file mode, false if in select-folder mode
|
|
||||||
*/
|
|
||||||
public SystemEnterOrSelectRemoteFileForm(ISystemMessageLine msgLine, Object caller, boolean fileMode) {
|
|
||||||
super(msgLine, caller, fileMode);
|
|
||||||
validator = new ValidatorFileName();
|
|
||||||
initialFileName = ""; //$NON-NLS-1$
|
|
||||||
fileName = initialFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calls super method and creates the text field for file name.
|
|
||||||
* @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#createContents(org.eclipse.swt.widgets.Shell, org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
public Control createContents(Shell shell, Composite parent) {
|
|
||||||
Control control = super.createContents(shell, parent);
|
|
||||||
|
|
||||||
Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
|
|
||||||
|
|
||||||
// file name text field
|
|
||||||
fileNameText = SystemWidgetHelpers.createLabeledTextField(
|
|
||||||
composite, null, FileResources.RESID_NEWFILE_NAME_LABEL, FileResources.RESID_NEWFILE_NAME_TOOLTIP);
|
|
||||||
|
|
||||||
// listen for file name modifications
|
|
||||||
fileNameText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
fileName = fileNameText.getText();
|
|
||||||
setPageComplete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// set file name
|
|
||||||
if (fileName != null) {
|
|
||||||
fileNameText.setText(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#verify()
|
|
||||||
*/
|
|
||||||
public boolean verify() {
|
|
||||||
|
|
||||||
boolean ok = super.verify();
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
|
|
||||||
IRemoteFile file = (IRemoteFile)getSelectedObject();
|
|
||||||
IRemoteFile saveasFile = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
saveasFile = file.getParentRemoteFileSubSystem().getRemoteFileObject(file, fileName, new NullProgressMonitor());
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#isPageComplete()
|
|
||||||
*/
|
|
||||||
public boolean isPageComplete() {
|
|
||||||
|
|
||||||
SystemMessage errMsg = null;
|
|
||||||
|
|
||||||
if (fileName != null) {
|
|
||||||
errMsg = validator.validate(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errMsg != null) {
|
|
||||||
setErrorMessage(errMsg);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
clearErrorMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return fileNameText != null && fileNameText.getText().length() > 0 && super.isPageComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#setPreSelection(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile)
|
|
||||||
*/
|
|
||||||
public void setPreSelection(IRemoteFile selection) {
|
|
||||||
|
|
||||||
// if preselect a directory, just call super
|
|
||||||
if (selection.isDirectory()) {
|
|
||||||
super.setPreSelection(selection);
|
|
||||||
}
|
|
||||||
// otherwise, if it's a file, select the parent and set the file name
|
|
||||||
else if (selection.isFile()) {
|
|
||||||
IRemoteFile parentFile = selection.getParentRemoteFile();
|
|
||||||
|
|
||||||
if (parentFile.isDirectory()) {
|
|
||||||
super.setPreSelection(parentFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
initialFileName = parentFile.getName();
|
|
||||||
fileName = initialFileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
|
||||||
*/
|
|
||||||
public void selectionChanged(SelectionChangedEvent e) {
|
|
||||||
super.selectionChanged(e);
|
|
||||||
|
|
||||||
Object selectedObject = getFirstSelection(e.getSelection());
|
|
||||||
|
|
||||||
if (selectedObject != null && selectedObject instanceof IRemoteFile) {
|
|
||||||
|
|
||||||
IRemoteFile remoteFile = (IRemoteFile)selectedObject;
|
|
||||||
|
|
||||||
ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject);
|
|
||||||
|
|
||||||
if ((remoteAdapter != null)) {
|
|
||||||
|
|
||||||
if (fileNameText != null) {
|
|
||||||
|
|
||||||
// simulate the parent file being selected...
|
|
||||||
Object parentFile = tree.getSelectedParent();
|
|
||||||
|
|
||||||
if (remoteFile.isFile()) {
|
|
||||||
fileName = remoteAdapter.getName(selectedObject);
|
|
||||||
fileNameText.setText(fileName);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fileName = initialFileName;
|
|
||||||
fileNameText.setText(fileName);
|
|
||||||
parentFile = remoteFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
remoteAdapter = getRemoteAdapter(parentFile);
|
|
||||||
|
|
||||||
if (remoteAdapter != null) {
|
|
||||||
String fullPath = remoteAdapter.getAbsoluteName(parentFile);
|
|
||||||
setNameText(fullPath);
|
|
||||||
outputObjects = new Object[] { parentFile };
|
|
||||||
setPageComplete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the remote element adapter.
|
|
||||||
* @param o the remote element.
|
|
||||||
* @return the remote element adapter.
|
|
||||||
*/
|
|
||||||
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) {
|
|
||||||
return SystemAdapterHelpers.getRemoteAdapter(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the file name.
|
|
||||||
* @return the file name.
|
|
||||||
*/
|
|
||||||
public String getFileName() {
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,410 +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) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.actions;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
|
||||||
import org.eclipse.rse.files.ui.dialogs.AddToArchiveDialog;
|
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
|
||||||
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.IVirtualRemoteFile;
|
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.actions.SystemBaseAction;
|
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|
||||||
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 SystemAddToArchiveAction extends SystemBaseAction
|
|
||||||
{
|
|
||||||
|
|
||||||
protected List _selected;
|
|
||||||
protected Shell _parent;
|
|
||||||
|
|
||||||
public SystemAddToArchiveAction(Shell parent)
|
|
||||||
{
|
|
||||||
super(FileResources.ACTION_ADDTOARCHIVE_LABEL, parent);
|
|
||||||
setToolTipText(FileResources.ACTION_ADDTOARCHIVE_TOOLTIP);
|
|
||||||
_selected = new ArrayList();
|
|
||||||
_parent = parent;
|
|
||||||
allowOnMultipleSelection(true);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0122"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemAddToArchiveAction(Shell parent, String label, String tooltip)
|
|
||||||
{
|
|
||||||
super(label, tooltip, parent);
|
|
||||||
_selected = new ArrayList();
|
|
||||||
_parent = parent;
|
|
||||||
allowOnMultipleSelection(true);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0122"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
boolean repeat = true;
|
|
||||||
while (repeat)
|
|
||||||
{
|
|
||||||
IRemoteFile firstSelection = (IRemoteFile) _selected.get(0);
|
|
||||||
String title = FileResources.RESID_ADDTOARCHIVE_TITLE;
|
|
||||||
|
|
||||||
String[] relativePaths = getRelativePaths();
|
|
||||||
|
|
||||||
AddToArchiveDialog dialog = new AddToArchiveDialog(getShell(), title, relativePaths);
|
|
||||||
dialog.setNeedsProgressMonitor(false);
|
|
||||||
|
|
||||||
dialog.setMessage(FileResources.RESID_ADDTOARCHIVE_PROMPT);
|
|
||||||
dialog.setShowNewConnectionPrompt(true);
|
|
||||||
dialog.setShowPropertySheet(true, false);
|
|
||||||
|
|
||||||
dialog.setPreSelection(firstSelection);
|
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
|
||||||
dialog.setShowLocationPrompt(true);
|
|
||||||
dialog.setLocationPrompt(FileResources.RESID_ADDTOARCHIVE_LOCATION);
|
|
||||||
dialog.setNameAndTypePrompt(FileResources.RESID_ADDTOARCHIVE_NAMEANDTYPE);
|
|
||||||
//dialog.setSelectionValidator(this);
|
|
||||||
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
// if (rc != 0) NOT RELIABLE!
|
|
||||||
boolean cancelled = false;
|
|
||||||
if (dialog.wasCancelled()) cancelled = true;
|
|
||||||
|
|
||||||
IRemoteFile destinationArchive = null;
|
|
||||||
IRemoteFileSubSystem destSS = null;
|
|
||||||
boolean saveFullPathInfo;
|
|
||||||
String relativeTo = ""; //$NON-NLS-1$
|
|
||||||
|
|
||||||
if (!cancelled)
|
|
||||||
{
|
|
||||||
destinationArchive = (IRemoteFile) dialog.getOutputObject();
|
|
||||||
saveFullPathInfo = dialog.getSaveFullPathInfo();
|
|
||||||
if (saveFullPathInfo) relativeTo = dialog.getRelativePath();
|
|
||||||
destSS = destinationArchive.getParentRemoteFileSubSystem();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ArchiveHandlerManager.isVirtual(destinationArchive.getAbsolutePath()))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ADDTO_VIRTUAL_DEST);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destinationInSource(destinationArchive))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_DEST_NOT_IN_SOURCE);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!destinationArchive.exists()) destSS.createFile(destinationArchive, new NullProgressMonitor());
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
IRemoteFile selection = (IRemoteFile) _selected.get(i);
|
|
||||||
addToArchive(selection, destinationArchive, saveFullPathInfo, relativeTo);
|
|
||||||
}
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, destinationArchive, destinationArchive.getParentPath(), destSS, null);
|
|
||||||
registry.fireEvent(new SystemResourceChangeEvent(destinationArchive, ISystemResourceChangeEvents.EVENT_REFRESH, destinationArchive.getParentPath()));
|
|
||||||
repeat = false;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addToArchive(IRemoteFile source, IRemoteFile destinationArchive, boolean saveFullPathInfo, String relativeTo)
|
|
||||||
{
|
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
|
||||||
IRemoteFile destination = null;
|
|
||||||
|
|
||||||
if (destinationArchive == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!destinationArchive.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ArchiveHandlerManager.isVirtual(destinationArchive.getAbsolutePath()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (destinationInSource(destinationArchive))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!destinationArchive.isArchive())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!destinationArchive.exists()) destinationArchive.getParentRemoteFileSubSystem().createFile(destinationArchive, monitor);
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (saveFullPathInfo)
|
|
||||||
{
|
|
||||||
String selectionPath = source.getAbsolutePath();
|
|
||||||
String destinationVirtualDirectory = selectionPath.substring(relativeTo.length());
|
|
||||||
int lastSlash = destinationVirtualDirectory.lastIndexOf(source.getSeparatorChar());
|
|
||||||
if (lastSlash != -1)
|
|
||||||
{
|
|
||||||
destinationVirtualDirectory = destinationVirtualDirectory.substring(0, lastSlash);
|
|
||||||
destinationVirtualDirectory = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualDirectory);
|
|
||||||
String newDestinationPath = destinationArchive.getAbsolutePath() + ArchiveHandlerManager.VIRTUAL_SEPARATOR + destinationVirtualDirectory;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
destination = destinationArchive.getParentRemoteFileSubSystem().getRemoteFileObject(newDestinationPath, monitor);
|
|
||||||
if (!destination.exists())
|
|
||||||
{
|
|
||||||
destinationArchive.getParentRemoteFileSubSystem().createFolders(destination, monitor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IRunnableContext runnableContext = getRunnableContext(_parent);
|
|
||||||
|
|
||||||
CopyRunnable runnable = new CopyRunnable(source, destination);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// currently we don't run this in a thread because
|
|
||||||
// in some cases dialogs are launched in the operation
|
|
||||||
// (widgets can only be legally used on the main thread)
|
|
||||||
runnableContext.run(false, true, runnable); // inthread, cancellable, IRunnableWithProgress
|
|
||||||
}
|
|
||||||
catch (java.lang.reflect.InvocationTargetException exc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (java.lang.InterruptedException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class CopyRunnable implements IRunnableWithProgress
|
|
||||||
{
|
|
||||||
private IRemoteFileSubSystem destSS;
|
|
||||||
private IRemoteFileSubSystem sourceSS;
|
|
||||||
private IRemoteFile selection;
|
|
||||||
private IRemoteFile destination;
|
|
||||||
|
|
||||||
public CopyRunnable(IRemoteFile source, IRemoteFile dest)
|
|
||||||
{
|
|
||||||
destSS = dest.getParentRemoteFileSubSystem();
|
|
||||||
sourceSS = source.getParentRemoteFileSubSystem();
|
|
||||||
selection = source;
|
|
||||||
destination = dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter) ((IAdaptable) selection).getAdapter(ISystemDragDropAdapter.class);
|
|
||||||
boolean sameSysType = sourceSS.getClass().equals(destSS.getClass());
|
|
||||||
srcAdapter.doDrag(selection, sameSysType, monitor);
|
|
||||||
boolean sameSys = (sourceSS == destSS);
|
|
||||||
srcAdapter.doDrop(selection, destination, sameSysType, sameSys, 0, monitor);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
System.out.println(e.getMessage());
|
|
||||||
System.out.println("SystemAddToArchiveAction: Could not drag and drop " + selection.getAbsolutePath()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the selection changes in the systems view. This determines
|
|
||||||
* the input object for the command and whether to enable or disable
|
|
||||||
* the action.
|
|
||||||
*
|
|
||||||
* @param selection the current seleciton
|
|
||||||
* @return whether to enable or disable the action
|
|
||||||
*/
|
|
||||||
public boolean updateSelection(IStructuredSelection selection)
|
|
||||||
{
|
|
||||||
_selected.clear();
|
|
||||||
boolean enable = false;
|
|
||||||
|
|
||||||
Iterator e = selection.iterator();
|
|
||||||
while (e.hasNext())
|
|
||||||
{
|
|
||||||
Object selected = e.next();
|
|
||||||
|
|
||||||
if (selected != null && selected instanceof IRemoteFile)
|
|
||||||
{
|
|
||||||
IRemoteFile file = (IRemoteFile) selected;
|
|
||||||
_selected.add(file);
|
|
||||||
enable = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IRunnableContext getRunnableContext(Shell shell)
|
|
||||||
{
|
|
||||||
IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
|
|
||||||
if (irc != null)
|
|
||||||
{
|
|
||||||
return irc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ProgressMonitorDialog(shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean destinationInSource(IRemoteFile destination)
|
|
||||||
{
|
|
||||||
boolean insource = false;
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
if (isAncestorOf((IRemoteFile)_selected.get(i), destination))
|
|
||||||
{
|
|
||||||
insource = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return insource;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isAncestorOf(IRemoteFile ancestor, IRemoteFile descendant)
|
|
||||||
{
|
|
||||||
return ancestor.isAncestorOf(descendant);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String[] getRelativePaths()
|
|
||||||
{
|
|
||||||
IRemoteFile file = (IRemoteFile) _selected.get(0);
|
|
||||||
if (file instanceof IVirtualRemoteFile) return null;
|
|
||||||
IHost con = file.getSystemConnection();
|
|
||||||
String host = con.getHostName();
|
|
||||||
String root = file.getRoot();
|
|
||||||
String lowestCommonPath = file.getAbsolutePath();
|
|
||||||
boolean caseSensitive = file.getParentRemoteFileSubSystem().isCaseSensitive();
|
|
||||||
char separator = file.getSeparatorChar();
|
|
||||||
|
|
||||||
for (int i = 1; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
file = (IRemoteFile) _selected.get(i);
|
|
||||||
if (file instanceof IVirtualRemoteFile) return null;
|
|
||||||
IHost nextCon = file.getSystemConnection();
|
|
||||||
String nextHost = nextCon.getHostName();
|
|
||||||
String nextRoot = file.getRoot();
|
|
||||||
String nextPath = file.getAbsolutePath();
|
|
||||||
if (nextHost.equals(host) && nextRoot.equals(root))
|
|
||||||
{
|
|
||||||
lowestCommonPath = getLowestCommonPath(lowestCommonPath, nextPath, caseSensitive);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getRelativePaths(lowestCommonPath, separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String[] getRelativePaths(String lcp, char separator)
|
|
||||||
{
|
|
||||||
Vector relpaths = new Vector();
|
|
||||||
for (int i = lcp.length() - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (lcp.charAt(i) == separator)
|
|
||||||
{
|
|
||||||
relpaths.add(lcp.substring(0, i+1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String[] results = new String[relpaths.size()];
|
|
||||||
for (int i = 0; i < relpaths.size(); i++)
|
|
||||||
{
|
|
||||||
results[i] = (String) relpaths.get(i);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getLowestCommonPath(String str1, String str2, boolean caseSensitive)
|
|
||||||
{
|
|
||||||
int maxLength = Math.min(str1.length(), str2.length());
|
|
||||||
|
|
||||||
for (int i = maxLength; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (str1.regionMatches(!caseSensitive, 0, str2, 0, i))
|
|
||||||
{
|
|
||||||
return str1.substring(0, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,173 +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) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.actions;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.files.ui.dialogs.CombineDialog;
|
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|
||||||
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 SystemCombineAction extends SystemExtractToAction {
|
|
||||||
|
|
||||||
public SystemCombineAction(Shell parent)
|
|
||||||
{
|
|
||||||
super(parent, FileResources.ACTION_COMBINE_LABEL, FileResources.ACTION_COMBINE_TOOLTIP);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0120"); //$NON-NLS-1$
|
|
||||||
setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_COMBINE_ID));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
boolean repeat = true;
|
|
||||||
while (repeat)
|
|
||||||
{
|
|
||||||
IRemoteFile firstSelection = (IRemoteFile) _selected.get(0);
|
|
||||||
String title = FileResources.RESID_COMBINE_TITLE;
|
|
||||||
CombineDialog dialog = new CombineDialog(getShell(), title);
|
|
||||||
|
|
||||||
dialog.setNeedsProgressMonitor(false);
|
|
||||||
|
|
||||||
dialog.setMessage(FileResources.RESID_COMBINE_PROMPT);
|
|
||||||
dialog.setShowNewConnectionPrompt(true);
|
|
||||||
dialog.setShowPropertySheet(true, false);
|
|
||||||
dialog.setSystemTypes(getValidSystemTypes());
|
|
||||||
|
|
||||||
dialog.setPreSelection(firstSelection);
|
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
|
||||||
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
// if (rc != 0) NOT RELIABLE!
|
|
||||||
boolean cancelled = false;
|
|
||||||
if (dialog.wasCancelled()) cancelled = true;
|
|
||||||
|
|
||||||
IRemoteFile destination = null;
|
|
||||||
IRemoteFileSubSystem destSS = null;
|
|
||||||
if (!cancelled)
|
|
||||||
{
|
|
||||||
destination = (IRemoteFile) dialog.getOutputObject();
|
|
||||||
destSS = destination.getParentRemoteFileSubSystem();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ArchiveHandlerManager.isVirtual(destination.getAbsolutePath()))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMBINETO_VIRTUAL_DEST);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destinationInSource(destination))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_DEST_NOT_IN_SOURCE);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!destination.exists()) destSS.createFile(destination, new NullProgressMonitor());
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog.displayMessage(e);
|
|
||||||
}
|
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
IRemoteFile selection = (IRemoteFile) _selected.get(i);
|
|
||||||
|
|
||||||
IRunnableContext runnableContext = getRunnableContext(_parent);
|
|
||||||
String nextName = selection.getName();
|
|
||||||
int j = nextName.lastIndexOf("."); //$NON-NLS-1$
|
|
||||||
if (j != -1)
|
|
||||||
{
|
|
||||||
nextName = nextName.substring(0, j);
|
|
||||||
}
|
|
||||||
String nextDest = destination.getAbsolutePath() + ArchiveHandlerManager.VIRTUAL_SEPARATOR + nextName;
|
|
||||||
IRemoteFile nextDestination = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
while (destSS.getRemoteFileObject(nextDest, monitor).exists())
|
|
||||||
{
|
|
||||||
nextDest = nextDest + "1"; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
nextDestination = destSS.getRemoteFileObject(nextDest, monitor);
|
|
||||||
destSS.createFolder(nextDestination, monitor);
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtractRunnable runnable = new ExtractRunnable(selection, nextDestination);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// currently we don't run this in a thread because
|
|
||||||
// in some cases dialogs are launched in the operation
|
|
||||||
// (widgets can only be legally used on the main thread)
|
|
||||||
runnableContext.run(false, true, runnable); // inthread, cancellable, IRunnableWithProgress
|
|
||||||
}
|
|
||||||
catch (java.lang.reflect.InvocationTargetException exc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (java.lang.InterruptedException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, destination, destination.getParentPath(), destSS, null);
|
|
||||||
registry.fireEvent(new SystemResourceChangeEvent(destination, ISystemResourceChangeEvents.EVENT_REFRESH, destination.getParentPath()));
|
|
||||||
repeat = false;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,179 +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) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.actions;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.files.ui.dialogs.CombineDialog;
|
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|
||||||
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 SystemConvertAction extends SystemExtractToAction {
|
|
||||||
|
|
||||||
public SystemConvertAction(Shell parent)
|
|
||||||
{
|
|
||||||
super(parent, FileResources.ACTION_CONVERT_LABEL, FileResources.ACTION_CONVERT_TOOLTIP);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0121"); //$NON-NLS-1$
|
|
||||||
setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONVERT_ID));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
IRemoteFile selection = (IRemoteFile) _selected.get(i);
|
|
||||||
String title = FileResources.RESID_CONVERT_TITLE;
|
|
||||||
CombineDialog dialog = new CombineDialog(getShell(), title, true);
|
|
||||||
|
|
||||||
dialog.setNeedsProgressMonitor(false);
|
|
||||||
String message = SystemMessage.sub(FileResources.RESID_CONVERT_PROMPT, "&1", selection.getAbsolutePath()); //$NON-NLS-1$
|
|
||||||
dialog.setMessage(message);
|
|
||||||
dialog.setShowNewConnectionPrompt(true);
|
|
||||||
dialog.setShowPropertySheet(true, false);
|
|
||||||
dialog.setSystemTypes(getValidSystemTypes());
|
|
||||||
|
|
||||||
dialog.setPreSelection(selection);
|
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
|
||||||
dialog.setHelp(RSEUIPlugin.HELPPREFIX + "cnvd0000"); //$NON-NLS-1$
|
|
||||||
dialog.setShowLocationPrompt(true);
|
|
||||||
dialog.setLocationPrompt(FileResources.RESID_CONVERT_LOCATION);
|
|
||||||
dialog.setNameAndTypePrompt(FileResources.RESID_CONVERT_NAMEANDTYPE);
|
|
||||||
dialog.setSelectionValidator(this);
|
|
||||||
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
// if (rc != 0) NOT RELIABLE!
|
|
||||||
boolean cancelled = false;
|
|
||||||
if (dialog.wasCancelled()) cancelled = true;
|
|
||||||
|
|
||||||
IRemoteFile destination = null;
|
|
||||||
IRemoteFileSubSystem destSS = null;
|
|
||||||
if (!cancelled)
|
|
||||||
{
|
|
||||||
destination = (IRemoteFile) dialog.getOutputObject();
|
|
||||||
destSS = destination.getParentRemoteFileSubSystem();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ArchiveHandlerManager.isVirtual(destination.getAbsolutePath()))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONVERTTO_VIRTUAL_DEST);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!destination.canWrite())
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_DEST_TARGET_READONLY);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (selection.isAncestorOf(destination))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_DEST_NOT_IN_SOURCE);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (destination.exists())
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_UPLOAD_FILE_EXISTS);
|
|
||||||
msg.makeSubstitution(destination.getName());
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
boolean ok = dlg.openQuestionNoException();
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
if (destination.getAbsolutePath().equals(selection.getAbsolutePath()))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
destSS.delete(destination, null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
destSS.createFile(destination, new NullProgressMonitor());
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
IRunnableContext runnableContext = getRunnableContext(_parent);
|
|
||||||
|
|
||||||
ExtractRunnable runnable = new ExtractRunnable(selection, destination);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// currently we don't run this in a thread because
|
|
||||||
// in some cases dialogs are launched in the operation
|
|
||||||
// (widgets can only be legally used on the main thread)
|
|
||||||
runnableContext.run(false, true, runnable); // inthread, cancellable, IRunnableWithProgress
|
|
||||||
}
|
|
||||||
catch (java.lang.reflect.InvocationTargetException exc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (java.lang.InterruptedException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, destination, destination.getParentPath(), destSS, null);
|
|
||||||
registry.fireEvent(new SystemResourceChangeEvent(destination, ISystemResourceChangeEvents.EVENT_REFRESH, destination.getParentPath()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,272 +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) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.actions;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.actions.SystemBaseAction;
|
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|
||||||
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 SystemExtractAction extends SystemBaseAction
|
|
||||||
{
|
|
||||||
protected List _selected;
|
|
||||||
protected Shell _parent;
|
|
||||||
protected String _label;
|
|
||||||
|
|
||||||
public SystemExtractAction(Shell parent)
|
|
||||||
{
|
|
||||||
super(FileResources.ACTION_EXTRACT_LABEL, parent);
|
|
||||||
_label = FileResources.ACTION_EXTRACT_LABEL;
|
|
||||||
setToolTipText(FileResources.ACTION_EXTRACT_TOOLTIP);
|
|
||||||
_selected = new ArrayList();
|
|
||||||
_parent = parent;
|
|
||||||
allowOnMultipleSelection(true);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0118"); //$NON-NLS-1$
|
|
||||||
setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EXTRACT_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemExtractAction(Shell parent, String label, String tooltip)
|
|
||||||
{
|
|
||||||
super(label, tooltip, parent);
|
|
||||||
_label = label;
|
|
||||||
setToolTipText(tooltip);
|
|
||||||
_selected = new ArrayList();
|
|
||||||
_parent = parent;
|
|
||||||
allowOnMultipleSelection(true);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0118"); //$NON-NLS-1$
|
|
||||||
setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EXTRACT_ID));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
IRemoteFile selection = (IRemoteFile) _selected.get(i);
|
|
||||||
IRemoteFile destinationParent = selection.getParentRemoteFile();
|
|
||||||
IRemoteFileSubSystem ss = selection.getParentRemoteFileSubSystem();
|
|
||||||
String newName = getExtractedName(selection);
|
|
||||||
IRemoteFile destination = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
destination = ss.getRemoteFileObject(destinationParent.getAbsolutePath() + destinationParent.getSeparator() + newName, monitor);
|
|
||||||
ss.createFolder(destination, monitor);
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
IRunnableContext runnableContext = getRunnableContext(_parent);
|
|
||||||
|
|
||||||
ExtractRunnable runnable = new ExtractRunnable(selection, destination);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// currently we don't run this in a thread because
|
|
||||||
// in some cases dialogs are launched in the operation
|
|
||||||
// (widgets can only be legally used on the main thread)
|
|
||||||
runnableContext.run(false, true, runnable); // inthread, cancellable, IRunnableWithProgress
|
|
||||||
}
|
|
||||||
catch (java.lang.reflect.InvocationTargetException exc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (java.lang.InterruptedException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
// always refresh
|
|
||||||
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, destination, destinationParent, ss, null);
|
|
||||||
registry.fireEvent(new SystemResourceChangeEvent(destination, ISystemResourceChangeEvents.EVENT_REFRESH, destinationParent));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class ExtractRunnable implements IRunnableWithProgress
|
|
||||||
{
|
|
||||||
private IRemoteFileSubSystem destSS;
|
|
||||||
private IRemoteFileSubSystem sourceSS;
|
|
||||||
private IRemoteFile selection;
|
|
||||||
private IRemoteFile destination;
|
|
||||||
|
|
||||||
public ExtractRunnable(IRemoteFile source, IRemoteFile dest)
|
|
||||||
{
|
|
||||||
destSS = dest.getParentRemoteFileSubSystem();
|
|
||||||
sourceSS = source.getParentRemoteFileSubSystem();
|
|
||||||
selection = source;
|
|
||||||
destination = dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
IRemoteFile[] sources = sourceSS.listFoldersAndFiles(selection, monitor);
|
|
||||||
for (int j = 0; j < sources.length && !monitor.isCanceled(); j++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter) ((IAdaptable) selection).getAdapter(ISystemDragDropAdapter.class);
|
|
||||||
boolean sameSysType = sourceSS.getClass().equals(destSS.getClass());
|
|
||||||
boolean sameSys = (sourceSS == destSS);
|
|
||||||
if (!sameSys)
|
|
||||||
{
|
|
||||||
Object source = srcAdapter.doDrag(sources[j], sameSysType, monitor);
|
|
||||||
srcAdapter.doDrop(source, destination, sameSysType, sameSys, 0, monitor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
srcAdapter.doDrop(sources[j], destination, sameSysType, sameSys, 0, monitor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
//System.out.println(e.getMessage());
|
|
||||||
//System.out.println("Could not extract " + sources[j].getAbsolutePath()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (SystemMessageException e)
|
|
||||||
{
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
|
||||||
dlg.open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the selection changes in the systems view. This determines
|
|
||||||
* the input object for the command and whether to enable or disable
|
|
||||||
* the action.
|
|
||||||
*
|
|
||||||
* @param selection the current seleciton
|
|
||||||
* @return whether to enable or disable the action
|
|
||||||
*/
|
|
||||||
public boolean updateSelection(IStructuredSelection selection)
|
|
||||||
{
|
|
||||||
_selected.clear();
|
|
||||||
boolean enable = false;
|
|
||||||
|
|
||||||
Iterator e = selection.iterator();
|
|
||||||
while (e.hasNext())
|
|
||||||
{
|
|
||||||
Object selected = e.next();
|
|
||||||
|
|
||||||
if (selected != null && selected instanceof IRemoteFile)
|
|
||||||
{
|
|
||||||
IRemoteFile file = (IRemoteFile) selected;
|
|
||||||
if (file.isArchive() && file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement())
|
|
||||||
{
|
|
||||||
_selected.add(file);
|
|
||||||
enable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_selected.size() == 1)
|
|
||||||
{
|
|
||||||
this.setText(getActionLabelForSingleSelection());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.setText(_label);
|
|
||||||
}
|
|
||||||
return enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extending classes must override this method, otherwise
|
|
||||||
* when there is one selection, the action label will be
|
|
||||||
* "Extract to xxxx", where xxxx is a dynamically created directory
|
|
||||||
* name. Note: you can also eliminate this behaviour by overriding
|
|
||||||
* the updateSelection method.
|
|
||||||
* @return Set this to return the normal action label if you don't want
|
|
||||||
* the name dynamically created.
|
|
||||||
*/
|
|
||||||
protected String getActionLabelForSingleSelection()
|
|
||||||
{
|
|
||||||
String msg = FileResources.ACTION_EXTRACT_SUB_LABEL;
|
|
||||||
return SystemMessage.sub(msg, "%1", getExtractedName((IRemoteFile)_selected.get(0))); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getExtractedName(IRemoteFile selection)
|
|
||||||
{
|
|
||||||
String newName = selection.getName();
|
|
||||||
int k = newName.lastIndexOf("."); //$NON-NLS-1$
|
|
||||||
if (k == -1)
|
|
||||||
{
|
|
||||||
newName = newName + "_contents"; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newName = newName.substring(0, k);
|
|
||||||
}
|
|
||||||
return newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IRunnableContext getRunnableContext(Shell shell)
|
|
||||||
{
|
|
||||||
IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
|
|
||||||
if (irc != null)
|
|
||||||
{
|
|
||||||
return irc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ProgressMonitorDialog(shell);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,209 +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) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.actions;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
|
||||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.files.ui.dialogs.ExtractToDialog;
|
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
|
||||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|
||||||
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
|
|
||||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
|
||||||
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 SystemExtractToAction extends SystemExtractAction implements IValidatorRemoteSelection
|
|
||||||
{
|
|
||||||
private static final String[] validSystemTypesIds = {
|
|
||||||
IRSESystemType.SYSTEMTYPE_LOCAL_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_WINDOWS_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_LINUX_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_POWER_LINUX_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_UNIX_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_AIX_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_ISERIES_ID
|
|
||||||
};
|
|
||||||
private static IRSESystemType[] validSystemTypes = null;
|
|
||||||
|
|
||||||
protected SystemMessage targetDescendsFromSrcMsg = null;
|
|
||||||
protected int currentlyProcessingSelection = 0;
|
|
||||||
|
|
||||||
public SystemExtractToAction(Shell parent)
|
|
||||||
{
|
|
||||||
super(parent,FileResources.ACTION_EXTRACT_TO_LABEL, FileResources.ACTION_EXTRACT_TO_TOOLTIP);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0119"); //$NON-NLS-1$
|
|
||||||
setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EXTRACTTO_ID));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemExtractToAction(Shell parent, String label, String tooltip)
|
|
||||||
{
|
|
||||||
super(parent, label, tooltip);
|
|
||||||
setHelp(RSEUIPlugin.HELPPREFIX + "actn0119"); //$NON-NLS-1$
|
|
||||||
setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EXTRACTTO_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IRSESystemType[] getValidSystemTypes() {
|
|
||||||
if (validSystemTypes==null) {
|
|
||||||
validSystemTypes = SystemWidgetHelpers.getValidSystemTypes(validSystemTypesIds);
|
|
||||||
}
|
|
||||||
return validSystemTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
currentlyProcessingSelection = i;
|
|
||||||
IRemoteFile selection = (IRemoteFile) _selected.get(i);
|
|
||||||
//IRemoteFileSubSystem sourceSS = selection.getParentRemoteFileSubSystem();
|
|
||||||
String title = FileResources.RESID_EXTRACTTO_TITLE;
|
|
||||||
ExtractToDialog dialog = new ExtractToDialog(getShell(), title);
|
|
||||||
|
|
||||||
dialog.setNeedsProgressMonitor(true);
|
|
||||||
|
|
||||||
String message = SystemMessage.sub(FileResources.RESID_EXTRACTTO_PROMPT, "&1", selection.getAbsolutePath()); //$NON-NLS-1$
|
|
||||||
dialog.setMessage(message);
|
|
||||||
dialog.setShowNewConnectionPrompt(true);
|
|
||||||
dialog.setShowPropertySheet(true, false);
|
|
||||||
dialog.setSystemTypes(getValidSystemTypes());
|
|
||||||
|
|
||||||
dialog.setPreSelection(selection);
|
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
|
||||||
dialog.setSelectionValidator(this);
|
|
||||||
|
|
||||||
/*if (dlgHelpId!=null)
|
|
||||||
{
|
|
||||||
dialog.setHelp(dlgHelpId);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
// if (rc != 0) NOT RELIABLE!
|
|
||||||
boolean cancelled = false;
|
|
||||||
if (dialog.wasCancelled()) cancelled = true;
|
|
||||||
|
|
||||||
IRemoteFile destination = null;
|
|
||||||
IRemoteFileSubSystem destSS = null;
|
|
||||||
if (!cancelled)
|
|
||||||
{
|
|
||||||
destination = (IRemoteFile) dialog.getOutputObject();
|
|
||||||
destSS = destination.getParentRemoteFileSubSystem();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selection.isAncestorOf(destination))
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_DEST_NOT_IN_SOURCE);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!destination.canWrite())
|
|
||||||
{
|
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_DEST_TARGET_READONLY);
|
|
||||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
|
||||||
dlg.open();
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
IRunnableContext runnableContext = getRunnableContext(_parent);
|
|
||||||
|
|
||||||
ExtractRunnable runnable = new ExtractRunnable(selection, destination);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// currently we don't run this in a thread because
|
|
||||||
// in some cases dialogs are launched in the operation
|
|
||||||
// (widgets can only be legally used on the main thread)
|
|
||||||
runnableContext.run(false, true, runnable); // inthread, cancellable, IRunnableWithProgress
|
|
||||||
}
|
|
||||||
catch (java.lang.reflect.InvocationTargetException exc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (java.lang.InterruptedException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
// always refresh
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, destination, destination.getParentPath(), destSS, null);
|
|
||||||
registry.fireEvent(new SystemResourceChangeEvent(destination, ISystemResourceChangeEvents.EVENT_REFRESH, destination.getParentPath()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean destinationInSource(IRemoteFile destination)
|
|
||||||
{
|
|
||||||
boolean insource = false;
|
|
||||||
for (int i = 0; i < _selected.size(); i++)
|
|
||||||
{
|
|
||||||
if (destination.isDescendantOf((IRemoteFile) _selected.get(i)))
|
|
||||||
{
|
|
||||||
insource = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return insource;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getActionLabelForSingleSelection()
|
|
||||||
{
|
|
||||||
return _label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
|
|
||||||
{
|
|
||||||
//if (selectedConnection != sourceConnection) {} // someday, but can't happen today.
|
|
||||||
Object selectedObject = selectedObjects[0];
|
|
||||||
IRemoteFile currentSelection = (IRemoteFile) _selected.get(currentlyProcessingSelection);
|
|
||||||
if (!(selectedObject instanceof IRemoteFile))
|
|
||||||
return null;
|
|
||||||
IRemoteFile selectedFolder = (IRemoteFile)selectedObject;
|
|
||||||
if (selectedFolder.isDescendantOf(currentSelection))
|
|
||||||
{
|
|
||||||
if (targetDescendsFromSrcMsg == null)
|
|
||||||
targetDescendsFromSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOUCE);
|
|
||||||
return targetDescendsFromSrcMsg;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -69,13 +69,9 @@ import org.eclipse.rse.core.subsystems.SubSystem;
|
||||||
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
|
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
|
||||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
import org.eclipse.rse.internal.files.ui.FileResources;
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemAddToArchiveAction;
|
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemCompareFilesAction;
|
import org.eclipse.rse.internal.files.ui.actions.SystemCompareFilesAction;
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemCompareWithEditionAction;
|
import org.eclipse.rse.internal.files.ui.actions.SystemCompareWithEditionAction;
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemConvertAction;
|
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemEditFilesAction;
|
import org.eclipse.rse.internal.files.ui.actions.SystemEditFilesAction;
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemExtractAction;
|
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemExtractToAction;
|
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemMoveRemoteFileAction;
|
import org.eclipse.rse.internal.files.ui.actions.SystemMoveRemoteFileAction;
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemNewFileAction;
|
import org.eclipse.rse.internal.files.ui.actions.SystemNewFileAction;
|
||||||
import org.eclipse.rse.internal.files.ui.actions.SystemNewFileFilterFromFolderAction;
|
import org.eclipse.rse.internal.files.ui.actions.SystemNewFileFilterFromFolderAction;
|
||||||
|
@ -178,10 +174,7 @@ public class SystemViewRemoteFileAdapter
|
||||||
//private SystemCommandAction commandAction, shellAction;
|
//private SystemCommandAction commandAction, shellAction;
|
||||||
|
|
||||||
private SystemSearchAction searchAction;
|
private SystemSearchAction searchAction;
|
||||||
private SystemExtractAction extractAction;
|
|
||||||
private SystemExtractToAction extractToAction;
|
|
||||||
private SystemConvertAction convertAction;
|
|
||||||
private SystemAddToArchiveAction addToArchiveAction;
|
|
||||||
private IEditorRegistry registry;
|
private IEditorRegistry registry;
|
||||||
private SystemRemoteFileOpenWithMenu openWithMenu;
|
private SystemRemoteFileOpenWithMenu openWithMenu;
|
||||||
|
|
||||||
|
@ -371,31 +364,6 @@ public class SystemViewRemoteFileAdapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extractAction == null)
|
|
||||||
{
|
|
||||||
extractAction = new SystemExtractAction(shell);
|
|
||||||
}
|
|
||||||
if (extractToAction == null)
|
|
||||||
{
|
|
||||||
extractToAction = new SystemExtractToAction(shell);
|
|
||||||
}
|
|
||||||
if (convertAction == null)
|
|
||||||
{
|
|
||||||
convertAction = new SystemConvertAction(shell);
|
|
||||||
}
|
|
||||||
if (addToArchiveAction == null)
|
|
||||||
{
|
|
||||||
addToArchiveAction = new SystemAddToArchiveAction(shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allHaveContents && canEdit && !isVirtual)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, extractAction);
|
|
||||||
menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, extractToAction);
|
|
||||||
menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, convertAction);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// add import and export actions for single selection of folder
|
// add import and export actions for single selection of folder
|
||||||
/* if ((elementType == 1 && selection.size() == 1) && canEdit)
|
/* if ((elementType == 1 && selection.size() == 1) && canEdit)
|
||||||
|
|
Loading…
Add table
Reference in a new issue