diff options
Diffstat (limited to 'rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse')
71 files changed, 0 insertions, 12866 deletions
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractJavaLanguageUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractJavaLanguageUtility.java deleted file mode 100644 index 179089670..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractJavaLanguageUtility.java +++ /dev/null @@ -1,34 +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.internal.subsystems.files.core; - -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * This class is a Java language utility. - */ -public abstract class AbstractJavaLanguageUtility extends AbstractLanguageUtility implements IJavaLanguageUtility { - - /** - * Constructor. - * @param subsystem the subsystem with which the utility is associated. - * @param language the language. - */ - public AbstractJavaLanguageUtility(IRemoteFileSubSystem subsystem, String language) { - super(subsystem, language); - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractLanguageUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractLanguageUtility.java deleted file mode 100644 index 979f098be..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractLanguageUtility.java +++ /dev/null @@ -1,73 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.rse.subsystems.files.core.ILanguageUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * Abstract class for language utility. Language utilities are expected to subclass - * it. - */ -public abstract class AbstractLanguageUtility implements ILanguageUtility { - - protected IRemoteFileSubSystem subsystem; - protected String language; - - /** - * Constructor. - * @param subsystem the subsystem with which the utility is associated. - * @param language the language. - */ - protected AbstractLanguageUtility(IRemoteFileSubSystem subsystem, String language) { - super(); - setSubSystem(subsystem); - setLanguage(language); - } - - /** - * Sets the subsystem with which the utility is associated. - * @param the subsystem. - */ - private void setSubSystem(IRemoteFileSubSystem subsystem) { - this.subsystem = subsystem; - } - - /** - * Sets the language to which this utility applies. It could be one of - * <code>LANGUAGE_JAVA</code>, <code>LANGUAGE_C</code>, and <code>LANGUAGE_CPP</code>, or - * another language. - */ - private void setLanguage(String language) { - this.language = language; - } - - /** - * @see org.eclipse.rse.subsystems.files.core.ILanguageUtility#getSubSystem() - */ - public IRemoteFileSubSystem getSubSystem() { - return subsystem; - } - - /** - * @see org.eclipse.rse.subsystems.files.core.ILanguageUtility#getLanguage() - */ - public String getLanguage() { - return language; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractLanguageUtilityFactory.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractLanguageUtilityFactory.java deleted file mode 100644 index c6780354f..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/AbstractLanguageUtilityFactory.java +++ /dev/null @@ -1,62 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.rse.subsystems.files.core.ILanguageUtility; -import org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * A language utility factory associated with a subsystem. - */ -public abstract class AbstractLanguageUtilityFactory implements ILanguageUtilityFactory { - - protected IRemoteFileSubSystem subsystem; - - /** - * Constructor. - * @param subsystem the subsystem with which this factory is associated. - */ - protected AbstractLanguageUtilityFactory(IRemoteFileSubSystem subsystem) { - super(); - setSubSystem(subsystem); - } - - /** - * Sets the subsystem with which the factory is associated. - * @param subsystem the subsystem. - */ - private void setSubSystem(IRemoteFileSubSystem subsystem) { - this.subsystem = subsystem; - } - - /** - * @see org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory#getSubSystem() - */ - public IRemoteFileSubSystem getSubSystem() { - return subsystem; - } - - /** - * For Java, subclasses should return an instance of <code>IJavaLanguageUtility</code> - * @see org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory#getUtility(java.lang.String) - * - * @see IJavaLanguageUtility - */ - public abstract ILanguageUtility getUtility(String language); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/Activator.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/Activator.java deleted file mode 100644 index 2de9dc0cb..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/Activator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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) - [180519][api] declaratively register adapter factories - * Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible - * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -/** - * The main plugin class to be used in the desktop. - */ -public class Activator extends Plugin { - - //The shared instance. - private static Activator plugin; - - public static final String PLUGIN_ID = "org.eclipse.rse.subsystems.files.core"; //$NON-NLS-1$ - - /** - * The constructor. - */ - public Activator() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * Returns the shared instance. - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/IJavaLanguageUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/IJavaLanguageUtility.java deleted file mode 100644 index 9ae082d68..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/IJavaLanguageUtility.java +++ /dev/null @@ -1,34 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.rse.subsystems.files.core.ILanguageUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -/** - * Interface for Java language utility. - */ -public interface IJavaLanguageUtility extends ILanguageUtility { - - /** - * Returns the qualified class name for the remote file. - * @param remoteFile the remote file. - * @return the qualified class name. - */ - public String getQualifiedClassName(IRemoteFile remoteFile); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFileMessageIds.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFileMessageIds.java deleted file mode 100644 index 822dd64c0..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFileMessageIds.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 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. - * - * Contributors: - * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared - ********************************************************************************/ -package org.eclipse.rse.internal.subsystems.files.core; - -public interface ISystemFileMessageIds { - - public static final String MSG_FILE_CANNOT_BE_SAVED = "RSEF5003"; //$NON-NLS-1$ - public static final String MSG_FOLDER_UNREADABLE = "RSEF5020"; //$NON-NLS-1$ - - public static final String MSG_VALIDATE_NAME_EMPTY = "RSEG1006"; //$NON-NLS-1$ - public static final String MSG_VALIDATE_NAME_NOTUNIQUE= "RSEG1007"; //$NON-NLS-1$ - public static final String MSG_VALIDATE_NAME_NOTVALID = "RSEG1008"; //$NON-NLS-1$ - - public static final String MSG_VALIDATE_RENAME_EMPTY = "RSEG1012"; //MSG_VALIDATE_PREFIX + "ReName.Required"; //$NON-NLS-1$ - public static final String MSG_VALIDATE_RENAME_NOTUNIQUE= "RSEG1010"; //MSG_VALIDATE_PREFIX + "ReName.NotUnique"; //$NON-NLS-1$ - public static final String MSG_VALIDATE_RENAME_NOTVALID = "RSEG1011"; //MSG_VALIDATE_PREFIX + "ReName.NotValid"; //$NON-NLS-1$ - public static final String MSG_VALIDATE_RENAME_OLDEQUALSNEW = "RSEG1009"; //MSG_VALIDATE_PREFIX+"ReName.OldEqualsNew"; //$NON-NLS-1$ - - public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_EMPTY = "RSEF1011"; //$NON-NLS-1$ - public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE= "RSEF1007"; //$NON-NLS-1$ - public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID = "RSEF1008"; //$NON-NLS-1$ - public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_NOINCLUDES = "RSEF1009"; //$NON-NLS-1$ - public static final String FILEMSG_FILE_NOTFOUND = "RSEF1006"; //$NON-NLS-1$ - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java deleted file mode 100644 index cf57d8448..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java +++ /dev/null @@ -1,57 +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: - * {Name} (company) - description of contribution. - * David McKnight (IBM) - [191367] setting supertransfer to be disabled by default - * Xuan Chen (IBM) - [191367] setting supertransfer back to enabled by default - * Xuan Chen (IBM) - [202686] Supertransfer should be disabled by default for 2.0.1 - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -public interface ISystemFilePreferencesConstants -{ - - public static final String ROOT = "org.eclipse.rse.subsystems.files.core.preferences."; //$NON-NLS-1$ - - public static final String SHOWHIDDEN = ROOT + "showhidden"; //$NON-NLS-1$ - - public static final String FILETRANSFERMODEDEFAULT = ROOT + "filetransfermodedefault"; //$NON-NLS-1$ - - public static final String PRESERVETIMESTAMPS = ROOT + "preservetimestamps"; //$NON-NLS-1$ - - public static final String LIMIT_CACHE = ROOT + "limit.cache"; //$NON-NLS-1$ - public static final String MAX_CACHE_SIZE = ROOT + "max.cache.size"; //$NON-NLS-1$ - - public static final String DOSUPERTRANSFER = ROOT + "dosupertransfer"; //$NON-NLS-1$ - public static final String SUPERTRANSFER_ARC_TYPE = ROOT + "supertransfer.archivetype"; //$NON-NLS-1$ - - public static final String DOWNLOAD_BUFFER_SIZE = ROOT + "download.buffer.size"; //$NON-NLS-1$ - public static final String UPLOAD_BUFFER_SIZE = ROOT + "upload.buffer.size"; //$NON-NLS-1$ - - public static final boolean DEFAULT_SHOW_HIDDEN = true; - public static final boolean DEFAULT_PRESERVETIMESTAMPS = true; - public static final int DEFAULT_FILETRANSFERMODE = 0; - - public static final int FILETRANSFERMODE_BINARY = 0; - public static final int FILETRANSFERMODE_TEXT = 1; - - public static final String DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE = "zip"; //$NON-NLS-1$ - public static final boolean DEFAULT_DOSUPERTRANSFER = false; - - public static final int DEFAULT_DOWNLOAD_BUFFER_SIZE = 40; - - public static final boolean DEFAULT_LIMIT_CACHE = false; - public static final String DEFAULT_MAX_CACHE_SIZE = "512"; //$NON-NLS-1$ -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemRemoteEditConstants.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemRemoteEditConstants.java deleted file mode 100644 index 926b1bb74..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemRemoteEditConstants.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [189130] Move SystemIFileProperties from UI to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -public interface ISystemRemoteEditConstants { - - - - // Constants for remote editing - public static final String REMOTE_FILE_OBJECT_KEY = "remote_file_object_key"; //$NON-NLS-1$ - - public static final String REMOTE_FILE_SUBSYSTEM_KEY = "remote_file_subsystem_key"; //$NON-NLS-1$ - public static final String REMOTE_FILE_PATH_KEY = "remote_file_path_key"; //$NON-NLS-1$ - - public static final String REMOTE_FILE_MODIFIED_STAMP = "remote_file_modified_stamp"; //$NON-NLS-1$ - public static final String REMOTE_FILE_BINARY_TRANSFER = "remote_file_binary_transfer"; //$NON-NLS-1$ - public static final String TEMP_FILE_DIRTY = "temp_file_dirty"; //$NON-NLS-1$ - public static final String TEMP_FILE_READONLY = "temp_file_readonly"; //$NON-NLS-1$ - - public static final String DOWNLOAD_FILE_MODIFIED_STAMP = "download_file_modified_stamp"; //$NON-NLS-1$ - // for mounted mappings - public static final String REMOTE_FILE_MOUNTED = "remote_file_mounted"; //$NON-NLS-1$ - public static final String RESOLVED_MOUNTED_REMOTE_FILE_PATH_KEY = "resolved_mounted_remote_file_path_key"; //$NON-NLS-1$ - public static final String RESOLVED_MOUNTED_REMOTE_FILE_HOST_KEY = "resolved_mounted_remote_file_host_key"; //$NON-NLS-1$ - - - // Constants related to how the editor will set the document content - public static final String LOAD_TYPE_KEY = "load_type_key"; //$NON-NLS-1$ - public static final String LOAD_TYPE_USE_STRING = "load_type_use_string"; //$NON-NLS-1$ - - - // Universal remote editing profile - public static final String DEFAULT_EDITOR_PROFILE = "default"; //$NON-NLS-1$ - public static final String UNIVERSAL_EDITOR_PROFILE = "universal"; //$NON-NLS-1$ - public static final String UNIVERSAL_LOCAL_EDITOR_PROFILE = "universallocal"; //$NON-NLS-1$ - - - // Local relative directory for various editor actions - public static final String EDITOR_COMPARE_LOCATION = "/compare/"; //$NON-NLS-1$ - public static final String EDITOR_GET_FILE_LOCATION = "/get/"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemTextEditorConstants.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemTextEditorConstants.java deleted file mode 100644 index acf7020e2..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemTextEditorConstants.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [189130] Move SystemIFileProperties from UI to Core - ********************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -public interface ISystemTextEditorConstants { - - - - // Editor id - public static final String SYSTEM_TEXT_EDITOR_ID = "org.eclipse.rse.editor"; //$NON-NLS-1$ - public static final String SYSTEM_TEXT_BROWSER_ID = "org.eclipse.rse.browser"; //$NON-NLS-1$ - - // Identifier for profile type - public static final String EDITOR_PROFILE_TYPE = "editorProfileType"; //$NON-NLS-1$ - - // key to identify file has sequence numbers - public static final String SEQUENCE_NUMBERS_KEY = "sequence_numbers_key"; //$NON-NLS-1$ - - // key to identify that a save limit should be set - public static final String MAX_LINE_LENGTH_KEY = "record_length_key"; //$NON-NLS-1$ - - // key to identify that a source encoding should be set - // this is used to emulate the remote encoding of the file - public static final String SOURCE_ENCODING_KEY = "source_encoding_key"; //$NON-NLS-1$ - - // key to identify host ccsid - public static final String CCSID_KEY = "ccsid_key"; //$NON-NLS-1$ - public static final String TEMP_CCSID_KEY = "temp_ccsid_key"; //$NON-NLS-1$ - - // key to identify logical or visual BIDI - public static final String BIDI_LOGICAL_KEY = "bidi_logical_key"; //$NON-NLS-1$ - - // key to identify the local encoding - // NOTE: DO NOT CHANGE THIS!! This is used by the IBM debugger. - public static final String LOCAL_ENCODING_KEY = "encoding"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java deleted file mode 100644 index 1134ede23..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 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. - * - * Contributors: - * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files - ********************************************************************************/ -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.rse.services.files.IFilePermissionsService; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory; - -public class RemoteFilePermissionsAdapterFactory extends - AbstractSystemRemoteAdapterFactory { - - - - public Object getAdapter(Object adaptableObject, Class adapterType) { - - IFileService fileService = null; - if (adaptableObject instanceof IFileService){ - fileService = (IFileService)adaptableObject; - } - else if (adaptableObject instanceof IRemoteFile){ - FileServiceSubSystem ss = (FileServiceSubSystem)((IRemoteFile)adaptableObject).getParentRemoteFileSubSystem(); - if (ss != null){ - fileService = ss.getFileService(); - } - } - - if (fileService != null){ - if (adapterType == IFilePermissionsService.class){ - if (fileService instanceof IFilePermissionsService){ - return fileService; - } - } - - } - - return null; - } - - /** - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - public Class[] getAdapterList() - { - return new Class[] {IFilePermissionsService.class}; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePropertyTester.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePropertyTester.java deleted file mode 100644 index 991249076..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePropertyTester.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. - * 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 - * - * Contributors: - * Anna Dushistova (MontaVista) - initial API and implementation - ********************************************************************************/ -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -public class RemoteFilePropertyTester extends PropertyTester { - - public boolean test(Object receiver, String property, Object[] args, - Object expectedValue) { - boolean test = ((Boolean) expectedValue).booleanValue(); - if (receiver != null && receiver instanceof IRemoteFile) { - return ((IRemoteFile) receiver).isDirectory() && test; - - } - return !test; - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileAPIProviderImpl.java deleted file mode 100644 index 6fdc6df7b..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileAPIProviderImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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 - * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileAPIProvider; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.ui.view.SystemAbstractAPIProvider; - - -/** - * Where to start when looking to traverse a remote file system. - */ -public class SystemFileAPIProviderImpl - extends SystemAbstractAPIProvider - implements ISystemFileAPIProvider -{ - - - protected ISystemRegistry sr = null; - protected boolean directoryMode = false; - //protected Object[] emptyList = new Object[0]; - - /** - * Constructor for SystemFileAPIProvider - * @param directoryMode true if you only want to traverse directories, false for both files and directories. - */ - public SystemFileAPIProviderImpl(boolean directoryMode) - { - super(); - this.directoryMode = directoryMode; - sr = RSECorePlugin.getTheSystemRegistry(); - } - - /** - * Get the directories-only mode. - */ - public boolean isDirectoriesOnly() - { - return directoryMode; - } - - // ---------------------------------- - // SYSTEMVIEWINPUTPROVIDER METHODS... - // ---------------------------------- - /** - * Return the children objects to consistute the root elements in the system view tree. - * We return all connections containing a remote file subsystem, for all active profiles. - */ - public Object[] getSystemViewRoots() - { - - return getConnections(); - } - /** - * Return true if {@link #getSystemViewRoots()} will return a non-empty list - * We return true if there are any connections containing a remote file subsystem, for any active profile. - */ - public boolean hasSystemViewRoots() - { - return (getConnectionCount()>0); - } - /** - * This method is called by the connection adapter when the user expands - * a connection. This method must return the child objects to show for that - * connection. - */ - public Object[] getConnectionChildren(IHost selectedConnection) - { - return sr.getConnectionChildren(selectedConnection); - } - /** - * This method is called by the connection adapter when deciding to show a plus-sign - * or not beside a connection. Return true if this connection has children to be shown. - */ - public boolean hasConnectionChildren(IHost selectedConnection) - { - return sr.hasConnectionChildren(selectedConnection); - } - - - // ---------------------------------- - // OUR OWN METHODS... - // ---------------------------------- - - /** - * Return all connections which have at least one subsystem that implements/extends RemoteFileSubSystem - */ - public IHost[] getConnections() - { - int connCount = getConnectionCount(); - IHost[] ourConns = new IHost[connCount]; - IHost[] allConns = sr.getHosts(); - int ourConnsIdx = 0; - if (allConns != null) - { - for (int idx=0; idx<allConns.length; idx++) - { - ISubSystem[] subsystems = sr.getSubSystems(allConns[idx]); - if (subsystems != null) - { - boolean match = false; - for (int jdx=0; !match && (jdx<subsystems.length); jdx++) - { - if (subsystems[jdx] instanceof IRemoteFileSubSystem) - { - ourConns[ourConnsIdx++] = allConns[idx]; - match = true; - } - } - } - } - } - return ourConns; - } - - /** - * Return a count of all connections which have at least one subsystem that implements/extends RemoteFileSubSystem - */ - public int getConnectionCount() - { - int count = 0; - IHost[] allConns = sr.getHosts(); - if (allConns != null) - { - for (int idx=0; idx<allConns.length; idx++) - { - ISubSystem[] subsystems = sr.getSubSystems(allConns[idx]); - boolean match = false; - if (subsystems != null) - { - for (int jdx=0; !match && (jdx<subsystems.length); jdx++) - { - if (subsystems[jdx] instanceof IRemoteFileSubSystem) - match = true; - } - } - if (match) - ++count; - } - } - return count; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileResources.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileResources.java deleted file mode 100644 index c3b848d71..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileResources.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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: - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible - * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared - * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; - -import org.eclipse.osgi.util.NLS; - - -public class SystemFileResources extends NLS -{ - private static String BUNDLE_NAME = "org.eclipse.rse.internal.subsystems.files.core.SystemFileResources"; //$NON-NLS-1$ - - // ------------------- - // DEFAULT FILTERS... - // ------------------- - public static String RESID_FILTER_ROOTS; - public static String RESID_FILTER_ROOTFILES; - public static String RESID_FILTER_ROOTFOLDERS; - public static String RESID_FILTER_DRIVES; - public static String RESID_FILTER_MYHOME; - - // ------------------------- - // MISCELLANEOUS... - // ------------------------- - public static String RESID_PROPERTY_FILE_FILTER_VALUE; - - // ------------------------- - // WIZARDS... - // ------------------------- - - // New System File Filter wizard... - public static String RESID_NEWFILEFILTER_PAGE1_TITLE; - public static String RESID_NEWFILEFILTER_PAGE1_DESCRIPTION; - - // File Filter String Re-Usable form (used in dialog and wizard) - public static String RESID_FILEFILTERSTRING_FILE_LABEL; - public static String RESID_FILEFILTERSTRING_INCFILESONLY_LABEL; - public static String RESID_FILEFILTERSTRING_BYFILENAME_LABEL; - public static String RESID_FILEFILTERSTRING_BYFILETYPES_LABEL; - public static String RESID_FILEFILTERSTRING_TYPES_LABEL; - public static String RESID_FILEFILTERSTRING_SELECTTYPES_LABEL; - - public static String RESID_FILEFILTERSTRING_FILE_TOOLTIP; - public static String RESID_FILEFILTERSTRING_INCFILESONLY_TOOLTIP; - public static String RESID_FILEFILTERSTRING_BYFILENAME_TOOLTIP; - public static String RESID_FILEFILTERSTRING_BYFILETYPES_TOOLTIP; - public static String RESID_FILEFILTERSTRING_TYPES_TOOLTIP; - public static String RESID_FILEFILTERSTRING_SELECTTYPES_TOOLTIP; - - // ------------------------- - // DIALOGS... - // ------------------------- - // Change System File Filter dialog... - public static String RESID_CHGFILEFILTER_TITLE; - - - // Select Directory dialog... - public static String RESID_SELECTDIRECTORY_TITLE; - public static String RESID_SELECTDIRECTORY_VERBIAGE; - - public static String RESID_SELECTDIRECTORY_SELECT_TOOLTIP; - - // Select File dialog... - public static String RESID_SELECTFILE_TITLE; - public static String RESID_SELECTFILE_VERBIAGE; - public static String RESID_SELECTFILE_SELECT_TOOLTIP; - - // Prompt for home folder dialog... - public static String RESID_HOMEPROMPT_TITLE; - - // ------------------------- - // ACTIONS... - // ------------------------- - public static String ACTION_NEWFILTER_LABEL; - public static String ACTION_NEWFILTER_TOOLTIP; - - public static String ACTION_SELECTFILETYPES_LABEL; - public static String ACTION_SELECTFILETYPES_TOOLTIP; - - // ------------------------- - // WIDGETS... - // ------------------------- - public static String WIDGET_FOLDER_LABEL; - public static String WIDGET_FOLDER_TOOLTIP; - - public static String WIDGET_BROWSE_LABEL; - public static String WIDGET_BROWSE_TOOLTIP; - - // ------------------------- - // PROPERTY PAGES... - // ------------------------- - public static String RESID_PP_FILE_TYPE_LABEL; - public static String RESID_PP_FILE_TYPE_TOOLTIP; - public static String RESID_PP_FILE_TYPE_FILE_VALUE; - public static String RESID_PP_FILE_TYPE_FOLDER_VALUE; - public static String RESID_PP_FILE_TYPE_ROOT_VALUE; - public static String RESID_PP_FILE_NAME_LABEL; - public static String RESID_PP_FILE_PATH_LABEL; - public static String RESID_PP_FILE_SIZE_LABEL; - public static String RESID_PP_FILE_MODIFIED_LABEL; - public static String RESID_PP_FILE_READONLY_LABEL; - public static String RESID_PP_FILE_HIDDEN_LABEL; - - public static String RESID_PP_FILE_NAME_TOOLTIP; - public static String RESID_PP_FILE_PATH_TOOLTIP; - public static String RESID_PP_FILE_SIZE_TOOLTIP; - public static String RESID_PP_FILE_MODIFIED_TOOLTIP; - public static String RESID_PP_FILE_READONLY_TOOLTIP; - public static String RESID_PP_FILE_HIDDEN_TOOLTIP; - - public static String RESID_PP_FILE_ENCODING_GROUP_LABEL; - public static String RESID_PP_FILE_ENCODING_DEFAULT_LABEL; - public static String RESID_PP_FILE_ENCODING_DEFAULT_TOOLTIP; - public static String RESID_PP_FILE_ENCODING_OTHER_LABEL; - public static String RESID_PP_FILE_ENCODING_OTHER_TOOLTIP; - public static String RESID_PP_FILE_ENCODING_ENTER_TOOLTIP; - - - public static String RESID_ENTER_OR_SELECT_FILE_TITLE; - - public static String RESID_JOB_SEARCH_NAME; - public static String RESID_JOB_DECORATEFILES_NAME; - - - public static String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE; - public static String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID; - public static String MSG_VALIDATE_NAME_EMPTY; - public static String MSG_VALIDATE_NAME_EMPTY_DETAILS; - public static String MSG_VALIDATE_NAME_NOTUNIQUE; - public static String MSG_VALIDATE_NAME_NOTUNIQUE_DETAILS; - - - public static String FILEMSG_FILE_NOTFOUND; - - - - public static String MSG_FOLDER_UNREADABLE; - - public static String MSG_FILE_CANNOT_BE_SAVED; - public static String MSG_FILE_CANNOT_BE_SAVED_DETAILS; - - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, SystemFileResources.class); - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileResources.properties b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileResources.properties deleted file mode 100644 index d89564bdf..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileResources.properties +++ /dev/null @@ -1,183 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2008 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: -# David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible -# David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared -# David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others -############################################################################### - -# NLS_MESSAGEFORMAT_VAR -# NLS_ENCODING=UTF-8 - -############################################################## -# Button values. Mnemonics will be assigned automatically, don't set them here. -############################################################## - - -#============================================================= -# FILE SUBSYSTEM ACTIONS... -#============================================================= -ACTION_NEWFILTER_LABEL=Filter... -ACTION_NEWFILTER_TOOLTIP=Create a new file system filter - -ACTION_SELECTFILETYPES_LABEL=Select... -ACTION_SELECTFILETYPES_TOOLTIP=Select file types - - -############################################################## -# REMOTE FILE SYSTEM TRANSLATABLE STRINGS -############################################################## -#============================================================= -# DEFAULT FILTERS... -#============================================================= -RESID_FILTER_ROOTS=Roots -RESID_FILTER_ROOTFILES=Root -RESID_FILTER_ROOTFOLDERS=Folders -RESID_FILTER_DRIVES=Drives -RESID_FILTER_MYHOME=My Home -#============================================================= -# NEW FILE FILTER WIZARD... -#============================================================= -RESID_NEWFILEFILTER_PAGE1_TITLE=File Filter -RESID_NEWFILEFILTER_PAGE1_DESCRIPTION=Create a file filter - - - -#============================================================= -# CHANGE FILE FILTER DIALOG... -#============================================================= -RESID_CHGFILEFILTER_TITLE=Change File Filter - - -#============================================================= -# SELECT DIRECTORY DIALOG... -#============================================================= -RESID_SELECTDIRECTORY_TITLE=Browse For Folder -RESID_SELECTDIRECTORY_VERBIAGE=Select a folder -RESID_SELECTDIRECTORY_SELECT_TOOLTIP=Expand tree and select folder - -#============================================================= -# SELECT FILE DIALOG... -#============================================================= -RESID_SELECTFILE_TITLE=Browse For File -RESID_SELECTFILE_VERBIAGE=Select a file -RESID_SELECTFILE_SELECT_TOOLTIP=Expand tree and select file - -#============================================================= -# PROMPT FOR HOME FOLDER DIALOG... -#============================================================= -RESID_HOMEPROMPT_TITLE=Prompt For Home Folder - - -#============================================================= -# REMOTE FILE SYSTEM PROPERTY VALUES -#============================================================= -RESID_PROPERTY_FILE_FILTER_VALUE=File filter - -#============================================================= -# REMOTE FILE PROPERTIES PAGE... -#============================================================= -RESID_PP_FILE_TYPE_ROOT_VALUE=Root -RESID_PP_FILE_TYPE_FOLDER_VALUE=Folder -RESID_PP_FILE_TYPE_FILE_VALUE=File - - - - - -#============================================================= -# NEW FILTER WIZARD... -#============================================================= - -RESID_FILEFILTERSTRING_FILE_LABEL=File name filter -RESID_FILEFILTERSTRING_FILE_TOOLTIP=File name filter pattern - - -RESID_FILEFILTERSTRING_INCFILESONLY_LABEL=Show files only -RESID_FILEFILTERSTRING_INCFILESONLY_TOOLTIP=Select to exclude folders from the list - - -RESID_FILEFILTERSTRING_BYFILENAME_LABEL=Subset by file name -RESID_FILEFILTERSTRING_BYFILENAME_TOOLTIP=Select to subset the list by generic file name - -RESID_FILEFILTERSTRING_BYFILETYPES_LABEL=Subset by file types -RESID_FILEFILTERSTRING_BYFILETYPES_TOOLTIP=Select to subset the list by one or more file types - -RESID_FILEFILTERSTRING_TYPES_LABEL=File types filter -RESID_FILEFILTERSTRING_TYPES_TOOLTIP=Select the file types to restrict the list by - - -RESID_FILEFILTERSTRING_SELECTTYPES_LABEL=Select... -RESID_FILEFILTERSTRING_SELECTTYPES_TOOLTIP=Select the file types to subset the list by - - -RESID_PP_FILE_PATH_LABEL=Location: -RESID_PP_FILE_PATH_TOOLTIP=Path of the remote file or folder - -RESID_PP_FILE_NAME_LABEL=Name: -RESID_PP_FILE_NAME_TOOLTIP=Name of the remote file or folder - -RESID_PP_FILE_TYPE_LABEL=Object type: -RESID_PP_FILE_TYPE_TOOLTIP=Type of the remote file or folder - -RESID_PP_FILE_SIZE_LABEL=Size: -RESID_PP_FILE_SIZE_TOOLTIP=Size in bytes of the remote file - -RESID_PP_FILE_MODIFIED_LABEL=Last modified: -RESID_PP_FILE_MODIFIED_TOOLTIP=Date this file or folder was last modified - -RESID_PP_FILE_READONLY_LABEL=Read-only -RESID_PP_FILE_READONLY_TOOLTIP=Is this file or folder read-only - -RESID_PP_FILE_HIDDEN_LABEL=Hidden -RESID_PP_FILE_HIDDEN_TOOLTIP=Is this file or folder typically hidden from lists - -RESID_PP_FILE_ENCODING_GROUP_LABEL=File encoding -RESID_PP_FILE_ENCODING_DEFAULT_LABEL=Default (%1) -RESID_PP_FILE_ENCODING_DEFAULT_TOOLTIP=The default encoding of the platform -RESID_PP_FILE_ENCODING_OTHER_LABEL=Other: -RESID_PP_FILE_ENCODING_OTHER_TOOLTIP=Specify a different encoding -RESID_PP_FILE_ENCODING_ENTER_TOOLTIP=Select or enter an encoding - - -RESID_ENTER_OR_SELECT_FILE_TITLE= Specify File - -#============================================================= -# RE-USABLE COMPOSITE FILE SYSTEM WIDGETS -#============================================================= -WIDGET_FOLDER_LABEL=Folder: -WIDGET_FOLDER_TOOLTIP=Select or specify folder path - -WIDGET_BROWSE_LABEL=Browse... -WIDGET_BROWSE_TOOLTIP=Browse for folder path - -RESID_JOB_SEARCH_NAME=Search -RESID_JOB_DECORATEFILES_NAME=Decorate Files - -FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE= Filter string ''{0}'' already exists in this filter -FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID = Filter string name pattern not valid - -MSG_VALIDATE_NAME_EMPTY = Enter name -MSG_VALIDATE_NAME_EMPTY_DETAILS = You must enter a name in the field where the cursor is positioned. -MSG_VALIDATE_NAME_NOTUNIQUE= Name in use -MSG_VALIDATE_NAME_NOTUNIQUE_DETAILS = This name is already used by another resource. Enter a unique name. -FILEMSG_FILE_NOTFOUND = File ''{0}'' not found - - -MSG_FOLDER_UNREADABLE = Folder {0} is not readable. Cannot expand - -MSG_FILE_CANNOT_BE_SAVED= File {0} can not be saved on {1}. You do not have write access to the file. -MSG_FILE_CANNOT_BE_SAVED_DETAILS= Change file permissions to ensure you have write access to the file. - - diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileSubSystemAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileSubSystemAPIProviderImpl.java deleted file mode 100644 index 064ad2738..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileSubSystemAPIProviderImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileAPIProvider; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - - - -/** - * This class is a provider of root nodes to the remote systems tree viewer part. - * It is used when the contents are to be subset to a particular remote file subsystem instance. - */ -public class SystemFileSubSystemAPIProviderImpl - extends SystemFileAPIProviderImpl - implements ISystemFileAPIProvider -{ - - - protected IRemoteFileSubSystem subsystem = null; - //protected Object[] emptyList = new Object[0]; - - /** - * Constructor for SystemFileAPIProvider - * @param subsystem The remote file subsystem from which we want to list referenced filter pools, filters and file system objects. - * @param directoryMode true if you only want to traverse directories, false for both files and directories. - */ - public SystemFileSubSystemAPIProviderImpl(IRemoteFileSubSystem subsystem, boolean directoryMode) - { - super(directoryMode); - this.subsystem = subsystem; - } - - /** - * Get the input subsystem object. - */ - public IRemoteFileSubSystem getSubSystem() - { - return subsystem; - } - - // ---------------------------------- - // SYSTEMVIEWINPUTPROVIDER METHODS... - // ---------------------------------- - /** - * Return the children objects to constitute the root elements in the system view tree. - * We return all filter pools for this subsystem - */ - public Object[] getSystemViewRoots() - { - // todo: maybe return a non-filter root for direct drill-down - return subsystem.getChildren(); - } - /** - * Return true if {@link #getSystemViewRoots()} will return a non-empty list - * We return true if there are any connections containing a remote file subsystem, for any active profile. - */ - public boolean hasSystemViewRoots() - { - return (subsystem.hasChildren()); - } - /** - * This method is called by the connection adapter when the user expands - * a connection. This method must return the child objects to show for that - * connection. - */ - public Object[] getConnectionChildren(IHost selectedConnection) - { - return sr.getConnectionChildren(selectedConnection); - } - /** - * This method is called by the connection adapter when deciding to show a plus-sign - * or not beside a connection. Return true if this connection has children to be shown. - */ - public boolean hasConnectionChildren(IHost selectedConnection) - { - return sr.hasConnectionChildren(selectedConnection); - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - // ---------------------------------- - // OUR OWN METHODS... - // ---------------------------------- - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileSubSystemConfigurationAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileSubSystemConfigurationAPIProviderImpl.java deleted file mode 100644 index f969a0c9f..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemFileSubSystemConfigurationAPIProviderImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [175680] Deprecate obsolete ISystemRegistry methods - ********************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileAPIProvider; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; - - - -/** - * This class is a provider of root nodes to the remote systems tree viewer part. - * It is used when the initial connections are to be subset to those that support a particular remote file subsystem factory, - * and subsystems shown within those connections are to be subset to only those from this subsystem factory. - */ -public class SystemFileSubSystemConfigurationAPIProviderImpl - extends SystemFileAPIProviderImpl - implements ISystemFileAPIProvider -{ - - - private IRemoteFileSubSystemConfiguration subsystemConfiguration = null; - //protected Object[] emptyList = new Object[0]; - - /** - * Constructor - * @param subsystemConfiguration The remote file subsystem configuration. - * Users will drill down from connections that support this subsystem - * configuration. - * @param directoryMode true if you only want to traverse directories, false for both files and directories. - */ - public SystemFileSubSystemConfigurationAPIProviderImpl(IRemoteFileSubSystemConfiguration subsystemConfiguration, boolean directoryMode) - { - super(directoryMode); - this.subsystemConfiguration = subsystemConfiguration; - } - - /** - * Get the input subsystem object. - */ - public IRemoteFileSubSystemConfiguration getSubSystemConfiguration() - { - return subsystemConfiguration; - } - - // ---------------------------------- - // SYSTEMVIEWINPUTPROVIDER METHODS... - // ---------------------------------- - /** - * Return the children objects to consistute the root elements in the system view tree. - * We return all filter pools for this subsystem - */ - public Object[] getSystemViewRoots() - { - return getConnections(); - } - /** - * Return true if {@link #getSystemViewRoots()} will return a non-empty list - * We return true if there are any connections containing a remote file subsystem, for any active profile. - */ - public boolean hasSystemViewRoots() - { - return hasConnections(); - } - /** - * This method is called by the connection adapter when the user expands - * a connection. This method must return the child objects to show for that - * connection. - */ - public Object[] getConnectionChildren(IHost selectedConnection) - { - return sr.getConnectionChildren(selectedConnection); - } - /** - * This method is called by the connection adapter when deciding to show a plus-sign - * or not beside a connection. Return true if this connection has children to be shown. - */ - public boolean hasConnectionChildren(IHost selectedConnection) - { - return sr.hasConnectionChildren(selectedConnection); - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - // ---------------------------------- - // OUR OWN METHODS... - // ---------------------------------- - /** - * Return connections defined which this factory supports - */ - public IHost[] getConnections() - { - return sr.getHostsBySubSystemConfiguration(subsystemConfiguration); - } - /** - * Return a count of all connections which have at least one subsystem that implements/extends RemoteFileSubSystem - */ - public int getConnectionCount() - { - return getConnections().length; - } - /** - * Return true if there are any connections defined which this factory supports - */ - public boolean hasConnections() - { - ISubSystem[] allOurSubSystems = subsystemConfiguration.getSubSystems(true); // true => full get; do restore from disk if not already - return ((allOurSubSystems!=null) && (allOurSubSystems.length>0)); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemRemoteDirectoryMatcher.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemRemoteDirectoryMatcher.java deleted file mode 100644 index 8f4937218..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/SystemRemoteDirectoryMatcher.java +++ /dev/null @@ -1,60 +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.internal.subsystems.files.core; -import org.eclipse.rse.core.SystemRemoteObjectMatcher; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes; - - - -/** - * This class encapsulates all the criteria required to identify a match on a remote - * system directory object. - * <p> - * Use the static method {@link #getDirectoryMatcher()} - * to get an default instance that matches on any directory of any name. - * <p> - * You only need to instantiate this class if you want to match on a directory of a - * particular name. - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter - */ -public class SystemRemoteDirectoryMatcher extends SystemRemoteObjectMatcher -{ - public static SystemRemoteDirectoryMatcher inst = null; - public static final String category = ISystemFileRemoteTypes.TYPECATEGORY; - public static final String type = ISystemFileRemoteTypes.TYPE_FOLDER; - - /** - * Constructor. - * You only need to instantiate yourself if you want to match on a directory - * of a particular name. - * Otherwise, call {@link #getDirectoryMatcher()}. - */ - public SystemRemoteDirectoryMatcher(String nameFilter) - { - super(null, category, nameFilter, type, null, null); - } - - /** - * Return an instance that will match on any directory of any name from any remote system - */ - public static SystemRemoteDirectoryMatcher getDirectoryMatcher() - { - if (inst == null) - inst = new SystemRemoteDirectoryMatcher(null); - return inst; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/RemotePath.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/RemotePath.java deleted file mode 100644 index 689029542..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/RemotePath.java +++ /dev/null @@ -1,261 +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) - [cleanup] Fix javadoc - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core.model; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.subsystems.files.core.model.IRemotePath; -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.ui.SystemBasePlugin; - - -/** - * Class representing a remote path. - */ -public class RemotePath implements IRemotePath { - - protected String profileName; - protected String connectionName; - protected String absolutePath; - - /** - * Constructor. - * @param profileName the profile name. - * @param connectionName the connection name. - * @param absolutePath the absolute path. - */ - public RemotePath(String profileName, String connectionName, String absolutePath) { - super(); - setProfileName(profileName); - setConnectionName(connectionName); - setAbsolutePath(absolutePath); - } - - - /** - * Sets the profile name, connection name and absolute path on the remote machine - * from the fully qualified path. The fully qualified path is the absolute path on the remote machine, - * prefixed by profile name and connection name. It must be of the form <code>"profileName.connectionName:absolutePath"</code>. - * @param fullyQualifiedPath the fully qualified path. - */ - public RemotePath(String fullyQualifiedPath) { - - if (fullyQualifiedPath != null) { - - int dotIndex = fullyQualifiedPath.indexOf('.'); - - if ((dotIndex != -1) && (dotIndex != (fullyQualifiedPath.length() - 1))) { - int colonIndex = fullyQualifiedPath.indexOf(':', dotIndex+1); - - if ((colonIndex != -1) && (colonIndex != (fullyQualifiedPath.length() - 1))) { - setProfileName(fullyQualifiedPath.substring(0, dotIndex)); - setConnectionName(fullyQualifiedPath.substring(dotIndex+1, colonIndex)); - setAbsolutePath(fullyQualifiedPath.substring(colonIndex+1)); - } - } - } - } - - /** - * Set the profile name. - * @param profileName the profile name. - */ - protected void setProfileName(String profileName) { - this.profileName = profileName; - } - - /** - * Set the connection name. - * @param connectionName the connection name. - */ - protected void setConnectionName(String connectionName) { - this.connectionName = connectionName; - } - - /** - * Set the absolute path string below the connection. - * Interpretation of this string is up to the subsystem. - * @param absolutePath the absolute path string. - */ - protected void setAbsolutePath(String absolutePath) { - this.absolutePath = absolutePath; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#getProfileName() - */ - public String getProfileName() { - return profileName; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#getConnectionName() - */ - public String getConnectionName() { - return connectionName; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#getAbsolutePath() - */ - public String getAbsolutePath() { - return absolutePath; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#getFullyQualifiedPath() - */ - public String getFullyQualifiedPath() { - - if ((profileName == null) || (connectionName == null) || (absolutePath == null)) { - return null; - } - else { - return profileName + "." + connectionName + ":" + absolutePath; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#getFileExtension() - */ - public String getFileExtension() { - - if (absolutePath == null) { - return null; - } - else { - - int dotIndex = absolutePath.lastIndexOf('.'); - - if (dotIndex != -1) { - - if (dotIndex != (absolutePath.length() - 1)) { - return absolutePath.substring(dotIndex+1); - } - else { - return ""; //$NON-NLS-1$ - } - } - else { - return null; - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#addFileExtension(java.lang.String) - */ - public IRemotePath addFileExtension(String extension) { - - if (absolutePath == null) { - return null; - } - - if (absolutePath.endsWith("/") || absolutePath.endsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ - return this; - } - else { - String newAbsolutePath = absolutePath + "." + extension; //$NON-NLS-1$ - return new RemotePath(profileName, connectionName, newAbsolutePath); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#removeFileExtension() - */ - public IRemotePath removeFileExtension() { - - if (absolutePath == null) { - return null; - } - - if (absolutePath.endsWith("/") || absolutePath.endsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ - return this; - } - else { - int dotIndex = absolutePath.lastIndexOf('.'); - - if (dotIndex == -1) { - return this; - } - else { - String newAbsolutePath = absolutePath.substring(0, dotIndex); - return new RemotePath(profileName, connectionName, newAbsolutePath); - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#isVirtual() - */ - public boolean isVirtual() { - return ArchiveHandlerManager.isVirtual(absolutePath); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.IRemotePath#toRemoteFile() - */ - public IRemoteFile toRemoteFile() { - - if ((profileName == null) || (connectionName == null) || (absolutePath == null)) { - return null; - } - - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISystemProfile profile = registry.getSystemProfile(profileName); - - if (profile == null) { - return null; - } - - IHost conn = registry.getHost(profile, connectionName); - - if (conn == null) { - return null; - } - - IRemoteFileSubSystem subsys = RemoteFileUtility.getFileSubSystem(conn); - IRemoteFile remoteFile = null; - - try { - remoteFile = subsys.getRemoteFileObject(absolutePath, new NullProgressMonitor()); - } - catch (SystemMessageException e) { - SystemBasePlugin.logError("Error occured trying to get remote file", e); //$NON-NLS-1$ - } - - return remoteFile; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/RemotePathUtil.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/RemotePathUtil.java deleted file mode 100644 index 265a0d5fd..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/RemotePathUtil.java +++ /dev/null @@ -1,137 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core.model; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.subsystems.files.core.model.IRemotePath; - -/** - * Singleton utility class for remote paths. - */ -public class RemotePathUtil { - - private static RemotePathUtil instance; - - /** - * Constructor. - */ - private RemotePathUtil() { - super(); - } - - /** - * Returns the singleton instance. - * @return the singleton instance. - */ - public static RemotePathUtil getInstance() { - - if (instance == null) { - instance = new RemotePathUtil(); - } - - return instance; - } - - /** - * Returns the path of the temp location corresponding to the remote path. The remote - * path must represent a file (i.e. can not be a directory). - * The temp path is simply the default temp location on the client system (given by system property - * "java.io.tmpdir"), with the name of the remote file appended (not the path of the - * remote file). - * @param remotePath the remote path. - * @return the path of the temporary file, or <code>null</code> if the default temporary location - * is not available. - */ - public IPath getClientTempLocationForFile(IRemotePath remotePath) { - String tempDirString = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - - IPath tempPath = new Path(tempDirString); - - if (tempDirString == null) { - return null; - } - else { - - String absolutePath = remotePath.getAbsolutePath(); - - // try '/' first - String sep = "/"; //$NON-NLS-1$ - - boolean isVirtual = remotePath.isVirtual(); - - IPath newPath = new Path(tempPath.toOSString()); - - newPath = appendRemoteFileNameToPath(newPath, absolutePath, sep); - - if (!newPath.equals(tempPath)) { - return newPath; - } - else { - - // for virtual separator is '/' - if (isVirtual) { - return null; - } - - sep = "\\"; //$NON-NLS-1$ - - newPath = appendRemoteFileNameToPath(newPath, absolutePath, sep); - - if (!newPath.equals(tempPath)) { - return newPath; - } - else { - return null; - } - } - } - } - - /** - * Apnnds a file name to a path given the absolute path of a file. - * The absolute path name of the file must not end with the given separator (we assume - * that a directory will end with a separator). - * @param path the path to which to append. - * @param absolutePath the absolute path from which the name will be obtained. - * @param sep the separator to parse the absolute path, and get the name. - * @return the new path, or the same path if the separator was not found, or - * was found to be the last character in the absolute path. - */ - private IPath appendRemoteFileNameToPath(IPath path, String absolutePath, String sep) { - - int sepIndex = absolutePath.lastIndexOf(sep); - - // found separator - if (sepIndex != -1) { - - // if not the last character in the path, then strip out the last segment - if (sepIndex != (absolutePath.length()-1)) { - return path.append(absolutePath.substring(sepIndex+1)); - } - // separator is last character in path, so it must be a directory - else { - return path; - } - } - // no separator found so simply append the absolute path - else { - return path.append(absolutePath); - } - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/SystemFileTransferModeMapping.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/SystemFileTransferModeMapping.java deleted file mode 100644 index 8d2b55f50..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/SystemFileTransferModeMapping.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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: - * David McKnight (IBM) - [208951] new priority field - * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - * Martin Oberhuber (Wind River) - [219975] Fix implementations of clone() - *******************************************************************************/ - -package org.eclipse.rse.internal.subsystems.files.core.model; - -import org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping; - - -/** - * An internal class. - * - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public class SystemFileTransferModeMapping implements ISystemFileTransferModeMapping, Cloneable { - - public static final int DEFAULT_PRIORITY = Integer.MAX_VALUE; - private String name; - private String extension; - private boolean isBinary = true; - private int priority = DEFAULT_PRIORITY; - - /** - * Constructor for SystemFileTransferModeMapping. The name is set to <code>*</code>. - * @param extension the extension. Can be <code>null</code>. - */ - public SystemFileTransferModeMapping(String extension) { - this("*", extension); //$NON-NLS-1$ - } - - /** - * Constructor for SystemFileTransferModeMapping. - * @param name the name. If the name is <code>null</code> or if it is an empty string, it is set to <code>*</code>. - * @param extension the extension. Can be <code>null</code>. - */ - public SystemFileTransferModeMapping(String name, String extension) { - - if ((name == null) || (name.length() < 1)) { - setName("*"); //$NON-NLS-1$ - } - else { - setName(name); - } - - setExtension(extension); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping#getExtension() - */ - public String getExtension() { - return extension; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping#getLabel() - */ - public String getLabel() { - - if (extension != null) { - return (name + "." + extension); //$NON-NLS-1$ - } - else { - return name; - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping#getName() - */ - public String getName() { - return name; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping#isBinary() - */ - public boolean isBinary() { - return isBinary; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping#isText() - */ - public boolean isText() { - return !isBinary(); - } - - /** - * Set whether transfer mode is binary - */ - public void setAsBinary() { - isBinary = true; - } - - /** - * Set whether transfer mode is text - */ - public void setAsText() { - isBinary = false; - } - - /** - * Set the name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Set the extension - */ - public void setExtension(String extension) { - this.extension = extension; - } - - /** - * Set the priority - the smaller the number, the higher priority - * @param priority priority to set. - */ - public void setPriority(int priority) { - this.priority = priority; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping#getPriority() - */ - public int getPriority() - { - return this.priority; - } - - /** - * Clone this object. - * - * Subclasses must ensure that such a deep copy operation is always - * possible, so their state must always be cloneable. - */ - public Object clone() { - try { - return super.clone(); - } - catch (CloneNotSupportedException e) { - //assert false; //can never happen - throw new RuntimeException(e); - } - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/SystemFileTransferModeRegistry.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/SystemFileTransferModeRegistry.java deleted file mode 100644 index 80d677f61..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/model/SystemFileTransferModeRegistry.java +++ /dev/null @@ -1,561 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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 - * David McKnight (IBM) - [208951] Use remoteFileTypes extension point to determine file types - * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - *******************************************************************************/ -package org.eclipse.rse.internal.subsystems.files.core.model; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; -import org.eclipse.rse.services.clientserver.SystemEncodingUtil; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeRegistry; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.XMLMemento; - - - -/** - * An internal class. - * - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ - -public class SystemFileTransferModeRegistry implements ISystemFileTransferModeRegistry { - - private static SystemFileTransferModeRegistry instance; - - private HashMap typeModeMappings; - - private RSEUIPlugin plugin; - - // Constants for reading from and writing to xml file - private static final String FILENAME = "fileTransferMode.xml"; //$NON-NLS-1$ - private static final String ENCODING = SystemEncodingUtil.ENCODING_UTF_8; - private static final String ROOT_NODE = "mode"; //$NON-NLS-1$ - private static final String INFO_NODE = "info"; //$NON-NLS-1$ - private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$ - private static final String EXTENSION_ATTRIBUTE = "extension"; //$NON-NLS-1$ - private static final String MODE_ATTRIBUTE = "mode"; //$NON-NLS-1$ - private static final String BINARY_VALUE = "binary"; //$NON-NLS-1$ - private static final String TEXT_VALUE = "text"; //$NON-NLS-1$ - private static final String PRIORITY_ATTRIBUTE = "priority"; //$NON-NLS-1$ - - /** - * Constructor for SystemFileTransferModeRegistry - */ - private SystemFileTransferModeRegistry() { - super(); - this.plugin = RSEUIPlugin.getDefault(); - initialize(); - } - - - /** - * Get the singleton instance - */ - public static SystemFileTransferModeRegistry getInstance() { - - if (instance == null) { - instance = new SystemFileTransferModeRegistry(); - } - - return instance; - } - - /** - * Delete's the existing file associations and reinitializes with defaults - */ - public void renit() - { - deleteAssociations(); - initialize(); - } - - /** - * Initialize the registry from storage. - */ - private void initialize() { - - // load our current associations (if any) - loadAssociations(); - - - // get reference to the extension registry - IExtensionRegistry extRegistry = Platform.getExtensionRegistry(); - - // get extensions to our extension point - IConfigurationElement[] elements = extRegistry.getConfigurationElementsFor("org.eclipse.rse.subsystems.files.core", "remoteFileTypes"); //$NON-NLS-1$ //$NON-NLS-2$ - - // go through all extensions - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - - // get the extension attribute value - String extension = element.getAttribute("extension"); //$NON-NLS-1$ - - if (extension != null && !extension.equals("")) { //$NON-NLS-1$ - - // get the type attribute value - String type = element.getAttribute("type"); //$NON-NLS-1$ - - if (type != null && !type.equals("")) { //$NON-NLS-1$ - - SystemFileTransferModeMapping mapping = new SystemFileTransferModeMapping(extension); - - // add extension to list of text types - if (type.equalsIgnoreCase("text")) { //$NON-NLS-1$ - mapping.setAsText(); - } - // add extension to list of binary types - if (type.equalsIgnoreCase("binary")) { //$NON-NLS-1$ - mapping.setAsBinary(); - } - - int priority = SystemFileTransferModeMapping.DEFAULT_PRIORITY; - String priorityStr = element.getAttribute("priority"); //$NON-NLS-1$ - try - { - if (priorityStr != null && !priorityStr.equals("")){ //$NON-NLS-1$ - priority = Integer.parseInt(priorityStr); - } - } - catch (Exception e) - { - } - mapping.setPriority(priority); - - String key = getMappingKey(mapping); - if (!typeModeMappings.containsKey(key)){ - typeModeMappings.put(key, mapping); - } - else { - SystemFileTransferModeMapping existingMapping = (SystemFileTransferModeMapping)typeModeMappings.get(key); - int existingPriority = existingMapping.getPriority(); - if (priority < existingPriority){ - - // change properties of existing mapping to that of new priority - if (mapping.isBinary() && existingMapping.isText()){ - existingMapping.setAsBinary(); - } - else if (mapping.isText() && existingMapping.isBinary()){ - existingMapping.setAsText(); - } - - existingMapping.setPriority(priority); - } - } - } - - } - else { - continue; - } - } - } - - /** - * @see ISystemFileTransferModeRegistry#getModeMappings() - */ - public ISystemFileTransferModeMapping[] getModeMappings() { - List sortedMappings = sortedTypeModeMappings(); // sort hash table elements - ISystemFileTransferModeMapping[] array = new ISystemFileTransferModeMapping[sortedMappings.size()]; - sortedMappings.toArray(array); - return array; - } - - - /** - * The mappings are kept in a hash map for fast lookup. Sorting is - * typically only needed for certain dialogs/choices etc. - */ - private List sortedTypeModeMappings() { - Comparator c = new Comparator() { - public int compare(Object o1, Object o2) { - String s1 = ((ISystemFileTransferModeMapping)o1).getLabel().toUpperCase(); - String s2 = ((ISystemFileTransferModeMapping)o2).getLabel().toUpperCase(); - return s1.compareTo(s2); - } - }; - SortedSet s = new TreeSet(c); - s.addAll(typeModeMappings.values()); - List result = new ArrayList(s); - return result; - } - - - /** - * Sets new mode mappings - */ - public void setModeMappings(SystemFileTransferModeMapping[] newMappings) { - typeModeMappings = new HashMap(); - - for (int i = 0; i < newMappings.length; i++) { - SystemFileTransferModeMapping mapping = newMappings[i]; - typeModeMappings.put(getMappingKey(mapping), mapping); - } - } - - - /** - * Return a key given the mapping - */ - private String getMappingKey(ISystemFileTransferModeMapping mapping) { - return mapping.getLabel().toLowerCase(); - } - - - /** - * @see ISystemFileTransferModeRegistry#isBinary(String) - */ - public boolean isBinary(String fileName) { - return getMapping(fileName).isBinary(); - } - - - /** - * @see ISystemFileTransferModeRegistry#isBinary(File) - */ - public boolean isBinary(File file) { - return isBinary(file.getName()); - } - - - /** - * @see ISystemFileTransferModeRegistry#isBinary(IFile) - */ - public boolean isBinary(IFile file) { - return isBinary(file.getName()); - } - - - /** - * @see ISystemFileTransferModeRegistry#isBinary(IRemoteFile) - */ - public boolean isBinary(IRemoteFile remoteFile) { - return isBinary(remoteFile.getName()); - } - - - /** - * @see ISystemFileTransferModeRegistry#isText(String) - */ - public boolean isText(String fileName) { - return getMapping(fileName).isText(); - } - - - /** - * @see ISystemFileTransferModeRegistry#isText(File) - */ - public boolean isText(File file) { - return isText(file.getName()); - } - - - /** - * @see ISystemFileTransferModeRegistry#isText(IFile) - */ - public boolean isText(IFile file) { - return isText(file.getName()); - } - - - /** - * @see ISystemFileTransferModeRegistry#isText(IRemoteFile) - */ - public boolean isText(IRemoteFile remoteFile) { - return isText(remoteFile.getName()); - } - - - /** - * Get the mode mapping given a file name - */ - private SystemFileTransferModeMapping getMapping(String fileName) { - SystemFileTransferModeMapping mapping = (SystemFileTransferModeMapping)(typeModeMappings.get(fileName.toLowerCase())); - - if (mapping == null) { - mapping = createMappingFromModeMappings(fileName); - } - - if (mapping == null) { - return getDefaultMapping(fileName); - } - - return mapping; - } - - private SystemFileTransferModeMapping createMappingFromModeMappings(String fileName) - { - // get file extension - //DY int extIndex = fileName.indexOf('.'); - int extIndex = fileName.lastIndexOf('.'); - - String name = null; - String extension = null; - - // if there is no extension - if ((extIndex == -1) || (extIndex == (fileName.length() - 1))) { - name = fileName; - } - else { - name = fileName.substring(0, extIndex); - extension = fileName.substring(extIndex + 1); - } - - // check if the name and extension combination exists already - SystemFileTransferModeMapping mapping = (SystemFileTransferModeMapping)(typeModeMappings.get(getMappingKey(new SystemFileTransferModeMapping(name, extension)))); - - // if not, check only for the extension - if (mapping == null) { - mapping = (SystemFileTransferModeMapping)(typeModeMappings.get(getMappingKey(new SystemFileTransferModeMapping(extension)))); - } - - if (mapping == null) { - return null; - } - - - SystemFileTransferModeMapping fileMapping = new SystemFileTransferModeMapping(name, extension); - - if (mapping.isText()) - { - fileMapping.setAsText(); - } - else - { - fileMapping.setAsBinary(); - } - - return fileMapping; - } - - /** - * Return whether to automatically detect, use binary or text during file transfer - * for unspecified file types - */ - public static int getFileTransferModeDefaultPreference() - { - IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore(); - return store.getInt(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT); - } - - /** - * Get a default mapping given an extension. Should never return null. - */ - private SystemFileTransferModeMapping getDefaultMapping(String fileName) { - - // now we check if the file has an extension - // DY int extIndex = fileName.indexOf('.'); - int extIndex = fileName.lastIndexOf('.'); - String name, extension; - - // if there is no extension - // DY 04-23-2002 changed from default binary to default text for files that - // a) Have no extension - // b) Ends with a period - // c) Start with a '.' i.e. .bash_history - if ((extIndex == -1) || (extIndex == (fileName.length() - 1)) || (extIndex == 0)) - { - name = fileName; - extension = null; - } - else - { - name = fileName.substring(0, extIndex); - extension = fileName.substring(extIndex + 1); - } - - - SystemFileTransferModeMapping mapping = new SystemFileTransferModeMapping(name, extension); - - // default - int defaultFileTransferMode = getFileTransferModeDefaultPreference(); - - if (defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY) - { - mapping.setAsBinary(); - } - else if (defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT) - { - mapping.setAsText(); - } - - return mapping; - } - - - /** - * Load the saved associations to the registry - * - * @return true if operation successful, false otherwise - */ - public boolean loadAssociations() { - - typeModeMappings = new HashMap(); - - String location = getFileLocation(); - - File file = new File(location); - - if (!file.exists()) - return false; - - FileInputStream stream = null; - InputStreamReader reader = null; - - boolean result = false; - - try { - stream = new FileInputStream(file); - reader = new InputStreamReader(stream, ENCODING); - XMLMemento memento = XMLMemento.createReadRoot(reader); - IMemento[] mementos = memento.getChildren(INFO_NODE); - - for (int i = 0; i < mementos.length; i++) { - String name = mementos[i].getString(NAME_ATTRIBUTE); - String extension = mementos[i].getString(EXTENSION_ATTRIBUTE); - String mode = mementos[i].getString(MODE_ATTRIBUTE); - - - SystemFileTransferModeMapping mapping = new SystemFileTransferModeMapping(name, extension); - - if (mode.equals(TEXT_VALUE)) { - mapping.setAsText(); - } - else { - mapping.setAsBinary(); - } - - try - { - Integer priorityInt = mementos[i].getInteger(PRIORITY_ATTRIBUTE); - if (priorityInt != null){ - int priority = priorityInt.intValue(); - mapping.setPriority(priority); - } - } - catch (Exception e) - { - } - - - typeModeMappings.put(getMappingKey(mapping), mapping); - } - - result = true; - } - catch (Exception e) { - SystemBasePlugin.logError("Could not read transfer mode xml file", e); //$NON-NLS-1$ - result = false; - } - finally { - - try { - - if (reader != null) - reader.close(); - } - catch (Exception e) { - SystemBasePlugin.logError("Could not close reader for transfer mode xml file", e); //$NON-NLS-1$ - } - } - - - return result; - } - - private void deleteAssociations() - { - String location = getFileLocation(); - File assFile = new File(location); - assFile.delete(); - } - - /** - * Save the contents of the registry - */ - public void saveAssociations() { - - String location = getFileLocation(); - - XMLMemento memento = XMLMemento.createWriteRoot(ROOT_NODE); - - Iterator iter = typeModeMappings.values().iterator(); - - while (iter.hasNext()) { - ISystemFileTransferModeMapping mapping = (ISystemFileTransferModeMapping)iter.next(); - IMemento infoMemento = memento.createChild(INFO_NODE); - infoMemento.putString(NAME_ATTRIBUTE, mapping.getName()); - infoMemento.putString(EXTENSION_ATTRIBUTE, mapping.getExtension()); - infoMemento.putString(MODE_ATTRIBUTE, mapping.isBinary() ? BINARY_VALUE : TEXT_VALUE); - infoMemento.putInteger(PRIORITY_ATTRIBUTE, mapping.getPriority()); - } - - FileOutputStream stream = null; - OutputStreamWriter writer = null; - - try { - stream = new FileOutputStream(location); - writer = new OutputStreamWriter(stream, ENCODING); - memento.save(writer); - } - catch (Exception e) { - SystemBasePlugin.logError("Could not write to transfer mode xml file", e); //$NON-NLS-1$ - } - finally { - - try { - - if (writer != null) - writer.close(); - } - catch (Exception e) { - SystemBasePlugin.logError("Could not close writer for transfer mode xml file", e); //$NON-NLS-1$ - } - } - } - - - /** - * Get the file location - */ - private String getFileLocation() { - return plugin.getStateLocation().append(FILENAME).toOSString(); - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/ILanguageUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/ILanguageUtility.java deleted file mode 100644 index da538dbad..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/ILanguageUtility.java +++ /dev/null @@ -1,56 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core; - -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * Interface for a language utility. Each programming language should have its own utility, - * for example Java, C/C++, etc. - */ -public interface ILanguageUtility { - - /** - * Constant for Java language. - */ - public static final String LANGUAGE_JAVA = "Java"; //$NON-NLS-1$ - - /** - * Constant for C language. - */ - public static final String LANGUAGE_C = "C"; //$NON-NLS-1$ - - /** - * Constant for C++ language. - */ - public static final String LANGUAGE_CPP = "C++"; //$NON-NLS-1$ - - /** - * Returns the subsystem with which the utility is associated. - * @return the subsystem. - */ - public IRemoteFileSubSystem getSubSystem(); - - /** - * Returns the language to which this utility applies. It could be one of - * <code>LANGUAGE_JAVA</code>, <code>LANGUAGE_C</code>, and <code>LANGUAGE_CPP</code>, or - * another language. - * @return the language. - */ - public String getLanguage(); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/ILanguageUtilityFactory.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/ILanguageUtilityFactory.java deleted file mode 100644 index 686d87a42..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/ILanguageUtilityFactory.java +++ /dev/null @@ -1,45 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core; - -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * A factory for creating language specific utility. - */ -public interface ILanguageUtilityFactory { - - /** - * Returns the subsystem with which the factory is associated. - * @return the subsystem. - */ - public IRemoteFileSubSystem getSubSystem(); - - /** - * Returns the language utility for the given language identifier. - * Identifiers for popular languages are available in <code>ILanguageUtility</code>. - * For Java, the identifier is <code>LANGUAGE_JAVA</code>. - * For C, the identifier is <code>LANGUAGE_C</code>. - * For C++, the identifier is <code>LANGUAGE_CPP</code>. - * @param language the language identifier. - * @return the language utility. - * - * @see ILanguageUtility - */ - public ILanguageUtility getUtility(String language); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/SystemIFileProperties.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/SystemIFileProperties.java deleted file mode 100644 index fe2dbf419..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/SystemIFileProperties.java +++ /dev/null @@ -1,548 +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) - [189130] Move SystemIFileProperties from UI to Core - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.rse.internal.subsystems.files.core.ISystemRemoteEditConstants; -import org.eclipse.rse.internal.subsystems.files.core.ISystemTextEditorConstants; - - - -/** - * Class that encapsulates ISeries IResource persistent properties. - */ -public class SystemIFileProperties { - - - private static final String STRING_EMPTY = ""; //$NON-NLS-1$ - private static final String EXPORT_KEY = "export"; //$NON-NLS-1$ - - private static QualifiedName _nameDirty = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.TEMP_FILE_DIRTY ); - private static QualifiedName _nameReadOnly = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.TEMP_FILE_READONLY ); - private static QualifiedName _nameEditorProfileType = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.EDITOR_PROFILE_TYPE ); - private static QualifiedName _nameEncoding = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.SOURCE_ENCODING_KEY ); - private static QualifiedName _nameHasSequenceNumbers = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.SEQUENCE_NUMBERS_KEY ); - private static QualifiedName _nameRecordLength = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.MAX_LINE_LENGTH_KEY ); - private static QualifiedName _nameRemoteCCSID = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.CCSID_KEY ); - private static QualifiedName _nameRemoteFileObject = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.REMOTE_FILE_OBJECT_KEY ); - private static QualifiedName _nameRemoteFilePath = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.REMOTE_FILE_PATH_KEY ); - private static QualifiedName _nameRemoteFileSubSystem = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.REMOTE_FILE_SUBSYSTEM_KEY ); - private static QualifiedName _nameRemoteFileTimeStamp = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.REMOTE_FILE_MODIFIED_STAMP ); - private static QualifiedName _nameDownloadFileTimeStamp = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.DOWNLOAD_FILE_MODIFIED_STAMP ); - private static QualifiedName _nameUsedBinaryTransfer = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.REMOTE_FILE_BINARY_TRANSFER ); - private static QualifiedName _nameTempCCSID = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.TEMP_CCSID_KEY ); - private static QualifiedName _nameRemoteBIDILogical = new QualifiedName( STRING_EMPTY, ISystemTextEditorConstants.BIDI_LOGICAL_KEY ); - - // for path mapping - private static QualifiedName _nameRemoteFileMounted = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.REMOTE_FILE_MOUNTED); - private static QualifiedName _nameResolvedMountedRemoteFileHost = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.RESOLVED_MOUNTED_REMOTE_FILE_HOST_KEY); - private static QualifiedName _nameResolvedMountedRemoteFilePath = new QualifiedName( STRING_EMPTY, ISystemRemoteEditConstants.RESOLVED_MOUNTED_REMOTE_FILE_PATH_KEY); - - // local encoding qualified name - // NOTE: DO NOT CHANGE THIS!! This exact qualified name is used by the IBM debugger. - private static QualifiedName _nameLocalEncoding = new QualifiedName("org.eclipse.rse.ui", ISystemTextEditorConstants.LOCAL_ENCODING_KEY); //$NON-NLS-1$ - - protected IResource _resource = null; - - /** - * - */ - public SystemIFileProperties( IResource file ){ - _resource = file; - - if( file == null ) - throw new NullPointerException(); - } - - /** - * Returns the temp file dirty persistent property value. - */ - public boolean getDirty(){ - return getPropertyBoolean( _nameDirty ); - } - - /** - * Returns the temp file readonly persistent property value. - */ - public boolean getReadOnly(){ - return getPropertyBoolean( _nameReadOnly); - } - - /** - * Returns whether the original file is marked as a mounted file - */ - public boolean getRemoteFileMounted(){ - return getPropertyBoolean( _nameRemoteFileMounted); - } - - /** - * Returns the editor profile persistent property value. - */ - public String getEditorProfileType(){ - return getPropertyString( _nameEditorProfileType ); - } - - /** - * Returns the source encoding persistent property value. - */ - public String getEncoding(){ - return getPropertyString( _nameEncoding ); - } - - /** - * Gets the local encoding persistent property value. - * @return the local encoding. - */ - public String getLocalEncoding() { - return getPropertyString(_nameLocalEncoding); - } - - /** - * Returns the file that this instance is associated with. - */ - public IResource getFile() { - return _resource; - } - - /** - * Returns the sequence numbers flag persistent property value. - */ - public boolean getHasSequenceNumbers(){ - return getPropertyBoolean( _nameHasSequenceNumbers ); - } - - /** - * Returns the session property value of the given property. - */ - protected Object getParentSessionObject( QualifiedName name ){ - try{ - return _resource.getParent().getSessionProperty( name ); - } - catch( CoreException ex ){ - return null; - } - } - - /** - * Returns the value of a boolean property. - */ - protected boolean getPropertyBoolean( QualifiedName name ){ - try{ - String strValue = _resource.getPersistentProperty( name ); - if( strValue == null ) - return false; - - return strValue.equals( "true" ); //$NON-NLS-1$ - } - catch( CoreException ex ){ - return false; - } - } - - /** - * Returns the value of an integer property. - */ - protected int getPropertyInteger( QualifiedName name ){ - try{ - String strValue = _resource.getPersistentProperty( name ); - - if( strValue == null ) - return 0; - - return Integer.parseInt( strValue ); - } - catch( CoreException ex ){ - return 0; - } - catch( NumberFormatException ex ){ - return 0; - } - } - - /** - * Returns the value of an integer property. - */ - protected long getPropertyLong( QualifiedName name ){ - try{ - String strValue = _resource.getPersistentProperty( name ); - - if( strValue == null ) - return 0; - - return Long.parseLong( strValue ); - } - catch( CoreException ex ){ - return 0; - } - catch( NumberFormatException ex ){ - return 0; - } - catch (Exception e) - { - return 0; - } - } - - /** - * Returns the value of a string persistent or session property. - */ - protected String getPropertyString( QualifiedName name ){ - try{ - return _resource.getPersistentProperty( name ); - } - catch( CoreException ex ){ - return STRING_EMPTY; - } - } - - /** - * Returns the remote file object session property value. - */ - public int getRecordLength() { - return getPropertyInteger( _nameRecordLength ); - } - - /** - * Returns the CCSID persistent property value. - */ - public int getRemoteCCSID(){ - return getPropertyInteger( _nameRemoteCCSID ); - } - - /** - * Returns the remote file object session property value. - */ - public Object getRemoteFileObject(){ - return getSessionObject( _nameRemoteFileObject ); - } - - /** - * Returns the remote file object session property value. - */ - public Object getTempCCSID(){ - return getParentSessionObject( _nameTempCCSID ); - } - - - /** - * Returns the actual file (member) path persistent property value on the originating host. - */ - public String getResolvedMountedRemoteFilePath(){ - return getPropertyString( _nameResolvedMountedRemoteFilePath); - } - - /** - * Returns the actual file (member) host persistent property value for a mounted file. - */ - public String getResolvedMountedRemoteFileHost(){ - return getPropertyString( _nameResolvedMountedRemoteFileHost); - } - - /** - * Returns the full file (member) path persistent property value. - */ - public String getRemoteFilePath(){ - return getPropertyString( _nameRemoteFilePath ); - } - - /** - * Returns the sub-system name persistent property value. - */ - public String getRemoteFileSubSystem(){ - return getPropertyString( _nameRemoteFileSubSystem ); - } - - /** - * Returns the remote file time stamp persistent property value. - */ - public long getRemoteFileTimeStamp(){ - return getPropertyLong( _nameRemoteFileTimeStamp ); - } - - - - /** - * Returns the timestamp of the Eclipse resource after download - */ - public long getDownloadFileTimeStamp(){ - return getPropertyLong( _nameDownloadFileTimeStamp ); - } - - /** - * Returns the session property value of the given property. - */ - protected Object getSessionObject( QualifiedName name ){ - try{ - return _resource.getSessionProperty( name ); - } - catch( CoreException ex ){ - return null; - } - } - - /** - * Returns the binary transfer flag persistent property value. - */ - public boolean getUsedBinaryTransfer(){ - return getPropertyBoolean( _nameUsedBinaryTransfer ); - } - - /** - * Sets the temp file dirty persistent property value. - */ - public void setDirty( boolean bDirty ){ - setPropertyBoolean( _nameDirty, bDirty ); - } - - /** - * Sets the temp file readonly persistent property value. - */ - public void setReadOnly( boolean bReadOnly ){ - setPropertyBoolean( _nameReadOnly, bReadOnly ); - } - - /** - * Sets the remote file mounted indicator property value - */ - public void setRemoteFileMounted( boolean bMounted){ - setPropertyBoolean( _nameRemoteFileMounted, bMounted); - } - - /** - * Sets the editor profile type persistent property value. - */ - public void setEditorProfileType( String strType ){ - setPropertyString( _nameEditorProfileType, strType ); - } - - /** - * Sets the source encoding persistent property value. - */ - public void setEncoding( String strEncoding ){ - setPropertyString( _nameEncoding, strEncoding ); - } - - /** - * Sets the local encoding persistent property value. - * @param strLocalEncoding the local encoding. - */ - public void setLocalEncoding(String strLocalEncoding) { - setPropertyString(_nameLocalEncoding, strLocalEncoding); - } - - /** - * Returns whether the file is stored in BIDI logical format. - * @return <code>true</code> if the file is stored in BIDI logical format, <code>false</code> if the file is stored in BIDI - * visual format. - */ - public boolean getBIDILogical() { - return getPropertyBoolean(_nameRemoteBIDILogical); - } - - /** - * Sets whether the file is stored in BIDI logical format. - * @param logical <code>true</code> if the file is stored in BIDI logical format, <code>false</code> if the file is stored in BIDI - * visual format. - */ - public void setBIDILogical(boolean logical) { - setPropertyBoolean(_nameRemoteBIDILogical, logical); - } - - /** - * Sets the sequence numbers flag persistent property value. - */ - public void setHasSequenceNumbers( boolean bSequenceNumbers ){ - setPropertyBoolean( _nameHasSequenceNumbers, bSequenceNumbers ); - } - - /** - * Sets the session property to the given object. - */ - protected void setParentSessionObject( QualifiedName name, Object objValue ){ - try{ - _resource.getParent().setSessionProperty( name, objValue ); - } - catch( CoreException ex ){ - } - } - - /** - * Sets a boolean property given a property name, and its value. - */ - protected void setPropertyBoolean( QualifiedName name, boolean bValue ){ - setPropertyString( name, bValue == true ? "true" : "false" ); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Sets a boolean property given a property name, and its value. - */ - protected void setPropertyInteger( QualifiedName name, int iValue ){ - setPropertyString( name, String.valueOf( iValue ) ); - } - - /** - * Sets a boolean property given a property name, and its value. - */ - protected void setPropertyLong( QualifiedName name, long lValue ){ - setPropertyString( name, String.valueOf( lValue ) ); - } - - /** - * Sets a string property given a property name, and its value. - */ - protected void setPropertyString( QualifiedName name, String strValue ){ - - // Setting is expensive, so do get and compare first - //-------------------------------------------------- - String strValueCurrent = null; - - try{ - strValueCurrent = _resource.getPersistentProperty( name ); - } - - catch( CoreException ex ){ - strValueCurrent = STRING_EMPTY; - } - - // If the value to be set is currently set, do nothing - //---------------------------------------------------- - if( strValue != null && strValue.equals( strValueCurrent ) == true ) - return; - - // McCoy the new value - //-------------------- - try{ - _resource.setPersistentProperty( name, strValue ); - } - catch( CoreException ex ){ - } - } - - /** - * Sets the record length persistent property value. - */ - public void setRecordLength( int iRecordLength ){ - setPropertyInteger( _nameRecordLength, iRecordLength ); - } - - /** - * Sets the codepage source encoding such as "Cp937" persistent property value. - */ - public void setRemoteCCSID( int iCCSID ){ - setPropertyInteger( _nameRemoteCCSID, iCCSID ); - } - - /** - * Sets the remote system member path persistent property value. - */ - public void setRemoteFileObject( Object object ) { - setSessionObject( _nameRemoteFileObject, object ); - } - - - /** - * Sets the actual remote system file (member) path persistent property value on the originating host. - */ - public void setResolvedMountedRemoteFilePath( String strPath ){ - setPropertyString( _nameResolvedMountedRemoteFilePath, strPath ); - } - - - /** - * Sets the actual remote system file (member) path persistent property value on the originating host. - */ - public void setResolvedMountedRemoteFileHost( String strHost ){ - setPropertyString( _nameResolvedMountedRemoteFileHost, strHost ); - } - - /** - * Sets the remote system file (member) path persistent property value. - */ - public void setRemoteFilePath( String strPath ){ - setPropertyString( _nameRemoteFilePath, strPath ); - } - - /** - * Sets the sub system name persistent property value. - */ - public void setRemoteFileSubSystem( String strSubSystem ){ - setPropertyString( _nameRemoteFileSubSystem, strSubSystem ); - } - - /** - * Sets the remote file time stamp persistent property value. - */ - public void setRemoteFileTimeStamp( long lTimeStamp ){ - setPropertyLong( _nameRemoteFileTimeStamp, lTimeStamp ); - } - - /** - * Sets the local file time stamp property value of download. - */ - public void setDownloadFileTimeStamp( long lTimeStamp ){ - setPropertyLong( _nameDownloadFileTimeStamp, lTimeStamp ); - } - - /** - * Sets the session property to the given object. - */ - protected void setSessionObject( QualifiedName name, Object objValue ){ - try{ - _resource.setSessionProperty( name, objValue ); - } - catch( CoreException ex ){ - } - } - - /** - * Sets the remote system member path persistent property value. - */ - public void setTempCCSID( Object object ) { - setParentSessionObject( _nameTempCCSID, object ); - } - - /** - * Sets the binary transfer flag persistent property value. - */ - public void setUsedBinaryTransfer( boolean bBinaryTransfer ){ - setPropertyBoolean( _nameUsedBinaryTransfer, bBinaryTransfer ); - } - - public void setModificationStampAtExport(String hostName, String destination, long modificationStamp) { - QualifiedName key = new QualifiedName(STRING_EMPTY, EXPORT_KEY + ":" + hostName + ":" + destination); //$NON-NLS-1$ //$NON-NLS-2$ - setPropertyLong(key, modificationStamp); - } - - public long getModificationStampAtExport(String hostName, String destination) { - QualifiedName key = new QualifiedName(STRING_EMPTY, EXPORT_KEY + ":" + hostName + ":" + destination); //$NON-NLS-1$ //$NON-NLS-2$ - return getPropertyLong(key); - } - - public boolean hasModificationStampAtExport(String hostName, String destination) { - QualifiedName key = new QualifiedName(STRING_EMPTY, EXPORT_KEY + ":" + hostName + ":" + destination); //$NON-NLS-1$ //$NON-NLS-2$ - String val = getPropertyString(key); - - if (val != null) { - return true; - } - else { - return false; - } - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/IRemotePath.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/IRemotePath.java deleted file mode 100644 index b1f200e55..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/IRemotePath.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 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: - * Martin Oberhuber (Wind River) - [cleanup] fix javadoc. - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; - -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - -/** - * This interface represents a remote path. - */ -public interface IRemotePath { - - /** - * Returns the profile name. - * @return the profile name. - */ - public String getProfileName(); - - /** - * Returns the connection name. - * @return the connection name. - */ - public String getConnectionName(); - - /** - * Returns the absolute path. - * @return the absolute path. - */ - public String getAbsolutePath(); - - /** - * Returns the fully qualified path. The fully qualified path is the absolute path on the remote machine, - * prefixed by profile name and connection name. It is of the form "profileName.connectionName:absolutePath". - * If the profile name, connection name or absolute path is <code>null</code>, then the fully qualified path - * will also be <code>null</code>. - * @return the fully qualified path. - */ - public String getFullyQualifiedPath(); - - /** - * Returns the file extension for the path. The file extension portion is - * defined as the string following the last period (".") character in the path. - * @return the extension, or <code>null</code> if none. - */ - public String getFileExtension(); - - /** - * Returns a new path with the file extension added to this path. The file extension portion is - * defined as the string following the last period (".") character in the path. If this path ends - * with a separator, i.e. '/' or '\\', then this path is returned. - * The given extension should not include a leading ".". - * @param extension the file extension to append to the path. - * @return the new path. - */ - public IRemotePath addFileExtension(String extension); - - /** - * Returns a new path with the file extension removed from this path. The file extension portion is - * defined as the string following the last period (".") character in the path. If this path ends - * with a separator, i.e. '/' or '\\', or if it does not have an extension, then this path is returned. - * The given extension should not include a leading ".". - * @return path with the file extension removed. - */ - public IRemotePath removeFileExtension(); - - /** - * Returns whether this path represents a virtual file. - * @return <code>true</code> if the path represents a virtual file, <code>false</code> otherwise. - */ - public boolean isVirtual(); - - /** - * Returns the remote file represented by the remote path. - * @return the remote file. - */ - public IRemoteFile toRemoteFile(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileAPIProvider.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileAPIProvider.java deleted file mode 100644 index 6640b83d3..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileAPIProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 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) - [190271] Move ISystemViewInputProvider to Core - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemViewInputProvider; - - - -/** - * Where to start when looking to traverse a remote file system - * @see org.eclipse.rse.internal.subsystems.files.core.SystemFileAPIProviderImpl - */ -public interface ISystemFileAPIProvider extends ISystemViewInputProvider -{ - /** - * Get the directories-only mode. - */ - public boolean isDirectoriesOnly(); - /** - * Return all connections which have at least one subsystem that implements/extends RemoteFileSubSystem - */ - public IHost[] getConnections(); - /** - * Return a count of all connections which have at least one subsystem that implements/extends RemoteFileSubSystem - */ - public int getConnectionCount(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileRemoteTypes.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileRemoteTypes.java deleted file mode 100644 index d4f27059d..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileRemoteTypes.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; -/** - * All remote object types we support. - * These can be used when registering property pages against remote universal file system objects. - */ -public interface ISystemFileRemoteTypes -{ - - // ------------------ - // TYPE CATEGORIES... - // ------------------ - - /** - * There is only one type category for remote files. - * It is "files". - */ - public static final String TYPECATEGORY = "files"; //$NON-NLS-1$ - /** - * There is only one type category for remote cmds. - * It is "cmds". - */ - public static final String TYPECMDCATEGORY = "cmds"; //$NON-NLS-1$ - - // ----------- - // TYPES... - // ----------- - - /** - * A folder object - */ - public static final String TYPE_FOLDER = "folder"; //$NON-NLS-1$ - /** - * A file object - */ - public static final String TYPE_FILE = "file"; //$NON-NLS-1$ - - // ----------- - // SUBTYPES... - // ----------- - - /** - * A folder object - */ - public static final String SUBTYPE_SUBFOLDER = "subfolder"; //$NON-NLS-1$ - /** - * A root object - */ - public static final String SUBTYPE_ROOT = "root"; //$NON-NLS-1$ - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileTransferModeMapping.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileTransferModeMapping.java deleted file mode 100644 index 115c829a4..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileTransferModeMapping.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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: - * David McKnight (IBM) - [208951] new priority field - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; - -public interface ISystemFileTransferModeMapping { - - - - /** - * Get the extension - * - * @return the extension for the mapping - */ - public String getExtension(); - - - /** - * Get the label - * - * @return the label for the mapping - */ - public String getLabel(); - - - /** - * Get the name - * - * @return the name for the mapping - */ - public String getName(); - - - /** - * Returns if the mapping is binary - * - * @return true if binary, false if text - */ - public boolean isBinary(); - - - /** - * Returns if the mapping is text - * - * @return true if text, false if binary - */ - public boolean isText(); - - - /** - * Gets the priority - the smaller the number, the higher priority - * @return the priority - * @since 3.0 - */ - public int getPriority(); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileTransferModeRegistry.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileTransferModeRegistry.java deleted file mode 100644 index ded0db456..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemFileTransferModeRegistry.java +++ /dev/null @@ -1,43 +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: - * {Name} (company) - description of contribution. - * David McKnight (IBM) - [208951] Don't use hard-coded file type defaults - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; - - -import org.eclipse.core.resources.IFile; -import org.eclipse.rse.services.clientserver.ISystemFileTypes; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; - - - -public interface ISystemFileTransferModeRegistry extends ISystemFileTypes -{ - - // Get all file transfer mode mappings - public ISystemFileTransferModeMapping[] getModeMappings(); - - - // Query whether a file should be treated as binary - public boolean isBinary(IFile file); - public boolean isBinary(IRemoteFile remoteFile); - - - // Query whether a file should be treated as text - public boolean isText(IFile file); - public boolean isText(IRemoteFile remoteFile); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemRemoteCommand.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemRemoteCommand.java deleted file mode 100644 index 6ef864f03..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemRemoteCommand.java +++ /dev/null @@ -1,34 +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.subsystems.files.core.model; - -import org.eclipse.rse.core.subsystems.ISubSystem; - - - -public interface ISystemRemoteCommand { - - - - public String getCommand(); - - public ISubSystem getSubSystem(); - - public ISystemRemoteCommandMessage[] getMessages(); - - public Object getObject(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemRemoteCommandMessage.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemRemoteCommandMessage.java deleted file mode 100644 index fe0d4c0c9..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/ISystemRemoteCommandMessage.java +++ /dev/null @@ -1,26 +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.subsystems.files.core.model; -public interface ISystemRemoteCommandMessage { - - - - - public String getMessageText(); - - public String getMessageHelp(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileFilterString.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileFilterString.java deleted file mode 100644 index 1e297d363..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileFilterString.java +++ /dev/null @@ -1,426 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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) - [219975] Fix implementations of clone() - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; -import java.util.StringTokenizer; -import java.util.Vector; - -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; - - -/** - * A string representing a filter sent to remote file subsystems. - * <p> - * Filters can be absolute or relative. Absolute contains a folder path, while relative do not. - * <p> - * The files can be filtered by name, or by a list of file types. If by name, it can have - * up to 2 asterisks anywhere in the name for wildcarding. If by types, multiple types can - * by specified. The types are the file extensions without the dot, as in "java" or "class". - * <p> - * Examples: - * <ul> - * <li>Absolute file name filter: <code>d:\mystuff\phil*.abc</code> - * <li>Relative file name filter: <code>phil*.abc</code> - * <li>Absolute file type filter: <code>d:\mystuff\java,class,</code> - * <li>Relative file type filter: <code>java,class,</code> - * <p> - * Syntactically, file type filter strings have at least one comma. - * Note that the file name filter string "*.java" is semantically the same - * as a type filter string "java,". Either one can be used and will get - * the same results. However, if you specify "java" you will be in trouble, - * as it will mean look for a file explicitly named "java". - * <p> - * It is invalid to have both a comma and an asterisk in the same filter string. - * It is also invalid to have both a comma and a period in the same filter string. - * - * Clients may use or subclass this class. When subclassing, clients need to - * ensure that the subclass is always capable of performing a deep clone - * operation with the {@link #clone()} method, so if they add fields of - * complex type, these need to be dealt with by overriding {@link #clone()}. - */ -public class RemoteFileFilterString implements Cloneable -{ - protected String path, file; - protected String[] types; - protected boolean subdirs, files, filterByTypes; - //private RemoteFileSubSystemConfiguration subsysFactory; - protected String PATH_SEP = java.io.File.separator; - public static final char TYPE_SEP = ','; - public static final String TYPE_SEP_STRING = ","; //$NON-NLS-1$ - public static final String SWITCH_NOSUBDIRS = " /ns"; //$NON-NLS-1$ - public static final String SWITCH_NOFILES = " /nf"; //$NON-NLS-1$ - - /** - * Constructor to use for a filter to list roots when used absolutely, or list all contents - * when used relatively. - */ - public RemoteFileFilterString() - { - file = "*"; //$NON-NLS-1$ - subdirs = true; - files = true; - } - - /** - * Constructor to use when there is no existing filter string. - * <p> - * This constructor is better that the default constructor, because it takes a remote file subsystem - * factory, from which we can query the folder and path separator characters, which are needed - * to parse and re-build filter strings. - * @see #setPath(String) - * @see #setFile(String) - * @see #setTypes(String[]) - */ - public RemoteFileFilterString(IRemoteFileSubSystemConfiguration subsysFactory) - { - PATH_SEP = subsysFactory.getSeparator(); - file = "*"; //$NON-NLS-1$ - subdirs = true; - files = true; - } - - /** - * Constructor to use when an absolute filter string already exists. - */ - public RemoteFileFilterString(IRemoteFileSubSystemConfiguration subsysFactory, String input) - { - this(subsysFactory); - parse(null, input); - } - - /** - * Constructor to use when you have a path and filename filter or comma-separated file types list. - * In the latter case, the last char must be a TYPE_SEP or comma, even for a single type. - */ - public RemoteFileFilterString(IRemoteFileSubSystemConfiguration subsysFactory, String path, String input) - { - this(subsysFactory); - parse(path, input); - } - - public void setSubSystemConfiguration(IRemoteFileSubSystemConfiguration subsysFactory) - { - PATH_SEP = subsysFactory.getSeparator(); - } - - /** - * Set the file name filter. You either call this or setTypes! - */ - public void setFile(String obj) - { - file = obj; - } - - /** - * Set the path to list files and/or folders in - */ - public void setPath(String path) - { - this.path = path; - } - - /** - * Set the file types to subset by. These are extensions, without the dot, as - * in java, class, gif, etc. - * You either call this or setFile! - */ - public void setTypes(String[] types) - { - this.types = types; - filterByTypes = (types != null); - } - - /** - * Allow files? - */ - public void setShowFiles(boolean set) - { - files = set; - } - - /** - * Allow subdirs? - */ - public void setShowSubDirs(boolean set) - { - subdirs = set; - } - - /** - * Get the file name filter - */ - public String getFile() - { - return file; - } - /** - * Return the file part of the filter string, without the path. - * This is either the file name filter or a comma-separated list of types if this - * is a file type filter string. - */ - public String getFileOrTypes() - { - if (!filterByTypes || (types==null)) - return file; - else - { - return getTypesString(types); - } - } - - /** - * Concatenate the given file types as a single string, each type comma-separated - */ - public static String getTypesString(String[] typesArray) - { - StringBuffer typesBuffer = new StringBuffer(""); //$NON-NLS-1$ - for (int idx=0; idx<typesArray.length; idx++) - typesBuffer.append(typesArray[idx]+","); //$NON-NLS-1$ - return typesBuffer.toString(); - } - - /** - * For file types filters, returns the types as a string of concatenated types, - * comma-delimited. For file name filters, returns null; - */ - public String getTypesAsString() - { - if (!filterByTypes || (types==null)) - return null; - return getTypesString(types); - } - - /** - * Get the path to list files and/or folders in - */ - public String getPath() - { - return path; - } - /** - * Get the types to subset by, if specified. - * Will be null if this is not a by-type filter string. - */ - public String[] getTypes() - { - return types; - } - - /** - * Should the filter show individual files? - */ - public boolean getShowFiles() - { - return files; - } - - /** - * Subdirs allowed? - */ - public boolean getShowSubDirs() - { - return subdirs; - } - - /** - * Return true if this filter string filters by file types versus by file name - */ - public boolean getFilterByTypes() - { - return filterByTypes; - } - - /** - * This filter string represent a list-roots filter string? - */ - public boolean listRoots() - { - //return toStringNoSwitches().equals("*"); - return (path==null || path.equals("/")); //$NON-NLS-1$ - } - - /** - * This filter string represent a list-files-in-root filter string? - */ - public boolean listRoot() - { - return toStringNoSwitches().equals("/*"); //$NON-NLS-1$ - } - - /** - * - */ - protected void parse(String inputPath, String input) - { - int idx = input.indexOf(SWITCH_NOSUBDIRS); - if (idx >= 0) - { - subdirs = false; - input = input.substring(0,idx); - } - else - subdirs = true; - idx = input.indexOf(SWITCH_NOFILES); - if (idx >= 0) - { - files = false; - input = input.substring(0,idx); - } - else - files = true; - if (inputPath != null) - { - path = inputPath; - parseFileOrTypes(input); // file = input; - } - else - { - int pathidx = input.lastIndexOf(PATH_SEP); - if (pathidx == 0) - { - // hmm, we have been given say \*.java -> what does this mean? On Windows, it - // would mean "*.java" in the current drive, whereas on Unix/Linux it would - // mean "*.java" in the root directory. - // For now, we are going with the Unix interpretation, and see if that leads - // to any problems on Windows, which should not allow such a filter anyway, unless - // it is absolute. - //path = null; - path = PATH_SEP; - if (input.length()>1) - //file = input.substring(1); // from the 2nd char on - parseFileOrTypes(input.substring(1)); // from the 2nd char on - else - file = "*"; //$NON-NLS-1$ - } - else if (pathidx>0) - { - path = input.substring(0,pathidx); - if (path.endsWith(":")) // special case: eg, given e: //$NON-NLS-1$ - path = path + PATH_SEP; // need it to be e:\ !! - if (pathidx == (input.length()-1)) - file = "*"; //$NON-NLS-1$ - else - //file = input.substring(pathidx+1); - parseFileOrTypes(input.substring(pathidx+1)); - } - else - { - path = null; - //file = input; - parseFileOrTypes(input); - } - } - ///File fileObj = (path==null)? new File(input) : new File(path, input); - //this.path = fileObj.getParent(); - //if (this.path == null) - //this.path = fileObj.getAbsolutePath(); // happens for root drives - //this.file = fileObj.getName(); - } - - /** - * Parse the non-folder part of the filter string. Will either be a - * generic name or comma-separated list of types. - */ - protected void parseFileOrTypes(String filter) - { - filterByTypes = false; - types = null; - if ((filter == null) || (filter.length()==0)) - { - file = "*"; //$NON-NLS-1$ - } - else if (filter.endsWith(TYPE_SEP_STRING)) - { - types = parseTypes(filter); - filterByTypes = true; - } - else - file = filter; - } - - /** - * Parse a comma-separated list of strings into an array of strings - */ - public static String[] parseTypes(String typeList) - { - StringTokenizer tokens = new StringTokenizer(typeList,TYPE_SEP_STRING); - Vector v = new Vector(); - while (tokens.hasMoreTokens()) - { - String token = tokens.nextToken().trim(); - if (token.length()>0) - v.addElement(token); - } - String[] types = new String[v.size()]; - for (int idx=0; idx<v.size(); idx++) - types[idx] = (String)v.elementAt(idx); - return types; - } - - /** - * Serialize into a string capturing all the attributes - */ - public String toString() - { - String fs = toStringNoSwitches(); - if (!getShowSubDirs()) - fs += SWITCH_NOSUBDIRS; - if (!getShowFiles()) - fs += SWITCH_NOFILES; - return fs; - } - - /** - * Return the filter as a string, without the switches for no-files, no-folders - */ - public String toStringNoSwitches() - { - String fs = null; - - // KM: defect 53009. Check where path is empty, so we don't add path separator to it - if (path == null || path.length() == 0) - fs = getFileOrTypes(); - else if (!path.endsWith(PATH_SEP)) - fs = path+PATH_SEP+getFileOrTypes(); - else - fs = path+getFileOrTypes(); - return fs; - } - - /** - * Clone this into another filter string object with the same attributes. - * - * Subclasses must ensure that such a deep copy operation is always - * possible, so their state must always be cloneable. Which should - * always be possible to achieve, since this Object also needs to be - * serializable. - */ - public Object clone() - { - RemoteFileFilterString copy = null; - try { - copy = (RemoteFileFilterString)super.clone(); - } catch(CloneNotSupportedException e) { - //assert false; //can never happen - throw new RuntimeException(e); - } - if (types!=null) { - copy.types = (String[])types.clone(); - } - return copy; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java deleted file mode 100644 index ddac9857f..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2008 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 - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.subsystems.files.core.model.SystemFileTransferModeRegistry; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; - - -/** - * Public utility class for dealing with remote file subsystems. - * - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public class RemoteFileUtility -{ - - /** - * Return the first remote file subsystem associated with a connection. - * @param connection the connection to query. - * @return an IRemoteFileSubSystem instance, or <code>null</code> if - * no file subsystem is configured with the given connection. - */ - public static IRemoteFileSubSystem getFileSubSystem(IHost connection) - { - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] sses = sr.getSubSystems(connection); - for (int i = 0; i < sses.length; i++) - { - if (sses[i] instanceof IRemoteFileSubSystem) - { - IRemoteFileSubSystem subSystem = (IRemoteFileSubSystem)sses[i]; - return subSystem; - } - } - return null; - } - - /** - * Return the list of file subsystems associated with a connection. - * @param connection the connection to query. - * @return a list of IRemoteFileSubSystem instances (may be empty). - */ - public static IRemoteFileSubSystem[] getFileSubSystems(IHost connection) - { - List results = new ArrayList(); - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - ISubSystem[] sses = sr.getSubSystems(connection); - for (int i = 0; i < sses.length; i++) - { - if (sses[i] instanceof IRemoteFileSubSystem) - { - IRemoteFileSubSystem subSystem = (IRemoteFileSubSystem)sses[i]; - results.add(subSystem); - } - } - return (IRemoteFileSubSystem[])results.toArray(new IRemoteFileSubSystem[results.size()]); - } - - /** - * Return the first remote file subsystem configuration associated with a system type. - * @param systemType the system type to query. - * @return an IRemoteFileSubSystemConfiguration instance, or <code>null</code> if - * no file subsystem is configured with the given system type. - */ - public static IRemoteFileSubSystemConfiguration getFileSubSystemConfiguration(IRSESystemType systemType) - { - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] sses = sr.getSubSystemConfigurationsBySystemType(systemType, false); - for (int i = 0; i < sses.length; i++) - { - if (sses[i] instanceof IRemoteFileSubSystemConfiguration) - { - return (IRemoteFileSubSystemConfiguration)sses[i]; - } - } - return null; - } - - /** - * Return the global SystemFileTransferModeRegistry. - * @return the global SystemFileTransferModeRegistry. - * @since 3.0 - */ - public static ISystemFileTransferModeRegistry getSystemFileTransferModeRegistry() - { - return SystemFileTransferModeRegistry.getInstance(); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/AbstractRemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/AbstractRemoteFile.java deleted file mode 100644 index c95542b73..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/AbstractRemoteFile.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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: - * David McKnight (IBM) - [231209] [api][breaking] IRemoteFile.getSystemConnection() should be changed to IRemoteFile.getHost() - * Martin Oberhuber (Wind River) - [234726] Update IRemoteFile Javadocs - * David McKnight (IBM) - [223461] [Refresh][api] Refresh expanded folder under filter refreshes Filter - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile; - - -public abstract class AbstractRemoteFile extends RemoteFile -{ - protected IHostFile _hostFile; - protected FileServiceSubSystem _subSystem; - protected String _classiciation; - - - public AbstractRemoteFile(FileServiceSubSystem subSystem, IRemoteFileContext context, IRemoteFile parent, IHostFile hostFile) - { - super(context); - _subSystem = subSystem; - _hostFile = hostFile; - setParentRemoteFile(parent); - if (_hostFile.isFile() && !_hostFile.isArchive()) // no need to query this again so marking false for stale - markStale(false, false); - } - - public IRemoteFileSubSystem getParentRemoteFileSubSystem() - { - return _subSystem; - } - - public IHost getHost() - { - return _subSystem.getHost(); - } - - public String getAbsolutePath() - { - return _hostFile.getAbsolutePath(); - } - - - public String getLabel() - { - return _hostFile.getName(); - } - - public String getName() - { - return _hostFile.getName(); - } - - public String getParentPath() - { - return _hostFile.getParentPath(); - } - - public boolean isRoot() - { - return _hostFile.isRoot(); - } - - public boolean isDirectory() - { - return _hostFile.isDirectory(); - } - - public boolean isFile() - { - return _hostFile.isFile(); - } - - - public boolean exists() - { - return _hostFile.exists(); - } - - public long getLastModified() - { - return _hostFile.getModifiedDate(); - } - - - public long getLength() - { - return _hostFile.getSize(); - } - - public int compareTo(Object other) throws ClassCastException - { - IRemoteFile otherFile = (IRemoteFile)other; - if (otherFile.isFile()) - { - if (isFile()) - { - String otherPath = otherFile.getAbsolutePath(); - String thisPath = getAbsolutePath(); - - return thisPath.compareToIgnoreCase(otherPath); - } - else - { - return -1; - } - } - else // not file - { - if (isDirectory()) - { - String otherPath = otherFile.getAbsolutePath(); - String thisPath = getAbsolutePath(); - - return thisPath.compareToIgnoreCase(otherPath); - } - else - { - return 1; - } - } - } - - public boolean showBriefPropertySet() - { - // TODO Auto-generated method stub - return false; - } - - /** - * @deprecated - shouldn't need apis like this - */ - public String getParentNoRoot() - { - String parentPath = getParentPath(); - return parentPath; - } - - /** - * @deprecated - shouldn't need apis like this - */ - public String getRoot() - { - // TODO Auto-generated method stub - return null; - } - - public String getParentName() - { - // TODO Auto-generated method stub - return null; - } - - public boolean isHidden() - { - return _hostFile.isHidden(); - } - - public boolean isVirtual() - { - // TODO Auto-generated method stub - return false; - } - - public boolean canRead() - { - return _hostFile.canRead(); - } - - public boolean canWrite() - { - return _hostFile.canWrite(); - } - - public boolean showReadOnlyProperty() - { - return true; - } - - public IHostFile getHostFile() - { - return _hostFile; - } - - /** - * Replacing the current associated IHostFile with a new one - * - * @param hostFile the new host file - * - * @since 3.0 - */ - public void setHostFile(IHostFile hostFile) { - _hostFile = hostFile; - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java deleted file mode 100644 index 0d77291d3..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java +++ /dev/null @@ -1,1229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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) - Fix 158534 - NPE in upload/download after conflict - * Martin Oberhuber (Wind River) - Fix 162962 - recursive removeCachedRemoteFile() - * Martin Oberhuber (Wind River) - [168596] FileServiceSubSystem.isCaseSensitive() - * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods - * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API - * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem - * Javier Montalvo Orus (Symbian) - [199773] Default file transfer mode is ignored for some file types - * David McKnight (IBM) - [207095] Implicit connect on getRemoteFileObject - * David McKnight (IBM) - [207100] fire event after upload and download - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - * David McKnight (IBM) - [162195] new APIs for upload multi and download multi - * David McKnight (IBM) - [203114] don't treat XML files specially (no hidden prefs for bin vs text) - * David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated - * Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND - * David McKnight (IBM) - [209704] added supportsEncodingConversion() - * David Dykstal (IBM) - [197036] pulling up subsystem switch logic - * David Dykstal (IBM) - [217556] remove service subsystem types - * Martin Oberhuber (Wind River) - [219098][api] FileServiceSubSystem should not be final - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible - * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared - * Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check - * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading - * David Dykstal (IBM) - [221211] fix IFileService API for batch operations - * Martin Oberhuber (Wind River) - [221211] Fix markStale() for delete() operation with exceptions - * David Dykstal (IBM) - [230821] fix IRemoteFileSubSystem API to be consistent with IFileService - * Martin Oberhuber (Wind River) - [234038] Mark IRemoteFile stale when changing permissions - * Martin Oberhuber (Wind River) - [235360][ftp][ssh][local] Return proper "Root" IHostFile - * David McKnight (IBM) - [223461] [Refresh][api] Refresh expanded folder under filter refreshes Filter - * Martin Oberhuber (Wind River) - [240704] Protect against illegal API use of getRemoteFileObject() with relative path as name - * Martin Oberhuber (Wind River) - [234026] Clarify IFileService#createFolder() Javadocs - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemRemoteChangeEvents; -import org.eclipse.rse.core.events.SystemRemoteChangeEvent; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType; -import org.eclipse.rse.internal.subsystems.files.core.Activator; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFileMessageIds; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.clientserver.PathUtility; -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath; -import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; -import org.eclipse.rse.services.clientserver.messages.CommonMessages; -import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds; -import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; -import org.eclipse.rse.services.clientserver.messages.SystemElementNotFoundException; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.services.search.IHostSearchResultSet; -import org.eclipse.rse.services.search.ISearchService; -import org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileContext; -import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem; -import org.eclipse.rse.ui.SystemBasePlugin; - -/** - * Generic Subsystem implementation for remote files. - * - * Clients may instantiate this class from their subsystem configurations. - * <p> - * Extending (overriding) this class is discouraged: configuration of the subsystem - * behavior should be done by providing a custom {@link IFileService} implementation - * wherever possible. - */ -public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileServiceSubSystem -{ - - protected ILanguageUtilityFactory _languageUtilityFactory; - protected IFileService _hostFileService; - protected ISearchService _hostSearchService; - protected IHostFileToRemoteFileAdapter _hostFileToRemoteFileAdapter; - protected IRemoteFile _userHome; - public FileServiceSubSystem(IHost host, IConnectorService connectorService, IFileService hostFileService, IHostFileToRemoteFileAdapter fileAdapter, ISearchService searchService) - { - super(host, connectorService); - _hostFileService = hostFileService; - _hostFileToRemoteFileAdapter = fileAdapter; - _hostSearchService = searchService; - - } - - /* (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#isCaseSensitive() - */ - public boolean isCaseSensitive() { - return getFileService().isCaseSensitive(); - } - - public IRemoteFileContext getContextFor(IRemoteFile file) - { - return getContext(file); - } - - public IRemoteFileContext getTheDefaultContext() - { - return getDefaultContextNoFilterString(); - } - - public IFileService getFileService() - { - return _hostFileService; - } - - public void setFileService(IFileService service) - { - _hostFileService = service; - } - - public ISearchService getSearchService() - { - return _hostSearchService; - } - - public void setSearchService(ISearchService service) - { - _hostSearchService = service; - } - - public IHostFileToRemoteFileAdapter getHostFileToRemoteFileAdapter() - { - return _hostFileToRemoteFileAdapter; - } - - public void setHostFileToRemoteFileAdapter(IHostFileToRemoteFileAdapter hostFileAdapter) - { - _hostFileToRemoteFileAdapter = hostFileAdapter; - } - - /** - * Constructs an IRemoteFile object given - * an unqualified file or folder name and its parent folder object. - * @param parent Folder containing the folder or file - * @param folderOrFileName Un-qualified folder or file name - * @param monitor the progress monitor - * @return an IRemoteFile object for the file. - * @see IRemoteFile - */ - public IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException - { - // Consistency would be totally messed up if folderOrFileName were a relative path - // Because IHostFiles would be incorrectly generated, getParent() would return wrong results etc - assert folderOrFileName.indexOf(getSeparator())<0; - // for bug 207095, implicit connect if the connection is not connected - checkIsConnected(monitor); - - String fullPath = parent.getAbsolutePath() + getSeparator() + folderOrFileName; - IRemoteFile file = getCachedRemoteFile(fullPath); - if (file != null && !file.isStale()) - { - return file; - } - // Fallback in case of incorrect API usage - // TODO remove this in next release for Performance, - // since it is just for bad clients using the API incorrectly - if (folderOrFileName.indexOf(getSeparator()) >= 0) { - try { - throw new IllegalArgumentException("getRemoteFileObject: folderOrFileName must not be a relative path"); //$NON-NLS-1$ - } catch (IllegalArgumentException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Illegal API use: " + e.getLocalizedMessage(), e)); //$NON-NLS-1$ - } - return getRemoteFileObject(fullPath, monitor); - } - - IHostFile node = getFile(parent.getAbsolutePath(), folderOrFileName, monitor); - return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, node); - } - - - - /** - * Constructs and returns an IRemoteFile object given a fully-qualified - * file or folder name. - * @param folderOrFileName Fully qualified folder or file name - * @param monitor the progress monitor - * @return The constructed IRemoteFile - * @see IRemoteFile - */ - public IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException - { - - String fofName = folderOrFileName; - if (folderOrFileName.length() > 1) - { - fofName = ArchiveHandlerManager.cleanUpVirtualPath(folderOrFileName); - } - IRemoteFile file = getCachedRemoteFile(fofName); - if (file != null && !file.isStale()) { - return file; - } - - // for bug 207095, implicit connect if the connection is not connected - checkIsConnected(monitor); - - if (fofName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR)) - { - fofName = fofName.substring(0, fofName.length() - ArchiveHandlerManager.VIRTUAL_SEPARATOR.length()); - } - - int j = fofName.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR); - if (j == -1) - { - if (fofName.equals("/")) //$NON-NLS-1$ - { - try - { - return listRoots(null)[0]; - } - catch (Exception e) - { - - } - } - - if (fofName.equals(".")) { //$NON-NLS-1$ - IRemoteFile userHome = getUserHome(); - if (userHome == null){ - - // with 207095, it's possible that we could be trying to get user home when not connected - SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, - ICommonMessageIds.MSG_ERROR_UNEXPECTED, - IStatus.ERROR, - CommonMessages.MSG_ERROR_UNEXPECTED); - throw new SystemMessageException(msg); - } - return userHome; - } - - String sep = PathUtility.getSeparator(folderOrFileName); - if (fofName.endsWith(sep)) - { - fofName = fofName.substring(0, fofName.length() - sep.length()); - } - - if (fofName.endsWith(":")) //$NON-NLS-1$ - { - try - { - IHostFile[] roots = getRoots(null); - for (int i = 0; i < roots.length; i++) - if (roots[i].getAbsolutePath().toLowerCase().startsWith(fofName.toLowerCase())) - return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), null, roots[i]); - } - catch (InterruptedException e) - { - } - return null; - } - - int lastSep = fofName.lastIndexOf(sep); - - if (lastSep > -1) - { - String parentPath = fofName.substring(0, lastSep); - - - if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$ - String name = fofName.substring(lastSep + 1, fofName.length()); - - IHostFile node = getFile(parentPath, name, monitor); - if (node != null) - { - IRemoteFile parent = null; - if (!node.isRoot()) - { - //parent = getRemoteFileObject(parentPath); - } - return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, node); - } - } - return null; - } - else - { - AbsoluteVirtualPath avp = new AbsoluteVirtualPath(fofName); - IHostFile node = getFile(avp.getPath(), avp.getName(), null); - if (node != null) - { - return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), null, node); - } - else return null; - } - } - - - - - - /** - * @return The IRemoteFile that is the user's home directory on this remote file system. - * The remote file system is assumed to have a concept of a home directory. - */ - protected IRemoteFile getUserHome() - { - if (_userHome != null) - { - return _userHome; - } - IRemoteFile root = getCachedRemoteFile("."); //$NON-NLS-1$ - if (root != null && !root.isStale()) { - return root; - } - IHostFile userHome = getFileService().getUserHome(); - // with 207095, it's possible that user is not connected, and that userHome is null - if (userHome == null) { - return null; - } - - IRemoteFile parent = null; - if (!".".equals(userHome.getParentPath())) //$NON-NLS-1$ - { - //note: parent path can be "null" if userHome is a Root - try - { - //parent = getRemoteFileObject(userHome.getParentPath()); - } - catch (Exception e) - { - } - } - root = getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, userHome); - cacheRemoteFile(root, "."); //$NON-NLS-1$ - _userHome = root; - return root; - } - - /** - * Return a list of children from the given parent path in service layer format. - * Was unified from the previous methods getFolders(), getFiles() and getFilesAndFolders() - * in RSE 3.0 - * @since 3.0 - */ - protected IHostFile[] internalList(String parentPath, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException - { - return getFileService().list(parentPath, fileNameFilter, fileType, monitor); - } - - protected IHostFile getFile(String parentPath, String fileName, IProgressMonitor monitor) throws SystemMessageException - { - return getFileService().getFile(parentPath, fileName, monitor); - } - - protected IHostFile[] getRoots(IProgressMonitor monitor) throws InterruptedException, SystemMessageException - { - return getFileService().getRoots(monitor); - } - - public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, - IProgressMonitor monitor) throws SystemMessageException - { - // for bug 207095, implicit connect if the connection is not connected - checkIsConnected(monitor); - - String[] parentPaths = new String[folderOrFileNames.length]; - String[] names = new String[folderOrFileNames.length]; - String sep = null; - for (int i = 0; i < folderOrFileNames.length; i++) - { - String fofName = folderOrFileNames[i]; - if (sep == null) - sep = PathUtility.getSeparator(fofName); - - String parentPath = null; - String name = null; - int lastSep = fofName.lastIndexOf(sep); - - if (lastSep > -1) - { - parentPath = fofName.substring(0, lastSep); - - if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$ - name = fofName.substring(lastSep + 1, fofName.length()); - } - - parentPaths[i] = parentPath; - names[i] = name; - } - - RemoteFileContext context = getDefaultContext(); - List hostFiles = new ArrayList(10); - getFileService().getFileMultiple(parentPaths, names, hostFiles, monitor); - IHostFile[] nodes = new IHostFile[hostFiles.size()]; - hostFiles.toArray(nodes); - return getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, nodes); - } - - - /** - * {@inheritDoc} - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, String[] fileNameFilters, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException - { - String[] parentPaths = new String[parents.length]; - for (int i = 0; i < parents.length; i++) - { - parentPaths[i] = parents[i].getAbsolutePath(); - } - - List hostFiles = new ArrayList(10); - - // query children via the service - getFileService().listMultiple(parentPaths, fileNameFilters, fileTypes, hostFiles, monitor); - RemoteFileContext context = getDefaultContext(); - - IHostFile[] results = (IHostFile[])hostFiles.toArray(new IHostFile[hostFiles.size()]); - - // convert the IHostFiles into AbstractRemoteFiles - AbstractRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results); - - // cache the results corresponding to each parent under each parent - for (int i = 0; i < parents.length; i++) - { - IRemoteFile parent = parents[i]; - String parentPath = parentPaths[i]; - String filter = fileNameFilters[i]; - - List underParent = new ArrayList(); - // what files are under this one? - for (int j = 0; j < farr.length; j++) - { - IRemoteFile child = farr[j]; - String childParentPath = child.getParentPath(); - - if (parentPath.equals(childParentPath)) - { - underParent.add(child); - } - } - - // update the parent with it's latest properties - // null is passed for the second argument because we currently don't get the parent in our results query - updateRemoteFile(parent, null, monitor); - - if (underParent.size() > 0) - { - Object[] qresults = underParent.toArray(); - parent.setContents(RemoteChildrenContentsType.getInstance(), filter, qresults); - } - } - - return farr; - } - - - /** - * {@inheritDoc} - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, String[] fileNameFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException - { - String[] parentPaths = new String[parents.length]; - for (int i = 0; i < parents.length; i++) - { - parentPaths[i] = parents[i].getAbsolutePath(); - } - - - List hostFiles = new ArrayList(10); - // query children via the service - getFileService().listMultiple(parentPaths, fileNameFilters, fileType, hostFiles, monitor); - RemoteFileContext context = getDefaultContext(); - - IHostFile[] results = (IHostFile[])hostFiles.toArray(new IHostFile[hostFiles.size()]); - - // convert the IHostFiles into AbstractRemoteFiles - AbstractRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results); - - // cache the results corresponding to each parent under each parent - for (int i = 0; i < parents.length; i++) - { - IRemoteFile parent = parents[i]; - String parentPath = parentPaths[i]; - String filter = fileNameFilters[i]; - - List underParent = new ArrayList(); - // what files are under this one? - for (int j = 0; j < farr.length; j++) - { - AbstractRemoteFile child = farr[j]; - String childParentPath = child.getParentPath(); - - if (parentPath.equals(childParentPath)) - { - underParent.add(child); - } - } - - // update the parent with it's latest properties - // null is passed for the second argument because we currently don't get the parent in our results query - updateRemoteFile(parent, null, monitor); - - if (underParent.size() > 0) - { - Object[] qresults = underParent.toArray(); - parent.setContents(RemoteChildrenContentsType.getInstance(), filter, qresults); - } - } - - return farr; - } - - - /** - * {@inheritDoc} - * @since 3.0 - */ - public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, int fileType, IProgressMonitor monitor) throws SystemMessageException - { - String parentPath = null; - if (parent != null) { - parentPath = parent.getAbsolutePath(); - } else { - parentPath = "/"; //$NON-NLS-1$ - } - - if (parent != null && !parent.canRead()) - { - String msgTxt = NLS.bind(SystemFileResources.MSG_FOLDER_UNREADABLE, parentPath); - SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.MSG_FOLDER_UNREADABLE, - IStatus.INFO, msgTxt); - throw new SystemMessageException(msg); - } - - // query children of the parent - IHostFile[] results = internalList(parentPath, fileNameFilter, fileType, monitor); - - // update the parent with it's latest properties - // null is passed for the second argument because we currently don't get the parent in our results query - updateRemoteFile(parent, null, monitor); - - // convert the IHostFiles to AbstractRemoteFile[] - AbstractRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results); - if (parent != null) - parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr); - return farr; - } - - - - private void updateRemoteFile(IRemoteFile parent, IHostFile newHostParent, IProgressMonitor monitor) throws SystemMessageException - { - // now newHostParent file passed in so we'll assume it wasn't returned and explicitly get it - if (newHostParent == null){ - String parentParentPath = parent.getParentPath(); - if (parentParentPath == null){ - parentParentPath = ""; //$NON-NLS-1$ - } - newHostParent = getFileService().getFile(parentParentPath, parent.getName(), monitor); - } - - if (newHostParent != null){ - IHostFile oldHostParent = parent.getHostFile(); - if (!newHostParent.equals(oldHostParent)){ - ((AbstractRemoteFile)parent).setHostFile(newHostParent); - parent.markStale(false); - } - } - } - - - public IRemoteFile[] listRoots(IRemoteFileContext context, IProgressMonitor monitor) throws InterruptedException - { - IHostFile[] roots = null; - try - { - roots = getRoots(monitor); - } - catch (SystemMessageException e) - { - - } - - IRemoteFile[] results = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, roots); - return results; - } - - protected boolean isBinary(String localEncoding, String hostEncoding, String remotePath) - { - return RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(remotePath); - } - - protected boolean isBinary(IRemoteFile source) - { - return source.isBinary(); // always use preferences (whether xml or not) - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#upload(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public void upload(String source, String srcEncoding, String remotePath, String rmtEncoding, IProgressMonitor monitor) throws SystemMessageException { - int slashIndex = remotePath.lastIndexOf(getSeparator()); - if (slashIndex > -1) { - String remoteParentPath = remotePath.substring(0, slashIndex); - String remoteFileName = remotePath.substring(slashIndex + 1, remotePath.length()); - boolean isBinary = isBinary(srcEncoding, rmtEncoding, remotePath); - if (ArchiveHandlerManager.isVirtual(remotePath)) - { - AbsoluteVirtualPath avp = new AbsoluteVirtualPath(remotePath); - remoteParentPath = avp.getPath(); - remoteFileName = avp.getName(); - } - getFileService().upload(new File(source), remoteParentPath, remoteFileName, isBinary, srcEncoding, rmtEncoding, monitor); - - // notify that the file was uploaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, remotePath, remoteParentPath, this)); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#upload(java.lang.String, org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public void upload(String source, IRemoteFile destination, String encoding, IProgressMonitor monitor) throws SystemMessageException - { - String remoteParentPath = destination.getParentPath(); - String remoteFileName = destination.getName(); - String hostEncoding = destination.getEncoding(); - boolean isBinary = isBinary(encoding, hostEncoding, destination.getAbsolutePath()); - - if ((destination.exists() && !destination.canWrite()) || (!destination.exists() && !destination.getParentRemoteFile().canWrite())) - { - String msgTxt = NLS.bind(SystemFileResources.MSG_FILE_CANNOT_BE_SAVED, remoteFileName, getHostName()); - String msgDetails = SystemFileResources.MSG_FILE_CANNOT_BE_SAVED_DETAILS; - - SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.MSG_FILE_CANNOT_BE_SAVED, - IStatus.ERROR, msgTxt, msgDetails); - throw new SystemMessageException(msg); - } - getFileService().upload(new File(source), remoteParentPath, remoteFileName, isBinary, encoding, hostEncoding, monitor); - - // notify that the file was uploaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, destination, destination.getParentRemoteFile(), this)); - } - - /** - * {@inheritDoc} - * @since 3.0 - */ - public void uploadMultiple(String[] sources, String[] srcEncodings, - String[] remotePaths, String[] rmtEncodings, - IProgressMonitor monitor) throws SystemMessageException - { - // create list of stuff - File[] sourceFiles = new File[sources.length]; - boolean[] isBinaries = new boolean[sources.length]; - String[] remoteParentPaths = new String[sources.length]; - String[] remoteFileNames = new String[sources.length]; - - // gather info - for (int i = 0; i < sources.length; i++) - { - sourceFiles[i] = new File(sources[i]); - String remotePath = remotePaths[i]; - int slashIndex = remotePath.lastIndexOf(getSeparator()); - if (slashIndex > -1) { - remoteParentPaths[i] = remotePath.substring(0, slashIndex); - remoteFileNames[i] = remotePath.substring(slashIndex + 1, remotePath.length()); - isBinaries[i] = isBinary(srcEncodings[i], rmtEncodings[i], remotePath); - if (ArchiveHandlerManager.isVirtual(remotePath)) - { - AbsoluteVirtualPath avp = new AbsoluteVirtualPath(remotePath); - remoteParentPaths[i] = avp.getPath(); - remoteFileNames[i] = avp.getName(); - } - } - else // unexpected - { - // throw an exception here - //SystemMessage msg = RSEUIPlugin.getPluginMessage("RSEF5003").makeSubstitution(remoteFileNames[i], getHostName()); //$NON-NLS-1$ - //throw new SystemMessageException(msg); - } - } - - // upload - getFileService().uploadMultiple(sourceFiles, remoteParentPaths, remoteFileNames, isBinaries, srcEncodings, rmtEncodings, monitor); - - // notification - // notify that the file was uploaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - for (int j = 0; j < remotePaths.length; j++) - { - String remotePath = remotePaths[j]; - String remoteParentPath = remoteParentPaths[j]; - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, remotePath, remoteParentPath, this)); - } - } - - /** - * {@inheritDoc} - * @since 3.0 - */ - public void uploadMultiple(String[] sources, IRemoteFile[] destinations, - String[] encodings, IProgressMonitor monitor) - throws SystemMessageException -{ - // create list of stuff - File[] sourceFiles = new File[sources.length]; - boolean[] isBinaries = new boolean[sources.length]; - String[] remoteParentPaths = new String[sources.length]; - String[] remoteFileNames = new String[sources.length]; - String[] hostEncodings = new String[sources.length]; - - // gather info - for (int i = 0; i < sources.length; i++) - { - sourceFiles[i] = new File(sources[i]); - IRemoteFile destination = destinations[i]; - - remoteParentPaths[i] = destination.getAbsolutePath(); - remoteFileNames[i] = destination.getName(); - - if (!destination.canWrite()) - { - String msgTxt = NLS.bind(SystemFileResources.MSG_FILE_CANNOT_BE_SAVED, remoteFileNames[i], getHostName()); - String msgDetails = SystemFileResources.MSG_FILE_CANNOT_BE_SAVED_DETAILS; - - SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.MSG_FILE_CANNOT_BE_SAVED, - IStatus.ERROR, msgTxt, msgDetails); - throw new SystemMessageException(msg); - } - - hostEncodings[i] = destination.getEncoding(); - isBinaries[i] = isBinary(encodings[i], hostEncodings[i], destination.getAbsolutePath()); - - } - - // upload - getFileService().uploadMultiple(sourceFiles, remoteParentPaths, remoteFileNames, isBinaries, encodings, hostEncodings, monitor); - - // notification - // notify that the file was uploaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - for (int j = 0; j < destinations.length; j++) - { - IRemoteFile destination = destinations[j]; - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, destination, destination.getParentRemoteFile(), this)); - } - - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#download(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public void download(IRemoteFile file, String localpath, String encoding, IProgressMonitor monitor) throws SystemMessageException - { - //Fixing bug 158534. TODO remove when bug 162688 is fixed. - if (monitor==null) { - monitor = new NullProgressMonitor(); - } - String parentPath = file.getParentPath(); - File localFile = new File(localpath); - - // FIXME why are we using file.getEncoding() instead of the specified encoding? - getFileService().download(parentPath, file.getName(), localFile, isBinary(file), file.getEncoding(), monitor); - if (monitor.isCanceled()) - { - localFile.delete(); - } - else - { - // notify that the file was downloaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DOWNLOADED, file, file.getParentRemoteFile(), this)); - - } - } - - /** - * {@inheritDoc} - * @since 3.0 - */ - public void downloadMultiple(IRemoteFile[] sources, String[] destinations, - String[] encodings, IProgressMonitor monitor) - throws SystemMessageException - { - //Fixing bug 158534. TODO remove when bug 162688 is fixed. - if (monitor==null) { - monitor = new NullProgressMonitor(); - } - - // get arrays of parent paths and local files - String[] parentPaths = new String[sources.length]; - String[] names = new String[sources.length]; - boolean[] isBinaries = new boolean[sources.length]; - File[] localFiles = new File[sources.length]; - - for (int i = 0; i < sources.length; i++) - { - IRemoteFile file = sources[i]; - parentPaths[i] = file.getParentPath(); - names[i] = file.getName(); - isBinaries[i] = isBinary(file); - localFiles[i] = new File(destinations[i]); - } - - getFileService().downloadMultiple(parentPaths, names, localFiles, isBinaries, encodings, monitor); - if (monitor.isCanceled()) - { - for (int d = 0; d < localFiles.length; d++) - { - File f = localFiles[d]; - f.delete(); - } - } - else - { - // notify that the file was downloaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - - for (int r = 0; r < sources.length; r++) - { - IRemoteFile file = sources[r]; - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DOWNLOADED, file, file.getParentRemoteFile(), this)); - } - } - } - - /** - * {@inheritDoc} - * - * @since 3.0 returns void - */ - public void copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException - { - IFileService service = getFileService(); - service.copy(sourceFolderOrFile.getParentPath(), sourceFolderOrFile.getName(), targetFolder.getAbsolutePath(), newName, monitor); - } - - /** - * {@inheritDoc} - * - * @since 3.0 returns void - */ - public void copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException - { - IFileService service = getFileService(); - String[] sourceParents = new String[sourceFolderOrFiles.length]; - String[] sourceNames = new String[sourceFolderOrFiles.length]; - - for (int i = 0; i < sourceFolderOrFiles.length; i++) - { - sourceParents[i] = sourceFolderOrFiles[i].getParentPath(); - sourceNames[i] = sourceFolderOrFiles[i].getName(); - } - service.copyBatch(sourceParents, sourceNames, targetFolder.getAbsolutePath(), monitor); - } - - public IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor) - { - try - { - return getRemoteFileObject(folderOrFile.getParentPath(), monitor); - } - catch (Exception e) - { - return null; - } - } - - public IRemoteFile createFile(IRemoteFile fileToCreate, IProgressMonitor monitor) throws SystemMessageException - { - IFileService service = getFileService(); - String parent = fileToCreate.getParentPath(); - String name = fileToCreate.getName(); - IHostFile newFile = service.createFile(parent, name, monitor); - return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), fileToCreate.getParentRemoteFile(), newFile); - } - - public IRemoteFile createFolder(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException - { - IFileService service = getFileService(); - String parent = folderToCreate.getParentPath(); - String name = folderToCreate.getName(); - IHostFile newFolder = service.createFolder(parent, name, monitor); - return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), folderToCreate.getParentRemoteFile(), newFolder); - } - - public IRemoteFile createFolders(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException - { - try { - //As per IFileService#createFolder() API Docs, Services *may* create parent folders. - //Therefore, first try this shortcut before actually iterating to create parents. - return createFolder(folderToCreate, monitor); - } catch (SystemMessageException e) { - //Parent did not exist? Need to create parent folders on this Service - IFileService service = getFileService(); - List parents = new ArrayList(); - IRemoteFile parent = folderToCreate; - while (!parent.isRoot()) { - parent = parent.getParentRemoteFile(); - IHostFile parentFile = service.getFile(parent.getParentPath(), parent.getName(), monitor); - if (parentFile.exists()) { - //Update cache with newest info, since we just got it - getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent.getParentRemoteFile(), parentFile); - break; - } else { - parents.add(parent); - } - } - if (parents.size()==0) { - //No parents missing -- throw original exception - throw e; - } - for (int i=parents.size()-1; i>=0; i--) { - parent = (IRemoteFile)parents.get(i); - // Remote side will change due to createFolder, so mark it stale - parent.markStale(true, true); - // Create new folder and cache the contents - createFolder(parent, monitor); - } - return createFolder(folderToCreate, monitor); - } - } - - /** - * {@inheritDoc} - * @since 3.0 returns void - */ - public void delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException - { - IFileService service = getFileService(); - String parent = folderOrFile.getParentPath(); - String name = folderOrFile.getName(); - try { - service.delete(parent, name, monitor); - } finally { - folderOrFile.markStale(true); - } - } - - /** - * {@inheritDoc} - * @since 3.0 returns void - */ - public void deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException - { - - String[] parents = new String[folderOrFiles.length]; - String[] names = new String[folderOrFiles.length]; - for (int i = 0; i < folderOrFiles.length; i++) - { - parents[i] = folderOrFiles[i].getParentPath(); - names[i] = folderOrFiles[i].getName(); - folderOrFiles[i].markStale(true); - //bug 162962: need to recursively remove children from cache - removeCachedRemoteFile(folderOrFiles[i]); - } - IFileService service = getFileService(); - service.deleteBatch(parents, names, monitor); - } - - /** - * {@inheritDoc} - * @since 3.0 returns void - */ - public void rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException - { - removeCachedRemoteFile(folderOrFile); - IFileService service = getFileService(); - String srcParent = folderOrFile.getParentPath(); - String oldName = folderOrFile.getName(); - String newPath = srcParent + folderOrFile.getSeparator() + newName; - service.rename(srcParent, oldName, newName, monitor); - folderOrFile.getHostFile().renameTo(newPath); - } - - /** - * {@inheritDoc} - * @since 3.0 returns void - */ - public void move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException - { - IFileService service = getFileService(); - String srcParent = sourceFolderOrFile.getParentPath(); - String srcName = sourceFolderOrFile.getName(); - String tgtParent = targetFolder.getAbsolutePath(); - removeCachedRemoteFile(sourceFolderOrFile); - try { - service.move(srcParent, srcName, tgtParent, newName, monitor); - } finally { - sourceFolderOrFile.markStale(true); - targetFolder.markStale(true); - } - } - - /** - * {@inheritDoc} - * @since 3.0 returns void - */ - public void setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException - { - String name = folderOrFile.getName(); - String parent = folderOrFile.getParentPath(); - //mark stale regardless of whether the call succeeds or not - folderOrFile.markStale(true); - _hostFileService.setLastModified(parent, name, newDate, monitor); - } - - /** - * {@inheritDoc} - * @since 3.0 returns void - */ - public void setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException - { - String name = folderOrFile.getName(); - String parent = folderOrFile.getParentPath(); - //mark stale regardless of whether the call succeeds or not - folderOrFile.markStale(true); - _hostFileService.setReadOnly(parent, name, readOnly, monitor); - } - - public ILanguageUtilityFactory getLanguageUtilityFactory() - { - if (_languageUtilityFactory == null) - { - _languageUtilityFactory = ((IFileServiceSubSystemConfiguration)getParentRemoteFileSubSystemConfiguration()).getLanguageUtilityFactory(this); - } - return _languageUtilityFactory; - } - - public void setLanguageUtilityFactory(ILanguageUtilityFactory factory) - { - _languageUtilityFactory = factory; - } - - public void search(IHostSearchResultConfiguration searchConfig) - { - ISearchService searchService = getSearchService(); - if (searchService != null) - { - SearchJob job = new SearchJob(searchConfig, searchService, getFileService()); - job.schedule(); - } - } - - /** - * {@inheritDoc} - * @see IRemoteFileSubSystem#cancelSearch(IHostSearchResultConfiguration) - */ - public void cancelSearch(IHostSearchResultConfiguration searchConfig) - { - ISearchService searchService = getSearchService(); - if (searchService != null) - { - searchService.cancelSearch(searchConfig, null); - } - } - - public IHostSearchResultConfiguration createSearchConfiguration(IHostSearchResultSet resultSet, Object searchTarget, SystemSearchString searchString) - { - ISearchService searchService = getSearchService(); - if (searchService != null) - { - IFileServiceSubSystemConfiguration factory = (IFileServiceSubSystemConfiguration)getParentRemoteFileSubSystemConfiguration(); - if (factory != null) - { - return factory.createSearchConfiguration(getHost(), resultSet, searchTarget, searchString); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#canSwitchTo(org.eclipse.rse.core.subsystems.ISubSystemConfiguration) - * Overriding the super implementation to return true for any configuration that implements IFileServiceSubSystemConfiguration - */ - public boolean canSwitchTo(ISubSystemConfiguration configuration) { - return (configuration instanceof IFileServiceSubSystemConfiguration); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystem#internalSwitchServiceSubSystemConfiguration(org.eclipse.rse.core.subsystems.ISubSystemConfiguration) - * Overriding the super implementation to do switch the file subsystem bits that need to be copied or initialized in a switch - */ - protected void internalSwitchSubSystemConfiguration(ISubSystemConfiguration newConfig) { - if (newConfig instanceof IFileServiceSubSystemConfiguration) { - IHost host = getHost(); - IFileServiceSubSystemConfiguration config = (IFileServiceSubSystemConfiguration) newConfig; - // file subsystem specific bits - _cachedRemoteFiles.clear(); - _languageUtilityFactory = null; - setFileService(config.getFileService(host)); - setHostFileToRemoteFileAdapter(config.getHostFileAdapter()); - setSearchService(config.getSearchService(host)); - } - } - - public Class getServiceType() - { - return IFileService.class; - } - - public void initializeSubSystem(IProgressMonitor monitor) - { - super.initializeSubSystem(monitor); - getFileService().initService(monitor); - } - - public void uninitializeSubSystem(IProgressMonitor monitor) - { - getFileService().uninitService(monitor); - _userHome = null; - super.uninitializeSubSystem(monitor); - } - - /** - * Returns the encoding from the file service being used by this subsystem. - * @see RemoteFileSubSystem#getRemoteEncoding() - */ - public String getRemoteEncoding() { - - try { - - IHost host = getHost(); - - // get the encoding from the host that was not set by the remote system - String encoding = host.getDefaultEncoding(false); - - // get the encoding from the host that was set by querying a remote system - // this allows us to pick up the host encoding that may have been set by another subsystem - if (encoding == null) { - encoding = getFileService().getEncoding(null); - - if (encoding != null) { - host.setDefaultEncoding(encoding, true); - } - } - - if (encoding != null) { - return encoding; - } - else { - return super.getRemoteEncoding(); - } - } - catch (SystemMessageException e) { - SystemBasePlugin.logMessage(e.getSystemMessage()); - } - - return super.getRemoteEncoding(); - } - - /** - * {@inheritDoc} Defers to the file service. The method is basically another - * way to do download. - * - * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#getInputStream(java.lang.String, - * java.lang.String, boolean, - * org.eclipse.core.runtime.IProgressMonitor) - */ - public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { - return new FileSubSystemInputStream(getFileService().getInputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this); - } - - /** - * {@inheritDoc} - * @deprecated Use - * {@link #getOutputStream(String, String, int, IProgressMonitor)} - * instead - */ - public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { - return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this); - } - - /** - * {@inheritDoc} - * @since 3.0 uses int options argument - */ - public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { - return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, options, monitor), remoteParent, remoteFile, this); - } - - /** - * {@inheritDoc} Defers to the file service. - * @since 3.0 - */ - public boolean supportsEncodingConversion(){ - return getFileService().supportsEncodingConversion(); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystemConfiguration.java deleted file mode 100644 index 64a873337..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystemConfiguration.java +++ /dev/null @@ -1,82 +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) - [168975] Move RSE Events API to Core - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.services.IService; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.search.ISearchService; -import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystemConfiguration; - - - -public abstract class FileServiceSubSystemConfiguration extends RemoteFileSubSystemConfiguration implements IFileServiceSubSystemConfiguration -{ - private Map _services; - private Map _searchServices; - - protected FileServiceSubSystemConfiguration() - { - super(); - _services = new HashMap(); - _searchServices = new HashMap(); - } - - public final Class getServiceType() - { - return IFileService.class; - } - - public final IService getService(IHost host) - { - return getFileService(host); - } - - public final IFileService getFileService(IHost host) - { - IFileService service = (IFileService)_services.get(host); - if (service == null) - { - service = createFileService(host); - _services.put(host, service); - } - return service; - } - - public final ISearchService getSearchService(IHost host) - { - ISearchService service = (ISearchService)_searchServices.get(host); - if (service == null) - { - service = createSearchService(host); - _searchServices.put(host, service); - } - return service; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.ui.model.IHost) - */ - public final boolean supportsServerLaunchProperties(IHost host) - { - return getConnectorService(host).supportsServerLaunchProperties(); - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java deleted file mode 100644 index 64e0e8031..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemInputStream.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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. - * - * Contributors: - * David McKnight (IBM) - [207100] decorated input stream - *******************************************************************************/ -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemRemoteChangeEvents; -import org.eclipse.rse.core.events.SystemRemoteChangeEvent; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * Decorates an input stream that was created in the service layer. The purpose - * of this class is to notify download after the stream is closed. - * - * @since 3.0 - */ -public class FileSubSystemInputStream extends InputStream { - - private InputStream _inStream; - private String _remoteParent; - private String _remoteFile; - private IRemoteFileSubSystem _fs; - - public FileSubSystemInputStream(InputStream inStream, String remoteParent, String remoteFile, IRemoteFileSubSystem fs) - { - _inStream = inStream; - _remoteParent = remoteParent; - _remoteFile = remoteFile; - _fs = fs; - } - - public int available() throws IOException { - return _inStream.available(); - } - - public void close() throws IOException { - _inStream.close(); - - // notify that the file was uploaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, _remoteParent, _remoteFile, _fs)); - } - - public synchronized void mark(int readlimit) { - _inStream.mark(readlimit); - } - - public boolean markSupported() { - return _inStream.markSupported(); - } - - public int read(byte[] b, int off, int len) throws IOException { - return _inStream.read(b, off, len); - } - - public int read(byte[] b) throws IOException { - return _inStream.read(b); - } - - public synchronized void reset() throws IOException { - _inStream.reset(); - } - - public long skip(long n) throws IOException { - return _inStream.skip(n); - } - - public int read() throws IOException { - return _inStream.read(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java deleted file mode 100644 index 18ba5f861..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileSubSystemOutputStream.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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. - * - * Contributors: - * David McKnight (IBM) - [207100] decorated output stream - *******************************************************************************/ -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - -import java.io.IOException; -import java.io.OutputStream; - -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemRemoteChangeEvents; -import org.eclipse.rse.core.events.SystemRemoteChangeEvent; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - -/** - * Decorates an output stream that was created in the service layer. The purpose - * of this class is to notify upload after the stream is closed. - * - * @since 3.0 - */ -public class FileSubSystemOutputStream extends OutputStream { - - private OutputStream _outStream; - private String _remoteParent; - private String _remoteFile; - private IRemoteFileSubSystem _fs; - - - public FileSubSystemOutputStream(OutputStream outStream, String remoteParent, String remoteFile, IRemoteFileSubSystem fs) - { - _outStream = outStream; - _remoteParent = remoteParent; - _remoteFile = remoteFile; - _fs = fs; - } - - public void close() throws IOException { - _outStream.close(); - - // notify that the file was uploaded - ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - - sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, _remoteParent, _remoteFile, _fs)); - } - - public void flush() throws IOException { - _outStream.flush(); - } - - public void write(byte[] b, int off, int len) throws IOException { - _outStream.write(b, off, len); - } - - public void write(byte[] b) throws IOException { - _outStream.write(b); - } - - public void write(int b) throws IOException { - _outStream.write(b); - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/IFileServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/IFileServiceSubSystem.java deleted file mode 100644 index a60db07b8..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/IFileServiceSubSystem.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2008 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: - * David Dykstal (IBM) - [217556] remove service subsystem types - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - - -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.services.search.IHostSearchResultSet; -import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; - - - -public interface IFileServiceSubSystem extends IRemoteFileSubSystem -{ - - /** - * Returns the file service used by this subsystem. By wrapping this service - * we can easily share it among connections or subsystems if that is desired. - * @return the file service wrapped by this subsystem. - */ - public IFileService getFileService(); - public IHostFileToRemoteFileAdapter getHostFileToRemoteFileAdapter(); - public IHostSearchResultConfiguration createSearchConfiguration(IHostSearchResultSet resultSet, Object searchTarget, SystemSearchString searchString); - - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/IFileServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/IFileServiceSubSystemConfiguration.java deleted file mode 100644 index c091c8f74..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/IFileServiceSubSystemConfiguration.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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: - * David Dykstal (IBM) - [217556] remove service subsystem types - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.services.search.IHostSearchResultSet; -import org.eclipse.rse.services.search.ISearchService; -import org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory; -import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; - - - -public interface IFileServiceSubSystemConfiguration extends IRemoteFileSubSystemConfiguration -{ - public IFileService getFileService(IHost host); - public IFileService createFileService(IHost host); - public IHostFileToRemoteFileAdapter getHostFileAdapter(); - public ISearchService getSearchService(IHost host); - public ISearchService createSearchService(IHost host); - public IHostSearchResultConfiguration createSearchConfiguration(IHost host, IHostSearchResultSet resultSet, Object searchTarget, SystemSearchString searchString); - public ILanguageUtilityFactory getLanguageUtilityFactory(IRemoteFileSubSystem ss); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/OutputRefresh.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/OutputRefresh.java deleted file mode 100644 index 0e046a66e..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/OutputRefresh.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 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.subsystems.files.core.servicesubsystem; - -import org.eclipse.rse.core.RSECorePlugin; -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.services.search.IHostSearchConstants; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; - - -public class OutputRefresh implements Runnable -{ - private IHostSearchResultConfiguration searchConfig; - private boolean isDone = false; - private boolean isCancelled = false; - - public OutputRefresh(IHostSearchResultConfiguration searchConfig) - { - this.searchConfig = searchConfig; - this.isDone = searchConfig.getStatus() == IHostSearchConstants.FINISHED; - this.isCancelled = searchConfig.getStatus() == IHostSearchConstants.CANCELLED; - } - - public void run() { - - if (searchConfig != null) - { - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - registry.fireEvent(new SystemResourceChangeEvent(searchConfig, ISystemResourceChangeEvents.EVENT_REFRESH, null)); - - if (isDone || isCancelled) - { - registry.fireEvent(new SystemResourceChangeEvent(searchConfig, ISystemResourceChangeEvents.EVENT_SEARCH_FINISHED, null)); - } - - - - } - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/SearchJob.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/SearchJob.java deleted file mode 100644 index ad25e514f..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/SearchJob.java +++ /dev/null @@ -1,56 +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) - [186128] Move IProgressMonitor last in all API - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.servicesubsystem; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.services.search.ISearchService; -import org.eclipse.swt.widgets.Display; - - -public class SearchJob extends Job -{ - IHostSearchResultConfiguration _searchConfig; - ISearchService _searchService; - IFileService _fileService; - - public SearchJob(IHostSearchResultConfiguration searchConfig, ISearchService searchService, IFileService fileService) - { - super(SystemFileResources.RESID_JOB_SEARCH_NAME); - _searchConfig = searchConfig; - _searchService = searchService; - _fileService = fileService; - } - - protected IStatus run(IProgressMonitor monitor) - { - _searchService.search(_searchConfig, _fileService, monitor); - - OutputRefresh refresh = new OutputRefresh(_searchConfig); - Display.getDefault().asyncExec(refresh); - monitor.done(); - return Status.OK_STATUS; - } - - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IHostFileToRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IHostFileToRemoteFileAdapter.java deleted file mode 100644 index dfd7899a3..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IHostFileToRemoteFileAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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) - [235363][api][breaking] IHostFileToRemoteFileAdapter methods should return AbstractRemoteFile - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystemConfiguration; - - -/** - * Provider interface for implementers of RSE IFileService instances, by which - * they convert their internal service objects into objects suitable for the RSE - * file subsystem. - * - * Must be implemented and returned by overriding the - * {@link IFileServiceSubSystemConfiguration#getHostFileAdapter()} method in the - * contributed concrete file subsystem configuration. - */ -public interface IHostFileToRemoteFileAdapter -{ - /** - * Convert a list of IHostFile objects from the file service into remote - * file objects. Used to return IRemoteFile[] before RSE 3.0, returns - * AbstractRemoteFile since RSE 3.0. - * - * @param ss The file service subsystem to which the remote files belong. - * @param context The context (connection, subsystem, filter) under which - * the files have been queried. - * @param parent The parent IRemoteFile below which the new nodes should - * appear. Can be <code>null</code> when converting root files. - * @param nodes IHostFile nodes from the file service - * @return an array of converted remote file objects. - * - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public AbstractRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes); - - /** - * Convert a single IHostFile object from the file service into a remote - * file object. Used to return IRemoteFile before RSE 3.0, returns - * AbstractRemoteFile since RSE 3.0. - * - * @param ss The file service subsystem to which the remote files belong. - * @param context The context (connection, subsystem, filter) under which - * the files have been queried. - * @param parent The parent IRemoteFile below which the new nodes should - * appear. Can be <code>null</code> when converting root files. - * @param node IHostFile node from the file service - * @return converted remote file object. - * - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public AbstractRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java deleted file mode 100644 index 34123a35e..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java +++ /dev/null @@ -1,357 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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: - * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files - * David McKnight (IBM) - [231209] [api][breaking] IRemoteFile.getSystemConnection() should be changed to IRemoteFile.getHost() - * Martin Oberhuber (Wind River) - [234726] Update IRemoteFile Javadocs - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; -import java.util.Date; - -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.IRemoteContainer; -import org.eclipse.rse.core.subsystems.IRemotePropertyHolder; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.files.IHostFilePermissions; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; -import org.eclipse.rse.ui.view.ISystemEditableRemoteObject; - -/** - * This interface represents a handle to a remote file system object, - * which is either a file or a folder. This interface is similar to - * a java.io.File object, but with some significant differences: - * <ul> - * <li>This represents a "handle" to the remote file or folder, and allows to - * mark special folders as "root" of the file system. For editing purposes, - * a local copy of the remote file can be managed. The support for this is - * captured in a separate interface, {@link ISystemEditableRemoteObject}. - * <li>This interface has no action methods, only property access methods. The action methods - * such as delete, rename, list or getRemoteFileObject() are found in the - * {@link IRemoteFileSubSystem} interface. All remote commands/actions are routed - * through subsystems in this remote system framework. - * <li>Similarly, IRemoteFile handle objects are not constructed directly. They are obtained - * from factory methods in {@link IRemoteFileSubSystem#getRemoteFileObject(String, org.eclipse.core.runtime.IProgressMonitor)}, - * and related methods, which may delegate the actual object creation to an - * {@link IHostFileToRemoteFileAdapter} in case of an {@link IFileServiceSubSystem} - * instance. - * <li>There are no relative names. All names are fully qualified, and include - * the root, the path and the file name (unless this is a folder). - * <li>There are additional methods for querying the root (ie, c:\) and the - * parent directory (unqualified name of the parent directory). - * </ul> - * <p> - * Note for subsystem providers: this method does not capture the set methods that the - * RemoteFile class defines. For that, cast to {@link RemoteFile}. - * - * @noimplement This interface is not intended to be implemented by clients. Clients - * should subclass the provided {@link RemoteFile} or one of its subclasses - * instead. For use with file services (IFileServiceSubSystem), the - * {@link AbstractRemoteFile} class must be subclassed. - */ -public interface IRemoteFile extends IRemoteContainer, IRemotePropertyHolder, ISchedulingRule -{ - public static final char CONNECTION_DELIMITER = ':'; - public static final boolean ISROOT_YES = true; - public static final boolean ISROOT_NO = false; - - /** - * Querying properties for the property sheet can be expensive on some operating systems. - * By default all properties are shown on the property sheet for this object, unless true - * is returned from this query, in which only a couple properties are shown. - */ - public boolean showBriefPropertySet(); - - /** - * Get parent subsystem. - * - * @return the Subsystem holding this file. - */ - public IRemoteFileSubSystem getParentRemoteFileSubSystem(); - - /** - * Return the separator character for this file system: \ or /. - * Queries it from the subsystem factory. - * - * @return the separator character for this file system. - */ - public char getSeparatorChar(); - - /** - * Return the separator character for this file system, as a string: "\" or "/". - * Queries it from the subsystem factory. - * - * @return the separator character for this file system as a String. - */ - - public String getSeparator(); - - /** - * Return as a string the line separator for this file system - * Queries it from the subsystem factory. - */ - public String getLineSeparator(); - - /** - * Return the connection this remote file is from. - * @since 3.0 renamed getSystemConnection() to getHost() - */ - public IHost getHost(); - - /** - * Return the parent remote file object expanded to get this object, - * or <code>null</code> if no such parent exists. - * - * @return the parent remote file object or <code>null</code>. - */ - public IRemoteFile getParentRemoteFile(); - - /** - * Return the filter string resolved to get this object - */ - public RemoteFileFilterString getFilterString(); - - /** - * If this is a folder, it is possible that it is listed as part of a multiple filter string - * filter. In this case, when the folder is expanded, we want to filter the file names to - * show all the files that match any of the filter strings that have the same parent path. - * <p> - * This method supports that by returning all the filter strings in the filter which have the - * same parent path as was used to produce this file. - */ - public RemoteFileFilterString[] getAllFilterStrings(); - - /** - * Get fully qualified name: root plus path plus name. No connection name. - * - * @return the fully qualified path for uniquely addressing this file - * on the remote host. Never returns <code>null</code>. - */ - public String getAbsolutePath(); - - /** - * Get fully qualified connection and file name: profile.connection\path\file. - * Note the separator character between the profile name and the connection name is always '.' - * Note the separator character between the connection and qualified-file is always ':' - */ - public String getAbsolutePathPlusConnection(); - - /** - * Get the display name for this file. By default, this should be the same as the name - * If this object represents only a root drive, this is the same as getRoot(). - */ - public String getLabel(); - - /** - * Get unqualified file name. No root and no path. - * If this object represents only a root drive, this is the same as getRoot(). - */ - public String getName(); - - /** - * Get fully qualified path and name of folder containing this file or folder. - * Returns the root and path. No file name, and no ending separator. - * <p> - * If this object represent only a root drive, this returns null; - * <p> - * Example: <code>c:\folder1\folder2\file1.ext</code> results in <code>c:\folder1\folder2</code> - */ - public String getParentPath(); - - /** - * Get fully qualified path and name of folder containing this file or folder, minus the root. - * Returns the path. No root prefix. No file name, and no ending separator. - * <p> - * If this object represent only a root drive, this returns null; - * <p> - * Example: <code>c:\folder1\folder2\file1.ext</code> results in <code>folder1\folder2</code> - */ - public String getParentNoRoot(); - - /** - * Get the root part of the name. - * <p> - * <ul> - * <li>Example: <code>c:\folder1\folder2\file1.ext</code> results in <code>c:\</code> - * <li>Example: <code>/folder1/folder2/file1.ext</code> results in <code>/</code> - * </ul> - */ - public String getRoot(); - - /** - * Get the unqualified name of the parent directory containing this file or folder. - * Compare this to getParent() that returns the fully qualified parent directory. - * If this object represents only a root drive, this returns null. - * <p> - * Example: <code>c:\folder1\folder2\file1.ext</code> results in <code>folder2</code> - */ - public String getParentName(); - - /** - * Return the extension part of a file name. - * Eg, for abc.java, return "java" - */ - public String getExtension(); - - /** - * Returns true if this represents a root folder (eg: c:\\ or /). - */ - public boolean isRoot(); - - /** - * Returns true if this represents a folder (eg: c:\\folder) - */ - public boolean isDirectory(); - - /** - * Returns true if this represents a file, versus a root or folder - */ - public boolean isFile(); - - /** - * Returns true if this represents an archive file, versues a non-archive file - */ - public boolean isArchive(); - - /** - * Returns true if this is a binary file - */ - public boolean isBinary(); - - /** - * Returns true if this is a text file - */ - public boolean isText(); - - /** - * Returns true if this is a hidden file. - */ - public boolean isHidden(); - - /** - * Returns true if the application can read this file. - */ - public boolean canRead(); - - /** - * Returns true if the application can write to this file. - */ - public boolean canWrite(); - - /** - * Returns true if this folder or file actually exists. - */ - public boolean exists(); - - /** - * Returns the time (in milliseconds since epoch) this file was last modified. - */ - public long getLastModified(); - - /** - * Return the last modified time as a Date object. - */ - public Date getLastModifiedDate() ; - - /** - * Returns the length, in bytes, of this file. - */ - public long getLength(); - - /** - * Returns true if the ReadOnly Property should be shown in the property page. - */ - public boolean showReadOnlyProperty(); - - // ================================== - // for comparator interface... - // ================================== - /** - * Compare one remote file to another. This enables us to sort the files so they - * are shown folders-first, and in alphabetical order. - */ - public int compareTo(Object other) throws ClassCastException; - - /** - * Get the object. - */ - public Object getFile(); - - /** - * Note: if this remoteFile is the same as the file passed - * as parameter, then this method returns true. - */ - public boolean isAncestorOf(IRemoteFile file); - - /** - * Note: if this remoteFile is the same as the file passed - * as parameter, then this method returns true. - */ - public boolean isDescendantOf(IRemoteFile file); - - /** - * @return Any comments stored with the file in the file system or archive. - */ - public String getComment(); - - /** - * Returns the classification of this file. If the file is - * an executable, then "executable(...)" will be returned. If the - * file is a symbolic link then it will appear as "symbolic link(....):resolvedPath". - * The resolvedPath is the path that the link resolves to. - * A symbolic link that resolves to an executable would appear as - * "symbolic link(executable(...)):resolvedPath". - * By default this should just return "file" or "directory". - * @return the classification, or "unknown", or <code>null</code> if not classifiable. - */ - public String getClassification(); - - /** - * Returns whether the file is executable or not. - * @return <code>true</code> if the file is executable, <code>false</code> otherwise. - */ - public boolean isExecutable(); - - /** - * Returns whether the file is a symbolic link or not. - * @return <code>true</code> if the file is a symbolic link, <code>false</code> otherwise. - */ - public boolean isLink(); - - /** - * Returns the canonical path of the remote file. - * @return the resolved path if the file is a symbolic link, or - */ - public String getCanonicalPath(); - - public IHostFile getHostFile(); - - /** - * Returns the encoding of the remote file. - * @return the encoding of the remote file. - * @since 2.0 - */ - public String getEncoding(); - - /** - * Returns the permissions for this file if they exist - * @return the permissions - * @since 3.0 - */ - public IHostFilePermissions getPermissions(); - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileContext.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileContext.java deleted file mode 100644 index 2499c1353..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileContext.java +++ /dev/null @@ -1,68 +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.subsystems.files.core.subsystems; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; - -/** - * This interface represents a place to hold contextual information stored within - * each remote file object. - * <p> - * We store in here information that might be the same for multiple remote file objects, - * in order to save memory. This way, we can merely hold a reference to a single object, - * which itself may have numerous pieces of information helpful when processing actions - * on a particular remote object. - */ -public interface IRemoteFileContext -{ - - /** - * Get parent subsystem - */ - public IRemoteFileSubSystem getParentRemoteFileSubSystem(); - /** - * Return the parent remote file object expanded to get this object, or null if no such parent - */ - public IRemoteFile getParentRemoteFile(); - /** - * Return the filter string used to resolve the list resulting in this remote object. - */ - public RemoteFileFilterString getFilterString(); - /** - * Return all the filter string objects applicable to this folder object. - */ - public RemoteFileFilterString[] getAllFilterStrings(); - - /** - * Set parent subsystem - */ - public void setParentRemoteFileSubSystem(IRemoteFileSubSystem parentSubSystem); - /** - * Set the parent remote file object expanded to get this object, or null if no such parent - */ - public void setParentRemoteFile(IRemoteFile parentFile); - /** - * Set the filter string used to resolve the list resulting in this remote object. - */ - public void setFilterString(RemoteFileFilterString filterString); - /** - * Add an additional filter string. This is called for folders in a multi-filter string - * filter. It is called for each filter string that lists the contents of the same parent - * path, when show subdirs is true. It is needed to support the subsequent expansion of - * this subdirectory, so that it can filter on all the appropriate filter strings. - */ - public void addFilterString(RemoteFileFilterString additionalFilterString); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileExceptionCodes.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileExceptionCodes.java deleted file mode 100644 index 76edf2969..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileExceptionCodes.java +++ /dev/null @@ -1,27 +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.subsystems.files.core.subsystems; - -/** - * Intended as a placeholder for all exception code constants - */ - -public interface IRemoteFileExceptionCodes { - - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileExceptionMessages.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileExceptionMessages.java deleted file mode 100644 index fd044a0db..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileExceptionMessages.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; -/** - * Keys into the core plugin's resource bundle for error messages related - * to exceptions thrown by the remote file system framework. - */ -public interface IRemoteFileExceptionMessages -{ - //public static final String PLUGIN_ID ="org.eclipse.rse.systems"; - //public static final String PLUGIN_ID =ISystemMessages.PLUGIN_ID; - // Message prefix - //public static final String FILEMSG_PREFIX = PLUGIN_ID+".ui.filemsg."; - - // Messages - public static final String FILEMSG_IO_ERROR = "RSEF1001"; //$NON-NLS-1$ - public static final String FILEMSG_SECURITY_ERROR = "RSEF1002"; //$NON-NLS-1$ - - public static final String FILEMSG_FOLDER_NOTEMPTY = "RSEF1003"; //$NON-NLS-1$ - public static final String FILEMSG_FOLDER_NOTFOUND = "RSEF1004"; //$NON-NLS-1$ - - public static final String FILEMSG_FILE_NOTFOUND = "RSEF1005"; //$NON-NLS-1$ -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileFactory.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileFactory.java deleted file mode 100644 index 44427c225..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileFactory.java +++ /dev/null @@ -1,42 +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.subsystems.files.core.subsystems; - -/** - * This interface represents a handle to a remote file object, - * which is either a universalFileSystem or an ifsFileSystem. - */ - -public interface IRemoteFileFactory -{ - - /** - * Get the RemoteFile object - */ - public IRemoteFile createRemoteFile(IRemoteFileContext context, Object obj, boolean isRoot); - - /** - * Get the RemoteFile object when we know if it is a exists or not - */ - public IRemoteFile createRemoteFile(IRemoteFileContext context, Object obj, boolean isRoot, boolean exists); - - /** - * Get the RemoteFile object when we know if it is a exists or not and whether it is a directory or not - */ - public IRemoteFile createRemoteFile(IRemoteFileContext context, Object obj, boolean isRoot, boolean exists, boolean isDir); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java deleted file mode 100644 index 1e8e8725c..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java +++ /dev/null @@ -1,702 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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) - [186128] Move IProgressMonitor last in all API - * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - * David McKnight (IBM) - [162195] new APIs for upload multi and download multi - * David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated - * Kevin Doyle (IBM) - [208778] new API getOutputSteam for getting an output stream in append mode - * David McKnight (IBM) - [209704] added supportsEncodingConversion() - * Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding() - * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService - * Martin Oberhuber (Wind River) - [234026] Clarify IFileService#createFolder() Javadocs - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.files.RemoteFileException; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory; - - -// -/** - * Specialized interface for remote file subsystems. - * <p> - * These are unix/windows like file systems, versus native OS/400 or OS/390 - * file subsystems. Rather, it is more like the IFS and HFS systems on - * these operating systems. - * <p> - * The idea is to encourage a common API and GUI layer that works - * with any remote unix-like file system on any remote operating system. - */ -public interface IRemoteFileSubSystem extends ISubSystem { - - // ---------------------- - // HELPER METHODS... - // ---------------------- - - /** - * Return parent subsystem factory, cast to a RemoteFileSubSystemConfiguration - */ - public IRemoteFileSubSystemConfiguration getParentRemoteFileSubSystemConfiguration(); - /** - * Return true if file names are case-sensitive. Used when doing name or type filtering - */ - public boolean isCaseSensitive(); - - // -------------------------------- - // FILE SYSTEM ATTRIBUTE METHODS... - // -------------------------------- - /** - * Return in string format the character used to separate folders. Eg, "\" or "/". - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getSeparator() - */ - public String getSeparator(); - - /** - * Return in character format the character used to separate folders. Eg, "\" or "/" - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getSeparatorChar() - */ - public char getSeparatorChar(); - - /** - * Return in string format the character used to separate paths. Eg, ";" or ":" - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparator() - */ - public String getPathSeparator(); - - /** - * Return in char format the character used to separate paths. Eg, ";" or ":" - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparatorChar() - */ - public char getPathSeparatorChar(); - - /** - * Return as a string the line separator. - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getLineSeparator() - */ - public String getLineSeparator(); - - // ---------------------- - // FILE SYSTEM METHODS... - // ---------------------- - - /** - * Return a list of roots/drives on the remote system. - * This version is called directly by users. - */ - public IRemoteFile[] listRoots(IProgressMonitor monitor) throws InterruptedException, SystemMessageException; - - - /** - * Return a list of all remote folders and/or files in the given folders. This list is not filtered. - * - * @param parents The parent folders to list folders and/or files in - * @param fileTypes - indicates whether to query files, folders, both or some other type. There - * should be exactly one fileType specified per parent. - * For the default list of available file types see <code>IFileServiceContants</code> - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Return a list of remote folders and/or files in the given folder. Only file names are filtered - * by the given file name filters. It can be null for no sub-setting. - * - * @param parents The parent folders to list folders and files in - * @param fileNameFilters The name patterns to subset the file list by, or null to return all files. - * There should be exactly one fileNameFilter per parent. - * @param fileTypes - indicates whether to query files, folders, both or some other type. There - * should be exactly one fileType specified per parent. - * For the default list of available file types see <code>IFileServiceContants</code> - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, String[] fileNameFilters, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Return a list of all remote folders and/or files in the given folders. This list is not filtered. - * - * @param parents The parent folders to list folders and/or files in - * @param fileType - indicates whether to query files, folders, both or some other type. This fileType is used for each parent query. - * For the default list of available file types see <code>IFileServiceContants</code> - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, int fileType, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Return a list of remote folders and/or files in the given folder. Only file names are filtered - * by the given file name filters. It can be null for no sub-setting. - * - * @param parents The parent folders to list folders and files in - * @param fileNameFilters The name patterns to subset the file list by, or null to return all files. - * There should be exactly one fileNameFilter per parent. - * @param fileType - indicates whether to query files, folders, both or some other type. - * Available file types include {@link IFileService#FILE_TYPE_FILES}, - * {@link IFileService#FILE_TYPE_FOLDERS}, and - * {@link IFileService#FILE_TYPE_FILES_AND_FOLDERS}. - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, String[] fileNameFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException; - - - /** - * Return a list of all remote folders and/or files in the given folder. The list is not filtered. - * - * @param parent The parent folder to list folders and/or files in - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] list(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Return a list of all remote folders and/or files in the given folder. The list is not filtered. - * - * @param parent The parent folder to list folders and files in - * @param fileType - indicates whether to query files, folders, both or some other type. - * Available file types include {@link IFileService#FILE_TYPE_FILES}, - * {@link IFileService#FILE_TYPE_FOLDERS}, and - * {@link IFileService#FILE_TYPE_FILES_AND_FOLDERS}. - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] list(IRemoteFile parent, int fileType, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Return a list of remote folders and/or files in the given folder. Only file names are filtered - * by the given file name filter. It can be null for no filtering. - * - * @param parent The parent folder to list folders and files in - * @param fileNameFilter The name pattern to subset the file list by, or null to return all files. - * @param fileType - indicates whether to query files, folders, both or some other type. - * For the default list of available file types see <code>IFileServiceContants</code> - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Return a list of remote folders and/or files in the given folder. The files part of the list is filtered - * by the given file name filter. It can be null for no filtering. - * - * @param parent The parent folder to list folders and files in - * @param fileNameFilter The name pattern to subset the file list by, or null to return all files. - * @param context The holder of state information - * - indicates whether to query files, folders, both or some other type - * @param fileType - indicates whether to query files, folders, both or some other type - * For the default list of available file types see <code>IFileServiceContants</code> - * @param monitor the progress monitor - * @since 3.0 - - */ - public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, int fileType, IProgressMonitor monitor) throws SystemMessageException; - - - - /** - * Given a search configuration, searches for its results. - * @param searchConfig a search configuration. - */ - public void search(IHostSearchResultConfiguration searchConfig); - - /** - * Given a search configuration, cancel the search. - * @param searchConfig a search configuration. - */ - public void cancelSearch(IHostSearchResultConfiguration searchConfig); - - /** - * Given a folder or file, return its parent folder object. - * @param folderOrFile folder or file to return parent of. - * @param monitor the progress monitor - * - * @return the remote file - */ - public IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor); - - /** - * Given a folder or file, return its parent folder name, fully qualified - * @param folderOrFile folder or file to return parent of. - */ - public String getParentFolderName(IRemoteFile folderOrFile); - - /** - * Returns the encoding of the remote system. - * @return the encoding of the remote system. - */ - public String getRemoteEncoding(); - - /** - * Returns the encoding of the file with the remote path. - * @param remotePath the remote path of the file. - * @return the encoding of the remote file. - */ - // public String getEncoding(String remotePath); - - /** - * Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it. - * @param folderOrFileNames Fully qualified folder or file names - * @param monitor the progress monitor - * - * @return the set of resources - * @since 3.0 - */ - public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Given a fully qualified file or folder name, return an IRemoteFile - * object for it. - * <p> - * This may be a long-running operation involving remote system access - * if the file with the given key is not found in the internal cache. - * </p> - * @param folderOrFileName Fully qualified folder or file name. - * @param monitor the progress monitor - * @return the requested IRemoteFile object. - * @throws SystemMessageException in case an error occurs contacting the - * remote system while retrieving the requested remote object. - */ - public IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Given a un-qualified file or folder name, and its parent folder object, - * return an IRemoteFile object for the file. - * @param parent Folder containing the folder or file - * @param folderOrFileName Un-qualified folder or file name - * @param monitor the progress monitor - * - * @return the requested IRemoteFile object - */ - public IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Given a key, returns a search result object for it. For the key, see < - * @param key the key that uniquely identifies a search result. - */ - public IRemoteSearchResult getRemoteSearchResultObject(String key) throws SystemMessageException; - - /** - * Create a new file, given its IRemoteFile object (these do not have to represent existing files). - * <p> - * <ul> - * <li>The parent folder must exist for this to succeed. - * <li>If this file already exists, this is a no-op. - * <li>If the given object is a folder, not a file, this is a no-op. - * </ul> - * - * @see #createFolders(IRemoteFile,IProgressMonitor) - * - * @param fileToCreate The object representing the file to be created. - * @return The same input object returned for convenience. Will throw exception if it fails. - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - */ - public IRemoteFile createFile(IRemoteFile fileToCreate, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Create a new folder, given its IRemoteFile object (these do not have to represent existing folders) - * <p> - * <ul> - * <li>The parent folder must exist for this to succeed. If the parent - * folder does not yet exist, implementations are free to create - * missing parents or fail (see also {@link IFileService#createFolder(String, String, IProgressMonitor)}).</li> - * <li>If this folder already exists, this is a no-op.</li> - * <li>If the given object is a file, not a folder, this is a no-op.</li> - * </ul> - * - * @see #createFolders(IRemoteFile, IProgressMonitor) - * - * @param folderToCreate The object representing the folder to be created. - * @param monitor the progress monitor - * @return The same input object returned for convenience. Will throw exception if it fails. - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - */ - public IRemoteFile createFolder(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Given an IRemoteFile for a folder, this will create that folder and any missing parent folders in its path. - * Use getParentFolder to get the parent object of your file or folder in order to call this method. - * <p> - * <ul> - * <li>If this folder already exists, this is a no-op. - * <li>If the given object is a file, not a folder, this is a no-op. - * </ul> - * - * @see #getParentFolder(IRemoteFile, IProgressMonitor) - * - * @param folderToCreate The object representing the folder to be created, along with its parents. - * @param monitor the progress monitor - * @return The same input object returned for convenience. Will throw exception if it fails. - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - */ - public IRemoteFile createFolders(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Delete the given remote file or folder. - * <ul> - * <li>If the input is a folder, that folder must be empty for this to succeed. - * </ul> - * - * @param folderOrFile represents the object to be deleted. - * @param monitor progressMonitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Delete the given batch of remote file or folder. - * <ul> - * <li>If any of the inputs are a folder, those folders must be empty for this to succeed. - * </ul> - * <p> - * If an error occurs during the deletion of an item, this operation stops on that item and a {@link SystemMessageException} is thrown. - * Items deleted before that item will remain deleted. Items specified after that item will not be deleted. - * The item on which the error occurs will not be deleted. - * Without an exception thrown in such cases, views may not be refreshed correctly to account for deleted resources. - * @param folderOrFiles represents the objects to be deleted. - * @param monitor progressMonitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Rename the given remote file or folder. This renames it in memory and, iff it exists, on disk. - * @param folderOrFile represents the object to be renamed. - * @param newName new name to give it. - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Move a file or folder to a new target parent folder. - * - * @param sourceFolderOrFile The file or folder to move - * @param targetFolder The folder to move to. No guarantee it is on the same system, so be sure to check getSystemConnection()! - * @param newName The new name for the moved file or folder - * @param monitor progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName,IProgressMonitor monitor) throws SystemMessageException; - - /** - * Set the last modified date for the given file or folder. Like a Unix "touch" operation. - * Folder or file must exist on disk for this to succeed. - * @param folderOrFile represents the object to be renamed. - * @param newDate new date, in milliseconds from epoch, to assign. - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Set a files read-only permissions. - * Folder or file must exist on disk for this to succeed. - * @param folderOrFile represents the object to be renamed. - * @param readOnly whether to set it to be read-only or not - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException; - - - // ---------------------------- - // METHODS FOR FILE TRANSFER... - // ---------------------------- - - // Beginning of methods for downloading remote files from the server - - /** - * Copy a file or folder to a new target parent folder. - * @param sourceFolderOrFile The file or folder to copy - * @param targetFolder The folder to copy to. No guarantee it is on the same system, so be sure to check getSystemConnection()! - * @param newName The new name for the copied file or folder - * @param monitor progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Copy a set of remote files or folders to a new target parent folder. Precondition: Sources and target must all be on the same system. - * <p> - * If an error occurs during the copy of an item, this operation stops on that item and a {@link SystemMessageException} is thrown. - * Items copied before that item will remain copied. Items copied after that item will not be copied. - * The item on which the error occurs will not be copied. - * @param sourceFolderOrFile The file or folder to copy - * @param targetFolder The folder to copy to. - * @param monitor progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since org.eclipse.rse.subsystems.files.core 3.0 - */ - public void copyBatch(IRemoteFile[] sourceFolderOrFile, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Get the remote file and save it locally. - * - * The file is saved in the encoding specified, with two exceptions: - * <ul> - * <li>If the remote file is binary, encoding does not apply.</li> - * <li>If the remote file is a XML file, then it will be - * copied to local in the encoding specified in the XML - * declaration, or as determined from the XML specification.</li> - * </ul> - * @param source remote file that represents the file to be obtained - * @param destination the absolute path of the local file - * @param encoding the encoding of the local file - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - */ - public void download(IRemoteFile source, String destination, String encoding, IProgressMonitor monitor) throws SystemMessageException; - - - /** - * Get the remote files and save them locally. - * - * The files are saved in the encodings specified, with two exceptions: - * <ul> - * <li>If a remote file is binary, encoding does not apply.</li> - * <li>If a remote file is a XML file, then it will be - * copied to local in the encoding specified in the XML - * declaration, or as determined from the XML specification.</li> - * </ul> - * @param sources remote files that represent the files to be obtained - * @param destinations the absolute paths of the local files - * @param encodings the encodings of the local files - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since 3.0 - */ - public void downloadMultiple(IRemoteFile[] sources, String[] destinations, String[] encodings, IProgressMonitor monitor) throws SystemMessageException; - - - - - /** - * Put the local copy of the remote file back to the remote location. - * - * The file is assumed to be in the encoding specified, with - * two exceptions: - * <ul> - * <li>If the local file is binary, encoding does not apply.</li> - * <li>If the local file is a XML file, then it will be copied - * to remote in the encoding specified in the XML declaration, - * or as determined from the XML specification.</li> - * </ul> - * @param source the absolute path of the local copy - * @param destination remote file that represents the file on the server - * @param encoding the encoding of the local copy - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - */ - public void upload(String source, IRemoteFile destination, String encoding, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Put the local copy of the remote file back to the remote location. - * - * The file is assumed to be in the encoding of the local operating system, - * with two exceptions: - * <ul> - * <li>If the local file is binary, encoding does not apply.</li> - * <li>If the local file is a XML file, then it will be copied - * to remote in the encoding specified in the XML declaration, - * or as determined from the XML specification.</li> - * </ul> - * @param source the absolute path of the local copy - * @param srcEncoding the encoding of the local copy - * @param remotePath remote file that represents the file on the server - * @param rmtEncoding the encoding of the remote file. - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - */ - public void upload(String source, String srcEncoding, String remotePath, String rmtEncoding, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Put the local copies of the remote files to the remote locations. - * - * The files are assumed to be in the encodings specified, with - * two exceptions: - * <ul> - * <li>If a local files is binary, encoding does not apply.</li> - * <li>If a local files is an XML file, then it will be copied - * to remote in the encoding specified in the XML declaration, - * or as determined from the XML specification.</li> - * </ul> - * @param sources the absolute paths of the local copies - * @param destinations remote files that represent the files on the server - * @param encodings the encodings of the local copies - * @param monitor the progress monitor - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since 3.0 - */ - public void uploadMultiple(String[] sources, IRemoteFile[] destinations, String[] encodings, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Put the local copies of the remote files to the remote locations. - * - * The files are assumed to be in the encodings of the local operating system, - * with two exceptions: - * <ul> - * <li>If a local file is binary, encoding does not apply.</li> - * <li>If a local file is a XML file, then it will be copied - * to remote in the encoding specified in the XML declaration, - * or as determined from the XML specification.</li> - * </ul> - * @param sources the absolute paths of the local copies - * @param srcEncodings the encodings of the local copies - * @param remotePaths remote files that represents the files on the server - * @param rmtEncodings the encodings of the remote files. - * @throws SystemMessageException if an error occurs. - * Typically this would be one of those in the - * {@link RemoteFileException} family. - * @since 3.0 - */ - public void uploadMultiple(String sources[], String[] srcEncodings, String[] remotePaths, String[] rmtEncodings, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Returns a language utility factory associated with this subsystem. - * @return the language utility factory associated with this subsystem. - */ - public ILanguageUtilityFactory getLanguageUtilityFactory(); - - /** - * Returns an unused port number on the remote host that could be used - * by any tool on the host. - * @return an unused port number on the host, or -1 if none could be found. - */ - public int getUnusedPort(); - - /** - * Return a list of roots/drives on the remote system. - * This version is called by RemoteFileSubSystemImpl's resolveFilterString(s) - * <b>note</b>This method should be abstract but MOF doesn't allow abstract impl classes at this point - */ - public IRemoteFile[] listRoots(IRemoteFileContext context, IProgressMonitor monitor) throws InterruptedException; - - /** - * Returns the TCP/IP address for the local system that is accessible from - * the remote server. If the local system has multiple IP addresses (because of multiple - * network cards or VPN), then this will return the address that the remote system - * can use to "call back" to the PC. There must be a network connection between the local - * system and the remote system for this method to work. If no network connection exists, - * then this method returns <code>null</code>. - * - * @return the local TCP/IP address accessible from the remote system, or <code>null</code> if - * no address can be resolved. - */ - public InetAddress getLocalAddress(); - - /** - * Gets the input stream to access the contents a remote file. Clients should close the input stream when done. Implementations should not return <code>null</code>. - * @param remoteParent the absolute path of the parent. - * @param remoteFile the name of the remote file. - * @param isBinary <code>true</code> if the file is a binary file, <code>false</code> otherwise. - * @return the input stream to access the contents of the remote file. - * @param monitor the progress monitor. - * @throws SystemMessageException if an error occurs. - * @since 2.0 - */ - public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Gets the output stream to write to a remote file. Clients should close the output stream when done. Implementations should not return <code>null</code>. - * @param remoteParent the absolute path of the parent. - * @param remoteFile the name of the remote file. - * @param isBinary <code>true</code> if the file is a binary file, <code>false</code> otherwise. - * @return the input stream to access the contents of the remote file. - * @param monitor the progress monitor. - * @throws SystemMessageException if an error occurs. - * @since 2.0 - * @deprecated Use {@link #getOutputStream(String, String, int, IProgressMonitor)} instead - */ - public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Gets the output stream to write/append to a remote file. Clients should close the output stream when done. Implementations should not return <code>null</code>. - * @param remoteParent the absolute path of the parent. - * @param remoteFile the name of the remote file. - * @param options bit wise or of option constants. Valid constants are {@link IFileService#APPEND}, {@link IFileService#TEXT_MODE}, and {@link IFileService#NONE} - * @return the input stream to access the contents of the remote file. - * @param monitor the progress monitor. - * @throws SystemMessageException if an error occurs. - * @since 3.0 - */ - public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException; - - /** - * Indicates whether this file subsystem supports code page conversion using - * the IFileServiceCodePageConverter mechanism. Certain extensions, such as - * property pages for encoding conversion can determine whether or not to - * display or enable themselves based on result of this call. - * - * @return whether this service supports encoding conversion - * @since 3.0 - */ - public boolean supportsEncodingConversion(); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystemConfiguration.java deleted file mode 100644 index 7a6a3c097..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystemConfiguration.java +++ /dev/null @@ -1,111 +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.subsystems.files.core.subsystems; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.ui.validators.ISystemValidator; -import org.eclipse.rse.ui.validators.ValidatorFileName; -import org.eclipse.rse.ui.validators.ValidatorFolderName; - - -// -/** - * Specialization for file subsystem factories. - */ -/** - * @lastgen interface RemoteFileSubSystemConfiguration extends SubSystemConfiguration {} - */ - -public interface IRemoteFileSubSystemConfiguration extends ISubSystemConfiguration -{ - /** - * Return true if subsystems of this factory support the environment variables property. - * Return true to show it, return false to hide it. - */ - public boolean supportsEnvironmentVariablesPropertyPage(); - - /** - * Return true if subsystems for this configuration support search functionality. - * @return true if search is supported - */ - public boolean supportsSearch(); - - /** - * Return true if subsystems for this configuration support archive management. - * @return true if archive management is supported - */ - public boolean supportsArchiveManagement(); - - /** - * Tell us if this is a unix-style file system or a windows-style file system. The - * default is windows. - * Child classes must call this, so we know how to respond to separator and path-separator requests. - */ - public boolean isUnixStyle(); - /** - * Tell us if this file system is case sensitive. The default is isUnixStyle(), and so should - * rarely need to be overridden. - */ - public boolean isCaseSensitive(); - - // -------------------------------- - // VALIDATOR METHODS... - // -------------------------------- - /** - * Return validator used in filter string dialog for the path part of the filter string - */ - public ISystemValidator getPathValidator(); - /** - * Return validator used in filter string dialog for the file part of the filter string - */ - public ISystemValidator getFileFilterStringValidator(); - /** - * Return validator used when creating or renaming files - */ - public ValidatorFileName getFileNameValidator(); - /** - * Return validator used when creating or renaming folders - */ - public ValidatorFolderName getFolderNameValidator(); - // -------------------------------- - // FILE SYSTEM ATTRIBUTE METHODS... - // -------------------------------- - /** - * Return in string format the character used to separate folders. Eg, "\" or "/" - */ - public String getSeparator(); - /** - * Return in character format the character used to separate folders. Eg, "\" or "/" - */ - public char getSeparatorChar(); - /** - * Return in string format the character used to separate paths. Eg, ";" or ":" - */ - public String getPathSeparator(); - /** - * Return in char format the character used to separate paths. Eg, ";" or ":" - */ - public char getPathSeparatorChar(); - /** - * Return as a string the line separator. - */ - public String getLineSeparator(); - /** - * Return the default remote systems editor profile ID for files on this subsystem - */ - public String getEditorProfileID(); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileWrapper.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileWrapper.java deleted file mode 100644 index d169156e8..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileWrapper.java +++ /dev/null @@ -1,23 +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.subsystems.files.core.subsystems; -public interface IRemoteFileWrapper -{ - - - IRemoteFile getRemoteFile(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteSearchConstants.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteSearchConstants.java deleted file mode 100644 index c818cf28a..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteSearchConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -public interface IRemoteSearchConstants { - - /** - * Status indicating configuration is still running, 0. - */ - public static final int RUNNING = 0; - - /** - * Status indicating configuration has finished, 1. - */ - public static final int FINISHED = 1; - - /** - * Status indicating configuration has been cancelled, 2. - */ - public static final int CANCELLED = 2; - - /** - * Status indicating configuration has been disconnected, 3. - */ - public static final int DISCONNECTED = 3; -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteSearchResult.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteSearchResult.java deleted file mode 100644 index 5571a7855..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteSearchResult.java +++ /dev/null @@ -1,78 +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.subsystems.files.core.subsystems; - -import org.eclipse.rse.core.subsystems.IRemoteLineReference; -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.search.IHostSearchResult; - - -/** - * This interface represents a handle to a search result. - */ -public interface IRemoteSearchResult extends IRemoteLineReference, IHostSearchResult -{ - - - - - /** - * Gets the text to display for a search result. - * @return the text. - */ - public String getText(); - - /** - * Gets the index of this search result in the context of its parent. - * @return the index. - */ - public int getIndex(); - - /** - * Gets the search string that this result matches. - * @return the search string. - */ - public SystemSearchString getMatchingSearchString(); - - /** - * Add a match to the result. A match comprises a char start offset and a char end offset, both - * relative to the beginning of the file. The matches are added in order. - * @param startOffset the char start offset, from the beginning of the file. - * @param endOffset the char end offset, from the beginning of the file. - */ - public void addMatch(int startOffset, int endOffset); - - /** - * Gets the number of matches in this line. - * @return the number of matches. - */ - public int numOfMatches(); - - /** - * Gets the char start offset for the given match index. - * @param matchIndex the match index. For example, to get the start offset for the first match, specify 0. - * @return the char start offset. - */ - public int getCharStart(int matchIndex); - - /** - * Gets the char end offset for the given match index. - * @param matchIndex the match index. For example, to get the end offset for the first match, specify 0. - * @return the char end offset. - */ - public int getCharEnd(int matchIndex); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IVirtualRemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IVirtualRemoteFile.java deleted file mode 100644 index da721c093..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IVirtualRemoteFile.java +++ /dev/null @@ -1,29 +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.subsystems.files.core.subsystems; - -public interface IVirtualRemoteFile extends IRemoteFile -{ - public String getVirtualName(); - public boolean isVirtualFolder(); - public boolean isVirtualFile(); - public String getComment(); - public long getCompressedSize(); - public String getCompressionMethod(); - public double getCompressionRatio(); - public long getExpandedSize(); -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java deleted file mode 100644 index c34f8f034..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java +++ /dev/null @@ -1,1220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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) - [177523] Unify singleton getter methods - * David McKnight (IBM) - [173518] [refresh] Read only changes are not shown in RSE until the parent folder is refreshed - * David McKnight (IBM) - [186363] get rid of obsolete calls to ISubSystem.connect() - * David McKnight (IBM) - [209660] use parent encoding as default, rather than system encoding - * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files - * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - * Martin Oberhuber (Wind River) - [219975] Fix implementations of clone() - * David McKnight (IBM) - [231209] [api][breaking] IRemoteFile.getSystemConnection() should be changed to IRemoteFile.getHost() - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.MultiRule; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemContentsType; -import org.eclipse.rse.core.subsystems.IRemoteContainer; -import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType; -import org.eclipse.rse.services.clientserver.StringComparePatternMatcher; -import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.files.IHostFilePermissions; -import org.eclipse.rse.services.files.IHostFilePermissionsContainer; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.eclipse.swt.widgets.Display; - -/** - * A remote file represents a named file on a remote file system. This class - * works with remote file names that do not include the preceding "<connectionName/subsystemName>" - * prefix. Such ultimately-qualified names are known as IRemoteFilePath names. - * <p> - * Base parent class that supplies all of the - * functionality required by the IRemoteFile interface. - * <p> - * This base functionality is possible because this is a - * read-only representation of a remote file ... all actions - * like delete and rename are handled by the subsystem. - * <p> - * For all this base functionality to work, the subsystem - * that creates this object must call the setter methods to - * prefill this object with the core required information: - * <ul> - * <li>{@link #RemoteFile(IRemoteFileContext)} constructor sets the parent subsystem - * </ul> - * A concrete implementation which extends this class, also needs to ensure - * that information is properly set by some means such that the {@link IRemoteFile#exists()}, - * {@link IRemoteFile#getAbsolutePath()}, {@link IRemoteFile#getLength()} - * and similar methods can be implemented. - */ -public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable -{ - protected IRemoteFileContext _context; - - protected String _label; - protected Object remoteObj; - protected IRemoteFile _parentFile; - - /* Archived file properties */ - // DKM - let's get rid of these fields - // - they should now be in IHostfile - protected boolean isContainer = false; - - // master hash map - protected HashMap _contents = new HashMap(); - - /* container properties */ - protected boolean _isStale = true; - - // properties - protected HashMap properties = new HashMap(); - protected HashMap propertyStates = new HashMap(); - - - - /** - * Constructor that takes a context object containing important information. - * @param context An object holding contextual information about this object - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext - */ - public RemoteFile(IRemoteFileContext context) - { - this._context = context; - if ((context!=null) && (context.getParentRemoteFileSubSystem()!=null) && - !context.getParentRemoteFileSubSystem().isConnected()) - try - { - // deduce active shell from display - IRemoteFileSubSystem ss = context.getParentRemoteFileSubSystem(); - - if (Display.getCurrent() == null) { - ss.connect(new NullProgressMonitor(), false); - } else { - ss.connect(false, null); - } - } catch (Exception exc) {} - } - - - /** - * Set the filter string resolved to get this object - */ - public void setFilterString(RemoteFileFilterString filterString) - { - _context.setFilterString(filterString); - } - - - public void setLabel(String newLabel) - { - _label = newLabel; - } - - - // ------------------------------------------------------------------------ - // GETTER METHODS. ALL FULLY IMPLEMENTED ASSUMING SETTERS HAVE BEEN CALLED. - // ------------------------------------------------------------------------ - - /** - * Return the context associated with this remote file - */ - public IRemoteFileContext getContext() - { - return _context; - } - - /** - * Return the parent subsystem - */ - public IRemoteFileSubSystem getParentRemoteFileSubSystem() - { - return _context.getParentRemoteFileSubSystem(); - } - /** - * Return the parent subsystem factory - */ - public IRemoteFileSubSystemConfiguration getParentRemoteFileSubSystemConfiguration() - { - IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); - if (ss == null) - return null; - else - return ss.getParentRemoteFileSubSystemConfiguration(); - } - - public void setParentRemoteFile(IRemoteFile parentFile) - { - this._parentFile = parentFile; - } - - /** - * Return the parent remote file object expanded to get this object, or null if no such parent - */ - public IRemoteFile getParentRemoteFile() - { - if (this._parentFile == null) - { - if (isRoot()) - { - return null; - } - - IRemoteFile parentFile = null; - -// _context.getParentRemoteFile(); - - String pathOnly = getParentPath(); - if (pathOnly != null) - { - IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); - if (ss != null) - { - IProgressMonitor monitor = new NullProgressMonitor(); - try { - char sep = getSeparatorChar(); - if (pathOnly.length() == 0) - parentFile = ss.getRemoteFileObject(pathOnly, monitor); - else if (pathOnly.length() == 1) - { - if (pathOnly.charAt(0) == sep) - { - parentFile = ss.getRemoteFileObject(pathOnly, monitor); // root file - } - } - else if (!(pathOnly.charAt(pathOnly.length()-1)==sep)) - parentFile = ss.getRemoteFileObject(pathOnly+sep, monitor); - else - parentFile = ss.getRemoteFileObject(pathOnly, monitor); - } catch (SystemMessageException e) { - SystemBasePlugin.logError("RemoteFileImpl.getParentRemoteFile()", e); //$NON-NLS-1$ - } - } - } - else - { - } - this._parentFile = parentFile; - } - return this._parentFile; - } - /** - * Return the filter string resolved to get this object - */ - public RemoteFileFilterString getFilterString() - { - return _context.getFilterString(); - } - /** - * If this is a folder, it is possible that it is listed as part of a multiple filter string - * filter. In this case, when the folder is expanded, we want to filter the file names to - * show all the files that match any of the filter strings that have the same parent path. - * <p> - * This method supports that by returning all the filter strings in the filter which have the - * same parent path as was used to produce this file. - */ - public RemoteFileFilterString[] getAllFilterStrings() - { - return _context.getAllFilterStrings(); - } - /** - * Return the separator character for this file system: \ or /. - * Queries it from the subsystem factory. - */ - public char getSeparatorChar() - { - IRemoteFileSubSystemConfiguration ssf = getParentRemoteFileSubSystemConfiguration(); - if (ssf != null) - return ssf.getSeparatorChar(); - else - return java.io.File.separatorChar; - } - /** - * Return the separator character for this file system, as a string: "\" or "/". - * Queries it from the subsystem factory. - */ - public String getSeparator() - { - IRemoteFileSubSystemConfiguration ssf = getParentRemoteFileSubSystemConfiguration(); - if (ssf != null) - return ssf.getSeparator(); - else - return java.io.File.separator; - } - /** - * Return as a string the line separator character values - */ - public String getLineSeparator() - { - IRemoteFileSubSystemConfiguration ssf = getParentRemoteFileSubSystemConfiguration(); - if (ssf != null) - return ssf.getLineSeparator(); - else - return System.getProperty("line.separator"); //$NON-NLS-1$ - } - /** - * Return if this is a file on Unix, versus windows say - * Queries it from the subsystem factory. - */ - public boolean isUnix() - { - IRemoteFileSubSystemConfiguration ssf = getParentRemoteFileSubSystemConfiguration(); - if (ssf != null) - return ssf.isUnixStyle(); - else - return System.getProperty("os.name").toLowerCase().startsWith("windows"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public boolean isLink() - { - String classifyString = getClassification(); - - if (classifyString == null) - { - return false; - } - else if (classifyString.indexOf("symbolic link") > -1) //$NON-NLS-1$ - { - return true; - } - return false; - } - - - public boolean isExecutable() - { - String classifyString = getClassification(); - - if (classifyString == null) - { - return false; - } - else if (classifyString.indexOf("executable") > -1) //$NON-NLS-1$ - { - return true; - } - return false; - } - - - public boolean isArchive() - { - File file = new File(getAbsolutePath()); - return ArchiveHandlerManager.getInstance().isArchive(file); - } - - /** - * Return the connection this remote file is from. - * - * @since 3.0 renamed getSystemConnection() to getHost() - */ - public IHost getHost() - { - IRemoteFileSubSystem ss = _context.getParentRemoteFileSubSystem(); - if (ss == null) - return null; - else - return ss.getHost(); - } - - /** - * Get fully qualified connection and file name: connection:\path\file - * Note the separator character between the profile name and the connection name is always '.' - * Note the separator character between the connection and qualified-file is always ':' - */ - public String getAbsolutePathPlusConnection() - { - IHost conn = getHost(); - if (conn == null) - return getAbsolutePath(); - else - return conn.getSystemProfileName()+'.'+conn.getAliasName() + CONNECTION_DELIMITER + getAbsolutePath(); - } - - /** - * @see IRemoteFile#getLabel() - */ - public String getLabel() - { - if (_label != null) - { - return _label; - } - return getName(); - } - - - /** - * @see IRemoteFile#isBinary() - */ - public boolean isBinary() - { - if (isDirectory()) - return false; - else - return RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(this); - } - - /** - * @see IRemoteFile#isText() - */ - public boolean isText() - { - if (isDirectory()) - return false; - else - return RemoteFileUtility.getSystemFileTransferModeRegistry().isText(this); - } - - - - - /** - * @see IRemoteFile#getLastModifiedDate() - */ - public Date getLastModifiedDate() - { - return new Date(getLastModified()); - } - - - /** - * Return the extension part of a file name. - * Eg, for abc.java, return "java" - */ - public String getExtension() - { - String nameOnly = getName(); - if (nameOnly == null) - return null; - int idx = nameOnly.lastIndexOf('.'); - if (idx >= 0) - return nameOnly.substring(idx+1); - return null; // TODO - why null? - } - - - /** - * Return the cached copy of this remote file. The returned IFile must be used for read-only - * purposes since no locks are acquired on the remote file. - * - * @return IFile The cached copy of this file if it exists AND it is upto date. null is returned if a local - * cached copy of this file is not available or the local cached copy is not upto date (last modified - * timestamp comparison.) - */ -// FIXME - core and ui separate now (editor is ui) -// public IFile getCachedCopy() throws SystemMessageException -// { -// if (SystemRemoteEditManager.getDefault().doesRemoteEditProjectExist()) -// { -// IResource replica = UniversalFileTransferUtility.getTempFileFor(this); -// if (replica != null && replica.exists()) -// { -// return (IFile)replica; -// } -// } -// return null; -// } - - // ----------------------- - // HOUSEKEEPING METHODS... - // ----------------------- - public String toString() - { - return getName(); - } - - /** - * This is the method required by the IAdaptable interface. - * Given an adapter class type, return an object castable to the type, or - * null if this is not possible. - * <p> - * By default this returns Platform.getAdapterManager().getAdapter(this, adapterType); - * This in turn results in the default subsystem adapter SystemViewSubSystemAdapter, - * in package org.eclipse.rse.ui.view. - */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - // ------------------------------- - // java.util.Comparable methods... - // ------------------------------- - /** - * Compare one remote file to another. This enables us to sort the files so they - * are shown folders-first, and in alphabetical order. - */ - public int compareTo(Object other) throws ClassCastException - { - IRemoteFile otherFile = (IRemoteFile)other; - if (isDirectory() && !otherFile.isDirectory()) - return -1; // we are a folder so we are less than a file - else if (!isDirectory() && otherFile.isDirectory()) - return 1; // we are a file so we are more than a folder - String comp1 = getName(); - - String comp2 = otherFile.getName(); - if (comp2 == null) - comp2 = otherFile.getParentPath(); - return comp1.toLowerCase().compareTo(comp2.toLowerCase()); - } - - // ================================== - // for a proxy mimicing java.io.File - // ================================== - - public void setFile (Object obj) - { - remoteObj = obj; - } - - public Object getFile() - { - return remoteObj; - } - - public boolean isAncestorOf(IRemoteFile file) - { - String separator = this.getSeparator(); - if (this instanceof IVirtualRemoteFile) separator = "/"; //$NON-NLS-1$ - if (this.isArchive()) separator = ArchiveHandlerManager.VIRTUAL_SEPARATOR; - - return file.getAbsolutePathPlusConnection().startsWith(this.getAbsolutePathPlusConnection() + separator); - } - - public boolean isDescendantOf(IRemoteFile file) - { - String separator = file.getSeparator(); - if (this instanceof IVirtualRemoteFile) separator = "/"; //$NON-NLS-1$ - if (file.isArchive()) separator = ArchiveHandlerManager.VIRTUAL_SEPARATOR; - - return this.getAbsolutePathPlusConnection().startsWith(file.getAbsolutePathPlusConnection() + separator); - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType) - */ - public boolean hasContents(ISystemContentsType contentsType) - { - boolean result = _contents.containsKey(contentsType); - -// KM: comment out this code to prevent us picking up wrong cache -// KM: defect 45072 -// if (!result) -// { -// if (contentsType == RemoteFileChildrenContentsType.getInstance()) -// { -// return hasContents(RemoteChildrenContentsType.getInstance()); -// } -// else if (contentsType == RemoteFolderChildrenContentsType.getInstance()) -// { -// return hasContents(RemoteChildrenContentsType.getInstance()); -// } -// } - - return result; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IRemoteContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType, java.lang.String) - */ - public boolean hasContents(ISystemContentsType contentsType, String filter) { - HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters == null) { - return false; - } - - if (filter == null) { - filter = "*"; //$NON-NLS-1$ - } - - boolean result = containsFilterKey(filters, filter); - -// KM: comment out this code to prevent us picking up wrong cache -// KM: defect 45072 -// if (!result) -// { -// if (contentsType == RemoteFileChildrenContentsType.getInstance()) -// { -// return hasContents(RemoteChildrenContentsType.getInstance(), filter); -// } -// else if (contentsType == RemoteFolderChildrenContentsType.getInstance()) -// { -// return hasContents(RemoteChildrenContentsType.getInstance(), filter); -// } -// } - - return result; - } - - protected boolean containsFilterKey(HashMap filters, String filter) - { - if (filters.containsKey(filter)) - { - return true; - } - else - { - - Set keySet = filters.keySet(); - Object[] keyArray = keySet.toArray(); - for (int i = 0; i < keyArray.length; i++) - { - String key = (String)keyArray[i]; - StringComparePatternMatcher matcher = new StringComparePatternMatcher(key); - if (matcher.stringMatches(filter)) - { - return true; - } - /* - StringComparePatternMatcher matcher = new StringComparePatternMatcher(filter); - if (matcher.stringMatches(key)) - { - return true; - } - */ - } - } - return false; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemContainer#getContents(org.eclipse.rse.core.model.ISystemContentsType) - */ - public Object[] getContents(ISystemContentsType contentsType) - { - return getContents(contentsType, "*"); //$NON-NLS-1$ - } - - private Object[] combine(Object[] set1, Object[] set2) - { - ArrayList result = new ArrayList(set1.length + set2.length); - - for (int i = 0; i < set1.length; i++) - { - result.add(set1[i]); - } - - for (int j = 0; j < set2.length; j++) - { - result.add(set2[j]); - } - - return result.toArray(new IRemoteFile[result.size()]); - } - - /* - private Object[] getFiles(Object[] filesAndFolders) - { - List results = new ArrayList(); - for (int i = 0; i < filesAndFolders.length; i++) - { - IRemoteFile fileOrFolder = (IRemoteFile)filesAndFolders[i]; - boolean supportsArchiveManagement = fileOrFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement(); - if (fileOrFolder.isFile() || (fileOrFolder.isArchive() && supportsArchiveManagement)) - { - results.add(fileOrFolder); - } - } - return results.toArray(); - } - */ - - private Object[] getFolders(Object[] filesAndFolders) - { - List results = new ArrayList(); - for (int i = 0; i < filesAndFolders.length; i++) - { - IRemoteFile fileOrFolder = (IRemoteFile)filesAndFolders[i]; - boolean supportsArchiveManagement = fileOrFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement(); - if (!fileOrFolder.isFile() || (fileOrFolder.isArchive() && supportsArchiveManagement)) - { - results.add(fileOrFolder); - } - } - return results.toArray(); - } - - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IRemoteContainer#getContents(org.eclipse.rse.core.model.ISystemContentsType, java.lang.String) - */ - public Object[] getContents(ISystemContentsType contentsType, String filter) - { - HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters == null || filters.isEmpty()) - { - if (contentsType == RemoteChildrenContentsType.getInstance()) - { - if (hasContents(RemoteFileChildrenContentsType.getInstance()) && hasContents(RemoteFolderChildrenContentsType.getInstance())) - { - // implies both files and folders - Object[] folders = getContents(RemoteFolderChildrenContentsType.getInstance(), filter); - Object[] files = getContents(RemoteFileChildrenContentsType.getInstance(), filter); - - return combine(folders, files); - } - } - else if (contentsType == RemoteFileChildrenContentsType.getInstance()) - { - if (hasContents(RemoteChildrenContentsType.getInstance())) - { - Object[] filesAndFolders = getContents(RemoteChildrenContentsType.getInstance()); - return filesAndFolders; - } - } - else if (contentsType == RemoteFolderChildrenContentsType.getInstance()) - { - if (hasContents(RemoteChildrenContentsType.getInstance())) - { - Object[] filesAndFolders = getContents(RemoteChildrenContentsType.getInstance()); - return getFolders(filesAndFolders); - } - } - return null; - } - - if (filter == null) { - filter = "*"; //$NON-NLS-1$ - } - - if (filters.containsKey(filter)) - { - Object[] filterResults = (Object[])filters.get(filter); - if (contentsType == RemoteChildrenContentsType.getInstance() || - contentsType == RemoteFileChildrenContentsType.getInstance() || - contentsType == RemoteFolderChildrenContentsType.getInstance() - ) - { - return filterResults; - } - else - { - return filterResults; - } - } - - ArrayList calculatedResults = new ArrayList(); - - StringComparePatternMatcher fmatcher = new StringComparePatternMatcher(filter); - - // the filter may be a subset of existing filters - Object[] keySet = filters.keySet().toArray(); - - for (int i = 0; i < keySet.length; i++) { - - String key = (String)keySet[i]; - - // KM: we need to match with the key to ensure that the filter is a subset - StringComparePatternMatcher matcher = new StringComparePatternMatcher(key); - - if (matcher.stringMatches(filter)) { - // get all children, i.e. the superset - Object[] all = (Object[]) filters.get(key); - - if (all != null) { - - for (int s = 0; s < all.length; s++) { - - Object subContent = all[s]; - - if (!calculatedResults.contains(subContent)) { - - if (subContent instanceof IRemoteFile) { - - IRemoteFile temp = (IRemoteFile) subContent; - - if (temp.isFile()) { - String compareTo = null; - boolean filterForFileTypes = isFilterForFileTypes(filter); - - if (!filterForFileTypes) { - compareTo = temp.getName(); - } - else { - compareTo = temp.getExtension(); - } - - // match with the filter to take out those - // that do not match the filter - if (compareTo != null && fmatcher.stringMatches(compareTo)) { - calculatedResults.add(subContent); - } - } - else { - calculatedResults.add(subContent); - } - } - else { - calculatedResults.add(subContent); - } - } - } - } - } - } - - return calculatedResults.toArray(); - } - - /** - * Returns whether filter is for file types. - * @param filter the filter. - * @return <code>true</code> if filter is for file types, <code>false</code> otherwise. - */ - private boolean isFilterForFileTypes(String filter) { - - if (filter.endsWith(",")) { //$NON-NLS-1$ - return true; - } - else { - return false; - } - } - - public void setIsContainer(boolean con) { - isContainer = con; - } - - /* - * Replace occurrences of cached object with new object - */ - public void replaceContent(Object oldObject, Object newObject) - { - HashMap filters = (HashMap)(_contents.get(RemoteChildrenContentsType.getInstance())); - if (filters != null) - { - Collection values = filters.values(); - Object[] valuesArray = values.toArray(); - for (int i = 0; i < valuesArray.length; i++) - { - Object[] children = (Object[])valuesArray[i]; - for (int j = 0; j < children.length; j++) - { - if (children[j]== oldObject) - { - children[j]= newObject; - } - } - } - } - } - - - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.IRemoteContainer#setContents(org.eclipse.rse.core.model.ISystemContentsType, java.lang.String, java.lang.Object[]) - */ - public void setContents(ISystemContentsType contentsType, String filter, Object[] con) { - - if (filter == null) { - filter = "*"; //$NON-NLS-1$ - } - - // DKM - consider all containers so that we can tell if an empty one - // has been queried before (i.e. via IRemoteFile[0] as it's contents vs null) -// if (con != null && con.length > 0) - { - isContainer = true; - } - - HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters == null) - { - filters = new HashMap(); - } - - if (isContainer) - { - filters.put(filter, con); - _contents.put(contentsType, filters); - } - - // set parent folders - if (isContainer && con != null) - { - for (int i = 0; i < con.length; i++) - { - if (con[i] instanceof RemoteFile) - { - RemoteFile rFile = (RemoteFile)con[i]; - rFile.setParentRemoteFile(this); - } - } - } - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemoteContainer#isStale() - */ - public boolean isStale() - { - return _isStale || !exists(); - } - - - - /** - * @see org.eclipse.rse.core.subsystems.IRemoteContainer#markStale(boolean) - */ - public void markStale(boolean isStale) - { - markStale(isStale, true); - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemoteContainer#markStale(boolean) - */ - public void markStale(boolean isStale, boolean clearCache) - { - _isStale = isStale; - - if (isStale && clearCache) - { - - Iterator iter = _contents.keySet().iterator(); - - while (iter.hasNext()) { - Object contentsType = iter.next(); - if (contentsType instanceof ISystemContentsType) - { - if (!((ISystemContentsType)contentsType).isPersistent()) - { - HashMap filters = (HashMap)(_contents.get(contentsType)); - - if (filters != null) - { - filters.clear(); - } - } - } - } - - if (_parentFile != null) - { - _parentFile.markStale(true, false); - } - - - } - } - - public void copyContentsTo(IRemoteContainer target) - { - Iterator iter = _contents.keySet().iterator(); - - while (iter.hasNext()) - { - Object contentsType = iter.next(); - if (contentsType instanceof ISystemContentsType) - { - ISystemContentsType ct = (ISystemContentsType)contentsType; - if (ct.isPersistent()) - { - HashMap filters = (HashMap)(_contents.get(ct)); - - Iterator fiter = filters.keySet().iterator(); - - while (fiter.hasNext()) - { - Object filter = fiter.next(); - Object fcontents = filters.get(filter); - if (fcontents != null && fcontents instanceof Object[]) - { - target.setContents(ct, (String)filter, (Object[])fcontents); - } - } - } - } - } - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#getProperties(java.lang.String[]) - */ - public Object[] getProperties(String[] keys) { - - Object[] values = new Object[keys.length]; - - for (int i = 0; i < keys.length; i++) { - values[i] = properties.get(keys[i]); - } - - return values; - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#getProperty(java.lang.String) - */ - public Object getProperty(String key) { - return properties.get(key); - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#isPropertyStale(java.lang.String) - */ - public boolean isPropertyStale(String key) { - - Boolean b = (Boolean)(propertyStates.get(key)); - - if (b == null) { - return false; - } - else { - return b.booleanValue(); - } - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#markAllPropertiesStale() - */ - public void markAllPropertiesStale() { - Iterator iter = propertyStates.keySet().iterator(); - - while (iter.hasNext()) { - String key = (String)(iter.next()); - markPropertyStale(key); - } - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#markPropertyStale(java.lang.String) - */ - public void markPropertyStale(String key) { - propertyStates.put(key, Boolean.FALSE); - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#setProperties(java.lang.String[], java.lang.Object[]) - */ - public void setProperties(String[] keys, Object[] values) { - - for (int i = 0; i < keys.length; i++) { - setProperty(keys[i], values[i]); - } - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemotePropertyHolder#setProperty(java.lang.String, java.lang.Object) - */ - public void setProperty(String key, Object value) { - properties.put(key, value); - propertyStates.put(key, Boolean.TRUE); - } - - public String getComment() - { - return ""; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see ISchedulingRule#contains(ISchedulingRule) - */ - public boolean contains(ISchedulingRule rule) { - if (this == rule) - return true; - if (rule instanceof MultiRule) { - MultiRule multi = (MultiRule) rule; - ISchedulingRule[] children = multi.getChildren(); - for (int i = 0; i < children.length; i++) - if (!contains(children[i])) - return false; - return true; - } - if (rule instanceof IResource) - return true; - if (rule instanceof IRemoteFile) - { - RemoteFile rf = (RemoteFile)rule; - return getHostName().equals(rf.getHostName()) && - rf.getAbsolutePath().startsWith(getAbsolutePath()); - } - //if (!(rule instanceof RemoteFileSchedulingRule)) - // return false; - if (rule instanceof RemoteFileSchedulingRule) - { - return getHostName().equals(((RemoteFileSchedulingRule) rule).getHostName()) && - ((RemoteFileSchedulingRule) rule).getAbsolutePath().startsWith(getAbsolutePath()); - } - return false; - } - - /* (non-Javadoc) - * @see ISchedulingRule#isConflicting(ISchedulingRule) - */ - public boolean isConflicting(ISchedulingRule rule) - { - if (rule instanceof RemoteFile) - { - String otherPath = ((RemoteFile)rule).getAbsolutePath(); - String path = this.getAbsolutePath(); - String otherHost = ((RemoteFile)rule).getHostName(); - return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); - } - else if (rule instanceof RemoteFileSchedulingRule) - { - String otherPath = ((RemoteFileSchedulingRule) rule).getAbsolutePath(); - String path = this.getAbsolutePath(); - String otherHost = ((RemoteFileSchedulingRule) rule).getHostName(); - return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); - } - else - { - return false; - } - } - - public boolean equals(Object otherObj) - { - if (otherObj instanceof RemoteFile) - { - RemoteFile other = (RemoteFile)otherObj; - if (this == other) return true; - - String otherPath = other.getAbsolutePath(); - String path = this.getAbsolutePath(); - //String otherHost = other.getHostName(); - - String alias1 = this.getParentRemoteFileSubSystem().getHostAliasName(); - String alias2 = other.getParentRemoteFileSubSystem().getHostAliasName(); - - //return getHostName().equals(otherHost) && path.equals(otherPath); - return alias1.equals(alias2) && path.equals(otherPath); - } - else - { - return false; - } - } - - public String getHostName() - { - return getHost().getHostName(); - } - - - - private String getParentPathFor(String path) - { - boolean isUnix = getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().isUnixStyle(); - - String separator = getSeparator(); - - if (isUnix && path.equals(separator)) - { - return null; // no parent of root - } - - int lastSep = path.lastIndexOf(separator); - - if (lastSep == 0) // root is the parent (on unix) - { - return separator; - } - else if (lastSep > 0) - { - return path.substring(0, lastSep); - } - else - { - return null; - } - } - - /** - * Returns the encoding of the remote file. If a user specified value does not exist, then we check - * it's ancestry for an encoding. Otherwise the encoding of the parent subsystem is returned. - * @see IRemoteFile#getEncoding() - */ - public String getEncoding() { - String hostName = getParentRemoteFileSubSystem().getHost().getHostName(); - String path = getAbsolutePath(); - String encoding = RemoteFileEncodingManager.getInstance().getEncoding(hostName, path); - - // ask the parent folder - if (encoding == null) { - if (_parentFile != null) - { - encoding = _parentFile.getEncoding(); - } - else - { - - // manually extra parents - String parentPath = getParentPathFor(path); - while (parentPath != null && encoding == null) - { - encoding = RemoteFileEncodingManager.getInstance().getEncoding(hostName, parentPath); - parentPath = getParentPathFor(parentPath); - } - - if (encoding == null) // no encoding found - fall back to system - { - encoding = getParentRemoteFileSubSystem().getRemoteEncoding(); - } - } - } - - return encoding; - } - /** - * Sets the encoding of the remote file. It sets the encoding of the remote file in {@link RemoteFileEncodingManager}. - * @param encoding the encoding to be set for the remote file. - */ - public void setEncoding(String encoding) { - RemoteFileEncodingManager.getInstance().setEncoding(getHostName(), getAbsolutePath(), encoding); - } - - /** - * {@inheritDoc} - * - * @since 3.0 - */ - public IHostFilePermissions getPermissions() { - IHostFile hostFile = getHostFile(); - if (hostFile instanceof IHostFilePermissionsContainer){ - return ((IHostFilePermissionsContainer)hostFile).getPermissions(); - } - return null; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileChildrenContentsType.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileChildrenContentsType.java deleted file mode 100644 index c2d726b5f..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileChildrenContentsType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 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 - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.rse.core.model.ISystemContentsType; - -/** - * Represents contents that are children of a container - */ -public class RemoteFileChildrenContentsType implements ISystemContentsType -{ - public static String CONTENTS_TYPE_CHILDREN = "contents_file_children"; //$NON-NLS-1$ - public static RemoteFileChildrenContentsType _instance = new RemoteFileChildrenContentsType(); - - public static RemoteFileChildrenContentsType getInstance() - { - return _instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.model.ISystemContentsType#getType() - */ - public String getType() - { - return CONTENTS_TYPE_CHILDREN; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.model.ISystemContentsType#isPersistent() - */ - public boolean isPersistent() - { - return false; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileCodeException.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileCodeException.java deleted file mode 100644 index 596e30f8d..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileCodeException.java +++ /dev/null @@ -1,99 +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.subsystems.files.core.subsystems; - -/** - * This exception class should be used to return exception codes to - * clients. Codes can be either integers or strings, or both may be - * used at the same time for better subclassing of similar errors that - * occur due to slightly different reasons. - */ - -public class RemoteFileCodeException extends Exception { - - - - private int code; - private String codeString; - - - /** - * Constructor for RemoteFileCodeException - */ - public RemoteFileCodeException() { - super(); - } - - - /** - * Constructor for RemoteFileCodeException - */ - public RemoteFileCodeException(int code) { - this.code = code; - } - - - /** - * Constructor for RemoteFileCodeException - */ - public RemoteFileCodeException(String codeString) { - this.codeString = codeString; - } - - - /** - * Constructor for RemoteFileCodeException - */ - public RemoteFileCodeException(int code, String codeString) { - this.code = code; - this.codeString = codeString; - } - - - /** - * Set the error code - * @param the error code - */ - public void setErrorCode(int code) { - this.code = code; - } - - - /** - * Get the error code - * @return the error code that was set - */ - public int getErrorCode() { - return code; - } - - - /** - * Set the error code string - */ - public void setErrorCodeString(String codeString) { - this.codeString = codeString; - } - - - /** - * Get the error code string - */ - public String getErrorCodeString() { - return codeString; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileContext.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileContext.java deleted file mode 100644 index b4789a902..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileContext.java +++ /dev/null @@ -1,149 +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.subsystems.files.core.subsystems; -import java.util.Vector; - -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; - -/** - * This interface represents a place to hold contextual information stored within - * each remote file object. - * <p> - * We store in here information that might be the same for multiple remote file objects, - * in order to save memory. This way, we can merely hold a reference to a single object, - * which itself may have numerous pieces of information helpful when processing actions - * on a particular remote object. - */ -public class RemoteFileContext implements IRemoteFileContext -{ - - protected IRemoteFileSubSystem subsystem; - protected IRemoteFile parentFile; - protected RemoteFileFilterString filterString; - protected Vector allFilterStrings; - - /** - * Constructor that takes all inputs. - */ - public RemoteFileContext(IRemoteFileSubSystem subsystem, IRemoteFile parentFileObject, - RemoteFileFilterString filterString) - { - this.subsystem = subsystem; - this.parentFile = parentFileObject; - this.filterString = filterString; - } - /** - * Constructor that takes no inputs. - */ - public RemoteFileContext() - { - } - - // ------------------------------------------------------------------------ - // SETTER METHODS... - // ------------------------------------------------------------------------ - /** - * Set the parent subsystem - */ - public void setParentRemoteFileSubSystem(IRemoteFileSubSystem subsystem) - { - this.subsystem = subsystem; - } - /** - * Set the parent remote file object expanded to get this object - */ - public void setParentRemoteFile(IRemoteFile parentFileObject) - { - this.parentFile = parentFileObject; - } - /** - * Set the filter string object resolved to get this object - */ - public void setFilterString(RemoteFileFilterString filterString) - { - this.filterString = filterString; - allFilterStrings = null; - } - /** - * Add an additional filter string. This is called for folders in a multi-filter string - * filter. It is called for each filter string that lists the contents of the same parent - * path, when show subdirs is true. It is needed to support the subsequent expansion of - * this subdirectory, so that it can filter on all the appropriate filter strings. - */ - public void addFilterString(RemoteFileFilterString additionalFilterString) - { - if (allFilterStrings == null) - { - allFilterStrings = new Vector(); - if (filterString != null) - allFilterStrings.addElement(filterString); - } - // ensure this filter string is not already in the list... - boolean match = false; - String newfs = additionalFilterString.toString(); - for (int idx=0; !match && (idx<allFilterStrings.size()); idx++) - { - RemoteFileFilterString prevfs = (RemoteFileFilterString)allFilterStrings.elementAt(idx); - if (newfs.equals(prevfs.toString())) - match = true; - } - if (!match) - allFilterStrings.addElement(additionalFilterString); - } - - // ------------------------------------------------------------------------ - // GETTER METHODS... - // ------------------------------------------------------------------------ - - /** - * Return the parent subsystem - */ - public IRemoteFileSubSystem getParentRemoteFileSubSystem() - { - return subsystem; - } - /** - * Return the parent remote file object expanded to get this object, or null if no such parent - */ - public IRemoteFile getParentRemoteFile() - { - return parentFile; - } - /** - * Return the filter string object resolved to get this object - */ - public RemoteFileFilterString getFilterString() - { - return filterString; - } - /** - * Return all the filter string objects applicable to this folder object. - */ - public RemoteFileFilterString[] getAllFilterStrings() - { - if (allFilterStrings == null) - return new RemoteFileFilterString[] {filterString}; - else - { - RemoteFileFilterString[] all = new RemoteFileFilterString[allFilterStrings.size()]; - for (int idx=0; idx<all.length; idx++) - all[idx] = (RemoteFileFilterString)allFilterStrings.elementAt(idx); - return all; - } - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java deleted file mode 100644 index ab1720c88..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEmpty.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.files.IHostFilePermissions; - - -/** - * A "dummy" node to use as a place holder - */ -public class RemoteFileEmpty extends RemoteFile -{ - /** - * Constructor for RemoteFileEmpty - */ - public RemoteFileEmpty() - { - super(new RemoteFileContext(null,null,null)); - } - - /** - * @since 3.0 - */ - public String getAbsolutePath() - { - return ""; //$NON-NLS-1$ - } - - - public String getName() - { - return "dummy"; //$NON-NLS-1$ - } - - - public int compareTo(Object o) - { - // TODO Auto-generated method stub - return 0; - } - - - public boolean isVirtual() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean showBriefPropertySet() - { - // TODO Auto-generated method stub - return false; - } - - - - public String getParentPath() - { - // TODO Auto-generated method stub - return null; - } - - - - public String getParentNoRoot() - { - // TODO Auto-generated method stub - return null; - } - - - - public String getRoot() - { - // TODO Auto-generated method stub - return null; - } - - - - public String getParentName() - { - // TODO Auto-generated method stub - return null; - } - - - - public boolean isRoot() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean isDirectory() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean isFile() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean isHidden() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean canRead() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean canWrite() - { - // TODO Auto-generated method stub - return false; - } - - - - public boolean exists() - { - // TODO Auto-generated method stub - return false; - } - - - - public long getLastModified() - { - // TODO Auto-generated method stub - return 0; - } - - - - public long getLength() - { - // TODO Auto-generated method stub - return 0; - } - - - - public boolean showReadOnlyProperty() - { - // TODO Auto-generated method stub - return false; - } - - - - public String getClassification() - { - // TODO Auto-generated method stub - return null; - } - - - - public String getCanonicalPath() - { - // TODO Auto-generated method stub - return null; - } - - - - public IHostFile getHostFile() - { - // TODO Auto-generated method stub - return null; - } - - /** - * Override this to provide permissions - */ - public IHostFilePermissions getPermissions() { - return null; - } - - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEncodingManager.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEncodingManager.java deleted file mode 100644 index 336e4aa11..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileEncodingManager.java +++ /dev/null @@ -1,317 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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 - * - * Contributors: - * Kushal Munir IBM - Initial creation of this file. - * David McKnight (IBM) [209660] delete encoding mapping when null is specified - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Properties; -import java.util.Set; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.rse.ui.RSEUIPlugin; - -/** - * This singleton class manages encodings of remote files. - */ -public class RemoteFileEncodingManager { - - private static RemoteFileEncodingManager instance; - private static final String ENCODINGS_DIR = "encodings"; //$NON-NLS-1$ - private static final String ENCODINGS_PROPERTIES_FILE = "encodings.properties"; //$NON-NLS-1$ - private boolean isLoaded; - private HashMap hostMap; - - /** - * Constructor for the manager. - */ - private RemoteFileEncodingManager() { - init(); - } - - /** - * Initializes the manager. - */ - private void init() { - isLoaded = false; - hostMap = new HashMap(); - } - - /** - * Returns the singleton instance. - * @return the singleton instance. - */ - public static final RemoteFileEncodingManager getInstance() { - - if (instance == null) { - instance = new RemoteFileEncodingManager(); - } - - return instance; - } - - /** - * Returns the encoding for a file with the given path on a system with the given hostname. - * @param hostname the hostname of the system. - * @param remotePath the remote path of the file on the system. - * @return the encoding. - */ - public String getEncoding(String hostname, String remotePath) { - - // if the encodings have not been loaded from disk, load them now - if (!isLoaded) { - load(); - } - - // check to see load was successful - if (isLoaded) { - - Properties props = (Properties)(hostMap.get(hostname)); - - // if no value exists for the hostname key, then return null - if (props == null) { - return null; - } - // otherwise, check the properties - // will return null if the remote path is not a property key - else { - String encoding = props.getProperty(remotePath); - return encoding; - } - } - // if loading was not successful, return null - else { - return null; - } - } - - /** - * Sets the encoding for a file with the given path on a system with the given hostname. - * @param hostname the hostname of the system. - * @param remotePath the remote path of the file on the system. - * @param encoding the encoding to set. - */ - public void setEncoding(String hostname, String remotePath, String encoding) { - - // if the encodings have not been loaded from disk, load them now - if (!isLoaded) { - load(); - } - - // check to see whether load was successful - if (isLoaded) { - - Properties props = null; - - if (hostMap.containsKey(hostname)) { - props = (Properties)(hostMap.get(hostname)); - } - else if (encoding != null) - { - props = new Properties(); - } - - if (props != null) - { - if (encoding == null) - { - props.remove(remotePath); - } - else - { - props.setProperty(remotePath, encoding); - hostMap.put(hostname, props); - } - } - } - } - - /** - * Loads the encoding data from disk. - */ - public void load() { - - if (!isLoaded) { - - IPath encodingsLocation = getEncodingLocation(); - File file = encodingsLocation.toFile(); - - // if the encodings settings location exists - if (file.exists() && file.isDirectory()) { - - // get a list of all the directory hostnames - File[] hosts = file.listFiles(); - - // go through each hostname dir - for (int i = 0; i < hosts.length; i++) { - - // do a check to ensure it indeed is a dir - if (hosts[i].exists() && hosts[i].isDirectory()) { - - // check if encodings.properties file exists in the dir - IPath encodingsFilePath = new Path(hosts[i].getAbsolutePath()); - - if (!encodingsFilePath.hasTrailingSeparator()) { - encodingsFilePath.addTrailingSeparator(); - } - - encodingsFilePath = encodingsFilePath.append(ENCODINGS_PROPERTIES_FILE); - encodingsFilePath = encodingsFilePath.makeAbsolute(); - - File encodingsFile = encodingsFilePath.toFile(); - - if (!encodingsFile.exists()) { - continue; - } - else { - Properties props = new Properties(); - InputStream inputStream = null; - - try { - inputStream = new FileInputStream(encodingsFile); - props.load(inputStream); - hostMap.put(hosts[i].getName(), props); - } - catch (FileNotFoundException e) { - RSEUIPlugin.logError("File " + encodingsFilePath.toOSString() + " could not be found", e); //$NON-NLS-1$ //$NON-NLS-2$ - continue; - } - catch (IOException e) { - RSEUIPlugin.logError("I/O problems reading file " + encodingsFilePath.toOSString(), e); //$NON-NLS-1$ - continue; - } - } - } - } - } - - isLoaded = true; - } - } - - /** - * Saves the encoding data to disk. - */ - public void save() { - - Set hosts = hostMap.keySet(); - - // if there are hosts in the hashmap - if (hosts != null && !hosts.isEmpty()) { - - // get the location for encoding settings - IPath encodingsLocation = getEncodingLocation(); - File file = encodingsLocation.toFile(); - - // create the location if it does not exist - if (!file.exists()) { - file.mkdirs(); - } - - // if the location now exists - if (file.exists() && file.isDirectory()) { - - Iterator iter = hosts.iterator(); - - while (iter.hasNext()) { - String hostname = (String)(iter.next()); - - IPath hostDirPath = new Path(encodingsLocation.toOSString()); - - if (!hostDirPath.hasTrailingSeparator()) { - hostDirPath.addTrailingSeparator(); - } - - hostDirPath = hostDirPath.append(hostname); - hostDirPath.makeAbsolute(); - - File hostDir = hostDirPath.toFile(); - - Properties props = (Properties)(hostMap.get(hostname)); - - if (props != null && !props.isEmpty()) { - - if (!hostDir.exists()) { - hostDir.mkdirs(); - } - - if (hostDir.exists() && hostDir.isDirectory()) { - - IPath encodingsFilePath = new Path(hostDirPath.toOSString()); - encodingsFilePath = encodingsFilePath.append(ENCODINGS_PROPERTIES_FILE); - encodingsFilePath = encodingsFilePath.makeAbsolute(); - - File encodingsFile = encodingsFilePath.toFile(); - - if (!encodingsFile.exists()) { - boolean created = false; - - try { - created = encodingsFile.createNewFile(); - } - catch (IOException e) { - RSEUIPlugin.logError("I/O error when trying to create encodings file " + encodingsFilePath.toOSString(), e); //$NON-NLS-1$ - created = false; - } - - if (!created) { - continue; - } - } - - OutputStream outStream = null; - - try { - outStream = new FileOutputStream(encodingsFile); - props.store(outStream, null); - } - catch (FileNotFoundException e) { - RSEUIPlugin.logError("File " + encodingsFilePath + " could not be found", e); //$NON-NLS-1$ //$NON-NLS-2$ - continue; - } - catch (IOException e) { - RSEUIPlugin.logError("I/O problems writing to file " + encodingsFilePath, e); //$NON-NLS-1$ - continue; - } - } - } - // no properties for hostname, so remove the dir corresponding to the hostname if it exists - else { - - if (hostDir.exists()) { - hostDir.delete(); - } - } - } - } - } - } - - /** - * Returns the absolute path of the location that contains the encoding settings. - * @return the absolute path of the location that contains encoding settings. - */ - private IPath getEncodingLocation() { - IPath location = RSEUIPlugin.getDefault().getStateLocation(); - location = location.append(ENCODINGS_DIR); - location = location.makeAbsolute(); - return location; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java deleted file mode 100644 index 49ccd71bd..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileRoot.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.rse.services.files.IHostFile; -import org.eclipse.rse.services.files.IHostFilePermissions; - -/** - * A root node used to drive a CheckboxTreeAndListGroup, or any viewer which - * takes a root which should return a single IRemoteFile object in the initial - * getChildren query. - */ -public class RemoteFileRoot extends RemoteFile -{ - private IRemoteFile rootFile; - private IRemoteFile[] rootFiles; - - /** - * Constructor when root is known - */ - public RemoteFileRoot(IRemoteFile rootFile) - { - super(new RemoteFileContext(null,null,null)); - setRootFile(rootFile); - } - - /** - * Constructor when root is not known. - * Client must call {@link #setRootFile(IRemoteFile)} before any - * get.. calls in this class are actually used. - */ - public RemoteFileRoot() - { - super(new RemoteFileContext(null,null,null)); - } - - /** - * Return the root file node - */ - public IRemoteFile getRootFile() - { - return rootFile; - } - - /** - * Reset the root file node - */ - public void setRootFile(IRemoteFile rootFile) - { - this.rootFile = rootFile; - rootFiles = new IRemoteFile[1]; - rootFiles[0] = rootFile; - } - - /** - * Return the root file node as an array of 1 - */ - public IRemoteFile[] getRootFiles() - { - return rootFiles; - } - - public String getName() - { - return "dummy"; //$NON-NLS-1$ - } - - public int compareTo(Object o) - { - // TODO Auto-generated method stub - return 0; - } - public boolean isVirtual() - { - // TODO Auto-generated method stub - return false; - } - public boolean showBriefPropertySet() - { - // TODO Auto-generated method stub - return false; - } - public String getParentPath() - { - // TODO Auto-generated method stub - return null; - } - public String getParentNoRoot() - { - // TODO Auto-generated method stub - return null; - } - public String getRoot() - { - return rootFile.getAbsolutePath(); - } - public String getParentName() - { - // TODO Auto-generated method stub - return null; - } - public boolean isRoot() - { - return true; - } - public boolean isDirectory() - { - return true; - } - public boolean isFile() - { - return false; - } - - public boolean isHidden() - { - return false; - } - - public boolean canRead() - { - return rootFile.canRead(); - } - - public boolean canWrite() - { - return rootFile.canWrite(); - } - - public boolean exists() - { - return rootFile.exists(); - } - - public long getLastModified() - { - return rootFile.getLastModified(); - } - - public long getLength() - { - return rootFile.getLength(); - } - - public boolean showReadOnlyProperty() - { - return rootFile.showReadOnlyProperty(); - } - - public String getClassification() - { - return rootFile.getClassification(); - } - - /** - * @since 3.0 - */ - public String getAbsolutePath() - { - return rootFile.getAbsolutePath(); - } - - public String getCanonicalPath() - { - return rootFile.getCanonicalPath(); - } - - public IHostFile getHostFile() - { - return rootFile.getHostFile(); - } - - /** - * Override this to provide permissions - */ - public IHostFilePermissions getPermissions() { - return rootFile.getPermissions(); - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSchedulingRule.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSchedulingRule.java deleted file mode 100644 index fdbe88d0c..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSchedulingRule.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.MultiRule; - - -public class RemoteFileSchedulingRule implements ISchedulingRule -{ - private IRemoteFile _file; - - public RemoteFileSchedulingRule(IRemoteFile file) - { - _file = file; - } - - /* - * (non-Javadoc) - * @see ISchedulingRule#contains(ISchedulingRule) - */ - public boolean contains(ISchedulingRule rule) { - if (this == rule) - return true; - if (rule instanceof MultiRule) { - MultiRule multi = (MultiRule) rule; - ISchedulingRule[] children = multi.getChildren(); - for (int i = 0; i < children.length; i++) - if (!contains(children[i])) - return false; - return true; - } - if (!(rule instanceof RemoteFileSchedulingRule)) - return false; - return getHostName().equals(((RemoteFileSchedulingRule) rule).getHostName()) && - ((RemoteFileSchedulingRule) rule).getAbsolutePath().startsWith(getAbsolutePath()); - } - - /* (non-Javadoc) - * @see ISchedulingRule#isConflicting(ISchedulingRule) - */ - public boolean isConflicting(ISchedulingRule rule) - { - if (!(rule instanceof RemoteFileSchedulingRule)) - return false; - String otherPath = ((RemoteFileSchedulingRule) rule).getAbsolutePath(); - String path = this.getAbsolutePath(); - String otherHost = ((RemoteFileSchedulingRule) rule).getHostName(); - return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); - } - - public String getAbsolutePath() - { - return _file.getAbsolutePath(); - } - - public String getHostName() - { - return _file.getHost().getHostName(); - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java deleted file mode 100644 index ad15db9a9..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java +++ /dev/null @@ -1,1494 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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) - Fix 162962 - recursive removeCachedRemoteFile() - * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core - * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation - * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem - * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes - * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * David McKnight (IBM) - [196664] prevent unnecessary query on the parent - * Rupen Mardirossian (IBM) - [204307] listFolders now deals with a null parameter for fileNameFilter preventing NPE - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - * David McKnight (IBM) - [210109] store constants in IFileService rather than IFileServiceConstants - * David McKnight (IBM) - [211472] [api][breaking] IRemoteObjectResolver.getObjectWithAbsoluteName() needs a progress monitor - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible - * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared - * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading - * Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding() - * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; -// copy all the following imports to your child class... -// remote system framework packages... - -import java.io.BufferedReader; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.osgi.util.NLS; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterReference; -import org.eclipse.rse.core.filters.ISystemFilterString; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemMessageObject; -import org.eclipse.rse.core.model.SystemChildrenContentsType; -import org.eclipse.rse.core.model.SystemMessageObject; -import org.eclipse.rse.core.subsystems.CommunicationsEvent; -import org.eclipse.rse.core.subsystems.ICommunicationsListener; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.IRemoteContainer; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType; -import org.eclipse.rse.core.subsystems.SubSystem; -import org.eclipse.rse.internal.subsystems.files.core.Activator; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFileMessageIds; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.clientserver.FileTypeMatcher; -import org.eclipse.rse.services.clientserver.IClientServerConstants; -import org.eclipse.rse.services.clientserver.IMatcher; -import org.eclipse.rse.services.clientserver.NamePatternMatcher; -import org.eclipse.rse.services.clientserver.SystemEncodingUtil; -import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.services.clientserver.messages.SystemMessageException; -import org.eclipse.rse.services.files.IFileService; -import org.eclipse.rse.services.search.IHostSearchResult; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; -import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCore; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.PropertyPage; - - -/** - * Specialization for file subsystem factories. - * It is subclassed via use of a Rose model and MOF/EMF, or better yet - * by subclassing {@link FileServiceSubSystem}. - * <p> - * For your convenience, there is built-in name filtering support. To use it, - * call: - * <ul> - * <li>{@link #setListValues(int, String)} or {@link #setListValues(int, String, String)} to set the filter criteria - * <li>{@link #accept(String, boolean)} to test a given name for a match - * </ul> - * - * <p>This class returns instances of {@link RemoteFile} objects. - */ - -public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFileSubSystem, ICommunicationsListener -{ - public boolean osVarsSet, osWindows, osWindows95, osWindowsNT; - public String osName, osCmdShell; - // variables to affect the list method for subsetting folder contents - private int includeFilesOrFolders = IClientServerConstants.INCLUDE_ALL; - //private NamePatternMatcher matcher = null; - protected IMatcher matcher = null; - protected NamePatternMatcher folderNameMatcher = null; - protected RemoteFileFilterString currFilterString = null; - protected RemoteFileFilterString FILTERSTRING_LISTROOTS = null; - protected RemoteFileContext DEFAULT_CONTEXT = null; - protected RemoteFileContext DEFAULT_CONTEXT_NOFILTERSTRING = null; - - protected ArrayList _searchHistory; - - // all created IRemoteFiles mapped in cache to quick retrieval - protected HashMap _cachedRemoteFiles = new HashMap(); - - /** - * Default constructor. Do not call directly! Rather, use the mof generated factory method to create. - * After instantiation, be sure to call {@link #setSubSystemConfiguration(ISubSystemConfiguration)}. - */ - public RemoteFileSubSystem(IHost host, IConnectorService connectorService) - { - super(host, connectorService); - _searchHistory = new ArrayList(); - } - /** - * @return true if this subsystem's properties should take precedence - * over other subsystems that share the same {@link IConnectorService} - */ - public boolean isPrimarySubSystem() - { - return true; - } - - /** - * Return parent subsystem factory, cast to a RemoteFileSubSystemConfiguration - * Assumes {@link #setSubSystemConfiguration(ISubSystemConfiguration)} has already been called. - */ - public IRemoteFileSubSystemConfiguration getParentRemoteFileSubSystemConfiguration() - { - return (IRemoteFileSubSystemConfiguration) super.getSubSystemConfiguration(); - } - - /** - * Return true if file names are case-sensitive. Used when doing name or type filtering - * Default is false, but can be overridden. - */ - public boolean isCaseSensitive() - { - return false; - } - - - protected RemoteFileFilterString getCurrentFilterString() - { - RemoteFileFilterString crffs = currFilterString; - currFilterString = null; - return crffs; - } - - protected RemoteFileFilterString getFilterStringListRoots() - { - if (FILTERSTRING_LISTROOTS == null) - FILTERSTRING_LISTROOTS = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration()); - return FILTERSTRING_LISTROOTS; - } - protected RemoteFileContext getDefaultContext() - { - if (DEFAULT_CONTEXT == null) - DEFAULT_CONTEXT = new RemoteFileContext(this, null, getFilterStringListRoots()); - return DEFAULT_CONTEXT; - } - protected RemoteFileContext getDefaultContextNoFilterString() - { - if (DEFAULT_CONTEXT_NOFILTERSTRING == null) - DEFAULT_CONTEXT_NOFILTERSTRING = new RemoteFileContext(this, null, null); - return DEFAULT_CONTEXT_NOFILTERSTRING; - } - protected RemoteFileContext getContext(IRemoteFile parent) - { - return new RemoteFileContext(this, parent, null); - } - protected RemoteFileContext getContext(IRemoteFile parent, RemoteFileFilterString rffs) - { - return new RemoteFileContext(this, parent, rffs); - } - - // -------------------------------- - // FILE SYSTEM ATTRIBUTE METHODS... - // -------------------------------- - /** - * Return in string format the character used to separate folders. Eg, "\" or "/". - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getSeparator() - */ - public String getSeparator() - { - return getParentRemoteFileSubSystemConfiguration().getSeparator(); - } - /** - * Return in character format the character used to separate folders. Eg, "\" or "/" - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getSeparatorChar() - */ - public char getSeparatorChar() - { - return getParentRemoteFileSubSystemConfiguration().getSeparatorChar(); - } - /** - * Return in string format the character used to separate paths. Eg, ";" or ":" - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparator() - */ - public String getPathSeparator() - { - return getParentRemoteFileSubSystemConfiguration().getPathSeparator(); - } - /** - * Return in char format the character used to separate paths. Eg, ";" or ":" - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparatorChar() - */ - public char getPathSeparatorChar() - { - return getParentRemoteFileSubSystemConfiguration().getPathSeparatorChar(); - } - /** - * Return as a string the line separator. - * <br> - * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getLineSeparator() - */ - public String getLineSeparator() - { - return getParentRemoteFileSubSystemConfiguration().getLineSeparator(); - } - - - // ------------------------------------- - // GUI methods - // ------------------------------------- - /** - * Return the single property page to show in the tabbed notebook for the - * for SubSystem property of the parent Connection. Return null if no - * page is to be contributed for this. You are limited to a single page, - * so you may have to compress. It is recommended you prompt for the port - * if applicable since the common base subsystem property page is not shown - * To help with this you can use the SubSystemPortPrompt widget. - */ - public PropertyPage getPropertyPage(Composite parent) - { - return new SystemSubSystemPropertyPageCore(); - } - - // ------------------------- - // Filter Testing Methods... - // ------------------------- - - /** - * @see org.eclipse.rse.core.subsystems.SubSystem#doesFilterMatch(org.eclipse.rse.core.filters.ISystemFilter, java.lang.String) - */ - public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName) { - - if (filter.isPromptable() || !doesFilterTypeMatch(filter, remoteObjectAbsoluteName)) { - return false; - } - - boolean would = false; - - String[] strings = filter.getFilterStrings(); - - if (strings != null) { - - for (int idx = 0; !would && (idx < strings.length); idx++) { - - // for "Drives" filter on Windows, only return match if the absolute path is a drive letter - if (strings[idx].equals("*")) { //$NON-NLS-1$ - IPath path = new Path(remoteObjectAbsoluteName); - - if (path.segmentCount() == 0) { - return true; - } - else { - return false; - } - } - //else if (strings[idx].equals("./*")) { - // would = true; - //} - else { - would = doesFilterStringMatch(strings[idx], remoteObjectAbsoluteName, filter.areStringsCaseSensitive()); - } - } - } - - return would; - } - - /** - * Return true if the given remote object name will pass the filtering criteria for - * the given filter string. - * <p> - * Subclasses need to override this. - * If in doubt, return true. - * <p> - * There is a hack here if you want to tell us the absolute name is that of a folder: append " -folder" to the name! - */ - public boolean doesFilterStringMatch(String filterString, String remoteObjectAbsoluteName, boolean caseSensitive) - { - RemoteFileFilterString rffs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), filterString); - // ok, this is a tweak: if the absolute name has " -folder" at the end, that means it is a folder... - if (remoteObjectAbsoluteName.endsWith(" -folder")) //$NON-NLS-1$ - { - if (!rffs.getShowSubDirs()) - return false; - remoteObjectAbsoluteName = remoteObjectAbsoluteName.substring(0, remoteObjectAbsoluteName.indexOf(" -folder")); //$NON-NLS-1$ - } - // problem 1: we don't know if the given remote object name represents a file or folder. We have to assume a file, - // since we don't support filtering by folder names. - if (!rffs.getShowFiles()) - return false; - - // step 1: verify the path of the remote object matches the path of the filter string - String container = rffs.getPath(); - if (container == null) - return false; - - if (container.equals(".") && !isOffline()) //$NON-NLS-1$ - { - try - { - container = getRemoteFileObject(container, new NullProgressMonitor()).getAbsolutePath(); - } - catch (Exception e) - { - - } - //return true; - } - - // DKM - if the filter and the remote object are the same - if (container.equals(remoteObjectAbsoluteName)) - return true; - - // trick: use filter string code to parse remote absolute name - RemoteFileFilterString rmtName = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), remoteObjectAbsoluteName); - boolean pathMatch = false; - if (caseSensitive) - pathMatch = container.equals(rmtName.getPath()); - else - pathMatch = container.equalsIgnoreCase(rmtName.getPath()); - if (!pathMatch) - return false; - - // step 2: test if the given file name matches the filter criteria - String nameFilter = rffs.getFileOrTypes(); - if (nameFilter == null) - return false; - if (!nameFilter.equals("*")) //$NON-NLS-1$ - { - IMatcher matcher = null; - if (nameFilter.endsWith(",")) //$NON-NLS-1$ - matcher = new FileTypeMatcher(FileTypeMatcher.parseTypes(nameFilter), true); - else - matcher = new NamePatternMatcher(nameFilter, true, caseSensitive); - return matcher.matches(rmtName.getFile()); - } - else - return true; - } - - /** - * Return true if the given filter string lists the contents of the given remote object. - * For example, if given a folder, return true if the given filter string - * lists the contents of that folder. Used in impact analysis when a remote object is - * created, deleted, renamed, copied or moved, so as to establish which filters need to be - * refreshed or collapsed (if the folder is deleted, say). - * <p> - * This should only return true if the filter string directly lists the contents of the given - * object, versus indirectly. - * <p> - * Subclasses should override this. - */ - public boolean doesFilterStringListContentsOf(ISystemFilterString filterString, String remoteObjectAbsoluteName) - { - RemoteFileFilterString rffs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), filterString.getString()); - String container = rffs.getPath(); - - if (container == null) - return false; - boolean affected = false; - - String remoteObjectContainer = remoteObjectAbsoluteName; - int lastSep = remoteObjectAbsoluteName.lastIndexOf(getSeparator()); - if (lastSep != -1) - { - remoteObjectContainer = remoteObjectAbsoluteName.substring(0, lastSep); - } - if (filterString.getParentSystemFilter().isStringsCaseSensitive()) - affected = container.equals(remoteObjectContainer); - else - affected = container.equalsIgnoreCase(remoteObjectContainer); - - //UniversalSystemPlugin.logDebugMessage( - // "UniversalFileSubSystemImpl::doesFilterStringListContentsOf", - // "Univ Filter String Testing '" + container + "' versus '" + remoteObjectAbsoluteName + "' => " + affected); - return affected; - } - - - - // ------------------------------- - // SubSystem METHODS ... - // ------------------------------- - - /** - * Resolves filter strings. - * The default implementation of this simply calls {@link #internalResolveFilterString(String, IProgressMonitor)}. - * If the result for each filter string is a SystemMessage (e.g. an error), then the messages are returned. - * If the result for any filter string is not a message (i.e. an array of children), then the children are returned, - * and the messages are not. This avoids mixing chuldren as a result of successful resolution of a filter string with - * messages that might result for other filter strings. - * So the returned results are always the successful results, or messages (never a mix of the two). - * @param filterStrings array of filter patterns for objects to return. - * @param monitor the progress monitor we are running under - * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterStrings(java.lang.String[], org.eclipse.core.runtime.IProgressMonitor) - * @return Array of objects that are the result of resolving all the filter strings - */ - public Object[] internalResolveFilterStrings(String[] filterStrings, IProgressMonitor monitor) - throws java.lang.reflect.InvocationTargetException, - java.lang.InterruptedException - { - - if (!isConnected()) { - return null; - } - - Object[] children = null; - Vector vChildren = new Vector(); - Vector vMessages = new Vector(); - - boolean oneSuccess = false; - boolean success = false; - if (filterStrings == null) - { - System.out.println("filterStrings==null!"); //$NON-NLS-1$ - System.out.println("connection == "+getHostAliasName()); //$NON-NLS-1$ - return null; - } - - // TODO - change this to use listMulti to be more efficient - for (int idx=0; idx<filterStrings.length; idx++) - { - if (monitor != null) - { - monitor.setTaskName(getResolvingMessage(filterStrings[idx])); - } - - children = internalResolveFilterString(filterStrings[idx], monitor); - - if (!(children != null && children.length == 1 && children[0] instanceof SystemMessageObject)) { - success = true; - - // one has been successful - oneSuccess = true; - } - else { - success = false; - } - - // if successful, then add to list - if (children != null && success) { - addResolvedFilterStringObjects(vChildren, children, filterStrings, idx); - } - // otherwise add to messages list - else if (children != null){ - super.addResolvedFilterStringObjects(vMessages, children, filterStrings, idx); - } - } - - if (oneSuccess) { - int nbrChildren = vChildren.size(); - children = new Object[nbrChildren]; - - for (int idx=0; idx<nbrChildren; idx++) - children[idx] = vChildren.elementAt(idx); - } - else { - int nbrMessages = vMessages.size(); - children = new Object[nbrMessages]; - - for (int idx=0; idx<nbrMessages; idx++) - children[idx] = vMessages.elementAt(idx); - } - - return children; - } - - /** - * Overridable parent extension point for adding the results of a filter string - * to the overall list of results. - * <p> - * Can be used to filter out redundant entries in the concatenated list, if this - * is desired. - */ - protected void addResolvedFilterStringObjects(Vector allChildrenSoFar, Object[] childrenForThisFilterString, String[] allFilterStrings, int currFilterStringIndex) - { - if (currFilterStringIndex == 0) - super.addResolvedFilterStringObjects(allChildrenSoFar, childrenForThisFilterString, allFilterStrings, currFilterStringIndex); - else - { - // for defect 42095, we filter out redundancies... - RemoteFileFilterString currFS = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), allFilterStrings[currFilterStringIndex]); - String currPath = currFS.getPath(); - if (currPath == null) - currPath = ""; //$NON-NLS-1$ - boolean matchingPaths = false; - boolean caseSensitive = getParentRemoteFileSubSystemConfiguration().isCaseSensitive(); - // test if we are listing in the same folder as any previous filter string... - // ... if we are not, we can save time and skip the redundancy checking.. - for (int idx = 0; idx < currFilterStringIndex; idx++) - { - RemoteFileFilterString prevFS = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), allFilterStrings[idx]); - String prevPath = prevFS.getPath(); - if (prevPath == null) - prevPath = ""; //$NON-NLS-1$ - - if ((caseSensitive && prevPath.equals(currPath)) || (!caseSensitive && prevPath.equalsIgnoreCase(currPath))) - { - matchingPaths = true; - } - } - - // ok, what through the current resolved list, and if appropriate strip out - // any entries that are already in the list. That is, any entries with the same - // absolute path name... - // ... for performance reasons, we don't want to waste time checking items in our - // our own list, so we do this in two passes, first marking redundant entries by - // nulling them out... - if (matchingPaths) - { - for (int jdx = 0; jdx < childrenForThisFilterString.length; jdx++) - { - if (childrenForThisFilterString[jdx] instanceof IRemoteFile) - { - IRemoteFile child = (IRemoteFile) childrenForThisFilterString[jdx]; - String path1 = child.getAbsolutePath(); - if (path1 == null) - path1 = ""; //$NON-NLS-1$ - IRemoteFile match = null; - for (int idx = 0;(match == null) && (idx < allChildrenSoFar.size()); idx++) - { - Object prevChild = allChildrenSoFar.elementAt(idx); - if (prevChild instanceof IRemoteFile) - { - String path2 = ((IRemoteFile) prevChild).getAbsolutePath(); - if (path2 == null) - path2 = ""; //$NON-NLS-1$ - if (path1.equals(path2)) - match = (IRemoteFile) prevChild; - } - } - if (match != null) - { - childrenForThisFilterString[jdx] = null; // mark as redundant - // if this redundant entry is a folder, that implies there are multiple - // filter strings that would have resulted in seeing this folder. We need - // to record all such filter strings in the folder's context, so that when - // subsequently expanded, all applicable filter strings will be used to get - // the children of this subdirectory... - if (match.isDirectory() && (match instanceof RemoteFile)) - { - IRemoteFileContext context = ((RemoteFile) match).getContext(); - if (context != null) - { - context.addFilterString(currFS); - } - } - } - } - } // end for loop - } - // second pass... - for (int jdx = 0; jdx < childrenForThisFilterString.length; jdx++) - if (childrenForThisFilterString[jdx] != null) - allChildrenSoFar.addElement(childrenForThisFilterString[jdx]); - } - } - - - private String fixFilterString(IRemoteFileSubSystemConfiguration rfssf, String filterString) - { - boolean windows = !rfssf.isUnixStyle(); - - if (filterString.startsWith("/") && windows) // request to list root files? //$NON-NLS-1$ - { // convert to request to list drives on Windows - int len = filterString.length(); - if (len == 1) - filterString = "*"; // hmm, should never happen //$NON-NLS-1$ - else - filterString = filterString.substring(1); - } - - return filterString; - } - - /** - * Actually resolve an absolute filter string. This is called by the - * run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString. - * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(String,IProgressMonitor) - */ - protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException - { - IRemoteFileSubSystemConfiguration rfssf = getParentRemoteFileSubSystemConfiguration(); - filterString = fixFilterString(rfssf, filterString); - - RemoteFileFilterString fs = new RemoteFileFilterString(rfssf, filterString); - currFilterString = fs; - - if (fs.listRoots()) - return listRoots(new RemoteFileContext(this, null, fs), monitor); - else - { - boolean showDirs = fs.getShowSubDirs(); - boolean showFiles = fs.getShowFiles(); - String path = fs.getPath(); - boolean windows = !rfssf.isUnixStyle(); - - if (windows && (path != null) && !path.endsWith(rfssf.getSeparator())) - path = path + rfssf.getSeparatorChar(); - - String filter = fs.getFileOrTypes(); - IRemoteFile parent = null; - try - { - parent = getRemoteFileObject(path, monitor); - } - catch (SystemMessageException e) - { - SystemBasePlugin.logError("RemoteFileSubSystemImpl.logError()", e); //$NON-NLS-1$ - } - - boolean parentExists = true; - - if (parent != null) { - parentExists = parent.exists(); - } - - Object[] children = null; - try - { - // if parent exists, get its children according to the filter - if (parent != null && parentExists) - { - boolean hasFileContents = !parent.isStale() && parent.hasContents(RemoteFileChildrenContentsType.getInstance(), filter); - boolean hasFolderContents = !parent.isStale() && parent.hasContents(RemoteFolderChildrenContentsType.getInstance(), filter); - boolean hasFileAndFolderContents = !parent.isStale() && parent.hasContents(RemoteChildrenContentsType.getInstance(), filter); - if (showDirs && showFiles) - { - if (hasFileAndFolderContents) - { - // has everything - } - else if (hasFileContents) - { - // already have the files, now add the folders - list(parent, filter, IFileService.FILE_TYPE_FOLDERS, monitor); - } - else if (hasFolderContents) - { - // already have the folders, now add the files - list(parent, filter, IFileService.FILE_TYPE_FILES, monitor); - } - else - { - // don't have anything - query both - list(parent, filter, IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor); - } - children = parent.getContents(RemoteChildrenContentsType.getInstance(), filter); - } - else if (showDirs) - { - if (hasFolderContents) - { - children = parent.getContents(RemoteFolderChildrenContentsType.getInstance(), filter); - } - else - { - children = list(parent, filter, IFileService.FILE_TYPE_FOLDERS, monitor); - } - } - else - { - if (hasFileContents) - { - children = parent.getContents(RemoteFileChildrenContentsType.getInstance(), filter); - } - else - { - children = list(parent, filter, IFileService.FILE_TYPE_FILES, monitor); - } - } - } - // otherwise return message saying parent could not be found - else if (parent != null && !parentExists) { - children = new SystemMessageObject[1]; - String msgTxt = NLS.bind(SystemFileResources.FILEMSG_FILE_NOTFOUND, parent.getAbsolutePath()); - SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.FILEMSG_FILE_NOTFOUND, - IStatus.ERROR, msgTxt); - children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, null); - } - } - catch (SystemMessageException e) - { - children = new SystemMessageObject[1]; - children[0] = new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null); - } - - return children; - } - //return null; - } - /** - * Sort the concatenated list of all objects returned by resolving one or more - * filter strings. - * The default implementation does nothing. Child classes can override if they wish - * to show their resulting objects sorted. - */ - public Object[] sortResolvedFilterStringObjects(Object[] children) - { - if ((children != null) && (children.length > 1)) - Arrays.sort(children); - return children; - } - - /** - * Called by parent when we defer getting a filter string until later, where we query it from - * the parent. In this case we need the first filter string for the progress monitor msg. - */ - protected String getFirstParentFilterString(Object parent) - { - RemoteFileFilterString[] allFilterStrings = ((IRemoteFile) parent).getAllFilterStrings(); - if ((allFilterStrings == null) || (allFilterStrings.length == 0)) - return "*"; //$NON-NLS-1$ - else - { - return allFilterStrings[0].getFileOrTypes(); - } - } - /** - * Actually resolve a relative filter string. This is called by the - * run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString. - * <p> - * As per IRunnableWithProgress rules: - * <ul> - * <li>if the user cancels (monitor.isCanceled()), throw new InterruptedException() - * <li>if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc); - * <li>do not worry about calling monitor.done() ... caller will do that! - * </ul> - * YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS! - */ - protected Object[] internalResolveFilterString(Object parent, String filterString, IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException - { - RemoteFileFilterString fs = null; - try - { - //System.out.println("Inside internalResolveFilterString for parent '"+parent+"' for filterstring '" + filterString+"'"); - if (filterString == null) // this will be the case when we want to support merging of filter strings - { - // this is all for defect 42095. Phil - RemoteFileFilterString[] allFilterStrings = ((IRemoteFile) parent).getAllFilterStrings(); - if (allFilterStrings == null) - fs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), "*"); //$NON-NLS-1$ - else - { - boolean onlyOne = (allFilterStrings.length == 1); - Object[] children = null; - Vector vChildren = null; - if (!onlyOne) - vChildren = new Vector(); - String[] allStrings = new String[allFilterStrings.length]; - for (int idx = 0; idx < allFilterStrings.length; idx++) - allStrings[idx] = allFilterStrings[idx].toString(); - for (int idx = 0; idx < allFilterStrings.length; idx++) - { - fs = (RemoteFileFilterString) allFilterStrings[idx].clone(); - fs.setPath(null); - children = internalResolveOneFilterString(parent, fs, onlyOne, monitor); - if (!onlyOne && (children != null)) - { - addResolvedFilterStringObjects(vChildren, children, allStrings, idx); - } - } - if (!onlyOne && vChildren != null) - { - children = new Object[vChildren.size()]; - for (int cdx = 0; cdx < children.length; cdx++) - children[cdx] = vChildren.elementAt(cdx); - Arrays.sort(children); - } - else - { - /* - System.out.println("Returning " + children.length + " children " ); - System.out.println(); - for (int idx=0;idx<children.length;idx++) - System.out.print(children[idx] + "; "); - System.out.println(); - */ - } - return children; - } - } - else - { - fs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), filterString); - } - return internalResolveOneFilterString(parent, fs, true, monitor); - } - - catch (SystemMessageException e) - { - SystemMessageObject[] children = new SystemMessageObject[1]; - children[0] = new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null); - return children; - } - } - /** - * Do one filter string relative resolve - */ - protected Object[] internalResolveOneFilterString(Object parent, RemoteFileFilterString fs, boolean sort, IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException, SystemMessageException - { - currFilterString = fs; - String filterString = fs.toStringNoSwitches(); - boolean showDirs = fs.getShowSubDirs(); - boolean showFiles = fs.getShowFiles(); - //String path = fs.getPath(); - //String filter = fs.getFile(); - //System.out.println("...path='"+path+"', filter='"+filter+"', showDirs="+showDirs+", showFiles="+showFiles); - //System.out.println("...toStringNoSwitches='"+filterString+"'"); - Object[] children = null; - if (parent != null) - { - if (showDirs && showFiles) - //children = listFoldersAndFiles((IRemoteFile)parent, filterString); - children = list((IRemoteFile) parent, filterString, IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor); - else if (showDirs) - children = list((IRemoteFile) parent, filterString, IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor); - else - children = list((IRemoteFile) parent, filterString, IFileService.FILE_TYPE_FILES, monitor); - if (sort && (children != null) && (children.length > 1)) - Arrays.sort(children); - } - return children; - } - // --------------------------------------- - // RemoteFileSubSystem WRAPPER METHODS ... - // ... we set the filterstring objects - // --------------------------------------- - - // ------------------------------- - // RemoteFileSubSystem METHODS ... - // ------------------------------- - /** - * Return a list of roots/drives on the remote system - */ - public IRemoteFile[] listRoots(IProgressMonitor monitor) throws InterruptedException - { - return listRoots(getDefaultContext(), monitor); - } - - - /** - * Return a list of all remote folders and files in the given folder. The - * list is not subsetted. - * - * @param parents The parent folders to list folders and files in - * @param fileTypes - indicates whether to query files, folders, both or - * some other type - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, int[] fileTypes, IProgressMonitor monitor) throws SystemMessageException - { - String[] fileNameFilters = new String[parents.length]; - for (int i = 0; i < parents.length; i++) - { - fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$ - } - - return listMultiple(parents, fileNameFilters, fileTypes, monitor); - } - - /** - * Return a list of all remote folders and files in the given folder. The - * list is not subsetted. - * - * @param parents The parent folders to list folders and files in - * @param fileType - indicates whether to query files, folders, both or some - * other type - * @param monitor the progress monitor - * @since 3.0 - */ - public IRemoteFile[] listMultiple(IRemoteFile[] parents, int fileType, IProgressMonitor monitor) throws SystemMessageException - { - String[] fileNameFilters = new String[parents.length]; - for (int i = 0; i < parents.length; i++) - { - fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$ - } - - return listMultiple(parents, fileNameFilters, fileType, monitor); - } - - /** - * Return a list of all remote folders and files in the given folder. The - * list is not subsetted. - * - * @param parent The parent folder to list folders and files in - * @param monitor the progress monitor - * @since 3.0 renamed from listFoldersAndFiles() - */ - public IRemoteFile[] list(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException - { - return list(parent, IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor); - } - - /** - * Return a list of all remote folders and files in the given folder. The - * list is not subsetted. - * - * @param parent The parent folder to list folders and files in - * @param fileType the type of file - * @param monitor the monitor - * @since 3.0 using int fileType parameter - */ - public IRemoteFile[] list(IRemoteFile parent, int fileType, IProgressMonitor monitor) throws SystemMessageException - { - return list(parent, (String) null, fileType, monitor); - } - - /** - * Return a list of remote folders and files in the given folder. - * <p> - * The files part of the list is subsetted by the given file name filter. It - * can be null for no subsetting. - * - * @param parent The parent folder to list folders and files in - * @param fileNameFilter The name pattern to subset the file list by, or - * null to return all files. - * @param fileType the type of file - * @param monitor the monitor - * @since 3.0 using int fileType parameter - */ - public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException - { - String path = parent.getAbsolutePath(); - fileNameFilter = (fileNameFilter == null) ? "*" : fileNameFilter; //$NON-NLS-1$ - IRemoteFileSubSystemConfiguration config = getParentRemoteFileSubSystemConfiguration(); - RemoteFileFilterString filterString = new RemoteFileFilterString(config, path, fileNameFilter); - filterString.setShowFiles(true); - filterString.setShowSubDirs(true); - RemoteFileContext context = new RemoteFileContext(this, parent, filterString); - return list(parent, fileNameFilter, context, fileType, monitor); - } - - - - /** - * Given a folder or file, return its parent folder name, fully qualified - * @param folderOrFile folder or file to return parent of. - */ - public String getParentFolderName(IRemoteFile folderOrFile) - { - return folderOrFile.getParentPath(); - } - - /* - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getRemoteSearchResultObject(java.lang.String) - */ - public IRemoteSearchResult getRemoteSearchResultObject(String key) throws SystemMessageException { - - int idx = key.indexOf(IHostSearchResult.SEARCH_RESULT_DELIMITER); - - if (idx != -1) { - String remoteFilePath = key.substring(0, idx); - IRemoteFile remoteFile = getRemoteFileObject(remoteFilePath, new NullProgressMonitor()); - - if (remoteFile != null) { - - int jdx = idx + IHostSearchResult.SEARCH_RESULT_DELIMITER.length() + IHostSearchResult.SEARCH_RESULT_OPEN_DELIMITER.length(); - - int kdx = key.indexOf(IHostSearchResult.SEARCH_RESULT_INDEX_DELIMITER, jdx); - - String searchString = key.substring(jdx, kdx); - - Object[] children = remoteFile.getContents(RemoteSearchResultsContentsType.getInstance(), searchString); - - if (children != null) { - - int ldx = key.indexOf(IHostSearchResult.SEARCH_RESULT_CLOSE_DELIMITER, kdx+1); - - int index = Integer.valueOf(key.substring(kdx+1, ldx)).intValue(); - - if (children.length > index) { - IRemoteSearchResult result = (IRemoteSearchResult)(children[index]); - return result; - } - else { - return null; - } - } - else { - return null; - } - } - else { - return null; - } - } - else { - return null; - } - } - - /** - * Given a set of fully qualified file or folder names, return an - * ISystemResourceSet object for it. <b>Overrideable</b> Override this - * method to provide optimized implementation - * - * @param folderOrFileNames Fully qualified folder or file names - * @since 3.0 - */ - public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException - { - IRemoteFile[] results = new IRemoteFile[folderOrFileNames.length]; - for (int i = 0; i < folderOrFileNames.length; i++) - { - String path = folderOrFileNames[i]; - results[i] = getRemoteFileObject(path, monitor); - } - return results; - } - - - - /** - * Return the object within the subsystem that corresponds to the specified - * unique ID. - * - * For remote files, assuming the key is the absolute path of a file, this - * is simply a wrapper to getRemoteFileObject(). - * - * @see SubSystem#getObjectWithAbsoluteName(String, IProgressMonitor) - */ - public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception - { - Object filterRef = super.getObjectWithAbsoluteName(key, monitor); - if (filterRef != null) { - return filterRef; - } - - // look to see if there is a search result delimiter - // if not, the key must be for a file - if (key.lastIndexOf(IHostSearchResult.SEARCH_RESULT_DELIMITER) < 0) { - - IRemoteFile remoteFile = getRemoteFileObject(key, monitor); - - if (remoteFile != null) { - return remoteFile; - } - else { - return null; - } - } - // otherwise, it's a search result - else { - return getRemoteSearchResultObject(key); - } - } - - - - - - - - - - - - - - - - - - // ----------------------------------------------------------------- - // CONVENIENCE METHODS FOR CHILD CLASSES FOR DOING NAME FILTERING... - // ----------------------------------------------------------------- - /** - * Method to set variables to affect the folder content subsetting. - * Use this when only listing <i>either</i> files <i>or</i> folders, but not both. - * @param includeFilesOrFolders A constant from {@link org.eclipse.rse.core.subsystems.IFileConstants} - * @param nameFilter The pattern to filter the file or folder names by. Can be null to include all. - */ - protected void setListValues(int includeFilesOrFolders, String nameFilter) - { - this.includeFilesOrFolders = includeFilesOrFolders; - if ((nameFilter != null) && !nameFilter.equals("*")) //$NON-NLS-1$ - { - if (nameFilter.endsWith(",")) //$NON-NLS-1$ - matcher = new FileTypeMatcher(FileTypeMatcher.parseTypes(nameFilter), isCaseSensitive()); - else - matcher = new NamePatternMatcher(nameFilter, true, isCaseSensitive()); - } - else - matcher = null; - folderNameMatcher = null; - } - /** - * Overloaded method to set variables to affect the folder content subsetting, - * when there is separate filters for both folder names and filter names. - * @param includeFilesOrFolders A constant from {@link org.eclipse.rse.core.subsystems.IFileConstants} - * @param folderNameFilter The pattern to filter the folder names by. Can be null to include all folders - * @param fileNameFilter The pattern to filter the file names by. Can be null to include all files - */ - protected void setListValues(int includeFilesOrFolders, String folderNameFilter, String fileNameFilter) - { - setListValues(includeFilesOrFolders, fileNameFilter); - if ((folderNameFilter != null) && !folderNameFilter.equals("*")) //$NON-NLS-1$ - folderNameMatcher = new NamePatternMatcher(folderNameFilter, true, isCaseSensitive()); - } - - /** - * Method to decide if a given folder or file name matches the present criteria. - * You must have previously called {@link #setListValues(int, String)} or {@link #setListValues(int, String, String)} - * @param name The file or folder name to test - * @param isFile true if this is a file name, false if it is a folder name. - * @return true if the name matches the previously specified criteria - */ - protected boolean accept(String name, boolean isFile) - { - boolean match = true; - if (includeFilesOrFolders == IClientServerConstants.INCLUDE_FILES_ONLY) - { - if (!isFile) - return false; - } - else if (includeFilesOrFolders == IClientServerConstants.INCLUDE_FOLDERS_ONLY) - { - if (isFile) - return false; - } - if ((matcher == null) && (folderNameMatcher == null)) - return true; - if (includeFilesOrFolders != IClientServerConstants.INCLUDE_ALL) - match = matcher.matches(name); - else - { - if (isFile) - { - if (matcher != null) - match = matcher.matches(name); - } - else - { - if (folderNameMatcher != null) - match = folderNameMatcher.matches(name); - } - } - return match; - } - - /** - * helper method to run an external command - */ - public static int runLocalCommand(String cmd, Vector lines) throws Exception - { - - boolean debug = true; - int rc = -99; - Process process; - try - { - if (debug) - SystemBasePlugin.logInfo("Running local command: " + cmd); //$NON-NLS-1$ - process = Runtime.getRuntime().exec(cmd); - } - catch (IOException exc) - { - if (debug) - { - String msg = exc.getMessage(); - if (msg == null) - msg = exc.getClass().getName(); - SystemBasePlugin.logInfo("...Unexpected error running command '" + cmd + "'. Error msg: " + msg); //$NON-NLS-1$ //$NON-NLS-2$ - } - throw exc; - } - String line; - DataInputStream err = new DataInputStream(process.getErrorStream()); // capture standard err - BufferedReader berr = new BufferedReader(new InputStreamReader(err)); - try - { - while ((line = berr.readLine()) != null) - { - if (debug) - SystemBasePlugin.logInfo("...System.err: " + line); //$NON-NLS-1$ - if ((lines != null) && (line.trim().length() > 0)) - lines.addElement(line); - } - } - catch (IOException exc) - { - } - DataInputStream in = new DataInputStream(process.getInputStream()); // capture standard out - BufferedReader bin = new BufferedReader(new InputStreamReader(in)); - try - { - while ((line = bin.readLine()) != null) - { - if (debug) - SystemBasePlugin.logInfo("...System out: " + line); //$NON-NLS-1$ - if ((lines != null) && (line.trim().length() > 0)) - lines.addElement(line); - } - } - catch (IOException exc) - { - } - try - { - rc = process.waitFor(); - } - catch (InterruptedException exc) - { - } - return rc; - } // end runCmd method - - public void initializeSubSystem(IProgressMonitor monitor) - { - super.initializeSubSystem(monitor); - // load UI plugin for adapters right after successful connect - Platform.getAdapterManager().loadAdapter(new RemoteFileEmpty(), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$ - getConnectorService().addCommunicationsListener(this); - } - - public void uninitializeSubSystem(IProgressMonitor monitor) - { - getConnectorService().removeCommunicationsListener(this); - super.uninitializeSubSystem(monitor); - } - - /** - * Store the IRemoteFile in a hashmap to quick subsequent retrieval - * @param file the file - */ - public void cacheRemoteFile(IRemoteFile file, String path) - { - - if (_cachedRemoteFiles.containsKey(path)) - { - IRemoteFile oldFile = (IRemoteFile)_cachedRemoteFiles.remove(path); - if (oldFile == file) - { - // already cached - recache - _cachedRemoteFiles.put(path, file); - return; - } - - // replace file under parent - if (oldFile instanceof RemoteFile) { - RemoteFile roldFile = (RemoteFile)oldFile; - if (roldFile._parentFile != null) // prevent parent query from bug #196664 - { - roldFile._parentFile.replaceContent(oldFile, file); - } - } - else if (oldFile != null && oldFile.getParentRemoteFile() != null) { - oldFile.getParentRemoteFile().replaceContent(oldFile, file); - } - - // preserve persistent information from old file to new - if (oldFile != null) - oldFile.copyContentsTo(file); - - } - _cachedRemoteFiles.put(path, file); - } - - /** - * Store the IRemoteFile in a hashmap to quick subsequent retrieval - * @param file the file - */ - public void cacheRemoteFile(IRemoteFile file) - { - if (file.exists()) - { - cacheRemoteFile(file, file.getAbsolutePath()); - } - } - /** - * Returns the cached remote file with the specified path. If no such file - * is found, returns null - * @param path - * @return the cached file, if found in the cache, else null - */ - public IRemoteFile getCachedRemoteFile(String path) - { - if (_cachedRemoteFiles.size() > 0) - { - path = path.replaceAll("//", "/"); //$NON-NLS-1$ //$NON-NLS-2$ - if (path.endsWith("\\") || (path.endsWith("/") && path.length() > 1)) //$NON-NLS-1$ //$NON-NLS-2$ - { - path = path.substring(0, path.length() - 1); - } - if (_cachedRemoteFiles.containsKey(path)) - { - {return (IRemoteFile)_cachedRemoteFiles.get(path);} - } - - } - return null; - } - - protected void removeCachedRemoteFile(IRemoteFile file) - { - if (file != null) - { - Object[] children = ((IRemoteContainer)file).getContents(SystemChildrenContentsType.getInstance()); - if (children != null) - { - for (int i = 0; i < children.length; i++) - { - if (children[i] instanceof IRemoteFile) - { - removeCachedRemoteFile((IRemoteFile)children[i]); - } - } - } - //Workaround for bug 162962: getContents() incomplete, children not deleted - //If getContents() is implemented correctly, no matches should be removed - String prefix = file.getAbsolutePath() + file.getSeparator(); - //Clone the hashMap in order to avoid ConcurrentModificationException in the iterator - HashMap tmpMap = (HashMap)_cachedRemoteFiles.clone(); - Iterator it = tmpMap.keySet().iterator(); - while (it.hasNext()) { - String remotePath = (String)it.next(); - if (remotePath.startsWith(prefix)) { - //FIXME this should never be called if getContents() is implemented correctly - //such that children are already removed in the code above. - removeCachedRemoteFile(remotePath); - } - } - - _cachedRemoteFiles.remove(file.getAbsolutePath()); - } - } - - protected void removeCachedRemoteFile(String path) - { - _cachedRemoteFiles.remove(path); - } - - - public void communicationsStateChange(CommunicationsEvent e) - { - switch (e.getState()) - { - case CommunicationsEvent.AFTER_DISCONNECT : - _cachedRemoteFiles.clear(); - // DKM - taking this out because it causes an exception when the event occurs in Modal Context - //ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); - //sr.connectedStatusChange(this, false, true, true); - getConnectorService().removeCommunicationsListener(this); - - break; - - case CommunicationsEvent.BEFORE_DISCONNECT : - case CommunicationsEvent.CONNECTION_ERROR : - break; - default : - break; - } - } - - /** - * @see ICommunicationsListener#isPassiveCommunicationsListener() - */ - public boolean isPassiveCommunicationsListener() - { - return true; - } - - /** - * Returns -1 by default. Subclasses should override if necessary. - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getUnusedPort() - */ - public int getUnusedPort() - { - return -1; - } - - /** - * Returns the address found by calling <code>InetAddress.getLocalHost()</code>. If that - * call returns the local loopback address, it returns <code>null</code>. - * Subclasses should reimplement to handle cases where systems have multiple IP addresses due - * to multiple network cards or VPN. This method should return an address - * that is usable from the remote system to connect back to the local system. - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getLocalAddress() - */ - public InetAddress getLocalAddress() { - - InetAddress addr = null; - - try { - addr = InetAddress.getLocalHost(); - } - catch (UnknownHostException e) { - SystemBasePlugin.logError("Error occured trying to get local host address", e); //$NON-NLS-1$ - } - - // if the address is the loopback address - if (addr != null && addr.isLoopbackAddress()) { - return null; - } - - return addr; - } - - - public Object getTargetForFilter(ISystemFilterReference filterRef) - { - String firstFilterString = filterRef.getReferencedFilter().getFilterStrings()[0]; - RemoteFileFilterString fs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), firstFilterString); - try - { - // change target to be referenced remote folder - return getRemoteFileObject(fs.getPath(), new NullProgressMonitor()); - } - catch (Exception e) - { - } - return null; - } - - /** - * {@inheritDoc} - * @deprecated Do not call this method directly since it is not implemented. - */ - public void cancelSearch(IHostSearchResultConfiguration searchConfig) - { - // TODO Auto-generated method stub - - } - - /** - * Returns the local platform encoding if the default encoding of the host was not set. - * Subclasses should override to return the actual remote encoding. - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getRemoteEncoding() - */ - public String getRemoteEncoding() { - IHost host = getHost(); - - // get the encoding from the host that was not by the remote system - String encoding = host.getDefaultEncoding(false); - - // get the encoding from the host that was set by querying a remote system - // this allows us to pick up the host encoding that may have been set by another subsystem - if (encoding == null) { - encoding = host.getDefaultEncoding(true); - } - - if (encoding != null) { - return encoding; - } - else { - return SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); - } - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java deleted file mode 100644 index be0aa9cb8..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java +++ /dev/null @@ -1,467 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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 - * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core - * Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core - * David Dykstal (IBM) - [197036] fixed NPE found during testing - * David Dykstal (IBM) - [222270] clean up interfaces in org.eclipse.rse.core.filters - * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI - * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.rse.core.filters.ISystemFilter; -import org.eclipse.rse.core.filters.ISystemFilterPool; -import org.eclipse.rse.core.filters.ISystemFilterPoolManager; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISubSystemConfigurator; -import org.eclipse.rse.core.subsystems.IFileConstants; -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.core.subsystems.SubSystemConfiguration; -import org.eclipse.rse.internal.core.SystemResourceConstants; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.subsystems.files.core.SystemIFileProperties; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; -import org.eclipse.rse.subsystems.files.core.util.ValidatorFileFilterString; -import org.eclipse.rse.ui.SystemBasePlugin; -import org.eclipse.rse.ui.validators.ISystemValidator; -import org.eclipse.rse.ui.validators.ValidatorFileName; -import org.eclipse.rse.ui.validators.ValidatorFolderName; - - -/** - * Specialization for file subsystem configurations. - * It is best used by subclassing - * {@link org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystemConfiguration}. - * - * @see RemoteFileSubSystem - */ - -public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfiguration implements IRemoteFileSubSystemConfiguration -{ - - protected boolean unixStyle = false; - protected String translatedType; - - /** - * Constructor - */ - public RemoteFileSubSystemConfiguration() - { - super(); - } - - /** - * Tell us if this is a unix-style file system or a windows-style file system. The - * default is windows. - * Child classes must call this, so we know how to respond to separator and path-separator requests. - */ - protected void setIsUnixStyle(boolean isUnixStyle) - { - this.unixStyle = isUnixStyle; - } - - /** - * Tell us if this is a unix-style file system or a windows-style file system. The - * default is windows. - * Child classes must call this, so we know how to respond to separator and path-separator requests. - */ - public boolean isUnixStyle() - { - return unixStyle; - } - - /** - * Tell us if this file system is case sensitive. The default is isUnixStyle(), and so should - * rarely need to be overridden. - */ - public boolean isCaseSensitive() - { - return isUnixStyle(); - } - - /** - * Tell us if this subsystem factory supports targets, which are destinations for - * pushes and builds. Normally only true for file system factories. - * <p>We return true. - */ - public boolean supportsTargets() - { - return true; - } - - /** - * Return true if subsystems of this factory support the environment variables property. - * Return true to show it, return false to hide it. We return true. - */ - public boolean supportsEnvironmentVariablesPropertyPage() - { - return true; - } - - /** - * By default this returns true. Override if the file subsystem - * does not support search. - */ - public boolean supportsSearch() - { - return true; - } - - - - // -------------------------------- - // VALIDATOR METHODS... - // -------------------------------- - /** - * Return validator used in filter string dialog for the path part of the filter string. - * By default, returns ValidatorPathName which does very limited checking. - * Override as appropriate. - */ - public ISystemValidator getPathValidator() - { - return new org.eclipse.rse.ui.validators.ValidatorPathName(); - } - /** - * Return validator used in filter string dialog for the file part of the filter string - * By default, returns ValidatorFileFilterString. - * Override as appropriate. - */ - public ISystemValidator getFileFilterStringValidator() - { - return new ValidatorFileFilterString(this); - } - /** - * Return validator used when creating or renaming files - */ - public ValidatorFileName getFileNameValidator() - { - return new ValidatorFileName(); - } - /** - * Return validator used when creating or renaming folders - */ - public ValidatorFolderName getFolderNameValidator() - { - return new ValidatorFolderName(); - } - // -------------------------------- - // FILE SYSTEM ATTRIBUTE METHODS... - // -------------------------------- - /** - * Return in string format the character used to separate folders. Eg, "\" or "/" - */ - public String getSeparator() - { - return (unixStyle) ? IFileConstants.SEPARATOR_UNIX : IFileConstants.SEPARATOR_WINDOWS; - } - /** - * Return in character format the character used to separate folders. Eg, "\" or "/" - */ - public char getSeparatorChar() - { - return (unixStyle) ? IFileConstants.SEPARATOR_CHAR_UNIX : IFileConstants.SEPARATOR_CHAR_WINDOWS; - } - /** - * Return in string format the character used to separate paths. Eg, ";" or ":" - */ - public String getPathSeparator() - { - return (unixStyle) ? IFileConstants.PATH_SEPARATOR_UNIX : IFileConstants.PATH_SEPARATOR_WINDOWS; - } - /** - * Return in char format the character used to separate paths. Eg, ";" or ":" - */ - public char getPathSeparatorChar() - { - return (unixStyle) ? IFileConstants.PATH_SEPARATOR_CHAR_UNIX : IFileConstants.PATH_SEPARATOR_CHAR_WINDOWS; - } - /** - * Return as a string the line separator. - */ - public String getLineSeparator() - { - if (isUnixStyle()) { - return "\n"; //$NON-NLS-1$ - } - else { - return "\r\n"; //$NON-NLS-1$ - } - } - // -------------------------------------------- - // PARENT METHODS RELATED TO WHAT WE SUPPORT... - // -------------------------------------------- - - /** - * Return true if filters of this subsystem factory support dropping into. - */ - public boolean supportsDropInFilters() - { - return true; - } - - /** - * Indicates that a drop on a filter will be handled as a copy by the file subsystem - * rather than having a filter update. - */ - public boolean providesCustomDropInFilters() - { - return true; - } - - /** - * Return true if you support user-defined/managed named file types - * <p>We return true - */ - public boolean supportsFileTypes() - { - return true; - } - - /* - * (non-Javadoc) - * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#renameSubSystemProfile(java.lang.String, java.lang.String) - */ - public void renameSubSystemProfile(String oldProfileName, String newProfileName) - { - super.renameSubSystemProfile(oldProfileName, newProfileName); - - // change all IFile properties in remote systems temp files tree - IProject project = SystemBasePlugin.getWorkspaceRoot().getProject(SystemResourceConstants.RESOURCE_TEMPFILES_PROJECT_NAME); - if (project != null) - { - IFolder folder = project.getFolder(oldProfileName); - if (folder != null && folder.exists()) - { - // recursively change all subsystem ids for the temp files - recursivelyUpdateIFileProperties(newProfileName, folder); - } - } - } - - protected void recursivelyUpdateIFileProperties(String newName, IFolder container) - { - try - { - IResource[] resources = container.members(); - for (int i = 0; i < resources.length; i++) - { - IResource resource = resources[i]; - if (resource instanceof IFile) - { - IFile file = (IFile)resource; - SystemIFileProperties properties = new SystemIFileProperties(file); - - String absoluteSubSystemName = properties.getRemoteFileSubSystem(); - if (absoluteSubSystemName != null) - { - int profileDelim = absoluteSubSystemName.indexOf("."); //$NON-NLS-1$ - String theRest = absoluteSubSystemName.substring(profileDelim, absoluteSubSystemName.length()); - properties.setRemoteFileSubSystem(newName + theRest); - } - } - else if (resource instanceof IFolder) - { - recursivelyUpdateIFileProperties(newName, (IFolder)resource); - } - } - } - catch (Exception e) - { - } - } - - // ------------------------------------------------------- - // PARENT METHODS RELATED TO FILTERS... - // ... ONLY INTERESTING IF supportsFilters() returns true! - // ------------------------------------------------------- - - /** - * Override from parent. - * <p> - * Here we create the default filter pool for this subsystem factory, and populate it - * with default filters. - * <p> - * This is overridden for local, windows and ifs file subsystem factories, so what we - * default here applies to Unix and Linux only. - */ - protected ISystemFilterPool createDefaultFilterPool(ISystemFilterPoolManager mgr) - { - //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"in createDefaultFilterPool for remote file subsystem factory"); - ISystemFilterPool pool = null; - try { - // ----------------------------------------------------- - // create a pool named filters - // ----------------------------------------------------- - String poolName = getDefaultFilterPoolName(mgr.getName(), getId()); - pool = mgr.createSystemFilterPool(poolName, true); // true => is deletable by user - //System.out.println("Pool created"); - // --------------------------------------------------------------------------------------------- - // create default filters in that pool iff this is the user's private profile we are creating... - // --------------------------------------------------------------------------------------------- - if (pool != null && isUserPrivateProfile(mgr)) - { - - - // ---------------------- - // "My Home" filter... - // ---------------------- - RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this); - myHomeFilterString.setPath(getSeparator()); - String[] filterStrings = new String[] {"./*"}; //$NON-NLS-1$ - ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME, filterStrings); - filter.setNonChangable(true); - filter.setSingleFilterStringOnly(true); - - // ---------------------- - // "Home" filter... - // ---------------------- - // Bug 142070: Get rid of the default "Home" filter because it is an invalid - // path in many cases -/* String name = null; - String path = null; - if (mgr.getName().equals("Team")) - { - path = "/home"; - name = SystemFileResources.RESID_FILTER_HOME; - } - else - { - path = "/home"; //"/home/username"; - name = SystemFileResources.RESID_FILTER_USERHOME; - } - filterStrings.clear(); - RemoteFileFilterString homeFilterString = new RemoteFileFilterString(this); - homeFilterString.setPath(path); - filterStrings.add(homeFilterString.toString()); - mgr.createSystemFilter(pool, name, filterStrings);*/ - - - // ---------------------- - // "Root Files" filter... - // ---------------------- - RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this); - rootFilesFilterString.setPath(getSeparator()); - filterStrings = new String[] {rootFilesFilterString.toString()}; - mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings); - } - else - { - // create an "All" - // need at least some kind of filter predefined for any given profile - // ---------------------- - // "Root Files" filter... - // ---------------------- - RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this); - rootFilesFilterString.setPath(getSeparator()); - String[] filterStrings = new String[] {rootFilesFilterString.toString()}; - mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings); - } - //else - //System.out.println("Did not create default filters because this is not the default private profile: " + mgr.getName()); - } catch (Exception exc) - { - SystemBasePlugin.logError("Error creating default filter pool",exc); //$NON-NLS-1$ - } - return pool; - } - - /** - * Return the translated string to show in the property sheet for the type property. - */ - public String getTranslatedFilterTypeProperty(ISystemFilter selectedFilter) - { - if (translatedType == null) - translatedType = SystemFileResources.RESID_PROPERTY_FILE_FILTER_VALUE; - return translatedType; - } - - // ------------------------------------------------------- - // PARENT METHODS RELATED TO SUBSYSTEMS... VERY IMPORTANT! - // ------------------------------------------------------- - - - /** - * Instantiate and return an instance of OUR subystem. Do not populate it yet though! - * Eg: - * <pre><code> - * SubSystem subsys = ((AcmesubsysFactoryImpl)factory).createAcmeSubSystem(); - * return subsys; - * </code></pre> - * <b>note</b>This method should be abstract but MOF doesn't allow abstract impl classes at this point - * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost) - */ - public ISubSystem createSubSystemInternal(IHost conn) - { - // example code for subclasses... - //SubSystem subsys = factory.createRemoteCmdSubSystem(); - //return subsys; - return null; - } - - /** - * Populate a new subsystem with our unique attributes, and/or create default filter references. - */ - protected void initializeSubSystem(ISubSystem ss, ISubSystemConfigurator[] configurators) - { - super.initializeSubSystem(ss, configurators); // add a reference to the default filter pool - - /** FIXME - decouple wiz pages from core - do we still need this? - // Find the "set port" page we contributed to the New Connection wizard, reads it value, and - // default the subsystem's port value to it. - if (yourNewConnectionWizardPages != null) - { - SystemFileNewConnectionWizardPage ourPage = null; - for (int idx=0; (ourPage==null) && (idx<yourNewConnectionWizardPages.length); idx++) - { - if (yourNewConnectionWizardPages[idx] instanceof SystemFileNewConnectionWizardPage) - ourPage = (SystemFileNewConnectionWizardPage)yourNewConnectionWizardPages[idx]; - } - if ((ourPage != null) && !ourPage.isInformationalOnly()) - { - int port = ourPage.getPortNumber(); - ss.getConnectorService().setPort(port); - } - } - */ - } - - /** - * Return the default remote systems editor profile ID for files on this subsystem - */ - public String getEditorProfileID() - { - return "universal"; //$NON-NLS-1$ - } - - /** - * Determines whether this factory is responsible for the creation of subsytems of the specified type - * Subsystem factories should override this to indicate which subsystems they support. - * - * @param subSystemType type of subsystem - * @return whether this factory is for the specified subsystemtype - */ - public boolean isFactoryFor(Class subSystemType) - { - boolean isFor = IRemoteFileSubSystem.class.equals(subSystemType); - return isFor; - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFolderChildrenContentsType.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFolderChildrenContentsType.java deleted file mode 100644 index 7cc37b4e3..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFolderChildrenContentsType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 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 - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.rse.core.model.ISystemContentsType; - -/** - * Represents contents that are children of a container - */ -public class RemoteFolderChildrenContentsType implements ISystemContentsType -{ - public static String CONTENTS_TYPE_CHILDREN = "contents_folder_children"; //$NON-NLS-1$ - public static RemoteFolderChildrenContentsType _instance = new RemoteFolderChildrenContentsType(); - - public static RemoteFolderChildrenContentsType getInstance() - { - return _instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.model.ISystemContentsType#getType() - */ - public String getType() - { - return CONTENTS_TYPE_CHILDREN; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.model.ISystemContentsType#isPersistent() - */ - public boolean isPersistent() - { - return false; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResult.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResult.java deleted file mode 100644 index 26b9baf0d..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResult.java +++ /dev/null @@ -1,248 +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.subsystems.files.core.subsystems; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; - - -/** - * The RemoteSearchResultImpl class is an implementation of IRemoteSearchResult. - * It is used for storing information about a particular search result. - */ -public class RemoteSearchResult implements IAdaptable, IRemoteSearchResult { - - - private String _text; - private int _line = 0; - private int _index = -1; - - private Object _parent; - private SystemSearchString _matchingSearchString; - private IHostSearchResultConfiguration _configuration; - private List _matches; - - protected class RemoteSearchResultMatch { - - private int _startOffset = -1; - private int _endOffset = -1; - - private RemoteSearchResultMatch(int startOffset, int endOffset) { - this._startOffset = startOffset; - this._endOffset = endOffset; - } - } - - /** - * Constructor to create a result. - * @param parent container of the result. - * @param searchString the search string for which the result was produced. - */ - public RemoteSearchResult(IHostSearchResultConfiguration configuration, Object parent, SystemSearchString searchString) { - _parent = parent; - _matchingSearchString = searchString; - _matches = new ArrayList(); - _configuration = configuration; - } - - /** - * Sets the displayable text for the search result. - * @param text the displayable text. - */ - public void setText(String text) { - _text = text; - } - - /** - * Sets the associated line number for the result. - * @param line the line number. - */ - public void setLine(int line) { - _line = line; - } - - /** - * Sets the index of the search result in the context of its parent. - * @param index the index. - */ - public void setIndex(int index) { - _index = index; - } - - /** - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteSearchResult#getText() - */ - public String getText() { - return _text; - } - - /** - * @see org.eclipse.rse.core.subsystems.IRemoteLineReference#getLine() - */ - public int getLine() { - return _line; - } - - /** - * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteSearchResult#getIndex() - */ - public int getIndex() { - return _index; - } - - /** - * Gets the absolute path of the file for which the result was found. - * @return the absolute path of the file. - */ - public String getAbsolutePath() { - - if (_parent instanceof IRemoteFile) { - return ((IRemoteFile)_parent).getAbsolutePath(); - } - else { - return null; - } - } - - /** - * Gets the containing object for the search result. - * @return the containing parent. - */ - public Object getParent() { - return _parent; - } - - /** - * Gets the associated adapter for this search result. - * @param adapterType the adapter type. - */ - public Object getAdapter(Class adapterType) { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - - /** - * Returns children of the search result, if applicable. - * @return <code>null</code> for this implementation. - */ - public Object[] getChildren() { - return null; - } - - /** - * Indicates whether this search result has children - * @return <code>false</code> since there are no children. - */ - public boolean hasChildren() { - return false; - } - - /** - * Gets the displayable label for this output. Calls getText(). - * @return the label. - */ - public String getLabel() { - return getText(); - } - - /** - * Gets the search string that this result matches. - * @return the search string. - */ - public SystemSearchString getMatchingSearchString() { - return _matchingSearchString; - } - - /** - * Add a match to the result. A match comprises a char start offset and a char end offset, both - * relative to the beginning of the file. The matches are added in order. - * @param startOffset the char start offset, from the beginning of the file. - * @param endOffset the char end offset, from the beginning of the file. - */ - public void addMatch(int startOffset, int endOffset) { - _matches.add(new RemoteSearchResultMatch(startOffset, endOffset)); - } - - /** - * Gets the number of matches in this line. - * @return the number of matches. - */ - public int numOfMatches() { - return _matches.size(); - } - - /** - * Gets the char start offset for the given match index. - * @param matchIndex the match index. For example, to get the start offset for the first match, specify 0. - * @return the char start offset, or -1 if there is no match corresponding to the given index. - */ - public int getCharStart(int matchIndex) { - RemoteSearchResultMatch match = (RemoteSearchResultMatch)(_matches.get(matchIndex)); - - if (match != null) { - return match._startOffset; - } - else { - return -1; - } - } - - /** - * Gets the char end offset for the given match index. - * @param matchIndex the match index. For example, to get the end offset for the first match, specify 0. - * @return the char end offset, or -1 if there is no match corresponding to the given index. - */ - public int getCharEnd(int matchIndex) { - RemoteSearchResultMatch match = (RemoteSearchResultMatch)(_matches.get(matchIndex)); - - if (match != null) { - return match._endOffset; - } - else { - return -1; - } - } - - /** - * Returns the char start offset of the first match. - * @see org.eclipse.rse.core.subsystems.IRemoteLineReference#getCharEnd() - */ - public int getCharEnd() { - return getCharEnd(0); - } - - /** - * Returns the char end offset of the first match. - * @see org.eclipse.rse.core.subsystems.IRemoteLineReference#getCharStart() - */ - public int getCharStart() { - return getCharStart(0); - } - - public IHostSearchResultConfiguration getConfiguration() - { - return _configuration; - } - - public void setParent(Object parent) - { - _parent = parent; - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResultConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResultConfiguration.java deleted file mode 100644 index 93981fdb7..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResultConfiguration.java +++ /dev/null @@ -1,212 +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: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -import org.eclipse.rse.services.clientserver.SystemSearchString; -import org.eclipse.rse.services.search.IHostSearchConstants; -import org.eclipse.rse.services.search.IHostSearchResult; -import org.eclipse.rse.services.search.IHostSearchResultConfiguration; -import org.eclipse.rse.services.search.IHostSearchResultSet; -import org.eclipse.rse.services.search.ISearchHandler; - - -/** - * This class represents a search result configuration. A configuration - * consists of a search target and a search string, and belongs to a search - * result set. Once a search has been started via a subsystem, the results - * are stored in the configuration itself. The status of the search can also be queried from - * the configuration. - */ -public class RemoteSearchResultConfiguration implements IHostSearchResultConfiguration { - - protected IHostSearchResultSet parentResultSet; - protected Object searchTarget; - protected SystemSearchString searchString; - protected Vector results; - protected int status; - protected Map _containedResults; - protected ISearchHandler _searchHandler; - - /** - * Constructor for a result set configuration. Sets status to <code>RUNNING</code>. - * @param resultSet the parent result set. - * @param searchObject the target of the search. - * @param string the search string. - */ - public RemoteSearchResultConfiguration(IHostSearchResultSet resultSet, Object searchObject, SystemSearchString string) { - results = new Vector(); - setParentResultSet(resultSet); - setSearchTarget(searchObject); - setSearchString(string); - setStatus(IHostSearchConstants.RUNNING); - _containedResults = new HashMap(); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#setParentResultSet(org.eclipse.rse.services.search.IHostSearchResultSet) - */ - public void setParentResultSet(IHostSearchResultSet resultSet) { - this.parentResultSet = resultSet; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getParentResultSet() - */ - public IHostSearchResultSet getParentResultSet() { - return parentResultSet; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#setSearchTarget(java.lang.Object) - */ - public void setSearchTarget(Object searchObject) { - this.searchTarget = searchObject; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getSearchTarget() - */ - public Object getSearchTarget() { - return searchTarget; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#setSearchString(org.eclipse.rse.services.clientserver.SystemSearchString) - */ - public void setSearchString(SystemSearchString string) { - this.searchString = string; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getSearchString() - */ - public SystemSearchString getSearchString() { - return searchString; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#addResult(java.lang.Object) - */ - public void addResult(Object result) { - results.add(result); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#removeResult(java.lang.Object) - */ - public void removeResult(Object result) { - results.remove(result); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#removeAndAddResult(java.lang.Object, java.lang.Object) - */ - public void removeAndAddResult(Object oldResult, Object newResult) { - results.remove(oldResult); - results.add(newResult); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getResults() - */ - public Object[] getResults() { - return results.toArray(); - } - - public IHostSearchResult[] getContainedResults(Object resultContainer) - { - return (IHostSearchResult[])_containedResults.get(resultContainer); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getResultsSize() - */ - public int getResultsSize() { - return results.size(); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#removeResults() - */ - public void removeResults() { - results.removeAllElements(); - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#setStatus(int) - */ - public void setStatus(int status) { - this.status = status; - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#getStatus() - */ - public int getStatus() { - return status; - } - - /** - * Does nothing. - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#cancel() - */ - public void cancel() { - - // if not running, return - if (getStatus() != IHostSearchConstants.RUNNING) { - return; - } - } - - /** - * @see org.eclipse.rse.services.search.IHostSearchResultConfiguration#dispose() - */ - public void dispose() { - - // cancel search first - cancel(); - - // remove results - removeResults(); - } - - public void addResults(Object container, IHostSearchResult[] results) - { - addResult(container); - _containedResults.put(container, results); - - } - - public void setSearchHandler(ISearchHandler handler) - { - _searchHandler = handler; - } - - /** - * Gets the search handler. - * @return the search handler. - */ - public ISearchHandler getSearchHandler() - { - return _searchHandler; - } -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResultsContentsType.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResultsContentsType.java deleted file mode 100644 index 575b4dc50..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteSearchResultsContentsType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2004, 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 - ********************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.subsystems; - -import org.eclipse.rse.core.model.ISystemContentsType; - -/** - * Represents contents that are children of a container - */ -public class RemoteSearchResultsContentsType implements ISystemContentsType -{ - public static String CONTENTS_TYPE_SEARCH_RESULTS = "contents_search_results"; //$NON-NLS-1$ - public static RemoteSearchResultsContentsType _instance = new RemoteSearchResultsContentsType(); - - public static RemoteSearchResultsContentsType getInstance() - { - return _instance; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.model.ISystemContentsType#getType() - */ - public String getType() - { - return CONTENTS_TYPE_SEARCH_RESULTS; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.ui.model.ISystemContentsType#isPersistent() - */ - public boolean isPersistent() - { - return true; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/SystemRemoteFileMatcher.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/SystemRemoteFileMatcher.java deleted file mode 100644 index 65a056c6b..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/SystemRemoteFileMatcher.java +++ /dev/null @@ -1,93 +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.subsystems.files.core.util; -import org.eclipse.rse.core.SystemRemoteObjectMatcher; -import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes; - - - -/** - * This class encapsulates all the criteria required to identify a match on a remote - * system file object. - * <p> - * Use the static method {@link #getFileOrFolderMatcher()} to get an default instance that - * matches on any directory of any name. - * <p> - * You only need to instantiate this class if you want to match on a file of a - * particular name. - * - * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter - */ -public class SystemRemoteFileMatcher extends SystemRemoteObjectMatcher -{ - public static SystemRemoteFileMatcher inst, instFiles, instFolders; - public static final String category = ISystemFileRemoteTypes.TYPECATEGORY; - public static final String fileType = ISystemFileRemoteTypes.TYPE_FILE; - public static final String folderType = ISystemFileRemoteTypes.TYPE_FOLDER; - - /** - * Constructor when you want to match on either folders or files - * You only need to instantiate yourself if you want to match on files/folder of a - * particular name - * Otherwise, call {@link #SystemRemoteFileMatcher(String, boolean)}. - */ - public SystemRemoteFileMatcher(String nameFilter) - { - super(null, category, nameFilter, null, null, null); - } - /** - * Constructor when you want to only list files or only list folders - * You only need to instantiate yourself if you want to match on files/folder of a - * particular name - * Otherwise, call {@link #SystemRemoteFileMatcher(String)}. - */ - public SystemRemoteFileMatcher(String nameFilter, boolean foldersOnly) - { - super(null, category, nameFilter, foldersOnly ? folderType : fileType, null, null); - } - - - /** - * Return an instance that will match on any file or folder of any name from any remote system - */ - public static SystemRemoteFileMatcher getFileOrFolderMatcher() - { - if (inst == null) - inst = new SystemRemoteFileMatcher(null); - return inst; - } - /** - * Return an instance that will match on any folder of any name from any remote system - */ - public static SystemRemoteFileMatcher getFolderOnlyMatcher() - { - if (instFolders == null) - instFolders = new SystemRemoteFileMatcher(null, true); - return instFolders; - } - /** - * Return an instance that will match on any file of any name from any remote system - */ - public static SystemRemoteFileMatcher getFileOnlyMatcher() - { - if (instFiles == null) - instFiles = new SystemRemoteFileMatcher(null, false); - return instFiles; - } - - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileFilterString.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileFilterString.java deleted file mode 100644 index 1f136a6ae..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileFilterString.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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) - [cleanup] fix javadoc. - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible - * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.util; -import java.util.Vector; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.rse.internal.subsystems.files.core.Activator; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFileMessageIds; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.clientserver.NamePatternMatcher; -import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; -import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; -import org.eclipse.rse.ui.validators.ValidatorFileName; -import org.eclipse.rse.ui.validators.ValidatorFolderName; -import org.eclipse.rse.ui.validators.ValidatorUniqueString; - - - -/** - * This class is used in dialogs that prompt for file filter strings. - * File filter strings are a bit complex to validate. They have to be: - * <ul> - * <li>Unique within their filter - * <li>Valid generic names (there are rules regarding number and location of asterisks) - * <li>Either a valid file or folder name, or both, when the asterisks are substituted with a letter like 'A' - * </ul> - * <p> - * The IInputValidator interface is implemented by our parent and it - * is used by jface's InputDialog class and property sheet window. - * <p> - * If you subclass this, consider overriding the getFileNameValidator and - * getFolderNameValidator methods. - */ -public class ValidatorFileFilterString - extends ValidatorUniqueString -{ - //public static final boolean CASE_SENSITIVE = true; - //public static final boolean CASE_INSENSITIVE = false; - protected SystemMessage msg_Invalid; - protected IWorkspace workspace = ResourcesPlugin.getWorkspace(); - protected boolean isFileName, isFolderName; - private ValidatorFileName fileNameValidator; - private ValidatorFolderName folderNameValidator; - private IRemoteFileSubSystemConfiguration ssConfiguration; - - /** - * Constructor accepting a Vector for the list of existing names. - * @param ssConfig - The remote subsystem configuration we are validating filter strings in - * @param existingList - A vector containing list of existing filter names to compare against. - * Note that toString() is used to get the string from each item. - */ - public ValidatorFileFilterString(IRemoteFileSubSystemConfiguration ssConfig, Vector existingList) - { - super(existingList, ssConfig.isCaseSensitive()); // case sensitive uniqueness - this.ssConfiguration = ssConfig; - init(); - } - /** - * Constructor accepting an Array for the list of existing names. - * @param ssConfig - The remote subsystem configuration we are validating filter strings in - * @param existingList - An array containing list of existing strings to compare against. - */ - public ValidatorFileFilterString(IRemoteFileSubSystemConfiguration ssConfig, String[] existingList) - { - super(existingList, ssConfig.isCaseSensitive()); // case sensitive uniqueness - this.ssConfiguration = ssConfig; - init(); - } - - /** - * Use this constructor when the name need not be unique, and you just want - * the syntax checking. - * @param ssConfig - The remote subsystem configuration we are validating filter strings in - */ - public ValidatorFileFilterString(IRemoteFileSubSystemConfiguration ssConfig) - { - super(new String[0], ssConfig.isCaseSensitive()); - this.ssConfiguration = ssConfig; - init(); - } - - - private void init() - { - //setErrorMessages(RSEUIPlugin.getPluginMessage(FILEMSG_VALIDATE_FILEFILTERSTRING_EMPTY), - setErrorMessages(new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.MSG_VALIDATE_NAME_EMPTY, - IStatus.ERROR, SystemFileResources.MSG_VALIDATE_NAME_EMPTY, SystemFileResources.MSG_VALIDATE_NAME_EMPTY_DETAILS), - new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE, - IStatus.ERROR, SystemFileResources.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE), - new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID, - IStatus.ERROR, SystemFileResources.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID)); - isFileName = isFolderName = true; - } - - /** - * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used. - * @param msg_Empty error message when entry field is empty - * @param msg_NonUnique error message when value entered is not unique - * @param msg_Invalid error message when syntax is not valid - */ - public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid) - { - super.setErrorMessages(msg_Empty, msg_NonUnique); - this.msg_Invalid = msg_Invalid; - } - - /** - * Call this before calling isValid! - * Specify true if this is a file name filter - * @see #setIsFolderName(boolean) - */ - public void setIsFileName(boolean is) - { - this.isFileName = is; - } - /** - * Call this before calling isValid! - * Specify true if this is a folder name filter - * @see #setIsFileName(boolean) - */ - public void setIsFolderName(boolean is) - { - this.isFolderName = is; - } - - - /** - * Validate each character. - * Override of parent method. - * Override yourself to refine the error checking. - */ - public SystemMessage isSyntaxOk(String newText) - { - boolean ok = NamePatternMatcher.verifyPattern(newText, true); // true=>advanced-style-patterns - if (!ok) - return msg_Invalid; - String tempText = newText; - if (isFileName || isFolderName) - tempText = newText.replace('*','A'); - //if (isFileName && (errMsg==null)) - if (isFileName) - return getFileNameValidator().isSyntaxOk(tempText); - else if (isFolderName) - return getFolderNameValidator().isSyntaxOk(tempText); - return null; - } - - /** - * Overridable extension point to get basic file name validator - * By default, queries it from the file subsystem configuration - */ - protected ValidatorFileName getFileNameValidator() - { - if (fileNameValidator == null) - fileNameValidator = ssConfiguration.getFileNameValidator(); - return fileNameValidator; - } - /** - * Overridable extension point to get basic folder name validator - * By default, queries it from the file subsystem configuration - */ - protected ValidatorFolderName getFolderNameValidator() - { - if (folderNameValidator == null) - folderNameValidator = ssConfiguration.getFolderNameValidator(); - return folderNameValidator; - } - - /** - * Return true if case sensitive, false it not. - * By default, return ssConfiguration.isUnixStyle() - * @param ssConfig subsystem configuration - */ - protected boolean isCaseSensitive(IRemoteFileSubSystemConfiguration ssConfig) - { - return ssConfig.isUnixStyle(); - } - - /** - * Return the max length for this file or folder name - */ - public int getMaximumNameLength() - { - /* should probably do the following but too high risk right now - if (isFileName) - return getFileNameValidator().getMaximumNameLength(); - else if (isFolderName) - return getFolderNameValidator().getMaximumNameLength(); - */ - return -1; - } - - - public String toString() - { - return "ValidatorFileFilterString class"; //$NON-NLS-1$ - } - - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java deleted file mode 100644 index 0a23e16ac..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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: - * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible - * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared - *******************************************************************************/ - -package org.eclipse.rse.subsystems.files.core.util; -import java.util.Vector; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.rse.internal.subsystems.files.core.Activator; -import org.eclipse.rse.internal.subsystems.files.core.ISystemFileMessageIds; -import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources; -import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; -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.ui.validators.ValidatorFileName; -import org.eclipse.rse.ui.validators.ValidatorFolderName; -import org.eclipse.rse.ui.validators.ValidatorUniqueString; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.widgets.Shell; - - - -/** - * This class is used in dialogs that prompt for file or folder names, and those names need to be unique - * within a given folder. To make sure error checking while typing is fast, we go get the list of names - * of the files and folders in the constructor and re-use it from then on. - * <p> - * The IInputValidator interface is implemented by our parent and it - * is used by jface's InputDialog class and property sheet window. - * <p> - * If you subclass this, consider overriding the getFileNameValidator and - * getFolderNameValidator methods. - */ -public class ValidatorFileUniqueName - extends ValidatorUniqueString -{ - //public static final boolean CASE_SENSITIVE = true; - //public static final boolean CASE_INSENSITIVE = false; - protected SystemMessage msg_Invalid; - private ValidatorFileName fileNameValidator = new ValidatorFileName(); - private ValidatorFolderName folderNameValidator = new ValidatorFolderName(); - protected IRemoteFile parentFolder; - protected Vector names; - protected boolean isFolder; - - /** - * Constructor - * @param parentFolder the folder within which the name must be unique. - * @param isFolder true if validating a folder name versus a file name - */ - public ValidatorFileUniqueName(Shell shell, IRemoteFile parentFolder, boolean isFolder) - { - super((Vector)null, parentFolder.getParentRemoteFileSubSystem().isCaseSensitive() ); - this.parentFolder = parentFolder; - this.isFolder = isFolder; - init(shell); - } - - - private void init(Shell shell) - { - Cursor busyCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); - //shell.setCursor(busyCursor); - org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(shell, busyCursor); - - setErrorMessages(new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.MSG_VALIDATE_NAME_EMPTY, - IStatus.ERROR, - SystemFileResources.MSG_VALIDATE_NAME_EMPTY, SystemFileResources.MSG_VALIDATE_NAME_EMPTY_DETAILS), - new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.MSG_VALIDATE_NAME_NOTUNIQUE, - IStatus.ERROR, - SystemFileResources.MSG_VALIDATE_NAME_NOTUNIQUE, SystemFileResources.MSG_VALIDATE_NAME_NOTUNIQUE_DETAILS), - isFolder ? new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE, - IStatus.ERROR, SystemFileResources.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE) : - new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileMessageIds.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID, - IStatus.ERROR, SystemFileResources.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTVALID)); - - try - { - IRemoteFile[] contents = parentFolder.getParentRemoteFileSubSystem().list(parentFolder, null); - if (contents!=null) - { - String[] names = new String[contents.length]; - for (int idx=0; idx<names.length; idx++) - names[idx] = contents[idx].getName(); - setExistingNamesList(names); - } - } - catch (SystemMessageException e) - { - } - - //shell.setCursor(null); - org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(shell, null); - busyCursor.dispose(); - } - - /** - * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used. - * @param msg_Empty error message when entry field is empty - * @param msg_NonUnique error message when value entered is not unique - * @param msg_Invalid error message when syntax is not valid - */ - public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid) - { - super.setErrorMessages(msg_Empty, msg_NonUnique); - this.msg_Invalid = msg_Invalid; - } - - /** - * Validate each character. - * Override of parent method. - * Override yourself to refine the error checking. - */ - public SystemMessage isSyntaxOk(String newText) - { - if (!isFolder) - return getFileNameValidator().isSyntaxOk(newText); - else - return getFolderNameValidator().isSyntaxOk(newText); - } - - /** - * Overridable extension point to get basic file name validator - * By default, queries it from the file subsystem factory of the parent folder - */ - protected ValidatorFileName getFileNameValidator() - { - if (fileNameValidator == null) - fileNameValidator = parentFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().getFileNameValidator(); - return fileNameValidator; - } - /** - * Overridable extension point to get basic folder name validator. - * By default, queries it from the file subsystem factory of the parent folder - */ - protected ValidatorFolderName getFolderNameValidator() - { - if (folderNameValidator == null) - folderNameValidator = parentFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().getFolderNameValidator(); - return folderNameValidator; - } - - /** - * Return the max length for this file or folder name - */ - public int getMaximumNameLength() - { - if (isFolder) - return getFolderNameValidator().getMaximumNameLength(); - else - return getFileNameValidator().getMaximumNameLength(); - } - - - public String toString() - { - return "ValidatorFileFilterString class"; //$NON-NLS-1$ - } -} |