Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files')
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/Activator.java203
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java433
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties422
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/ISystemFileConstants.java100
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/LinkWithSystemViewAction.java532
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/ShowResourceInSystemsViewDelegate.java91
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SynchronizeCacheActionDelegate.java249
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileAction.java55
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileLineAction.java56
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareFilesAction.java132
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareWithEditionAction.java39
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java599
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCreateEditActions.java272
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDoubleClickEditAction.java97
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDownloadConflictAction.java295
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileAction.java184
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileInPlaceAction.java84
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileLineAction.java130
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilePlatformAction.java84
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilesAction.java215
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditionAction.java386
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemFileUpdateFilterAction.java57
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java367
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileAction.java88
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterAction.java134
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterFromFolderAction.java131
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFolderAction.java86
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileLineOpenWithMenu.java214
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileOpenWithMenu.java564
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSearchOpenWithMenu.java149
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemReplaceWithEditionAction.java39
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchAction.java65
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchBrowseFileLineAction.java54
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchEditFileLineAction.java166
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSelectFileTypesAction.java158
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemUploadConflictAction.java638
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SaveAsDialog.java87
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java609
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java101
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemCachePreferencePage.java651
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java474
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePropertyPage.java676
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java1118
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java72
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/ISystemRemoteCoreConstants.java28
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemFileNameHelper.java81
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java894
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarker.java288
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerInfo.java236
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerManager.java405
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerSet.java357
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinition.java142
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinitionCache.java125
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemotePath.java99
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResource.java179
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceInfo.java92
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceManager.java87
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemOpenSearchPageAction.java62
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchPage.java1620
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java474
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderDialog.java67
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderForm.java46
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java93
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesAction.java47
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesDialog.java133
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/DownloadAndOpenJob.java168
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapter.java177
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapterFactory.java61
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemRemoteFileSelectionInputProvider.java47
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewFileAdapterFactory.java65
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java3715
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultAdapter.java823
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultSetAdapter.java361
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultAdapterFactory.java81
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultSetAdapterFactory.java76
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java169
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemFileNewConnectionWizardPage.java234
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizard.java488
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizardMainPage.java237
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizard.java342
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizardMainPage.java238
81 files changed, 0 insertions, 24193 deletions
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/Activator.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/Activator.java
deleted file mode 100644
index a2f580b72..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/Activator.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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
- * David McKnight (IBM) - [205820] create the temp files project (if not there) when files.ui is loaded
- * 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) - [228353] Asynchronously initialize the remote edit project
- * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui;
-
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.core.runtime.preferences.DefaultScope;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.files.ui.resources.SystemUniversalTempFileListener;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.osgi.framework.BundleContext;
-
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class Activator extends AbstractUIPlugin
-{
-
- //The shared instance.
- private static Activator plugin;
-
- private static SystemUniversalTempFileListener _tempFileListener;
-
- public final static String PLUGIN_ID = "org.eclipse.rse.files.ui"; //$NON-NLS-1$
- public static final String HELPPREFIX = "org.eclipse.rse.files.ui."; //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- public Activator() {
- plugin = this;
- }
-
- private class InitRemoteEditJob extends Job {
- public InitRemoteEditJob() {
- super("InitRemoteEditJob"); //$NON-NLS-1$
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- // create the temp files project if it doesn't exist
- // fix for bug 205820
- SystemRemoteEditManager.getInstance().getRemoteEditProject();
-
- // refresh the remote edit project at plugin startup, to ensure
- // it's never closed
- SystemRemoteEditManager.getInstance().refreshRemoteEditProject();
-
- // universal temp file listener
- _tempFileListener = SystemUniversalTempFileListener.getListener();
- // add listener for temp files
- int eventMask = IResourceChangeEvent.POST_CHANGE;
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.addResourceChangeListener(_tempFileListener, eventMask);
-
- return Status.OK_STATUS;
- }
-
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- // DKM - workaround for issue in 175295
- // I had tried SystemFilePreferenceInitializer but it was not being started by the platform because
- // the preference store is rse.ui. In order to fix that, we'd have to migrate the
- // preferences for files to the files.ui preference store.
- // Instead calling this directly at startup.
- initializeDefaultRSEPreferences();
-
- //Bug 228353: Initialize remote edit project in a Job
- //The Job must run AFTER initializeDefaultRSEPreferences(), because that one
- //needs some classes loaded, and the class loader could fall into a deadlock
- //when the deferred Job also wants to load some classes but cannot continue
- //because the start() method is not yet finished
- InitRemoteEditJob job = new InitRemoteEditJob();
- job.setRule(ResourcesPlugin.getWorkspace().getRoot());
- job.schedule();
-
- }
-
- /**
- * Initializes preferences.
- */
- public void initializeDefaultRSEPreferences()
- {
- //FIXME This should really be migrated into a Preferences Initializer Extension
- //in order to avoid unnecessary plugin activation
- //IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
-
-
- // as per bug 245260, using scoped store for preference initialization
- IPreferenceStore store = new ScopedPreferenceStore(new DefaultScope(), RSEUIPlugin.getDefault().getBundle().getSymbolicName());
-
- // system cache preferences
- if (store.isDefault(ISystemFilePreferencesConstants.LIMIT_CACHE)){
- store.setDefault(ISystemFilePreferencesConstants.LIMIT_CACHE, ISystemFilePreferencesConstants.DEFAULT_LIMIT_CACHE);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.MAX_CACHE_SIZE)){
- store.setDefault(ISystemFilePreferencesConstants.MAX_CACHE_SIZE, ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE);
- }
-
-
- // universal preferences
- if (store.isDefault(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT)){
- store.setDefault(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT, ISystemFilePreferencesConstants.DEFAULT_FILETRANSFERMODE);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.SHOWHIDDEN)){
- store.setDefault(ISystemFilePreferencesConstants.SHOWHIDDEN, false);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS)){
- store.setDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS, ISystemFilePreferencesConstants.DEFAULT_PRESERVETIMESTAMPS);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES)){
- store.setDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES, ISystemFilePreferencesConstants.DEFAULT_SHARECACHEDFILES);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.DOSUPERTRANSFER)){
- store.setDefault(ISystemFilePreferencesConstants.DOSUPERTRANSFER, ISystemFilePreferencesConstants.DEFAULT_DOSUPERTRANSFER);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE)){
- store.setDefault(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE, ISystemFilePreferencesConstants.DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE)){
- store.setDefault(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE, ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE);
- }
-
- if (store.isDefault(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE)){
- store.setDefault(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE, ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE);
- }
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception
- {
- super.stop(context);
- if (_tempFileListener != null) {
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.removeResourceChangeListener(_tempFileListener);
- _tempFileListener = null;
- }
- plugin = null;
- }
-
- /**
- * Returns the shared instance.
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.rse.files.ui", path); //$NON-NLS-1$
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java
deleted file mode 100644
index b3927b4be..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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) - 176488: adding some text for the cache limit checkbox
- * David McKnight(IBM) - [210142] for accessibility need transfer mode toggle button
- * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
- * David McKnight (IBM) - [216252] [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) - [223103] [cleanup] fix broken externalized strings
- * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * Rupen Mardirossian (IBM) - [227213] Added RESID_CONFLICT_COPY_PATTERN to be used for copying resources to parent folder.
- * David Dykstal (IBM) [231841] Correcting messages for folder creation
- * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
- * David McKnight (IBM) - [283033] remoteFileTypes extension point should include "xml" type
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class FileResources extends NLS
-{
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.files.ui.FileResources"; //$NON-NLS-1$
-
- public static String RESID_FILES_DOWNLOAD;
-
- public static String RESID_FILES_PREFERENCES_BUFFER;
- public static String RESID_FILES_PREFERENCES_DOWNLOAD_BUFFER_SIZE_LABEL;
- public static String RESID_FILES_PREFERENCES_UPLOAD_BUFFER_SIZE_LABEL;
- public static String RESID_FILES_PREFERENCES_DOWNLOAD_BUFFER_SIZE_TOOLTIP;
- public static String RESID_FILES_PREFERENCES_UPLOAD_BUFFER_SIZE_TOOLTIP;
-
- public static String ResourceNavigator_openWith;
- public static String RSEOperation_message;
-
- // --- File Editors ---
-
- public static String FileEditorPreference_existsTitle;
- public static String FileEditorPreference_existsMessage;
-
-
- public static String DefaultEditorDescription_name;
-
-
-
- // NEW FILE WIZARD...
- public static String RESID_NEWFILE_TITLE;
- public static String RESID_NEWFILE_PAGE1_TITLE;
- public static String RESID_NEWFILE_PAGE1_DESCRIPTION;
- public static String RESID_NEWFILE_NAME_LABEL;
- public static String RESID_NEWFILE_NAME_TOOLTIP;
- public static String RESID_NEWFILE_FOLDER_LABEL;
- public static String RESID_NEWFILE_FOLDER_TIP;
- public static String RESID_NEWFILE_CONNECTIONNAME_LABEL;
- public static String RESID_NEWFILE_CONNECTIONNAME_TIP;
-
- // NEW FOLDER WIZARD...
- public static String RESID_NEWFOLDER_TITLE;
- public static String RESID_NEWFOLDER_PAGE1_TITLE;
- public static String RESID_NEWFOLDER_PAGE1_DESCRIPTION;
- public static String RESID_NEWFOLDER_NAME_LABEL;
- public static String RESID_NEWFOLDER_NAME_TOOLTIP;
- public static String RESID_NEWFOLDER_FOLDER_LABEL;
- public static String RESID_NEWFOLDER_FOLDER_TIP;
- public static String RESID_NEWFOLDER_CONNECTIONNAME_LABEL;
- public static String RESID_NEWFOLDER_CONNECTIONNAME_TIP;
-
- // ---------------------------------------------------
- // PREFERENCES FOR UNIVERSAL FILE SYSTEM ...
- // ---------------------------------------------------
-
- public static String RESID_PREF_UNIVERSAL_SHOWHIDDEN_LABEL;
-
- public static String RESID_PREF_UNIVERSAL_PRESERVE_TIMESTAMPS_LABEL;
-
- public static String RESID_PREF_UNIVERSAL_SHARE_CACHED_FILES_LABEL;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_ADDBUTTON_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_ADDBUTTON_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_REMOVEBUTTON_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_REMOVEBUTTON_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TOGGLEBUTTON_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TOGGLEBUTTON_TOOLTIP;
-
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_TOOLTIP;
-
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_DEFAULT_MODE_LABEL;
- public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_DEFAULT_MODE_TOOLTIP;
-
- // Search constants
- // Search dialog constants
- // search string controls
- public static String RESID_SEARCH_STRING_LABEL_LABEL;
- public static String RESID_SEARCH_STRING_LABEL_TOOLTIP;
-
- public static String RESID_SEARCH_STRING_COMBO_TOOLTIP;
-
- public static String RESID_SEARCH_CASE_BUTTON_LABEL;
- public static String RESID_SEARCH_CASE_BUTTON_TOOLTIP;
-
- public static String RESID_SEARCH_STRING_HINT_LABEL;
- public static String RESID_SEARCH_STRING_HINT_TOOLTIP;
-
- public static String RESID_SEARCH_STRING_REGEX_LABEL;
- public static String RESID_SEARCH_STRING_REGEX_TOOLTIP;
-
- // file name controls
- public static String RESID_SEARCH_FILENAME_LABEL_LABEL;
- public static String RESID_SEARCH_FILENAME_LABEL_TOOLTIP;
- public static String RESID_SEARCH_FILENAME_COMBO_TOOLTIP;
- public static String RESID_SEARCH_FILENAME_BROWSE_LABEL;
- public static String RESID_SEARCH_FILENAME_BROWSE_TOOLTIP;
-
- public static String RESID_SEARCH_FILENAME_HINT_LABEL;
- public static String RESID_SEARCH_FILENAME_HINT_TOOLTIP;
-
- public static String RESID_SEARCH_FILENAME_REGEX_LABEL;
- public static String RESID_SEARCH_FILENAME_REGEX_TOOLTIP;
-
- // folder name controls
- public static String RESID_SEARCH_FOLDERNAME_LABEL_LABEL;
- public static String RESID_SEARCH_FOLDERNAME_LABEL_TOOLTIP;
-
- public static String RESID_SEARCH_FOLDERNAME_COMBO_TOOLTIP;
-
- public static String RESID_SEARCH_FOLDERNAME_BROWSE_LABEL;
- public static String RESID_SEARCH_FOLDERNAME_BROWSE_TOOLTIP;
-
- // advanced search controls
- public static String RESID_SEARCH_INCLUDE_ARCHIVES_LABEL;
- public static String RESID_SEARCH_INCLUDE_ARCHIVES_TOOLTIP;
-
- public static String RESID_SEARCH_INCLUDE_SUBFOLDERS_LABEL;
- public static String RESID_SEARCH_INCLUDE_SUBFOLDERS_TOOLTIP;
-
-
-
- public static String RESID_SEARCH_MESSAGE_SEARCHING;
-
- // Resource conflict dlg constants
- public static String RESID_CONFLICT_SAVE_TITLE;
- public static String RESID_CONFLICT_SAVE_MESSAGE;
- public static String RESID_CONFLICT_SAVE_OVERWRITEREMOTE;
- public static String RESID_CONFLICT_SAVE_REPLACELOCAL;
- public static String RESID_CONFLICT_SAVE_SAVETODIFFERENT;
-
- public static String RESID_CONFLICT_DOWNLOAD_TITLE;
- public static String RESID_CONFLICT_DOWNLOAD_MESSAGE_LOCALCHANGED;
- public static String RESID_CONFLICT_DOWNLOAD_MESSAGE_REMOTECHANGED;
- public static String RESID_CONFLICT_DOWNLOAD_REPLACELOCAL;
- public static String RESID_CONFLICT_DOWNLOAD_OPENWITHLOCAL;
-
- // Resource conflict constants
- public static String RESID_CONFLICT_COPY_PATTERN;
-
- // RSE Cache Preferences
- public static String RESID_PREF_CACHE_CLEAR;
- public static String RESID_PREF_CACHE_CLEAR_TOOLTIP;
- public static String RESID_PREF_CACHE_LIMIT_CACHE_SIZE_LABEL;
- public static String RESID_PREF_CACHE_LIMIT_CACHE_SIZE_TOOLTIP;
- public static String RESID_PREF_CACHE_MAX_CACHE_SIZE_LABEL;
- public static String RESID_PREF_CACHE_MAX_CACHE_SIZE_TOOLTIP;
- public static String RESID_PREF_CACHE_CLEAR_WARNING_DESCRIPTION;
-
- // SUPERTRANSFER PROGRESS MONITOR CONSTANTS
- public static String RESID_SUPERTRANSFER_PROGMON_MAIN;
- public static String RESID_SUPERTRANSFER_PROGMON_SUBTASK_CREATE;
- public static String RESID_SUPERTRANSFER_PROGMON_SUBTASK_POPULATE;
-
- public static String RESID_SUPERTRANSFER_PROGMON_SUBTASK_TRANSFER;
- public static String RESID_SUPERTRANSFER_PROGMON_SUBTASK_EXTRACT;
-
- // SUPERTRANSFER PREFERENCES PAGE CONSTANTS
- public static String RESID_SUPERTRANSFER_PREFS_ENABLE;
- public static String RESID_SUPERTRANSFER_PREFS_TYPE_LABEL;
- public static String RESID_SUPERTRANSFER_PREFS_TYPE_TOOLTIP;
-
- // Compare with menu item
- public static String ACTION_COMPAREWITH_EACH_LABEL;
- public static String ACTION_COMPAREWITH_EACH_TOOLTIP;
-
- public static String ACTION_COMPAREWITH_HISTORY_LABEL;
- public static String ACTION_COMPAREWITH_HISTORY_TOOLTIP;
-
- // Replace with menu item
- public static String ACTION_REPLACEWITH_HISTORY_LABEL;
- public static String ACTION_REPLACEWITH_HISTORY_TOOLTIP;
-
-
-
- // Other Actions
- public static String ACTION_NEWFOLDER_LABEL;
- public static String ACTION_NEWFOLDER_TOOLTIP;
-
- public static String ACTION_SELECT_DIRECTORY_LABEL;
- public static String ACTION_SELECT_DIRECTORY_TOOLTIP;
-
- public static String ACTION_SELECT_FILE_LABEL;
- public static String ACTION_SELECT_FILE_TOOLTIP;
-
- // Property Pages
- public static String MESSAGE_ENCODING_NOT_SUPPORTED;
-
- // synchronize cache action
- public static String MESSAGE_ERROR_CACHING_REMOTE_FILES;
- public static String MESSAGE_SYNCHRONIZING_REMOTE_FILE_CACHE;
-
- // link with editor
- public static String MESSAGE_EXPANDING_FOLDER;
- public static String MESSAGE_EXPANDING_FILTER;
- public static String MESSSAGE_QUERYING_FILE;
-
- // file permisssions property page
- public static String MESSAGE_FILE_PERMISSIONS_NOT_SUPPORTED;
- public static String RESID_PREF_PERMISSIONS_PERMISSIONS_LABEL;
- public static String RESID_PREF_PERMISSIONS_TYPE_LABEL;
- public static String RESID_PREF_PERMISSIONS_READ_LABEL;
- public static String RESID_PREF_PERMISSIONS_WRITE_LABEL;
- public static String RESID_PREF_PERMISSIONS_EXECUTE_LABEL;
- public static String RESID_PREF_PERMISSIONS_USER_LABEL;
- public static String RESID_PREF_PERMISSIONS_GROUP_LABEL;
- public static String RESID_PREF_PERMISSIONS_OTHERS_LABEL;
- public static String RESID_PREF_PERMISSIONS_OWNERSHIP_LABEL;
-
- // file permissions messages
- public static String MESSAGE_PENDING;
- public static String MESSAGE_NOT_SUPPORTED;
- public static String MESSAGE_GETTING_PERMISSIONS;
-
- public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL;
-
- public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE;
- public static String RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION;
-
- public static String RESID_PROPERTY_ARCHIVE_COMMENT_LABEL;
- public static String RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION;
-
-
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL;
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE;
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION;
-
- public static String RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL;
- public static String RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION;
-
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL;
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION;
-
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL;
- public static String RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION;
-
- public static String RESID_PROPERTY_FILE_SIZE_VALUE;
-
- public static String RESID_PROPERTY_FILE_LASTMODIFIED_LABEL;
- public static String RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_SIZE_LABEL;
- public static String RESID_PROPERTY_FILE_SIZE_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL;
- public static String RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_EXTENSION_LABEL;
- public static String RESID_PROPERTY_FILE_EXTENSION_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_PERMISSIONS_LABEL;
- public static String RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_OWNER_LABEL;
- public static String RESID_PROPERTY_FILE_OWNER_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_GROUP_LABEL;
- public static String RESID_PROPERTY_FILE_GROUP_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_CLASSIFICATION_LABEL;
- public static String RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP;
-
- public static String RESID_PROPERTY_FILE_READONLY_LABEL;
- public static String RESID_PROPERTY_FILE_READONLY_TOOLTIP;
-
-
- public static String RESID_PROPERTY_FILE_HIDDEN_LABEL;
- public static String RESID_PROPERTY_FILE_HIDDEN_TOOLTIP;
-
- // search result properties
- public static String RESID_PROPERTY_SEARCH_LINE_LABEL;
- public static String RESID_PROPERTY_SEARCH_LINE_TOOLTIP;
- //public static String RESID_PROPERTY_SEARCH_CHAR_END_LABEL;
- //public static String RESID_PROPERTY_SEARCH_CHAR_END_TOOLTIP;
-
- public static String RESID_PROPERTY_SEARCH_STATUS_ACTIVE_VALUE;
- public static String RESID_PROPERTY_SEARCH_STATUS_INACTIVE_VALUE;
-
-
- // messages
- public static String MSG_ERROR_FILE_NOTFOUND;
-
- // Remote editing messages
- public static String MSG_DOWNLOAD_NO_WRITE;
- public static String MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR;
- public static String MSG_UPLOAD_FILE_EXISTS;
- public static String MSG_DOWNLOAD_NO_WRITE_DETAILS;
- public static String MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR_DETAILS;
-
- // file transfer messages
- public static String MSG_SYNCHRONIZE_PROGRESS;
- public static String MSG_EXTRACT_PROGRESS;
- public static String MSG_DOWNLOADING_PROGRESS;
- public static String MSG_UPLOADING_PROGRESS;
-
- // Remote File Exception Messages
- public static String FILEMSG_SECURITY_ERROR;
- public static String FILEMSG_IO_ERROR;
- public static String FILEMSG_FOLDER_NOTFOUND;
- public static String FILEMSG_FILE_NOTFOUND;
-
- public static String FILEMSG_SECURITY_ERROR_DETAILS;
- public static String FILEMSG_IO_ERROR_DETAILS;
-
-
-
- // --------------------------
- // UNIVERSAL FILE MESSAGES...
- // --------------------------
- public static String FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE;
-
-
- public static String FILEMSG_DELETE_FILE_FAILED;
- public static String FILEMSG_CREATE_FILE_FAILED;
- public static String FILEMSG_CREATE_FILE_FAILED_EXIST;
- public static String FILEMSG_CREATE_FOLDER_FAILED;
- public static String FILEMSG_CREATE_FOLDER_FAILED_EXIST;
- public static String FILEMSG_CREATE_RESOURCE_NOTVISIBLE;
- public static String FILEMSG_ERROR_NOFILETYPES;
- public static String FILEMSG_COPY_FILE_FAILED;
- public static String FILEMSG_MOVE_FILE_FAILED;
- public static String FILEMSG_MOVE_TARGET_EQUALS_SOURCE;
- public static String FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE;
- public static String FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE;
- public static String FILEMSG_MOVE_FILTER_NOT_VALID;
-
- public static String FILEMSG_DELETE_FILE_FAILED_DETAILS;
- public static String FILEMSG_CREATE_FILE_FAILED_DETAILS;
- public static String FILEMSG_CREATE_FILE_FAILED_EXIST_DETAILS;
- public static String FILEMSG_CREATE_FOLDER_FAILED_DETAILS;
- public static String FILEMSG_CREATE_FOLDER_FAILED_EXIST_DETAILS;
- public static String FILEMSG_CREATE_RESOURCE_NOTVISIBLE_DETAILS;
- public static String FILEMSG_ERROR_NOFILETYPES_DETAILS;
- public static String FILEMSG_COPY_FILE_FAILED_DETAILS;
- public static String FILEMSG_MOVE_FILE_FAILED_DETAILS;
- public static String FILEMSG_MOVE_TARGET_EQUALS_SOURCE_DETAILS;
- public static String FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE_DETAILS;
- public static String FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE_DETAILS;
- public static String FILEMSG_MOVE_FILTER_NOT_VALID_DETAILS;
-
- public static String FILEMSG_MOVE_INTERRUPTED;
- public static String FILEMSG_COPY_INTERRUPTED;
- public static String FILEMSG_MOVE_INTERRUPTED_DETAILS;
- public static String FILEMSG_COPY_INTERRUPTED_DETAILS;
-
- // cache preferences
- public static String MSG_CACHE_UPLOAD_BEFORE_DELETE;
- public static String MSG_CACHE_UNABLE_TO_SYNCH;
-
- public static String MSG_ERROR_PROFILE_NOTFOUND;
- public static String MSG_ERROR_CONNECTION_NOTFOUND;
-
- public static String MSG_VALIDATE_PATH_EMPTY;
-
- public static String MSG_VALIDATE_PATH_EMPTY_DETAILS;
-
-
-
-
- // remote search messages
- public static String MSG_REMOTE_SEARCH_INVALID_REGEX;
- public static String MSG_REMOTE_SEARCH_INVALID_REGEX_DETAILS;
-
-
-
- public static String MSG_CREATEFILEGENERIC_PROGRESS;
- public static String MSG_CREATEFOLDERGENERIC_PROGRESS;
-
- public static String MSG_MAKE_SELECTION;
- public static String MSG_SELECT_FOLDER_NOT_VALID;
-
-
- // preferences
- public static String MSG_ERROR_FILENAME_INVALID;
-
- public static String EditorManager_saveResourcesTitle;
-
- public static String OpenWithMenu_Other;
- public static String OpenWithMenu_OtherDialogDescription;
-
- static
- {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, FileResources.class);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties
deleted file mode 100644
index 969888660..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties
+++ /dev/null
@@ -1,422 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2009 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) - 176488: adding some text for the cache limit checkbox
-# David McKnight(IBM) - [210142] for accessibility need transfer mode toggle button
-# David McKnight(IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
-# David McKnight (IBM)- [216252] [nls] Resources 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) - [223103] [cleanup] fix broken externalized strings
-# David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
-# David McKnight (IBM) - [224377] "open with" menu does not have "other" option
-# Martin Oberhuber (Wind River) - [226784] [nls] Standardize on Cancelled in PII
-# Rupen Mardirossian (IBM) - [227213] Added RESID_CONFLICT_COPY_PATTERN to be used for copying resources to parent folder.
-# David Dykstal (IBM) [231841] Correcting messages for folder creation
-# Kevin Doyle (IBM) - [242389] [usability] RSE Save Conflict dialog should indicate which file is in conflict
-# David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
-# David McKnight (IBM) - [283033] remoteFileTypes extension point should include "xml" type
-###############################################################################
-
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-RESID_FILES_DOWNLOAD=Download
-
-RESID_FILES_PREFERENCES_BUFFER=File Transfer Buffer Size
-RESID_FILES_PREFERENCES_DOWNLOAD_BUFFER_SIZE_LABEL=Download (KB):
-RESID_FILES_PREFERENCES_UPLOAD_BUFFER_SIZE_LABEL=Upload (KB):
-RESID_FILES_PREFERENCES_DOWNLOAD_BUFFER_SIZE_TOOLTIP=Maximum size of buffer to use while sending files from the host to the client
-RESID_FILES_PREFERENCES_UPLOAD_BUFFER_SIZE_TOOLTIP=Maximum size of the buffer to use while sending files from the client to the host
-
-ResourceNavigator_openWith = Open Wit&h
-RSEOperation_message = Remote System Explorer Operation
-
-# --- File Editors ---
-FileEditorPreference_existsTitle = File Type Exists
-FileEditorPreference_existsMessage = An entry already exists for that file type
-
-
-DefaultEditorDescription_name = &Default Editor
-
-#=============================================================
-# NEW FILE WIZARD...
-#=============================================================
-RESID_NEWFILE_TITLE=New File
-RESID_NEWFILE_PAGE1_TITLE=Remote File
-RESID_NEWFILE_PAGE1_DESCRIPTION=Create a New File
-RESID_NEWFILE_FOLDER_LABEL=Parent folder
-RESID_NEWFILE_FOLDER_TIP=Folder in which the new file will be created
-RESID_NEWFILE_CONNECTIONNAME_LABEL=Connection name
-RESID_NEWFILE_CONNECTIONNAME_TIP=Connection name where the new file will be created
-RESID_NEWFILE_NAME_LABEL=New file name
-RESID_NEWFILE_NAME_TOOLTIP=Enter a file name for the new file
-
-#=============================================================
-# NEW FOLDER WIZARD...
-#=============================================================
-RESID_NEWFOLDER_TITLE=New Folder
-RESID_NEWFOLDER_PAGE1_TITLE=Remote Folder
-RESID_NEWFOLDER_PAGE1_DESCRIPTION=Create a New Folder
-RESID_NEWFOLDER_CONNECTIONNAME_LABEL=Connection name
-RESID_NEWFOLDER_CONNECTIONNAME_TIP=Connection name where the new folder will be created
-RESID_NEWFOLDER_NAME_LABEL=New folder name
-RESID_NEWFOLDER_NAME_TOOLTIP=Enter a folder name for the new folder
-RESID_NEWFOLDER_FOLDER_LABEL=Parent folder
-RESID_NEWFOLDER_FOLDER_TIP=Folder in which the new folder will be created
-
-##############################################################
-# Preference pages for universal file system
-##############################################################
-RESID_PREF_UNIVERSAL_SHOWHIDDEN_LABEL=Show hidden files
-
-RESID_PREF_UNIVERSAL_PRESERVE_TIMESTAMPS_LABEL=Copy timestamps during file transfer
-
-RESID_PREF_UNIVERSAL_SHARE_CACHED_FILES_LABEL=Share cached files between different connections to the same host
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_LABEL=File types:
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_TOOLTIP=List of file types
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_LABEL=Type
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_TOOLTIP=Type
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_ADDBUTTON_LABEL=Add...
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_ADDBUTTON_TOOLTIP=Add a file type
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_REMOVEBUTTON_LABEL=Remove
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_REMOVEBUTTON_TOOLTIP=Remove selected file type
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_TOGGLEBUTTON_LABEL=Toggle
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_TOGGLEBUTTON_TOOLTIP=Toggle between binary and text transfer mode
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_LABEL=File Transfer Mode
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TOOLTIP=Mode of file transfer for selected file type
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL=Binary
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_TOOLTIP=Transfer as binary file
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL=Text
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_TOOLTIP=Transfer as text file
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_LABEL=XML
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_TOOLTIP=Transfer as XML file
-
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_DEFAULT_MODE_LABEL=Default File Transfer Mode
-RESID_PREF_UNIVERSAL_FILES_FILETYPES_DEFAULT_MODE_TOOLTIP=Default mode of file transfer for unspecified file types
-
-###################################################################################
-############################Remote Search##############################
-###################################################################################
-RESID_SEARCH_STRING_LABEL_LABEL= Search string (leave empty for file search):
-RESID_SEARCH_STRING_LABEL_TOOLTIP=String to be searched
-RESID_SEARCH_STRING_COMBO_TOOLTIP= Enter or select search string
-RESID_SEARCH_CASE_BUTTON_LABEL= Case sensitive
-RESID_SEARCH_CASE_BUTTON_TOOLTIP= Specify whether case should be considered during search
-RESID_SEARCH_STRING_HINT_LABEL= (* = any string, ? = any character, \\ = escape for literals: * ? \\)
-RESID_SEARCH_STRING_HINT_TOOLTIP= Special characters allowed in search string
-RESID_SEARCH_STRING_REGEX_LABEL= Regular expression
-RESID_SEARCH_STRING_REGEX_TOOLTIP= Specify whether search string is a regular expression
-RESID_SEARCH_FILENAME_LABEL_LABEL= File name patterns:
-RESID_SEARCH_FILENAME_LABEL_TOOLTIP= File name patterns
-RESID_SEARCH_FILENAME_COMBO_TOOLTIP= Enter or select file name patterns
-RESID_SEARCH_FILENAME_BROWSE_LABEL= Browse...
-RESID_SEARCH_FILENAME_BROWSE_TOOLTIP= Opens a dialog to select or enter file types
-RESID_SEARCH_FILENAME_HINT_LABEL= Patterns are separated by comma (* = any string, ? = any character)
-RESID_SEARCH_FILENAME_HINT_TOOLTIP= Special characters allowed in file name patterns
-RESID_SEARCH_FILENAME_REGEX_LABEL= Regular expression
-RESID_SEARCH_FILENAME_REGEX_TOOLTIP= Specify whether file name pattern is a regular expression
-RESID_SEARCH_FOLDERNAME_LABEL_LABEL= Folder:
-RESID_SEARCH_FOLDERNAME_LABEL_TOOLTIP= Folder path
-RESID_SEARCH_FOLDERNAME_COMBO_TOOLTIP= Identifies the folder in which to search. It is fully qualified including the connection name, as in connection:/path/folder
-RESID_SEARCH_FOLDERNAME_BROWSE_LABEL= Browse...
-RESID_SEARCH_FOLDERNAME_BROWSE_TOOLTIP= Opens a dialog to select a folder
-RESID_SEARCH_INCLUDE_ARCHIVES_LABEL= Search archive files
-RESID_SEARCH_INCLUDE_ARCHIVES_TOOLTIP= Specify whether archive files such as zip, jar and tar files should also be searched
-RESID_SEARCH_INCLUDE_SUBFOLDERS_LABEL= Search subfolders
-RESID_SEARCH_INCLUDE_SUBFOLDERS_TOOLTIP= Specify whether subfolders should also be searched
-
-# Search dialog
-RESID_SEARCH_MESSAGE_SEARCHING= Searching...
-
-##################################################################################
-############################Resource Conflict Dlgs #########################
-##################################################################################
-RESID_CONFLICT_SAVE_TITLE= Save Conflict
-RESID_CONFLICT_SAVE_MESSAGE= The file "{0}" has changed on the remote system since it was opened.
-RESID_CONFLICT_SAVE_OVERWRITEREMOTE= Overwrite the remote file.
-RESID_CONFLICT_SAVE_REPLACELOCAL= Replace contents of editor with remote file. Pending changes will be lost.
-RESID_CONFLICT_SAVE_SAVETODIFFERENT= Save the contents of the editor to a different remote file.
-
-RESID_CONFLICT_DOWNLOAD_TITLE= Local Changes Pending
-RESID_CONFLICT_DOWNLOAD_MESSAGE_LOCALCHANGED= This file has pending changes that have not been saved to the remote system.
-RESID_CONFLICT_DOWNLOAD_MESSAGE_REMOTECHANGED= This file has pending changes that have not been saved to the remote system and the file has changed on the remote system.
-RESID_CONFLICT_DOWNLOAD_REPLACELOCAL= Replace pending changes with remote file
-RESID_CONFLICT_DOWNLOAD_OPENWITHLOCAL= Open editor with pending changes
-
-##################################################################################
-############################Resource Conflict Constants #########################
-##################################################################################
-
-RESID_CONFLICT_COPY_PATTERN =Copy{0,choice,1#|1< ({0,number,integer})} of {1}
-
-
-#==============================================================
-# REMOTE FILE SYSTEM CACHE PREFERENCE PAGE
-#=============================================================
-RESID_PREF_CACHE_CLEAR=Clear Cached Files
-RESID_PREF_CACHE_CLEAR_TOOLTIP=Delete remote files that have been cached in the local workspace
-RESID_PREF_CACHE_LIMIT_CACHE_SIZE_LABEL=&Limit cache size
-RESID_PREF_CACHE_LIMIT_CACHE_SIZE_TOOLTIP=Check this box to limit the cache size. Leave unchecked to specify no limit.
-RESID_PREF_CACHE_MAX_CACHE_SIZE_LABEL=&Maximum cache size (MB):
-RESID_PREF_CACHE_MAX_CACHE_SIZE_TOOLTIP=Enter the maxium size space that can be used by the cache
-RESID_PREF_CACHE_CLEAR_WARNING_DESCRIPTION=Note: Clearing the cache closes all open remote files
-
-#=============================================================
-# SUPERTRANSFER PROGRESS MONITOR
-#=============================================================
-RESID_SUPERTRANSFER_PROGMON_MAIN=Compressed copy...
-RESID_SUPERTRANSFER_PROGMON_SUBTASK_CREATE=Creating temp archive
-RESID_SUPERTRANSFER_PROGMON_SUBTASK_POPULATE=Populating temp archive
-RESID_SUPERTRANSFER_PROGMON_SUBTASK_TRANSFER=Transferring temp archive
-RESID_SUPERTRANSFER_PROGMON_SUBTASK_EXTRACT=Extracting temp archive
-
-#=============================================================
-# SUPERTRANSFER PREFERENCE PAGE
-#=============================================================
-RESID_SUPERTRANSFER_PREFS_ENABLE=Enable fast folder transfer using data compression
-RESID_SUPERTRANSFER_PREFS_TYPE_LABEL=Archive type
-RESID_SUPERTRANSFER_PREFS_TYPE_TOOLTIP=Select an archive type to use for the transfer
-
-##################################################################################
-############################Compare menu item#############################
-##################################################################################
-ACTION_COMPAREWITH_EACH_LABEL= Each Other
-ACTION_COMPAREWITH_EACH_TOOLTIP= Compare remote resources to each other
-ACTION_COMPAREWITH_HISTORY_LABEL= Local History...
-ACTION_COMPAREWITH_HISTORY_TOOLTIP= Compare the local edition history of this resource
-
-##################################################################################
-############################Replace menu item#############################
-##################################################################################
-ACTION_REPLACEWITH_HISTORY_LABEL= Local History...
-ACTION_REPLACEWITH_HISTORY_TOOLTIP= Replace the remote file with a previous edition from it's local history
-
-
-#=============================================================
-# ACTIONS...
-#=============================================================
-ACTION_NEWFOLDER_LABEL=Folder
-ACTION_NEWFOLDER_TOOLTIP=Create a new Folder
-ACTION_SELECT_DIRECTORY_LABEL=Browse...
-ACTION_SELECT_DIRECTORY_TOOLTIP=Select folder from remote system
-ACTION_SELECT_FILE_LABEL=Browse...
-ACTION_SELECT_FILE_TOOLTIP=Select file from remote system
-
-#=============================================================
-# Property Pages...
-#=============================================================
-MESSAGE_ENCODING_NOT_SUPPORTED=The selected encoding is not supported.
-
-
-#=============================================================
-# Synchronize Cache Action...
-#=============================================================
-MESSAGE_ERROR_CACHING_REMOTE_FILES=Error Caching Remote Files
-MESSAGE_SYNCHRONIZING_REMOTE_FILE_CACHE=Synchronizing Remote File Cache
-
-#=============================================================
-# Link with Editor...
-#=============================================================
-MESSAGE_EXPANDING_FOLDER=Expanding Folder...
-MESSAGE_EXPANDING_FILTER=Expanding Filter...
-MESSSAGE_QUERYING_FILE=Querying File...
-
-#=============================================================
-# File Permissions Property Page...
-#=============================================================
-MESSAGE_FILE_PERMISSIONS_NOT_SUPPORTED=Permissions and ownership not supported
-RESID_PREF_PERMISSIONS_PERMISSIONS_LABEL=Permissions
-RESID_PREF_PERMISSIONS_TYPE_LABEL=Type
-RESID_PREF_PERMISSIONS_READ_LABEL=Read
-RESID_PREF_PERMISSIONS_WRITE_LABEL=Write
-RESID_PREF_PERMISSIONS_EXECUTE_LABEL=Execute
-RESID_PREF_PERMISSIONS_USER_LABEL=User
-RESID_PREF_PERMISSIONS_GROUP_LABEL=Group
-RESID_PREF_PERMISSIONS_OTHERS_LABEL=Others
-RESID_PREF_PERMISSIONS_OWNERSHIP_LABEL=Ownership
-
-#=============================================================
-# File Permissions Messages...
-#=============================================================
-MESSAGE_PENDING=Pending...
-MESSAGE_NOT_SUPPORTED=Not supported
-MESSAGE_GETTING_PERMISSIONS=Getting permissions for {0}
-
-
-#FILE PROPERTIES
-RESID_PROPERTY_FILE_LASTMODIFIED_LABEL=Last modified
-RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP=When last changed
-RESID_PROPERTY_FILE_SIZE_LABEL=Size
-RESID_PROPERTY_FILE_SIZE_VALUE=&1 bytes
-RESID_PROPERTY_FILE_SIZE_TOOLTIP=Number of bytes in this file
-
-RESID_PROPERTY_FILE_READONLY_LABEL=Read-only
-RESID_PROPERTY_FILE_READONLY_TOOLTIP=Is this file read-only
-RESID_PROPERTY_FILE_HIDDEN_LABEL=Hidden
-RESID_PROPERTY_FILE_HIDDEN_TOOLTIP=Is this file hidden
-RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL=Canonical Path
-RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP=Canonical path of this file or folder
-RESID_PROPERTY_FILE_CLASSIFICATION_LABEL=Classification
-RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP=Classification path of this file
-RESID_PROPERTY_FILE_EXTENSION_LABEL=Extension
-RESID_PROPERTY_FILE_EXTENSION_TOOLTIP=Extension of this file
-
-RESID_PROPERTY_FILE_PERMISSIONS_LABEL=Permissions
-RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP=The user, group and other permissions of this file
-RESID_PROPERTY_FILE_OWNER_LABEL=Owner
-RESID_PROPERTY_FILE_OWNER_TOOLTIP=The owner of this file
-RESID_PROPERTY_FILE_GROUP_LABEL=Group
-RESID_PROPERTY_FILE_GROUP_TOOLTIP=The group of this file
-
-
-#SEARCH RESULT PROPERTIES
-RESID_PROPERTY_SEARCH_LINE_LABEL=Line
-RESID_PROPERTY_SEARCH_LINE_TOOLTIP=Line in file of match
-
-#ARCHIVE PROPERTIES
-RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL=Expanded Size
-RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE=&1 bytes
-RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION=Number of bytes in this archive when it is decompressed/expanded
-RESID_PROPERTY_ARCHIVE_COMMENT_LABEL=Comment
-RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION=The user-defined comment for this archive
-
-
-
-#VIRTUAL FILE PROPERTIES
-RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL=Compressed Size
-RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE=&1 bytes
-RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION=Number of bytes in the file after compression
-RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL=Compression ratio
-RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION=Compressed size divided by expanded size expressed as a percentage
-RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL=Compression method
-RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION=The algorithm used to compress the file
-RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL=Comment
-RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION=The user-defined comment for this virtual file
-
-RESID_PROPERTY_SEARCH_STATUS_ACTIVE_VALUE=Running
-RESID_PROPERTY_SEARCH_STATUS_INACTIVE_VALUE=Finished
-
-
-#MESSAGES
-MSG_ERROR_FILE_NOTFOUND=File {0} not found on host {1}
-
-MSG_DOWNLOAD_NO_WRITE=You do not have write access to file {0} on {1}. Do you want to open the file in browse mode?
-MSG_DOWNLOAD_NO_WRITE_DETAILS=You do not have write permission to the file {0} on {1}. You can open the file in browse (read-only) mode. If you want to edit the file, change file permissions to allow write access to the file.
-MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR=You are currently editing file {0} on {1}. Do you want to open the file in browse mode?
-MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR_DETAILS=You are allowed to edit a file in one editor only. You can, however, open the file in another editor for browsing. Browsing lets you view the file but does not allow you to edit its contents.
-MSG_UPLOAD_FILE_EXISTS=File {0} already exists. Do you want to replace it?
-
-
-MSG_SYNCHRONIZE_PROGRESS=Synchronizing Resources...
-MSG_EXTRACT_PROGRESS=Extracting {0}
-
-MSG_DOWNLOADING_PROGRESS=Downloading resources...
-MSG_UPLOADING_PROGRESS=Uploading resources...
-
-# REMOTE FILE SYSTEM EXCEPTION ERROR MESSAGES
-FILEMSG_SECURITY_ERROR=Operation failed. Security violation
-FILEMSG_SECURITY_ERROR_DETAILS=Message reported from file system: {0}
-
-FILEMSG_IO_ERROR=Operation failed. File system input or output error
-FILEMSG_IO_ERROR_DETAILS=Message reported from file system: {0}
-
-FILEMSG_FOLDER_NOTFOUND=Folder ''{0}'' not found
-FILEMSG_FILE_NOTFOUND=File ''{0}'' not found
-
-# PATH VALIDATION
-MSG_VALIDATE_PATH_EMPTY=Enter path
-MSG_VALIDATE_PATH_EMPTY_DETAILS=You must specify a file system path.
-
-# Universal File Messages
-FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE=Filter string ''{0}'' already exists in this filter
-
-FILEMSG_DELETE_FILE_FAILED=Deletion of the object {0} failed
-FILEMSG_DELETE_FILE_FAILED_DETAILS=Either the object does not exist or you do not have enough authority to delete the object. If this is a folder, the folder may not be empty
-
-FILEMSG_CREATE_FILE_FAILED=No authority or file name not valid
-FILEMSG_CREATE_FILE_FAILED_DETAILS=The file could not be created because of one of the following reasons:\n- the user does not have enough authority to create the file \n- the file name is not valid
-
-FILEMSG_CREATE_FOLDER_FAILED=No authority or folder name not valid
-FILEMSG_CREATE_FOLDER_FAILED_DETAILS=The folder could not be created because of one of the following reasons:\n- the user does not have enough authority to create the folder \n- the folder name is not valid
-
-FILEMSG_CREATE_FILE_FAILED_EXIST=File already exists
-FILEMSG_CREATE_FILE_FAILED_EXIST_DETAILS=The new file {0} already exists
-
-FILEMSG_CREATE_FOLDER_FAILED_EXIST= Folder already exists
-FILEMSG_CREATE_FOLDER_FAILED_EXIST_DETAILS=The new folder {0} already exists
-
-FILEMSG_CREATE_RESOURCE_NOTVISIBLE=New resource will not be visible due to subsetting. Create it anyway?
-FILEMSG_CREATE_RESOURCE_NOTVISIBLE_DETAILS=The name of the resource you are creating does not match the current filter criteria. If you select Yes to create the resource, it will not be visible within the current filter.
-
-FILEMSG_ERROR_NOFILETYPES =No file types specified
-FILEMSG_ERROR_NOFILETYPES_DETAILS=Either specify one or more file types, or select to subset by file name
-
-FILEMSG_COPY_FILE_FAILED=Copy of the file or folder {0} failed
-FILEMSG_COPY_FILE_FAILED_DETAILS=The file system reported the copy operation failed. You may not have authority to the target folder, or it may be in use
-
-FILEMSG_MOVE_FILE_FAILED=Move of the file or folder {0} failed
-FILEMSG_MOVE_FILE_FAILED_DETAILS=The file system reported the move operation failed. You may not have authority to the source folder or file, or you may not have authority to the target folder, or it may be in use
-
-FILEMSG_MOVE_TARGET_EQUALS_SOURCE=Target folder cannot equal source folder
-FILEMSG_MOVE_TARGET_EQUALS_SOURCE_DETAILS=It is impossible to move a folder to itself.
-
-FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE = Target folder cannot equal parent of source file/folder.
-FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE_DETAILS =A file or folder cannot be moved into the directory in which it exists. If you wish to rename the file, use the rename action.
-
-FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE =Target folder cannot descend from source folder
-FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE_DETAILS=It is impossible to move a folder to one of its subfolders.
-
-FILEMSG_MOVE_FILTER_NOT_VALID = Selected filter is not a valid destination.
-FILEMSG_MOVE_FILTER_NOT_VALID_DETAILS=Some filters, such as the Root or Drives filter, do not designate locations on the remote file system and cannot have files moved into them.
-
-MSG_ERROR_CONNECTION_NOTFOUND = Connection {0} not found
-
-MSG_ERROR_PROFILE_NOTFOUND =Profile {0} not found
-
-FILEMSG_MOVE_INTERRUPTED = Operation interrupted. Some objects have been moved.
-FILEMSG_MOVE_INTERRUPTED_DETAILS = The following objects have been moved:\n{0}
-FILEMSG_COPY_INTERRUPTED = Operation interrupted. Some objects have been copied to the destination.
-FILEMSG_COPY_INTERRUPTED_DETAILS=The following objects have been copied:\n{0}
-
-# cache preferences
-MSG_CACHE_UPLOAD_BEFORE_DELETE = One or more cached files have changes that have not been saved on the host.
-MSG_CACHE_UNABLE_TO_SYNCH = Unable to synchronize cache changes to host. Operation cancelled.
-
-# remote search messages
-MSG_REMOTE_SEARCH_INVALID_REGEX = Regular expression is not valid.
-MSG_REMOTE_SEARCH_INVALID_REGEX_DETAILS=The value {0} you entered is not a valid regular expression.
-
-MSG_CREATEFILEGENERIC_PROGRESS = Creating file {0}...
-MSG_CREATEFOLDERGENERIC_PROGRESS =Creating folder {0}...
-
-# preferences
-MSG_ERROR_FILENAME_INVALID = File type extension must not contain '*' or '.'
-
-EditorManager_saveResourcesTitle = Save Resources
-
-OpenWithMenu_Other=Other...
-OpenWithMenu_OtherDialogDescription=Choose the editor for opening {0}:
-
-MSG_MAKE_SELECTION = Please make a selection.
-MSG_SELECT_FOLDER_NOT_VALID=Folder is not a valid selection.
- \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/ISystemFileConstants.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/ISystemFileConstants.java
deleted file mode 100644
index 80c85124c..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/ISystemFileConstants.java
+++ /dev/null
@@ -1,100 +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] cleaning up message ids and strings
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui;
-
-
-/**
- * Constants used throughout the System plugin
- */
-public interface ISystemFileConstants
-{
- // --------------------------------
- // Message Ids
- // -------------------------------
- // Remote editing messages
- public static final String MSG_DOWNLOAD_NO_WRITE = "RSEF5002"; //$NON-NLS-1$
- public static final String MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR = "RSEF5009"; //$NON-NLS-1$
- public static final String MSG_UPLOAD_FILE_EXISTS = "RSEF5012"; //$NON-NLS-1$
-
- public static final String MSG_FOLDER_UNREADABLE = "RSEF5020"; //$NON-NLS-1$
- public static final String MSG_ERROR_FILE_NOTFOUND = "RSEG1106"; //$NON-NLS-1$
-
- // Remote File Exception Messages
- public static final String FILEMSG_SECURITY_ERROR = "RSEF1001"; //$NON-NLS-1$
- public static final String FILEMSG_IO_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_FOLDER_NOTFOUND_WANTTOCREATE = "RSEF1005"; //$NON-NLS-1$
- public static final String FILEMSG_FILE_NOTFOUND = "RSEF1006"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_PATH_EMPTY = "RSEG1032"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PATH_NOTUNIQUE= "RSEG1033"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PATH_NOTVALID = "RSEG1034"; //$NON-NLS-1$
-
- // --------------------------
- // UNIVERSAL FILE MESSAGES...
- // --------------------------
- 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_DELETE_FILE_FAILED = "RSEF1300"; //$NON-NLS-1$
- public static final String FILEMSG_RENAME_FILE_FAILED = "RSEF1301"; //$NON-NLS-1$
- public static final String FILEMSG_CREATE_FILE_FAILED = "RSEF1302"; //$NON-NLS-1$
- public static final String FILEMSG_CREATE_FILE_FAILED_EXIST = "RSEF1303"; //$NON-NLS-1$
- public static final String FILEMSG_CREATE_FOLDER_FAILED = "RSEF1304"; //$NON-NLS-1$
- public static final String FILEMSG_CREATE_FOLDER_FAILED_EXIST = "RSEF1309"; //$NON-NLS-1$
- public static final String FILEMSG_CREATE_RESOURCE_NOTVISIBLE = "RSEF1310"; //$NON-NLS-1$
- public static final String FILEMSG_RENAME_RESOURCE_NOTVISIBLE = "RSEF1311"; //$NON-NLS-1$
- public static final String FILEMSG_ERROR_NOFILETYPES = "RSEF1010"; //$NON-NLS-1$
- public static final String FILEMSG_COPY_FILE_FAILED = "RSEF1306"; //$NON-NLS-1$
- public static final String FILEMSG_MOVE_FILE_FAILED = "RSEF1307"; //$NON-NLS-1$
- public static final String FILEMSG_MOVE_TARGET_EQUALS_SOURCE = "RSEF1308"; //$NON-NLS-1$
- public static final String FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE = "RSEF1312"; //$NON-NLS-1$
- public static final String FILEMSG_DELETING = "RSEF1315"; //$NON-NLS-1$
- public static final String FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE = "RSEF1314"; //$NON-NLS-1$
- public static final String FILEMSG_MOVE_FILTER_NOT_VALID = "RSEF1313"; //$NON-NLS-1$
-
- public static final String FILEMSG_RENAME_INTERRUPTED = "RSEG1246"; //$NON-NLS-1$
- public static final String FILEMSG_DELETE_INTERRUPTED = "RSEG1247"; //$NON-NLS-1$
- public static final String FILEMSG_COPY_INTERRUPTED = "RSEG1248"; //$NON-NLS-1$
- public static final String FILEMSG_MOVE_INTERRUPTED = "RSEG1245"; //$NON-NLS-1$
-
- // cache preferences
- public static final String MSG_CACHE_UPLOAD_BEFORE_DELETE = "RSEF6101"; //$NON-NLS-1$
- public static final String MSG_CACHE_UNABLE_TO_SYNCH = "RSEF6102"; //$NON-NLS-1$
-
- public static final String MSG_ERROR_FILENAME_INVALID = "RSEF6002"; //$NON-NLS-1$
-
-
- // remote search messages
- public static final String MSG_REMOTE_SEARCH_INVALID_REGEX = "RSEG1601"; //$NON-NLS-1$
-
-
- // --------------------------------
- // INFO-POPS FOR UNIVERSAL FILE
- // -------------------------------
-
- public static final String NEW_FILE_WIZARD = "ufwf0000"; //$NON-NLS-1$
- public static final String NEW_FOLDER_WIZARD = "ufwr0000"; //$NON-NLS-1$
- public static final String NEW_FILE_ACTION = "ufaf0000"; //$NON-NLS-1$
- public static final String NEW_FOLDER_ACTION = "ufar0000"; //$NON-NLS-1$
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/LinkWithSystemViewAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/LinkWithSystemViewAction.java
deleted file mode 100644
index 40bad1583..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/LinkWithSystemViewAction.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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) - [187711] Link with Editor action for System View
- * David McKnight (IBM) - [238294] ClassCastException using Link With Editor
- * David McKnight (IBM) - [281309] RSE Explorer View is not able to be sync with Editor in next Eclipse launched
- *******************************************************************************/
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-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.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.view.ContextObject;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.IViewLinker;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.part.FileEditorInput;
-
-public class LinkWithSystemViewAction implements IViewActionDelegate {
-
- /**
- * Main thread runnable used to create tree items in system view and look for the target remote file
- * item in the tree. If the remote file item is not found, then this indirectly recurses via a new
- * LinkFromFolderJob.
- */
- private class ShowChildrenInTree implements Runnable
- {
- private Object _parentObject;
- private Object[] _children;
- private ISystemTree _systemTree;
- private IAdaptable _targetRemoteObj;
- private ISystemFilterReference _filterReference;
-
- public ShowChildrenInTree(Object parentObject, Object[] children, ISystemFilterReference filterReference, ISystemTree systemTree, IAdaptable targetRemoteObj)
- {
- _parentObject = parentObject;
- _children = children;
- _systemTree = systemTree;
- _targetRemoteObj = targetRemoteObj;
- _filterReference = filterReference;
- }
-
- private String getAbsolutePath(IAdaptable adaptable){
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
- return adapter.getAbsoluteName(adaptable);
- }
-
- public void run()
- {
- // make sure the filter is expanded
- _systemTree.revealAndExpand(_filterReference.getSubSystem(), _filterReference.getReferencedFilter());
-
- Vector matches = new Vector();
-
- _systemTree.findAllRemoteItemReferences(_parentObject, _parentObject, matches);
- if (matches.size() > 0){
- TreeItem item = (TreeItem)matches.get(0);
- _systemTree.createTreeItems(item, _children);
- item.setExpanded(true);
-
- IAdaptable containingFolder = null;
-
- // is one of these items our remote file?
- for (int i = 0; i < item.getItemCount(); i++){
- TreeItem childItem = item.getItem(i);
- Object data = childItem.getData();
- if (data instanceof IAdaptable){
- IAdaptable childObj = (IAdaptable)data;
- String childPath = getAbsolutePath(childObj);
- String targetPath = getAbsolutePath(_targetRemoteObj);
- if (childPath.equals(targetPath)){
- // select our remote file
- _systemTree.getTree().setSelection(childItem);
- return; // we're done!
- }
- else if (targetPath.startsWith(childPath)){
- containingFolder = childObj; // using this to start a deeper search for the target remote file
- }
- }
- }
-
- // remote file not found so now we have to expand further
- if (containingFolder != null){
- LinkFromFolderJob job = new LinkFromFolderJob(containingFolder, _filterReference, _targetRemoteObj, _systemTree);
- job.schedule();
- }
- }
- }
- }
-
- /**
- * Job for doing a query on a folder and then using Display.asyncExec() to reveal the results in the tree.
- */
- private class LinkFromFolderJob extends Job
- {
- private ISubSystem _subSystem;
- private IAdaptable _remoteFolder;
- private IAdaptable _targetRemoteObj;
- private ISystemTree _systemTree;
- private ISystemFilterReference _filterRef;
- private ISystemViewElementAdapter _adapter;
-
- public LinkFromFolderJob(IAdaptable remoteFolder, ISystemFilterReference filterRef, IAdaptable targetRemoteObj, ISystemTree systemTree) {
- super(FileResources.MESSAGE_EXPANDING_FOLDER);
- _remoteFolder = remoteFolder;
- _subSystem = getSubSystem(remoteFolder);
- _filterRef = filterRef; // used for context of query
- _targetRemoteObj = targetRemoteObj;
- _systemTree = systemTree;
- }
-
- private ISubSystem getSubSystem(IAdaptable adaptable)
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
- return adapter.getSubSystem(adaptable);
- }
-
- public IStatus run(IProgressMonitor monitor){
- try
- {
- // get the adapter
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)_remoteFolder).getAdapter(ISystemViewElementAdapter.class);
-
- // get the context
- ContextObject contextObject = new ContextObject(_remoteFolder, _subSystem, _filterRef);
-
- // get the children
- Object[] children = adapter.getChildren(contextObject, monitor);
-
- if (monitor.isCanceled()){
- return Status.CANCEL_STATUS;
- }
-
- // put these items in the tree and look for remoteFile
- // if we can't find the remote file under this filter, the ShowChildrenInTree will recurse
- Display.getDefault().asyncExec(new ShowChildrenInTree(_remoteFolder, children, _filterRef, _systemTree, _targetRemoteObj));
- }
- catch (Exception e){
- }
- return Status.OK_STATUS;
- }
-
- }
-
- /**
- * Job for doing a query on a filter and then using Display.asyncExec() to reveal the results in the tree.
- */
- private class LinkFromFilterJob extends Job
- {
- private ISubSystem _subSystem;
- private IAdaptable _targetRemoteObj;
- private ISystemTree _systemTree;
-
- public LinkFromFilterJob(IAdaptable targetRemoteObject, ISystemTree systemTree) {
- super(FileResources.MESSAGE_EXPANDING_FILTER);
-
- _targetRemoteObj = targetRemoteObject;
- _subSystem = getSubSystem(_targetRemoteObj);
- _systemTree = systemTree;
- }
-
- private ISystemViewElementAdapter getAdapter(IAdaptable adaptable)
- {
- return (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
- }
-
- private ISubSystem getSubSystem(IAdaptable adaptable)
- {
- ISystemViewElementAdapter adapter = getAdapter(adaptable);
- return adapter.getSubSystem(adaptable);
- }
-
- public IStatus run(IProgressMonitor monitor){
- try
- {
- // find matching filter reference
- ISystemFilterReference ref = findMatchingFilterReference();
- if (ref == null)
- {
- // the object is nowhere to be found!
- return Status.OK_STATUS;
- }
-
- // get the context
- ContextObject contextObject = new ContextObject(ref, _subSystem, ref);
-
- // get the children
- Object[] children = getAdapter((IAdaptable)ref).getChildren(contextObject, monitor);
-
- if (monitor.isCanceled()){
- return Status.CANCEL_STATUS;
- }
-
- // put these items in the tree and look for remoteFile
- // if we can't find the remote file under this filter, the ShowChildrenInTree will recurse
- Display.getDefault().asyncExec(new ShowChildrenInTree(ref, children, ref, _systemTree, _targetRemoteObj));
- }
- catch (Exception e){
- e.printStackTrace();
- }
- return Status.OK_STATUS;
- }
-
- private ISystemFilterReference findMatchingFilterReference()
- {
- String remoteObjectName = getAbsolutePath(_targetRemoteObj);
- ISystemFilterPoolReferenceManager refmgr = _subSystem.getFilterPoolReferenceManager();
- if (refmgr != null){
- ISystemFilterReference[] refs = refmgr.getSystemFilterReferences(_subSystem);
- for (int i = 0; i < refs.length; i++) {
- ISystemFilterReference ref = refs[i];
-
- if (doesFilterEncompass(ref.getReferencedFilter(), remoteObjectName)){
- return ref;
- }
- }
- }
- return null;
- }
-
- private String getAbsolutePath(IAdaptable adaptable){
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class);
- return adapter.getAbsoluteName(adaptable);
- }
-
- private boolean doesFilterEncompass(ISystemFilter filter, String remoteObjectAbsoluteName)
- {
- boolean would = false;
- String[] strings = filter.getFilterStrings();
- if (strings != null){
- for (int idx=0; !would && (idx<strings.length); idx++)
- {
- if (strings[idx].equals("/*")) //$NON-NLS-1$
- would = true;
- else if (strings[idx].equals("./*")) //$NON-NLS-1$
- {
- // my home filter - will encompass iff remoteObjectAbsoluteName is within the home dir
- try
- {
- IAdaptable homeObj = (IAdaptable)_subSystem.getObjectWithAbsoluteName(".", new NullProgressMonitor());
- if (homeObj != null){
- String homePath = getAbsolutePath(homeObj);
- would = remoteObjectAbsoluteName.startsWith(homePath);
- }
- }
- catch (Exception e){
- }
- }
- else
- would = doesFilterStringEncompass(strings[idx], remoteObjectAbsoluteName);
- }
- }
- return would;
- }
-
- private boolean doesFilterStringEncompass(String filterString, String remoteObjectAbsoluteName)
- {
- if (_subSystem instanceof IRemoteFileSubSystem){
- RemoteFileFilterString rffs = new RemoteFileFilterString(((IRemoteFileSubSystem)_subSystem).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(".")) //$NON-NLS-1$
- {
- try
- {
- IAdaptable containerObj = (IAdaptable)_subSystem.getObjectWithAbsoluteName(container, new NullProgressMonitor());
- if (containerObj != null){
- container = getAbsolutePath(containerObj);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- if (remoteObjectAbsoluteName.startsWith(container)){
- return true;
- }
- }
-
- return false;
- }
-
- }
-
- /**
- * Job for doing a query on a file. After the query it checks for the file in the tree on the main thread. If the item
- * is not found, then a search is started from the first matching filter via the LinkFromFilterJob.
- */
- private class SelectFileJob extends Job
- {
- private ISubSystem _subSystem;
- private String _path;
- private ISystemTree _systemTree;
-
- public SelectFileJob(ISubSystem subSystem, String path, ISystemTree systemTree) {
- super(FileResources.MESSSAGE_QUERYING_FILE);
- _subSystem = subSystem;
- _path = path;
- _systemTree = systemTree;
- }
-
- public IStatus run(IProgressMonitor monitor){
- try
- {
- // doing query to get the remote file
- final IAdaptable remoteObj = (IAdaptable)_subSystem.getObjectWithAbsoluteName(_path, monitor);
-
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run()
- {
- // on main thread, looking for the reference in the tree
- TreeItem item = (TreeItem)_systemTree.findFirstRemoteItemReference(remoteObj, null);
- if (item != null){
- _systemTree.getTree().setSelection(item);
- }
- else
- {
- // no reference in the tree so we will search forward from the filter in a job (avoiding query on the main thread)
- LinkFromFilterJob job = new LinkFromFilterJob(remoteObj, _systemTree);
- job.schedule();
- }
- }
- });
- }
- catch (Exception e){
- }
- return Status.OK_STATUS;
- }
- }
-
- public class ViewLinker implements IViewLinker
- {
- public void linkViewToEditor(Object remoteObject, IWorkbenchPage page)
- {
- Object obj = remoteObject;
- if (obj instanceof IAdaptable)
- {
- try
- {
- ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)((IAdaptable)obj).getAdapter(ISystemRemoteElementAdapter.class);
- if (adapter != null)
- {
-
- if (adapter.canEdit(obj))
- {
- IEditorReference[] editorRefs = page.getEditorReferences();
- for (int i = 0; i < editorRefs.length; i++)
- {
- IEditorReference editorRef = editorRefs[i];
-
- IEditorPart editor = editorRef.getEditor(true);
- if (editor != null)
- {
- IEditorInput input = editor.getEditorInput();
- if (input instanceof FileEditorInput)
- {
- ((FileEditorInput)input).getFile();
- IFile file = ((FileEditorInput)input).getFile();
- if (file.getProject().getName().equals(SystemRemoteEditManager.REMOTE_EDIT_PROJECT_NAME))
- {
- SystemIFileProperties properties = new SystemIFileProperties(file);
- String path = properties.getRemoteFilePath();
- if (path != null && path.equals(adapter.getAbsoluteName(obj)))
- {
- page.bringToTop(editor);
- return;
- }
- }
- }
- }
- }
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- public void linkEditorToView(IEditorPart editor, ISystemTree systemTree)
- {
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput)
- {
- IFileEditorInput fileInput = (IFileEditorInput) input;
- fileInput.getFile();
-
- IFile file = fileInput.getFile();
- SystemIFileProperties properties = new SystemIFileProperties(file);
- Object rmtEditable = properties.getRemoteFileObject();
- IAdaptable remoteObj = null;
- ISubSystem subSystem = null;
- if (rmtEditable != null && rmtEditable instanceof ISystemEditableRemoteObject)
- {
- ISystemEditableRemoteObject editable = (ISystemEditableRemoteObject) rmtEditable;
- remoteObj = editable.getRemoteObject();
-
- TreeItem item = (TreeItem)systemTree.findFirstRemoteItemReference(remoteObj, null);
- if (item != null){
- systemTree.getTree().setSelection(item);
- }
- else
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)remoteObj.getAdapter(ISystemViewElementAdapter.class);
- subSystem = adapter.getSubSystem(remoteObj);
-
- // no match, so we will expand from filter
- // query matching filter in a job (to avoid main thread)
- LinkFromFilterJob job = new LinkFromFilterJob(remoteObj, systemTree);
- job.schedule();
-
- }
- }
- else
- {
- String subsystemId = properties.getRemoteFileSubSystem();
- String path = properties.getRemoteFilePath();
- if (subsystemId != null && path != null)
- {
- subSystem = RSECorePlugin.getTheSystemRegistry().getSubSystem(subsystemId);
- if (subSystem != null)
- {
- // query for file in a job (to avoid main thread)
- SelectFileJob job = new SelectFileJob(subSystem, path, systemTree);
- job.schedule();
- }
- }
- }
- }
- }
-
-
- }
-
- private SystemViewPart _systemViewPart;
- private IAction _action;
- private IViewLinker _linker;
-
- public LinkWithSystemViewAction()
- {
- super();
- }
-
- public void init(IViewPart view) {
- _systemViewPart = (SystemViewPart)view;
- _linker = new ViewLinker();
-
- boolean isLinkingEnabled = _systemViewPart.isLinkingEnabled();
- if (isLinkingEnabled){
- // set it here by default to true so that we have a _linker at the start
- // and restore from memento will be able to use the linker
- _systemViewPart.setLinkingEnabled(isLinkingEnabled, _linker);
- }
- }
-
- public void run(IAction action) {
- if (_systemViewPart != null){
- boolean isToggled = action.isChecked();
- _systemViewPart.setLinkingEnabled(isToggled, _linker);
-
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (_action == null) {
- _action= action;
- _action.setChecked(_systemViewPart.isLinkingEnabled());
- }
- if (_systemViewPart.isLinkingEnabled() && !_action.isChecked()){ // if restored from memento
- _action.setChecked(true);
- _systemViewPart.setLinkingEnabled(true, _linker);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/ShowResourceInSystemsViewDelegate.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/ShowResourceInSystemsViewDelegate.java
deleted file mode 100644
index eef0da362..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/ShowResourceInSystemsViewDelegate.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2009 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) - [218227][usability] Contribute a "Show in RSE" action to Resource Navigator and Project Explorer
- ********************************************************************************/
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.net.URI;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.IAction;
-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.internal.ui.actions.ShowInSystemsViewDelegate;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-
-public class ShowResourceInSystemsViewDelegate extends
- ShowInSystemsViewDelegate {
-
- public void run(IAction action) {
-
- if (_selectedObject instanceof IResource){
- Object remoteObject = null;
- IResource resource = (IResource)_selectedObject;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- // need to find the remote equivalent of this
- IPath location = resource.getLocation();
-
- if (location != null){
- String fullPath = location.toOSString();
-
- IHost localHost = sr.getLocalHost();
- if (localHost != null){
- IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(localHost);
- try {
- remoteObject = ss.getRemoteFileObject(fullPath, new NullProgressMonitor());
- }
- catch (Exception e) {
- }
- }
- }
- else {
- URI uri = resource.getLocationURI();
-
- String hostName = uri.getHost();
- String fullPath = uri.getPath();
-
- IHost host = null;
-
- // find the host
- ISystemProfile[] profiles = sr.getSystemProfileManager().getActiveSystemProfiles();
- for (int i = 0; i < profiles.length && host == null; i++){
- ISystemProfile profile = profiles[i];
- host = sr.getHost(profile, hostName);
- }
-
- if (host != null){
- IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(host);
- try {
- remoteObject = ss.getRemoteFileObject(fullPath, new NullProgressMonitor());
- }
- catch (Exception e) {
- }
- }
-
- }
-
- if (remoteObject != null){
- _selectedObject = remoteObject;
- }
- else {
- //unable to find remote object equivalent so returning
- return;
- }
- }
- super.run(action);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SynchronizeCacheActionDelegate.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SynchronizeCacheActionDelegate.java
deleted file mode 100644
index b2cceaeda..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SynchronizeCacheActionDelegate.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/********************************************************************************
- * Copyright (c) 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.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- * David McKnight (IBM) [143503] [updating] need a synchronize cache operation
- * David McKnight (IBM) - [276534] Cache Conflict After Synchronization when Browsing Remote System with Case-Differentiated-Only Filenames
- ********************************************************************************/
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.core.model.ISystemResourceSet;
-import org.eclipse.rse.core.model.SystemRemoteResourceSet;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This action downloads remote files of a directory to the temp file cache
- * if the lastest versions have not yet been cached.
- *
- */
-public class SynchronizeCacheActionDelegate implements IActionDelegate {
-
- protected IStructuredSelection fSelection;
- private IStatus errorStatus;
- private SystemMessage systemMessage;
-
- public SynchronizeCacheActionDelegate() {
- }
-
- public void run(IAction action) {
- errorStatus = null;
- systemMessage = null;
-
- IRemoteFile[] files = getRemoteFiles(fSelection);
- boolean completed = performCacheRemoteFiles(files);
-
- if (!completed) {
- return; // not appropriate to show errors
- }
-
- // If errors occurred, open an Error dialog
- if (errorStatus != null) {
- ErrorDialog.openError(getShell(), FileResources.MESSAGE_ERROR_CACHING_REMOTE_FILES, null, errorStatus);
- errorStatus = null;
- }
- else if (systemMessage != null){
- SystemMessageDialog dlg = new SystemMessageDialog(getShell(), systemMessage);
- dlg.open();
- systemMessage = null;
- }
- }
-
- private void cacheRemoteFiles(IRemoteFile[] files, IProgressMonitor monitor) throws SystemMessageException
- {
- SystemRemoteResourceSet[] sets = getResourceSetsFor(files);
- for (int i = 0; i < sets.length; i++){
- SystemRemoteResourceSet set = sets[i];
- ISystemResourceSet resultSet = set.getAdapter().doDrag(set, monitor);
-
- systemMessage = resultSet.getMessage();
- }
- }
-
- private SystemRemoteResourceSet[] getResourceSetsFor(IRemoteFile[] files)
- {
- ISystemViewElementAdapter adapter = null;
- Map sets = new HashMap();
- for (int i = 0; i < files.length; i++){
- IRemoteFile file = files[i];
- if (adapter == null){
- adapter = (ISystemViewElementAdapter)((IAdaptable)file).getAdapter(ISystemViewElementAdapter.class);
- }
- IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
- SystemRemoteResourceSet set = (SystemRemoteResourceSet)sets.get(ss);
- if (set == null){
- set = new SystemRemoteResourceSet(ss, adapter);
- sets.put(ss, set);
- }
- set.addResource(file);
- }
- Iterator iterator = sets.values().iterator();
- List results = new ArrayList();
- while (iterator.hasNext()){
- results.add(iterator.next());
- }
- return (SystemRemoteResourceSet[])results.toArray(new SystemRemoteResourceSet[results.size()]);
- }
-
- boolean performCacheRemoteFiles(final IRemoteFile[] files) {
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- // download all files that need to be cached
- cacheRemoteFiles(files, monitor);
- }
- catch (Exception e) {
- if (e.getCause() instanceof CoreException) {
- recordError((CoreException)e.getCause());
- }
- else {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR,
- Activator.getDefault().getBundle().getSymbolicName(),
- -1, e.getMessage(), e));
- displayError(e.getMessage());
- }
- }
- }
- };
-
- try {
- //TODO make this a Job an run in foreground with option to send to background
- ProgressMonitorDialog mon = new ProgressMonitorDialog(getShell()) {
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(FileResources.MESSAGE_SYNCHRONIZING_REMOTE_FILE_CACHE);
- }
- };
- mon.run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayError("Internal Error: "+e.getTargetException().getMessage()); //$NON-NLS-1$
- return false;
- }
-
- return true;
- }
-
-
- /**
- * Opens an error dialog to display the given message.
- * <p>
- * Note that this method must be called from UI thread.
- * </p>
- *
- * @param message
- * the message
- */
- void displayError(String message) {
- MessageDialog.openError(getShell(), FileResources.MESSAGE_ERROR_CACHING_REMOTE_FILES, message);
- }
-
-
- /**
- * Records the core exception to be displayed to the user once the action is
- * finished.
- *
- * @param error
- * a <code>CoreException</code>
- */
- final void recordError(CoreException error) {
- this.errorStatus = error.getStatus();
- }
-
- /**
- * Sets the selection. The selection is only set if given a structured selection, otherwise it is set to an
- * empty structured selection.
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
-
- if (selection instanceof IStructuredSelection) {
- fSelection = (IStructuredSelection)selection;
- }
- else {
- fSelection = StructuredSelection.EMPTY;
- }
- }
-
- /**
- * Returns the remote files in the selection.
- * Use this method if this action allows multiple remote file selection.
- * @return an array of remote files.
- */
- protected IRemoteFile[] getRemoteFiles(IStructuredSelection selection) {
-
- IRemoteFile[] files = new IRemoteFile[selection.size()];
- Iterator iter = selection.iterator();
-
- int i = 0;
-
- while (iter.hasNext()) {
- files[i++] = (IRemoteFile)iter.next();
- }
-
- return files;
- }
- /**
- * Returns the workbench.
- * @return the workbench.
- */
- protected IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
- }
-
- /**
- * Returns the active shell.
- * @return the active shell.
- */
- protected Shell getShell() {
- return Display.getDefault().getActiveShell();
- }
-
- /**
- * Returns the selection.
- * @return the selection.
- */
- protected IStructuredSelection getSelection() {
- return fSelection;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileAction.java
deleted file mode 100644
index bca27c990..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileAction.java
+++ /dev/null
@@ -1,55 +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) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-
-
-/**
- * Open a remote file as read-only
- */
-public class SystemBrowseFileAction extends SystemEditFileAction {
-
-
- /**
- * Constructor for SystemBrowseFileAction.
- * @param text
- * @param tooltip
- * @param image
- * @param parent
- * @param editorDescriptor
- */
- public SystemBrowseFileAction(String text, String tooltip, ImageDescriptor image, Shell parent, IEditorDescriptor editorDescriptor) {
- super(text, tooltip, image, parent, editorDescriptor);
- }
-
- /**
- * @see org.eclipse.rse.internal.files.ui.actions.SystemEditFileAction#process(IRemoteFile)
- */
- protected void process(IRemoteFile remoteFile) {
- SystemEditableRemoteFile editableFile = new SystemEditableRemoteFile(remoteFile, _editorDescriptor);
- editableFile.open(SystemBasePlugin.getActiveWorkbenchShell(), true);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileLineAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileLineAction.java
deleted file mode 100644
index 0aea2f670..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemBrowseFileLineAction.java
+++ /dev/null
@@ -1,56 +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) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-
-/**
- * Open a remote file as read-only
- */
-public class SystemBrowseFileLineAction extends SystemEditFileLineAction {
-
- /**
- * Constructor for SystemBrowseFileAction.
- * @param text
- * @param tooltip
- * @param image
- * @param parent
- * @param editorId
- * @param line
- */
- public SystemBrowseFileLineAction(String text, String tooltip, ImageDescriptor image, Shell parent, IEditorDescriptor editorDescriptor,
- IRemoteFile remoteFile, int line, int charStart, int charEnd) {
- super(text, tooltip, image, parent, editorDescriptor, remoteFile, line, charStart, charEnd);
- }
-
- /**
- * @see org.eclipse.rse.internal.files.ui.actions.SystemEditFileAction#process(IRemoteFile)
- */
- protected void process(IRemoteFile remoteFile) {
- SystemEditableRemoteFile editableFile = new SystemEditableRemoteFile(remoteFile, _editorDescriptor);
- editableFile.open(SystemBasePlugin.getActiveWorkbenchShell(), true);
- handleGotoLine();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareFilesAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareFilesAction.java
deleted file mode 100644
index 77cb768a5..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareFilesAction.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [256644][refresh] RSE Compare with should refresh file cache before opening compare editor
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.compare.SystemCompareInput;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Compare two remote files
- */
-public class SystemCompareFilesAction extends SystemBaseAction
-{
-
-
- private List _selected;
-
- /**
- * Constructor for SystemCompareFilesAction
- * @param parent
- */
- public SystemCompareFilesAction(Shell parent)
- {
- super(FileResources.ACTION_COMPAREWITH_EACH_LABEL, parent);
- setToolTipText(FileResources.ACTION_COMPAREWITH_EACH_TOOLTIP);
- _selected = new ArrayList();
- allowOnMultipleSelection(true);
- }
-
- /**
- * Compare two remote files
- */
- public void run()
- {
- CompareConfiguration cc = new CompareConfiguration();
- cc.setProperty("org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY", new Boolean(false)); //$NON-NLS-1$
- SystemCompareInput fInput = new SystemCompareInput(cc);
-
- for (int i = 0; i < _selected.size(); i++)
- {
- IRemoteFile file = (IRemoteFile) _selected.get(i);
- // make sure this is the most up-to-date version
- try {
- file = file.getParentRemoteFileSubSystem().getRemoteFileObject(file.getAbsolutePath(), new NullProgressMonitor());
- // ensure that, if this is cached, we get the latest on download
- file.markStale(true);
- }
- catch (Exception e){
- }
-
- SystemEditableRemoteFile ef = new SystemEditableRemoteFile(file);
- fInput.addRemoteEditable(ef);
- }
-
- CompareUI.openCompareEditor(fInput);
- }
-
- /**
- * Called when the selection changes in the systems view. This determines
- * the input object for the command and whether to enable or disable
- * the action.
- *
- * @param selection the current seleciton
- * @return whether to enable or disable the action
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- _selected.clear();
- boolean enable = false;
-
- Iterator e = selection.iterator();
- while (e.hasNext())
- {
- Object selected = e.next();
-
- if (selected != null && selected instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile) selected;
- if (file.isFile())
- {
- _selected.add(file);
- if (_selected.size() == 2)
- {
- enable = true;
- }
- else
- {
- enable = false;
- }
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- return enable;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareWithEditionAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareWithEditionAction.java
deleted file mode 100644
index 8e835ba69..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCompareWithEditionAction.java
+++ /dev/null
@@ -1,39 +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.files.ui.actions;
-
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-public class SystemCompareWithEditionAction extends SystemEditionAction
-{
-
- public SystemCompareWithEditionAction(Shell parent)
- {
- super(parent,
- FileResources.ACTION_COMPAREWITH_HISTORY_LABEL,
- FileResources.ACTION_COMPAREWITH_HISTORY_TOOLTIP,
- "org.eclipse.compare.internal.CompareWithEditionAction", //$NON-NLS-1$
- false);
-
- this.fHelpContextId= ICompareContextIds.COMPARE_WITH_EDITION_DIALOG;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java
deleted file mode 100644
index 8049f2776..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java
+++ /dev/null
@@ -1,599 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [196588] Move Dialog doesn't show Archives
- * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * 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
- * Rupen Mardirossian (IBM) - [210682] created checkForCollision method that returns a boolean for SystemCopyDialog enhancement
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
- * David McKnight (IBM) - [261019] New File/Folder actions available in Work Offline mode
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-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.NullProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Copy selected files and folders action.
- */
-public class SystemCopyRemoteFileAction extends SystemBaseCopyAction
-implements IValidatorRemoteSelection
-{
- protected IRemoteFile targetFolder, targetFileOrFolder = null;
- protected IRemoteFile firstSelection = null;
- protected IRemoteFile firstSelectionParent = null;
- protected IRemoteFile[] files;
- protected Vector copiedFiles = new Vector();
- protected IHost sourceConnection;
- protected IRemoteFileSubSystem ss;
-
- /**
- * Constructor
- */
- public SystemCopyRemoteFileAction(Shell shell)
- {
- this(shell, MODE_COPY);
- }
- /**
- * Constructor for subclass
- */
- SystemCopyRemoteFileAction(Shell shell, int mode)
- {
- super(shell, mode);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0110"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX+"dcrf0000"); //$NON-NLS-1$
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- //System.out.println("inside remote file copy reset()");
- super.reset();
- targetFolder = null;
- targetFileOrFolder = null;
- firstSelection = null;
- firstSelectionParent = null;
- files = null;
- copiedFiles = new Vector();
- sourceConnection = null;
- ss = null;
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We simply ensure every selected object is an IRemoteFile
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (!(selectedObject instanceof IRemoteFile))
- enable = false;
- else {
- enable = !((IRemoteFile)selectedObject).getParentRemoteFileSubSystem().isOffline();
- }
- }
- return enable;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- public static class RenameRunnable implements Runnable
- {
- private IRemoteFile _targetFileOrFolder;
- private String _newName;
- public RenameRunnable(IRemoteFile targetFileOrFolder)
- {
- _targetFileOrFolder = targetFileOrFolder;
- }
-
- public void run() {
- ValidatorFileUniqueName validator = null;
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(null, true, _targetFileOrFolder, validator); // true => copy-collision-mode
-
- dlg.open();
- if (!dlg.wasCancelled())
- _newName = dlg.getNewName();
- else
- _newName = null;
- }
-
- public String getNewName()
- {
- return _newName;
- }
- }
-
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- * @param shell Window to host dialog
- * @param monitor Usually not needed
- * @param targetContainer will be the IRemoteFile folder selected to copy into
- * @param oldObject will be the IRemoteFile object currently being copied
- * @param oldName will be the name of the IRemoteFile object currently being copied
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- String newName = oldName;
-
- try {
-
-
-
- targetFolder = (IRemoteFile)targetContainer;
- ss = targetFolder.getParentRemoteFileSubSystem();
- targetFileOrFolder = ss.getRemoteFileObject(targetFolder, oldName, monitor);
-
-
- //RSEUIPlugin.logInfo("CHECKING FOR COLLISION ON '"+srcFileOrFolder.getAbsolutePath() + "' IN '" +targetFolder.getAbsolutePath()+"'");
- //RSEUIPlugin.logInfo("...TARGET FILE: '"+tgtFileOrFolder.getAbsolutePath()+"'");
- //RSEUIPlugin.logInfo("...target.exists()? "+tgtFileOrFolder.exists());
- if (targetFileOrFolder.exists())
- {
- //monitor.setVisible(false); wish we could!
-
- // we no longer have to set the validator here... the common rename dialog we all now use queries the input
- // object's system view adaptor for its name validator. See getNameValidator in SystemViewRemoteFileAdapter. phil
- // ValidatorFileUniqueName validator = null; // new
- // ValidatorFileUniqueName(shell, targetFolder,
- // srcFileOrFolder.isDirectory());
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- RenameRunnable rr = new RenameRunnable(targetFileOrFolder);
- Display.getDefault().syncExec(rr);
- newName = rr.getNewName();
- }
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("SystemCopyRemoteFileAction.checkForCollision()", e); //$NON-NLS-1$
- }
-
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- * @param shell Window to host dialog
- * @param monitor Usually not needed
- * @param targetContainer will be the IRemoteFile folder selected to copy into
- * @param oldName will be the name of the IRemoteFile object currently being copied
- */
- protected boolean checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, String oldName)
- {
- try
- {
- targetFolder = (IRemoteFile)targetContainer;
- ss = targetFolder.getParentRemoteFileSubSystem();
- targetFileOrFolder = ss.getRemoteFileObject(targetFolder, oldName, monitor);
-
- if (targetFileOrFolder.exists())
- {
- return true;
- }
-
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError("SystemCopyRemoteFileAction.checkForCollision()", e); //$NON-NLS-1$
- }
- return false;
-
- }
-
- /**
- * @param targetContainer will be the IRemoteFile folder selected to copy into
- * @param oldObject will be the IRemoteFile object currently being copied
- * @param newName will be the new name to give the oldObject on copy
- * @param monitor Usually not needed
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- targetFolder = (IRemoteFile)targetContainer;
- IRemoteFile srcFileOrFolder = (IRemoteFile)oldObject;
-
- IHost targetConnection = targetFolder.getHost();
- IHost srcConnection = srcFileOrFolder.getHost();
-
- boolean ok = false;
- if (targetConnection == srcConnection)
- {
- ss = targetFolder.getParentRemoteFileSubSystem();
- ss.copy(srcFileOrFolder, targetFolder, newName, null);
- ok = true;
- String sep = targetFolder.getSeparator();
- String targetFolderName = targetFolder.getAbsolutePath();
- if (!targetFolderName.endsWith(sep))
- copiedFiles.addElement(targetFolderName+sep+newName);
- else
- copiedFiles.addElement(targetFolderName+newName);
- }
- // DKM - for cross system copy
- else
- {
- IRemoteFileSubSystem targetFS = targetFolder.getParentRemoteFileSubSystem();
- IRemoteFileSubSystem srcFS = srcFileOrFolder.getParentRemoteFileSubSystem();
- String newPath = targetFolder.getAbsolutePath() + "/" + newName; //$NON-NLS-1$
- if (srcFileOrFolder.isFile())
- {
- SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance();
- // if remote edit project doesn't exist, create it
- if (!mgr.doesRemoteEditProjectExist())
- mgr.getRemoteEditProject();
-
- StringBuffer path = new StringBuffer(mgr.getRemoteEditProjectLocation().makeAbsolute().toOSString());
- path = path.append("/" + srcFS.getSystemProfileName() + "/" + srcFS.getHostAliasName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- String absolutePath = srcFileOrFolder.getAbsolutePath();
-
-
- int colonIndex = absolutePath.indexOf(IPath.DEVICE_SEPARATOR);
-
- if (colonIndex != -1)
- {
- if (colonIndex == 0)
- {
- absolutePath = absolutePath.substring(1);
- }
- else if (colonIndex == (absolutePath.length() - 1))
- {
- absolutePath = absolutePath.substring(0, colonIndex);
- }
- else
- {
- absolutePath = absolutePath.substring(0, colonIndex) + absolutePath.substring(colonIndex + 1);
- }
- }
-
- path = path.append(absolutePath);
-
- String tempFile = path.toString();
-
- srcFS.download(srcFileOrFolder, tempFile, SystemEncodingUtil.ENCODING_UTF_8, null);
- targetFS.upload(tempFile, SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), null); //$NON-NLS-1$
- }
- else
- {
-
- IRemoteFile newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
- targetFS.createFolder(newTargetFolder, monitor);
- IRemoteFile[] children = srcFS.list(srcFileOrFolder, monitor);
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- IRemoteFile child = children[i];
- monitor.subTask("copying " + child.getName()); //$NON-NLS-1$
- doCopy(newTargetFolder, child, child.getName(), monitor);
- monitor.worked(1);
- }
- }
- }
- }
-
- return ok;
- }
-
-
- /**
- * Required parent class abstract method.
- * Does not apply to us as we supply our own dialog for the copy-target
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- return null;
- }
- /**
- * Required parent class abstract method.
- * Does not apply to us as we supply our own dialog for the copy-target
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return null;
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- * Returns an array of IRemoteFile objects
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFiles();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- IRemoteFile[] files = getSelectedFiles();
- String[] names = new String[files.length];
- for (int idx=0; idx<files.length; idx++)
- names[idx] = files[idx].getName();
- return names;
- }
-
-
- /**
- * @see SystemBaseCopyAction#getOldAbsoluteNames()
- */
- protected String[] getOldAbsoluteNames()
- {
- IRemoteFile[] files = getSelectedFiles();
- String[] names = new String[files.length];
- for (int idx=0; idx<files.length; idx++)
- names[idx] = files[idx].getAbsolutePath();
- return names;
- }
-
- /**
- * Override of parent.
- * Return the dialog that will be used to prompt for the copy/move target location.
- */
- protected Dialog createDialog(Shell shell)
- {
- ++runCount;
- if (runCount > 1)
- reset();
- //return new SystemSimpleCopyDialog(parent, getPromptString(), mode, this, getTreeModel(), getTreeInitialSelection());
- String dlgTitle = (mode==MODE_COPY ? SystemResources.RESID_COPY_TITLE : SystemResources.RESID_MOVE_TITLE);
-
- firstSelection = getFirstSelectedFile();
- sourceConnection = firstSelection.getHost();
- SystemRemoteFolderDialog dlg = new SystemRemoteFolderDialog(shell, dlgTitle, sourceConnection);
- dlg.setNeedsProgressMonitor(true);
- dlg.setMessage(getPromptString());
- dlg.setShowPropertySheet(true, false);
- dlg.setDefaultSystemConnection(sourceConnection, true);
-
- //dlg.setSystemConnection(sourceConnection);
- if (mode==MODE_MOVE)
- dlg.setSelectionValidator(this);
- //RSEUIPlugin.logInfo("Calling getParentRemoteFile for '"+firstSelection.getAbsolutePath()+"'");
- firstSelectionParent = firstSelection.getParentRemoteFile();
- boolean supportsArchiveManagement = firstSelectionParent.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- if (supportsArchiveManagement)
- {
- // Set a new viewer filter
- SystemActionViewerFilter _filter = new SystemActionViewerFilter();
- Class[] types = {IRemoteFile.class};
- _filter.addFilterCriterion(types, "isDirectory", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- _filter.addFilterCriterion(types, "isArchive", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- dlg.setCustomViewerFilter(_filter);
- }
- /*
- if (firstSelectionParent != null)
- RSEUIPlugin.logInfo("Result of getParentRemoteFile: '"+firstSelectionParent.getAbsolutePath()+"'");
- else
- RSEUIPlugin.logInfo("Result of getParentRemoteFile: null");
- */
- dlg.setPreSelection(firstSelectionParent);
-
- // our title now reflects multiple selection. If single change it.
- IStructuredSelection sel = getSelection();
- //System.out.println("size = "+sel.size());
- if (sel.size() == 1)
- {
- String singleTitle = null;
- if (mode == MODE_COPY)
- singleTitle = SystemResources.RESID_COPY_SINGLE_TITLE;
- else
- singleTitle = SystemResources.RESID_MOVE_SINGLE_TITLE;
- //System.out.println("..."+singleTitle);
- if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev //$NON-NLS-1$
- dlg.setTitle(singleTitle);
- }
- return dlg;
- }
-
- /**
- * Override this method if you supply your own copy/move target dialog.
- * Return the user-selected target or null if cancelled
- */
- protected Object getTargetContainer(Dialog dlg)
- {
- SystemRemoteFolderDialog cpyDlg = (SystemRemoteFolderDialog)dlg;
- Object targetContainer = null;
- if (!cpyDlg.wasCancelled())
- {
- targetContainer = cpyDlg.getSelectedObject();
- if (targetContainer instanceof ISystemFilterReference)
- {
- ISubSystem targetSubSystem = ((ISystemFilterReference)targetContainer).getSubSystem();
- ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration();
- if (factory.supportsDropInFilters())
- {
- targetContainer = targetSubSystem.getTargetForFilter((ISystemFilterReference)targetContainer);
- }
- }
- }
- return targetContainer;
- }
-
- private void invalidateFilterReferences(IRemoteFile targetFolder)
- {
- String path = targetFolder.getAbsolutePath();
- IRemoteFileSubSystem fileSS = targetFolder.getParentRemoteFileSubSystem();
- ISystemFilterPoolReferenceManager mgr = fileSS.getSystemFilterPoolReferenceManager();
- ISystemFilterPool[] pools = mgr.getReferencedSystemFilterPools();
- IProgressMonitor monitor = new NullProgressMonitor();
- for (int i = 0; i < pools.length; i++)
- {
- ISystemFilterPool pool = pools[i];
- ISystemFilter[] filters = pool.getSystemFilters();
- for (int f = 0; f < filters.length; f++)
- {
- String[] strs = filters[f].getFilterStrings();
- for (int s = 0; s < strs.length; s++)
- {
- String str = strs[s];
- int lastSep = str.lastIndexOf(fileSS.getSeparator());
- if (lastSep > 0)
- {
- str = str.substring(0, lastSep);
- }
- IRemoteFile par = null;
- try
- {
- par = fileSS.getRemoteFileObject(str, monitor);
- }
- catch (Exception e)
- {
- }
-
- if (par != null)
- str = par.getAbsolutePath();
-
- //if (StringCompare.compare(str, path, true))
- if (str.equals(path))
- {
- ISystemFilterReference ref = mgr.getSystemFilterReference(fileSS, filters[f]);
- ref.markStale(true);
- }
- }
- }
- }
- }
-
- /**
- * Called after all the copy/move operations end, be it successfully or not.
- * Your opportunity to display completion or do post-copy selections/refreshes
- */
- public void copyComplete(String operation)
- {
- if (copiedFiles.size() == 0)
- return;
-
- // refresh all instances of this parent, and all affected filters...
- ISubSystem fileSS = targetFolder.getParentRemoteFileSubSystem();
- Viewer originatingViewer = getViewer();
-
- targetFolder.markStale(true);
-
- // invalidate filters
- invalidateFilterReferences(targetFolder);
-
- if (operation == null){
- operation = ISystemRemoteChangeEvents.SYSTEM_REMOTE_OPERATION_COPY;
- }
-
-
- RSECorePlugin.getTheSystemRegistry().fireRemoteResourceChangeEvent(operation,
- ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, copiedFiles, targetFolder.getAbsolutePath(), fileSS, getOldAbsoluteNames(), originatingViewer);
-
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Get the currently selected IRemoteFile objects
- */
- protected IRemoteFile[] getSelectedFiles()
- {
- if (files == null)
- {
- IStructuredSelection selection = getSelection();
- files = new IRemoteFile[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- files[idx++] = (IRemoteFile)i.next();
- }
- }
- return files;
- }
- /**
- * Get the first selected file or folder
- */
- protected IRemoteFile getFirstSelectedFile()
- {
- if (files == null)
- getSelectedFiles();
- if (files.length > 0)
- return files[0];
- else
- return null;
- }
-
- /**
- * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
- * if it is not to be enabled. The message will be displayed on the message line.
- * <p>
- * This is overridden in SystemMoveRemoteFileAction
- */
- public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
- {
- return null;
- }
-
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCreateEditActions.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCreateEditActions.java
deleted file mode 100644
index 50deb006a..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCreateEditActions.java
+++ /dev/null
@@ -1,272 +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) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemSeparatorAction;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-
-/**
- * Class for creating edit actions
- * @deprecated - use <code>SystemRemoteFileOpenWithMenu</code> now
- *
- */
-public class SystemCreateEditActions
-{
-
-
- protected IEditorRegistry registry;
-
- /*
- * Compares the labels from two IEditorDescriptor objects
- */
- private static final Comparator comparer = new Comparator() {
- private Collator collator = Collator.getInstance();
-
- public int compare(Object arg0, Object arg1) {
- String s1 = ((IEditorDescriptor)arg0).getLabel();
- String s2 = ((IEditorDescriptor)arg1).getLabel();
- return collator.compare(s1, s2);
- }
- };
-
- /**
- * Constructor for CreateEditActions
- */
- public SystemCreateEditActions() {
- super();
- registry = PlatformUI.getWorkbench().getEditorRegistry();
- }
-
- /**
- * Create edit actions
- */
- public void create(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
-
- if (selection.size() <= 0)
- return;
-
- // create basic open
- createForAnySelection(menu, selection, shell, menuGroup);
-
-
- // create open with->
- if (selection.size() == 1)
- {
- createForSingleSelection(menu, selection.getFirstElement(), shell, menuGroup);
- }
- else
- { // editing is only allowed when there is only one selection
- return;
- }
- }
-
- public void createForAnySelection(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- String label = SystemResources.ACTION_CASCADING_OPEN_LABEL;
- String tooltip = SystemResources.ACTION_CASCADING_OPEN_TOOLTIP;
- SystemEditFilesAction action = new SystemEditFilesAction(label, tooltip, shell);
-
- // add action
- menu.add(ISystemContextMenuConstants.GROUP_OPEN, action);
- }
-
-
- protected IEditorRegistry getEditorRegistry()
- {
- return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
- }
-
- protected IEditorDescriptor getDefaultTextEditor()
- {
- IEditorRegistry registry = getEditorRegistry();
- return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
- /**
- * Create actions when one file has been selected.
- */
- public void createForSingleSelection(SystemMenuManager menu, Object element, Shell shell, String menuGroup) {
- IRemoteFile remoteFile = null;
-
- if ((element == null) || !(element instanceof IRemoteFile)) {
- return;
- }
- else {
- remoteFile = (IRemoteFile)element;
- }
-
- IEditorDescriptor defaultEditor = getDefaultTextEditor();
-
- IEditorDescriptor preferredEditor = getPreferredEditor(remoteFile); // may be null
-
- Object[] editors = registry.getEditors(remoteFile.getName());
- Collections.sort(Arrays.asList(editors), comparer);
-
- boolean defaultFound = false;
-
- //Check that we don't add it twice. This is possible
- //if the same editor goes to two mappings.
- ArrayList alreadyMapped = new ArrayList();
-
- for (int i = 0; i < editors.length; i++) {
-
- IEditorDescriptor editor = (IEditorDescriptor) editors[i];
-
- if (!alreadyMapped.contains(editor)) {
-
- createEditAction(menu, shell, remoteFile, editor, preferredEditor);
-
- // remember if we find default text editor
- if (defaultEditor != null && editor.getId().equals(defaultEditor.getId())) {
- defaultFound = true;
- }
-
- alreadyMapped.add(editor);
- }
- }
-
- // only add a separator if there are associated editors
- if (editors.length > 0) {
- SystemSeparatorAction sep = new SystemSeparatorAction(shell);
- menu.add(ISystemContextMenuConstants.GROUP_OPENWITH, sep);
- }
-
- // add default text editor if it was not already associated
- if (!defaultFound && defaultEditor != null) {
- createEditAction(menu, shell, remoteFile, defaultEditor, preferredEditor);
- }
-
- // add system editor (should never be null)
- IEditorDescriptor descriptor = registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
- createEditAction(menu, shell, remoteFile, descriptor, preferredEditor);
-
- /* DKM - 56067
- // add system in-place editor (can be null)
- descriptor = registry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
-
- if (descriptor != null) {
- createEditAction(menu, shell, remoteFile, descriptor, preferredEditor);
- }
- */
-
- // TODO: default action
- // createDefaultEditAction(menu, file);
- }
-
- /**
- * Creates an edit action for a specific editor. If the editor is the preferred editor, then it is selected.
- * @param menu the menu manager.
- * @param shell the shell.
- * @param remoteFile the remote file.
- * @param descriptor the editor descriptor.
- * @param preferredEditor the descriptor of the preferred editor, or <code>null</code>.
- */
- private void createEditAction(SystemMenuManager menu, Shell shell, IRemoteFile remoteFile, IEditorDescriptor descriptor, final IEditorDescriptor preferredEditor) {
- String editorId = descriptor.getId();
-
- String label = descriptor.getLabel();
- ImageDescriptor image = getImageDescriptor(remoteFile, descriptor);
-
- // create action
- SystemEditFileAction action = new SystemEditFileAction(label, label, image, IAction.AS_RADIO_BUTTON, shell, descriptor);
-
- // check if editor is the preferred editor
- boolean isPreferred = preferredEditor != null && editorId.equals(preferredEditor.getId());
-
- // mark action as checked or not
- action.setChecked(isPreferred);
-
- // add action
- menu.add(ISystemContextMenuConstants.GROUP_OPENWITH, action);
- }
-
-
- /**
- * Returns the preferred editor for the remote file. If the remote file has a cached local resource,
- * then returns the default editor associated with that resource, by calling <code>IDE.getDefaultEditor(IFile)</code>.
- * Otherwise, get the default editor associated with that remote file name from the editor registry.
- * @param remoteFile the remote file.
- * @return the preferred editor for the remote file, or <code>null</code> if none.
- */
- private IEditorDescriptor getPreferredEditor(IRemoteFile remoteFile) {
-
- IFile localFile = getLocalResource(remoteFile);
-
- if (localFile == null) {
- return registry.getDefaultEditor(remoteFile.getName());
- }
- else {
- return IDE.getDefaultEditor(localFile);
- }
- }
-
- /**
- * Get the local cache of the remote file, or <code>null</code> if none.
- * @param remoteFile the remote file.
- * @return the local cached resource, or <code>null</code> if none.
- */
- private IFile getLocalResource(IRemoteFile remoteFile)
- {
- return (IFile)UniversalFileTransferUtility.getTempFileFor(remoteFile);
- }
-
- /**
- * Returns the image descriptor for the given editor descriptor. If the editor descriptor is
- * <code>null</code>, returns the image descriptor for the remote file name.
- * @param remoteFile the remote file.
- */
- private ImageDescriptor getImageDescriptor(IRemoteFile remoteFile, IEditorDescriptor editorDesc) {
- ImageDescriptor imageDesc = null;
-
- if (editorDesc == null) {
- imageDesc = registry.getImageDescriptor(remoteFile.getName());
- }
- else {
- imageDesc = editorDesc.getImageDescriptor();
- }
-
- if (imageDesc == null && editorDesc != null) {
-
- if (editorDesc.getId().equals(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID))
- imageDesc = registry.getSystemExternalEditorImageDescriptor(remoteFile.getName());
- }
-
- return imageDesc;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDoubleClickEditAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDoubleClickEditAction.java
deleted file mode 100644
index efd5fe4dd..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDoubleClickEditAction.java
+++ /dev/null
@@ -1,97 +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) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-
-
-public class SystemDoubleClickEditAction extends SystemBaseAction
-{
-
-
-
- private Object element;
-
- /**
- * Constructor for SystemDoubleClickEditAction
- */
- public SystemDoubleClickEditAction(Object element)
- {
- super(null, null);
- this.element = element;
- }
-
- protected IEditorRegistry getEditorRegistry()
- {
- return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
- }
-
- protected IEditorDescriptor getDefaultTextEditor()
- {
- IEditorRegistry registry = getEditorRegistry();
- return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
- /**
- * @see SystemBaseAction#run()
- */
- public void run()
- {
-
- IRemoteFile remoteFile = null;
-
- if ((element == null) || !(element instanceof IRemoteFile))
- return;
- else
- remoteFile = (IRemoteFile) element;
-
- /* DKM - use Eclipse default, instead
- // open LPEX editor on double click if remote file is a text file
- if (remoteFile.isText()) {
- IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry();
- IEditorDescriptor descriptor = registry.findEditor(ISystemTextEditorConstants.SYSTEM_TEXT_EDITOR_ID);
- String id = descriptor.getId();
- SystemEditFileAction editAction = new SystemEditFileAction(null, null, null, null, id);
- editAction.setSelection(new StructuredSelection(element));
- editAction.run();
- }
- else { // open the system editor on double click if remote file is a text file
- SystemEditFilePlatformAction platformEditAction = new SystemEditFilePlatformAction(null, null, null, null);
- platformEditAction.setSelection(new StructuredSelection(element));
- platformEditAction.run();
- }
- */
-
- // DKM, use Eclipse default
- String fileName = remoteFile.getName();
- IEditorRegistry registry = getEditorRegistry();
- IEditorDescriptor descriptor = registry.getDefaultEditor(fileName);
- if (descriptor == null)
- {
- descriptor = registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
-
- }
- SystemEditFileAction editAction = new SystemEditFileAction(null, null, null, null, descriptor);
- editAction.setSelection(new StructuredSelection(element));
- editAction.run();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDownloadConflictAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDownloadConflictAction.java
deleted file mode 100644
index f96042dd8..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemDownloadConflictAction.java
+++ /dev/null
@@ -1,295 +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) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * This is the default action used to handle download conflicts
- */
-public class SystemDownloadConflictAction extends SystemBaseAction implements Runnable
-{
-
- /**
- * This is the default dialog used to handle download conflicts
- */
- protected class DownloadConflictDialog extends SystemPromptDialog
- {
- private Button _keepLocalButton;
- private Button _replaceLocalButton;
-
- private boolean _keepLocal;
- private String _openLocalText;
- private String _replaceText;
- private String _dialogText;
- private String _helpId;
-
- /**
- * Constructor.
- * @param shell the parent shell of the dialog
- * @param remoteNewer indicates whether the remote file has changed since it was last downloaded
- */
- public DownloadConflictDialog(Shell shell, boolean remoteNewer)
- {
- super(shell, FileResources.RESID_CONFLICT_DOWNLOAD_TITLE);
- }
-
- /**
- * Return whether the user decided to keep the local cached file
- * @return the whether the user decided to keep the local cached file
- */
- public boolean keepLocal()
- {
- return _keepLocal;
- }
-
- /**
- * Called when a button is pressed in the dialog
- */
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
- _keepLocal = _keepLocalButton.getSelection();
- close();
- }
-
- /**
- * Creates the dialog content
- */
- public Control createInner(Composite parent)
- {
- Image image = getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION);
-
- Composite c = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- c.setLayout(layout);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite m = new Composite(c, SWT.NONE);
-
- GridLayout mlayout = new GridLayout();
- mlayout.numColumns = 2;
- m.setLayout(mlayout);
- m.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(m, 0);
- image.setBackground(label.getBackground());
- label.setImage(image);
- label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
-
- Text text = new Text(m, SWT.WRAP | SWT.MULTI);
- text.setEditable(false);
- text.setText(_dialogText);
- text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- Composite options = new Composite(c, SWT.NONE);
- GridLayout olayout = new GridLayout();
- olayout.numColumns = 1;
- options.setLayout(olayout);
- options.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- _replaceLocalButton = new Button(options, SWT.RADIO);
- _replaceLocalButton.setText(_replaceText);
- _replaceLocalButton.setSelection(true);
-
- _keepLocalButton = new Button(options, SWT.RADIO);
- _keepLocalButton.setText(_openLocalText);
-
- setHelp();
- return c;
- }
-
- /**
- * Returns the initial focus control
- * @return the initial focus control
- */
- protected Control getInitialFocusControl()
- {
- enableOkButton(true);
- return _replaceLocalButton;
- }
-
- private void setHelp()
- {
- setHelp(_helpId);
- }
-
- /**
- * Sets the help id for this dialog
- * @param id the help id
- */
- public void setHelpId(String id)
- {
- _helpId= id;
- }
-
- /**
- * Sets the dialog message
- * @param dialogText the dialog message
- */
- public void setDialogText(String dialogText)
- {
- _dialogText = dialogText;
- }
-
- /**
- * Sets the dialog action message for replacing the local file with the remote file
- * @param replaceText the dialog action message for replacing the local file
- */
- public void setReplaceText(String replaceText)
- {
- _replaceText = replaceText;
- }
-
- /**
- * Sets the dialog action message for keeping the local file
- * @param openLocalText the dialog action message for keeping the local file
- */
- public void setOpenLocalText(String openLocalText)
- {
- _openLocalText = openLocalText;
- }
-
- }
-
- protected IFile _tempFile;
- protected boolean _remoteNewer;
- protected int _state;
-
- public static final int REPLACE_WITH_REMOTE = 0;
- public static final int OPEN_WITH_LOCAL = 1;
- public static final int CANCELLED = 2;
-
- /**
- * Constructor.
- * @param tempFile the cached local file that is in conflict with the remote file
- * @param remoteNewer indicates whether the remote file has changed since it was last downloaded
- */
- public SystemDownloadConflictAction(IFile tempFile, boolean remoteNewer)
- {
- super(FileResources.RESID_CONFLICT_DOWNLOAD_TITLE, null);
- _tempFile = tempFile;
- _remoteNewer = remoteNewer;
- }
-
- /**
- * Constructor.
- * @param title the title for the action
- * @param tempFile the cached local file that is in conflict with the remote file
- * @param remoteNewer indicates whether the remote file has changed since it was last downloaded
- */
- public SystemDownloadConflictAction(String title, IFile tempFile, boolean remoteNewer)
- {
- super(title, null);
- _tempFile = tempFile;
- _remoteNewer = remoteNewer;
- }
-
- /**
- * Returns the action taken in response to the conflict. The state may be one of the following:
- * <ul>
- * <li> REPLACE_WITH_REMOTE
- * <li> OPEN_WITH_LOCAL
- * <li> CANCELLED
- * </ul>
- * @return the response to the conflict
- */
- public int getState()
- {
- return _state;
- }
-
- /**
- * Returns the dialog used to prompt a user on how to resolve a conflict.
- * @return the dialog
- */
- protected DownloadConflictDialog getConflictDialog()
- {
- DownloadConflictDialog dlg = new DownloadConflictDialog(SystemBasePlugin.getActiveWorkbenchShell(), _remoteNewer);
-
- if (_remoteNewer)
- {
- dlg.setDialogText(FileResources.RESID_CONFLICT_DOWNLOAD_MESSAGE_REMOTECHANGED);
- }
- else
- {
- dlg.setDialogText(FileResources.RESID_CONFLICT_DOWNLOAD_MESSAGE_LOCALCHANGED);
- }
-
- dlg.setReplaceText(FileResources.RESID_CONFLICT_DOWNLOAD_REPLACELOCAL);
- dlg.setOpenLocalText(FileResources.RESID_CONFLICT_DOWNLOAD_OPENWITHLOCAL);
- dlg.setHelpId(RSEUIPlugin.HELPPREFIX + "lcdl0000"); //$NON-NLS-1$
- return dlg;
- }
-
- /**
- * Called when this action is invoked
- */
- public void run()
- {
- setShell(RSEUIPlugin.getTheSystemRegistryUI().getShell());
- SystemIFileProperties properties = new SystemIFileProperties(_tempFile);
-
- DownloadConflictDialog cnfDialog = getConflictDialog();
- if (cnfDialog.open() == Window.OK)
- {
- // does user want to open local or replace local with remote?
- if (cnfDialog.keepLocal())
- {
- // user wants to keep the local version
- // don't synchronize with server, save that for the save operation
- _state = OPEN_WITH_LOCAL;
- }
- else
- {
- // user wants to replace local copy with the remote version
- _state = REPLACE_WITH_REMOTE;
- }
-
- }
- else
- {
- _state = CANCELLED;
-
- // cancelled dialog, so no remote synchronization
- // set dirty flag!
- properties.setDirty(true);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileAction.java
deleted file mode 100644
index 450db7194..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileAction.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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
- * David McKnight (IBM) - [189873] DownloadJob changed to DownloadAndOpenJob
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * David McKnight (IBM) - [276103] Files with names in different cases are not handled properly
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.files.ui.view.DownloadAndOpenJob;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-
-
-
-public class SystemEditFileAction extends SystemBaseAction {
-
-
- protected IEditorDescriptor _editorDescriptor;
-
- /**
- * Constructor for SystemEditFileAction
- */
- public SystemEditFileAction(String text, String tooltip, ImageDescriptor image, Shell parent, IEditorDescriptor editorDescriptor) {
- super(text, tooltip, null, image, parent);
- init();
- _editorDescriptor = editorDescriptor;
- }
-
- /**
- * Constructor for SystemEditFileAction
- */
- public SystemEditFileAction(String text, String tooltip, ImageDescriptor image, int style, Shell parent, IEditorDescriptor editorDescriptor) {
- super(text, tooltip, null, image, style, parent);
- init();
- _editorDescriptor = editorDescriptor;
- }
-
- /**
- * Initialize the action
- */
- private void init() {
- allowOnMultipleSelection(false);
- }
-
-
- /**
- * @see SystemBaseAction#run
- */
- public void run() {
- IStructuredSelection selection = getSelection();
-
- if (selection.size() != 1)
- return;
-
- Object element = getFirstSelection();
-
- if (element == null)
- return;
- else if (!(element instanceof IRemoteFile))
- return;
-
- process((IRemoteFile)element);
- }
-
- private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile)
- {
- // DY: check if the file exists and is read-only (because it was previously opened
- // in the system editor)
- IFile file = editable.getLocalResource();
- SystemIFileProperties properties = new SystemIFileProperties(file);
- boolean newFile = !file.exists();
-
- // detect whether there exists a temp copy already
- if (!newFile && file.exists())
- {
- // we have a local copy of this file, so we need to compare timestamps
-
- // get stored modification stamp
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
-
- // get updated remoteFile so we get the current remote timestamp
- //remoteFile.markStale(true);
- IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
- try
- {
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
-
- }
-
- // get the remote modified stamp
- long remoteModifiedStamp = remoteFile.getLastModified();
-
- // get dirty flag
- boolean dirty = properties.getDirty();
-
- boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp);
-
-
-
- String remoteEncoding = remoteFile.getEncoding();
- String storedEncoding = properties.getEncoding();
-
- boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding));
-
- boolean usedBinary = properties.getUsedBinaryTransfer();
- boolean isBinary = remoteFile.isBinary();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- !encodingChanged);
- }
- return false;
- }
-
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- protected void process(IRemoteFile remoteFile) {
-
- SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, null);
- if (editable == null){
- // case for cancelled operation when user was prompted to save file of different case
- return;
- }
- else
- {
- try
- {
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
- {
- if (isFileCached(editable, remoteFile))
- {
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
- }
- else
- {
- editable.setLocalResourceProperties();
- editable.openEditor();
- }
- }
- catch (Exception e)
- {
- }
-
-
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileInPlaceAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileInPlaceAction.java
deleted file mode 100644
index 4b6f18a03..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileInPlaceAction.java
+++ /dev/null
@@ -1,84 +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) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class SystemEditFileInPlaceAction extends SystemBaseAction
-{
- //private RSEUIPlugin plugin;
-
- /**
- * Constructor for SystemEditFileAction
- */
- public SystemEditFileInPlaceAction(String text, String tooltip, ImageDescriptor image, Shell parent) {
- super(text, tooltip, image, parent);
- init();
- }
-
-
- /**
- * Initialize the action
- */
- private void init() {
- allowOnMultipleSelection(false);
-
- // set the context menu group here seems to have no affect
- // had to add it in the group in the adapter
- // setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPENWITH);
-
- //plugin = RSEUIPlugin.getDefault();
- }
-
-
- /**
- * @see SystemBaseAction#run
- */
- public void run() {
-
- IStructuredSelection selection = getSelection();
-
- if (selection.size() != 1)
- return;
-
- Object element = getFirstSelection();
-
- if (element == null)
- return;
- else if (!(element instanceof IRemoteFile))
- return;
-
- process((IRemoteFile)element);
- }
-
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- private void process(IRemoteFile remoteFile) {
-
- SystemEditableRemoteFile editableFile = new SystemEditableRemoteFile(remoteFile);
- editableFile.openInSystemEditor(SystemBasePlugin.getActiveWorkbenchShell());
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileLineAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileLineAction.java
deleted file mode 100644
index 368f46873..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileLineAction.java
+++ /dev/null
@@ -1,130 +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
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-
-
-
-public class SystemEditFileLineAction extends SystemEditFileAction {
-
-
- protected IRemoteFile _remoteFile;
- protected int _line, _charStart, _charEnd;
-
- /**
- * Constructor for SystemEditFileAction.
- */
- public SystemEditFileLineAction(String text, String tooltip, ImageDescriptor image, Shell parent, IEditorDescriptor editorDescriptor, IRemoteFile remoteFile, int line, int charStart, int charEnd) {
- super(text, tooltip, image, parent, editorDescriptor);
- _line = line;
- _remoteFile = remoteFile;
- _charStart = charStart;
- _charEnd = charEnd;
- }
-
- public void run() {
- process(_remoteFile);
- }
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- protected void process(IRemoteFile remoteFile) {
- super.process(remoteFile);
- handleGotoLine();
- }
-
- protected void handleGotoLine() {
- handleGotoLine(_remoteFile, _line, _charStart, _charEnd);
- }
-
- public static void handleGotoLine(IRemoteFile remoteFile, int line, int charStart, int charEnd) {
-
- if (line > 0) {
-
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
- IEditorPart editor = null;
- String fileName = remoteFile.getAbsolutePath();
- IEditorReference[] editors = persp.getEditorReferences();
-
- for (int i = 0; i < editors.length; i++) {
-
- IEditorReference ref = editors[i];
- IEditorPart editorp = ref.getEditor(false);
-
- if (editorp != null) {
-
- IEditorInput einput = editorp.getEditorInput();
-
- if (einput instanceof IFileEditorInput) {
-
- IFileEditorInput input = (IFileEditorInput) einput;
- IFile efile = input.getFile();
-
- SystemIFileProperties properties = new SystemIFileProperties(efile);
- String comparePath = properties.getRemoteFilePath();
-
- if (comparePath != null && (comparePath.replace('\\','/').equals(fileName.replace('\\','/')))) {
-
- editor = editorp;
- persp.bringToTop(editor);
-
- try {
- IMarker marker = createMarker(efile, line, charStart, charEnd);
- IDE.gotoMarker(editor, marker);
- }
- catch (CoreException e) {
- SystemBasePlugin.logError("Error occured in handleGotoLine", e); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
- }
-
- protected static IMarker createMarker(IFile file, int line, int charStart, int charEnd) throws CoreException {
- IMarker marker = file.createMarker(IMarker.TEXT);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.CHAR_START, charStart);
- marker.setAttribute(IMarker.CHAR_END, charEnd);
-
- return marker;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilePlatformAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilePlatformAction.java
deleted file mode 100644
index d6a481610..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilePlatformAction.java
+++ /dev/null
@@ -1,84 +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) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class SystemEditFilePlatformAction extends SystemBaseAction
-{
- //private RSEUIPlugin plugin;
-
- /**
- * Constructor for SystemEditFileAction
- */
- public SystemEditFilePlatformAction(String text, String tooltip, ImageDescriptor image, Shell parent) {
- super(text, tooltip, image, parent);
- init();
- }
-
-
- /**
- * Initialize the action
- */
- private void init() {
- allowOnMultipleSelection(false);
-
- // set the context menu group here seems to have no affect
- // had to add it in the group in the adapter
- // setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPENWITH);
-
- //plugin = RSEUIPlugin.getDefault();
- }
-
-
- /**
- * @see SystemBaseAction#run
- */
- public void run() {
-
- IStructuredSelection selection = getSelection();
-
- if (selection.size() != 1)
- return;
-
- Object element = getFirstSelection();
-
- if (element == null)
- return;
- else if (!(element instanceof IRemoteFile))
- return;
-
- process((IRemoteFile)element);
- }
-
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- private void process(IRemoteFile remoteFile) {
-
- SystemEditableRemoteFile editableFile = new SystemEditableRemoteFile(remoteFile);
- editableFile.openInSystemEditor(SystemBasePlugin.getActiveWorkbenchShell());
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilesAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilesAction.java
deleted file mode 100644
index cc5448f67..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilesAction.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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
- * David McKnight (IBM) - [209660] check for changed encoding before using cached file
- * David McKnight (IBM) - [189873] DownloadJob changed to DownloadAndOpenJob
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * David McKnight (IBM) - [276103] Files with names in different cases are not handled properly
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.files.ui.view.DownloadAndOpenJob;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-
-
-public class SystemEditFilesAction extends SystemBaseAction {
-
-
- private IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
-
- /**
- * Constructor for SystemEditFilesAction
- */
- public SystemEditFilesAction(String text, String tooltip, Shell parent)
- {
- super(text, tooltip, parent);
- init();
- }
-
-
-
- /**
- * Initialize the action
- */
- private void init()
- {
- allowOnMultipleSelection(true);
- }
-
- /**
- * Get the local cache of the remote file, or <code>null</code> if none.
- * @param remoteFile the remote file.
- * @return the local cached resource, or <code>null</code> if none.
- */
- private IFile getLocalResource(IRemoteFile remoteFile)
- {
- return (IFile)UniversalFileTransferUtility.getTempFileFor(remoteFile);
- }
-
- protected IEditorDescriptor getDefaultEditor(IRemoteFile remoteFile)
- {
- IFile localFile = getLocalResource(remoteFile);
-
- if (localFile == null) {
- return registry.getDefaultEditor(remoteFile.getName());
- }
- else {
- return IDE.getDefaultEditor(localFile);
- }
- }
-
- /**
- * @see SystemBaseAction#run
- */
- public void run() {
-
- IStructuredSelection selection = getSelection();
-
- Iterator iterator = selection.iterator();
- while (iterator.hasNext())
- {
- Object obj = iterator.next();
- if (obj instanceof IRemoteFile)
- {
- process((IRemoteFile)obj);
- }
- }
- }
-
- private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile)
- {
- // DY: check if the file exists and is read-only (because it was previously opened
- // in the system editor)
- IFile file = editable.getLocalResource();
- SystemIFileProperties properties = new SystemIFileProperties(file);
- boolean newFile = !file.exists();
-
- // detect whether there exists a temp copy already
- if (!newFile && file.exists())
- {
- // we have a local copy of this file, so we need to compare timestamps
-
- // get stored modification stamp
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
-
- // get updated remoteFile so we get the current remote timestamp
- //remoteFile.markStale(true);
- IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
- try
- {
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
-
- }
-
- // get the remote modified stamp
- long remoteModifiedStamp = remoteFile.getLastModified();
-
- // get dirty flag
- boolean dirty = properties.getDirty();
-
- boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp);
-
- String remoteEncoding = remoteFile.getEncoding();
- String storedEncoding = properties.getEncoding();
-
- boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding));
-
- boolean usedBinary = properties.getUsedBinaryTransfer();
- boolean isBinary = remoteFile.isBinary();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- !encodingChanged);
-
- }
- return false;
- }
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- protected void process(IRemoteFile remoteFile) {
-
- String editorId = null;
- IEditorDescriptor des = getDefaultEditor(remoteFile);
- if (des != null)
- {
- editorId = des.getId();
- }
- else
- {
- editorId = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
- }
-
- SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, des);
- if (editable == null){
- // case for cancelled operation when user was prompted to save file of different case
- return;
- }
- else
- {
- try
- {
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
- {
- if (isFileCached(editable, remoteFile))
- {
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
- }
- else
- {
- editable.setLocalResourceProperties();
- editable.openEditor();
- }
- }
- catch (Exception e)
- {
- }
-
- }
- }
-
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditionAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditionAction.java
deleted file mode 100644
index ae17b2bc9..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditionAction.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [267247] Wrong encoding
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.eclipse.compare.EditionSelectionDialog;
-import org.eclipse.compare.HistoryItem;
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.ResourceNode;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFileState;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-
-public class SystemEditionAction extends SystemBaseAction
-{
-
- /**
- * Implements the IStreamContentAccessor and ITypedElement protocols
- * for a Document.
- */
- class DocumentBufferNode implements ITypedElement, IStreamContentAccessor
- {
-
- private IDocument fDocument;
- private IFile fFile;
-
- DocumentBufferNode(IDocument document, IFile file)
- {
- fDocument = document;
- fFile = file;
- }
-
- public String getName()
- {
- return fFile.getName();
- }
-
- public String getType()
- {
- return fFile.getFileExtension();
- }
-
- public Image getImage()
- {
- return null;
- }
-
- public InputStream getContents()
- {
- return new ByteArrayInputStream(fDocument.get().getBytes());
- }
- }
-
- private List _selected;
- private boolean fReplaceMode;
- private String fBundleName;
- protected boolean fPrevious = false;
- protected String fHelpContextId;
-
- SystemEditionAction(Shell parent, String title, String tooltip, String bundleName, boolean replaceMode)
- {
- super(title, parent);
- setToolTipText(tooltip);
-
- fReplaceMode = replaceMode;
- fBundleName = bundleName;
- _selected = new ArrayList();
- }
-
-
- /**
- * Called when the selection changes in the systems view. This determines
- * the input object for the command and whether to enable or disable
- * the action.
- *
- * @param selection the current seleciton
- * @return whether to enable or disable the action
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = false;
- _selected.clear();
- Iterator e = selection.iterator();
- if (e.hasNext())
- {
- Object selected = e.next();
-
- if (selected != null && selected instanceof IRemoteFile)
- {
- RemoteFile file = (RemoteFile) selected;
- if (file.isFile())
- {
- ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)file.getAdapter(ISystemRemoteElementAdapter.class);
- if (adapter != null)
- {
- ISystemEditableRemoteObject editable = adapter.getEditableRemoteObject(file);
- if (editable != null)
- {
- if (editable.getLocalResource().exists())
- {
- _selected.add(file);
- enable = true;
- }
- }
- }
-
-
- /** FIXME - no longer have a getCachedCopy() method
- try
- {
- if (file.getCachedCopy() != null)
- {
- _selected.add(file);
- enable = true;
- }
- }
- catch (SystemMessageException ex)
- {
- }
- */
- }
- }
- }
-
- return enable;
- }
-
- public void run()
- {
- // get cached file
- IFile[] files = getFiles(_selected, fReplaceMode);
- for (int i = 0; i < files.length; i++)
- doFromHistory(files[i]);
- }
-
- private void doFromHistory(final IFile file)
- {
- //DKM - hack - needed to use compare class loader to load bundle for current locale
- ResourceBundle bundle = ResourceBundle.getBundle(fBundleName, Locale.getDefault(), CompareUIPlugin.class.getClassLoader());
-
- String title = Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
- Shell parentShell = CompareUIPlugin.getShell();
-
- IFileState states[] = null;
- try
- {
- states = file.getHistory(null);
- }
- catch (CoreException ex)
- {
- MessageDialog.openError(parentShell, title, ex.getMessage());
- return;
- }
-
- if (states == null || states.length <= 0)
- {
- String msg = Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
- MessageDialog.openInformation(parentShell, title, msg);
- return;
- }
-
- ITypedElement base = new ResourceNode(file);
-
- IDocument document = getDocument(file);
- ITypedElement target = base;
- if (document != null)
- target = new DocumentBufferNode(document, file);
-
- ITypedElement[] editions = new ITypedElement[states.length + 1];
- editions[0] = base;
- for (int i = 0; i < states.length; i++)
- editions[i + 1] = new HistoryItem(base, states[i]);
-
- EditionSelectionDialog d = new EditionSelectionDialog(parentShell, bundle);
- d.setEditionTitleArgument(file.getName());
- d.setEditionTitleImage(CompareUIPlugin.getImage(file));
- //d.setHideIdenticalEntries(false);
- if (fHelpContextId != null)
- d.setHelpContextId(fHelpContextId);
-
- if (fReplaceMode)
- {
-
- ITypedElement ti = null;
- if (fPrevious)
- ti = d.selectPreviousEdition(target, editions, null);
- else
- ti = d.selectEdition(target, editions, null);
-
- if (ti instanceof IStreamContentAccessor)
- {
- IStreamContentAccessor sa = (IStreamContentAccessor) ti;
- try
- {
-
- if (document != null)
- updateDocument(document, sa);
- else
- updateWorkspace(bundle, parentShell, sa, file);
-
- }
- catch (InterruptedException x)
- {
- // Do nothing. Operation has been cancelled by user.
-
- }
- catch (InvocationTargetException x)
- {
- String reason = x.getTargetException().getMessage();
- MessageDialog.openError(parentShell, title, Utilities.getFormattedString(bundle, "replaceError", reason)); //$NON-NLS-1$
- }
- }
- }
- else
- {
- d.setCompareMode(true);
-
- d.selectEdition(target, editions, null);
- }
- }
-
- private void updateWorkspace(final ResourceBundle bundle, Shell shell, final IStreamContentAccessor sa, final IFile file) throws InvocationTargetException, InterruptedException
- {
-
- WorkspaceModifyOperation operation = new WorkspaceModifyOperation()
- {
- public void execute(IProgressMonitor pm) throws InvocationTargetException
- {
- try
- {
- String taskName = Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
- pm.beginTask(taskName, IProgressMonitor.UNKNOWN);
- file.setContents(sa.getContents(), false, true, pm);
- }
- catch (CoreException e)
- {
- throw new InvocationTargetException(e);
- }
- finally
- {
- pm.done();
- }
- }
- };
-
- ProgressMonitorDialog pmdialog = new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
- }
-
- private void updateDocument(IDocument document, IStreamContentAccessor sa) throws InvocationTargetException
- {
- try
- {
- InputStream is = sa.getContents();
- String encoding = ResourcesPlugin.getEncoding();
- String text = Utilities.readString(is, encoding);
- document.replace(0, document.getLength(), text);
- }
- catch (CoreException e)
- {
- throw new InvocationTargetException(e);
- }
- catch (BadLocationException e)
- {
- throw new InvocationTargetException(e);
- }
- catch (Exception e) // TODO in Eclipse 3.3 this should be changed to IOException
- {
- throw new InvocationTargetException(e);
- }
- }
-
- private IDocument getDocument(IFile file)
- {
- IWorkbench wb = PlatformUI.getWorkbench();
- if (wb == null)
- return null;
- IWorkbenchWindow[] ws = wb.getWorkbenchWindows();
- if (ws == null)
- return null;
-
- FileEditorInput test = new FileEditorInput(file);
-
- for (int i = 0; i < ws.length; i++)
- {
- IWorkbenchWindow w = ws[i];
- IWorkbenchPage[] wps = w.getPages();
- if (wps != null)
- {
- for (int j = 0; j < wps.length; j++)
- {
- IWorkbenchPage wp = wps[j];
- IEditorPart ep = wp.findEditor(test);
- if (ep instanceof ITextEditor)
- {
- ITextEditor te = (ITextEditor) ep;
- IDocumentProvider dp = te.getDocumentProvider();
- if (dp != null)
- {
- IDocument doc = dp.getDocument(ep);
- if (doc != null)
- return doc;
- }
- }
- }
- }
- }
- return null;
- }
-
- private IFile[] getFiles(List remoteFiles, boolean modifiable)
- {
- IFile[] result = new IFile[remoteFiles.size()];
- for (int i = 0; i < remoteFiles.size(); i++)
- {
- IRemoteFile remotefile = (IRemoteFile)remoteFiles.get(i);
- SystemEditableRemoteFile eFile = new SystemEditableRemoteFile(remotefile);
- try
- {
- eFile.download(getShell());
- eFile.addAsListener();
- eFile.setLocalResourceProperties();
- IFile localFile = eFile.getLocalResource();
- result[i] = localFile;
- }
- catch (Exception e)
- {
- }
- }
-
- return result;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemFileUpdateFilterAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemFileUpdateFilterAction.java
deleted file mode 100644
index d97d8accf..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemFileUpdateFilterAction.java
+++ /dev/null
@@ -1,57 +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.files.ui.actions;
-import org.eclipse.rse.files.ui.widgets.SystemFileFilterStringEditPane;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action that displays the Change File Filter dialog.
- * Note that the input filter is deduced from the current selection, which must be a filter reference.
- */
-public class SystemFileUpdateFilterAction
- extends SystemChangeFilterAction
-{
-
- /**
- * Constructor
- */
- public SystemFileUpdateFilterAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_UPDATEFILTER_LABEL, SystemResources.ACTION_UPDATEFILTER_TOOLTIP);
- setDialogTitle(SystemFileResources.RESID_CHGFILEFILTER_TITLE);
- }
- /**
- * Overridable extension point to configure the filter dialog. Typically you don't need
- * to subclass our default dialog.
- */
- protected void configureFilterDialog(SystemChangeFilterDialog dlg)
- {
- // it is cheaper to do this here, as it defers instantiation of the edit pane until the
- // user actually runs the action!
- Shell shell = dlg.getShell();
- if (shell == null)
- shell = dlg.getParentShell();
-
- dlg.setFilterStringEditPane(new SystemFileFilterStringEditPane(shell));
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java
deleted file mode 100644
index 6b86110c4..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java
+++ /dev/null
@@ -1,367 +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][refactoring] Move IProgressMonitor last in public base classes
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [198007] Moving multiple folders allows moving to themselves
- * Kevin Doyle (IBM) - [160769] Move Resource dialog allows user to continue on invalid destination
- * Kevin Doyle (IBM) - [199324] [nls] Move dialog SystemMessages should be added/updated
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
- * 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
- * Rupen Mardirossian (IBM) - [210682] Modified MoveRemoteFileJob.runInWorkspace to use SystemCopyDialog for collisions in move operations
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.ui.dialogs.CopyRunnable;
-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.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Move selected files and folders action.
- */
-public class SystemMoveRemoteFileAction extends SystemCopyRemoteFileAction
- implements IValidatorRemoteSelection
-{
- private SystemMessage targetEqualsSrcMsg = null;
- private SystemMessage targetEqualsParentSrcMsg = null;
- private SystemMessage targetDescendsFromSrcMsg = null;
- private SystemMessage invalidFilterMsg = null;
- protected Vector movedFiles = new Vector();
- protected Vector movedFileNames = new Vector();
-
- private class MoveRemoteFileJob extends WorkspaceJob
- {
-
- /**
- * RenameJob job.
- * @param message text used as the title of the job
- */
- public MoveRemoteFileJob(String message)
- {
- super(message);
- setUser(true);
- }
-
- public IStatus runInWorkspace(IProgressMonitor monitor)
- {
- SystemMessage msg = getCopyingMessage();
-
- IStatus status = Status.OK_STATUS;
-
- //holds existing objects
- List existing = new ArrayList();
- //holds objects to be copied
- List toCopy = new ArrayList();
- boolean overwrite = false;
-
-
- int steps = oldObjects.length;
- monitor.beginTask(msg.getLevelOneText(), steps);
- copiedOk = true;
- String oldName = null;
- String newName = null;
- Object oldObject = null;
- newNames = new String[oldNames.length];
- //go through all files to see if they exist
- for (int idx=0; copiedOk && (idx<steps); idx++)
- {
- oldName = oldNames[idx];
- oldObject = oldObjects[idx];
- //monitor.subTask(getCopyingMessage(oldName).getLevelOneText());
- if(checkForCollision(getShell(), monitor, targetContainer, oldName))
- {
- existing.add(oldObject);
- }
- toCopy.add(oldObject);
- /*newName = checkForCollision(getShell(), monitor, targetContainer, oldObject, oldName);
- if (newName == null)
- copiedOk = false;
- else
- copiedOk = doCopy(targetContainer, oldObject, newName, monitor);
- newNames[idx] = newName;
- monitor.worked(1);
- movedFileNames.add(oldName);*/ //remember the old name, in case we need it later.
- }
- //monitor.done();
-
- //SystemCopyDialog used here with all existing objects
- if(existing.size()>0)
- {
- CopyRunnable cr = new CopyRunnable(existing);
- Display.getDefault().syncExec(cr);
- overwrite = cr.getOk();
- if(!overwrite)
- {
- status = Status.CANCEL_STATUS;
- }
- }
- //Proceed with copy if user chose to overwrite or there were no copy collisions
- if(existing.size()==0 || overwrite)
- {
- try
- {
- for (int idx=0; copiedOk && (idx<steps); idx++)
- {
- newName = oldNames[idx];
- oldObject = oldObjects[idx];
- monitor.subTask(getCopyingMessage(newName).getLevelOneText());
- copiedOk = doCopy(targetContainer, oldObject, newName, monitor);
- monitor.worked(1);
- newNames[idx] = newName;
- movedFileNames.add(newName);
- monitor.done();
- }
- }
- catch (SystemMessageException exc)
- {
- copiedOk = false;
- //If this operation is cancelled, need to display a proper message to the user.
- if (monitor.isCanceled() && movedFileNames.size() > 0)
- {
- //Get the moved file names
- String movedFileNamesList = (String)(movedFileNames.get(0));
- for (int i=1; i<(movedFileNames.size()); i++)
- {
- movedFileNamesList = movedFileNamesList + "\n" + (String)(movedFileNames.get(i)); //$NON-NLS-1$
- }
- String msgTxt = FileResources.FILEMSG_MOVE_INTERRUPTED;
- String msgDetails = NLS.bind(FileResources.FILEMSG_MOVE_INTERRUPTED_DETAILS, movedFileNamesList);
-
- SystemMessage thisMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_MOVE_INTERRUPTED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(shell, thisMessage);
-
- status = Status.CANCEL_STATUS;
- }
- else
- {
- SystemMessageDialog.displayErrorMessage(shell, exc.getSystemMessage());
- }
- }
- catch (Exception exc)
- {
- copiedOk = false;
- exc.printStackTrace();
- }
- }
- if (movedFiles.size() > 0)
- {
- copyComplete(ISystemRemoteChangeEvents.SYSTEM_REMOTE_OPERATION_MOVE); //Need to reflect the views.
- }
-
- return status;
- }
- }
- /**
- * Constructor
- */
- public SystemMoveRemoteFileAction(Shell shell)
- {
- super(shell, MODE_MOVE);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0111"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX+"dmrf0000"); //$NON-NLS-1$
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- movedFiles.clear();
- super.reset();
-
- //targetEqualsSrcMsg = null;
- }
-
- public void run(IProgressMonitor monitor)
- throws java.lang.reflect.InvocationTargetException,
- java.lang.InterruptedException
- {
- SystemMessage moveMessage = getCopyingMessage();
- moveMessage.makeSubstitution(""); //$NON-NLS-1$
- MoveRemoteFileJob moveRemoteFileJob = new MoveRemoteFileJob(moveMessage.getLevelOneText());
- moveRemoteFileJob.schedule();
- }
-
- /**
- * @param targetContainer will be the IRemoteFile folder selected to move into
- * @param oldObject will be the IRemoteFile object currently being moved
- * @param newName will be the new name to give the oldObject on move
- * @param monitor Usually not needed
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor) throws Exception {
- IRemoteFile targetFolder = (IRemoteFile) targetContainer;
- IRemoteFile srcFileOrFolder = (IRemoteFile) oldObject;
-
- IRemoteFileSubSystem ss = targetFolder.getParentRemoteFileSubSystem();
-
- ss.move(srcFileOrFolder, targetFolder, newName, monitor);
- String sep = targetFolder.getSeparator();
- String targetFolderName = targetFolder.getAbsolutePath();
- String resultPath = null;
-
- if (!targetFolderName.endsWith(sep))
- resultPath = targetFolderName + sep + newName;
- else
- resultPath = targetFolderName + newName;
-
- copiedFiles.addElement(resultPath);
- movedFiles.add(srcFileOrFolder);
- return true;
- }
-
- /**
- * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
- * if it is not to be enabled. The message will be displayed on the message line.
- */
- public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
- {
- //if (selectedConnection != sourceConnection) {} // someday, but can't happen today.
- IRemoteFile[] files = getSelectedFiles();
- Object selectedObject = selectedObjects[0];
- if (!(selectedObject instanceof IRemoteFile || selectedObject instanceof ISystemFilterReference) || files == null) {
- return null;
- }
-
- if (selectedObject instanceof IRemoteFile) {
- IRemoteFile selectedFolder = (IRemoteFile)selectedObject;
- String selectedFolderPath = selectedFolder.getAbsolutePath();
-
- for (int i = 0; i < files.length; i++) {
- IRemoteFile selectedFile = files[i];
- if (selectedFile != null && selectedFile.getParentRemoteFile() != null) {
- IRemoteFile selectedParentFile = selectedFile.getParentRemoteFile();
-
- if (selectedFolderPath.equals(selectedParentFile.getAbsolutePath()))
- {
- if (targetEqualsParentSrcMsg == null){
- targetEqualsParentSrcMsg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE,
- IStatus.ERROR,
- FileResources.FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE,
- FileResources.FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SOURCE_DETAILS);
-
-
- }
- return targetEqualsParentSrcMsg;
- }
- else if (selectedFolderPath.equals(selectedFile.getAbsolutePath()))
- {
- if (targetEqualsSrcMsg == null){
- targetEqualsSrcMsg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_MOVE_TARGET_EQUALS_SOURCE,
- IStatus.ERROR,
- FileResources.FILEMSG_MOVE_TARGET_EQUALS_SOURCE,
- FileResources.FILEMSG_MOVE_TARGET_EQUALS_SOURCE_DETAILS);
- }
- return targetEqualsSrcMsg;
- }
- else if (selectedFolder.isDescendantOf(selectedFile))
- {
- if (targetDescendsFromSrcMsg == null){
- targetDescendsFromSrcMsg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE,
- IStatus.ERROR,
- FileResources.FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE,
- FileResources.FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE_DETAILS);
-
- }
- return targetDescendsFromSrcMsg;
- }
- }
- }
- } else if (selectedObject instanceof ISystemFilterReference) {
- ISystemFilterReference filter = (ISystemFilterReference) selectedObject;
- String[] filterStrings = filter.getReferencedFilter().getFilterStrings();
- String firstFilterString = filterStrings[0];
- // Check only first filter string as by convention we move files only
- // to the first filter string. * and /* are invalid as they represent
- // Drives and Root Filters which we can't Move files to.
- if (firstFilterString.equals("*") || firstFilterString.equals("/*")) { //$NON-NLS-1$ //$NON-NLS-2$
- if (invalidFilterMsg == null) {
- invalidFilterMsg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_MOVE_FILTER_NOT_VALID,
- IStatus.ERROR,
- FileResources.FILEMSG_MOVE_FILTER_NOT_VALID,
- FileResources.FILEMSG_MOVE_FILTER_NOT_VALID_DETAILS);
-
- }
- return invalidFilterMsg;
- }
- }
- return null;
- }
-
- /**
- * Called after all the copy/move operations end, be it successfully or not.
- * Your opportunity to display completion or do post-copy selections/refreshes
- */
- public void copyComplete(String operation)
- {
- // we want to do the super.copyComplete() to refresh the target, but first we must do refresh the
- // source to reflect the deletion...
-
- // refresh all instances of the source parent, and all affected filters...
- ISubSystem fileSS = targetFolder.getParentRemoteFileSubSystem();
-
- if (operation == null){
- operation = ISystemRemoteChangeEvents.SYSTEM_REMOTE_OPERATION_MOVE;
- }
-
-
- Viewer originatingViewer = getViewer();
- RSECorePlugin.getTheSystemRegistry().fireRemoteResourceChangeEvent(operation,
- ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, movedFiles, firstSelectionParent.getAbsolutePath(), fileSS, getOldAbsoluteNames(), originatingViewer);
-
- super.copyComplete(operation);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileAction.java
deleted file mode 100644
index 3fe62fb93..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileAction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [261019] New File/Folder actions available in Work Offline mode
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.wizards.SystemNewFileWizard;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseWizardAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * An action for prompting the user with a wizard, for creating a new file
- */
-public class SystemNewFileAction extends SystemBaseWizardAction
-{
-
- /**
- * Constructor when you want to use the default label, tooltip and image
- */
- public SystemNewFileAction(Shell parent)
- {
- this(SystemResources.ACTION_NEWFILE_LABEL,
- SystemResources.ACTION_NEWFILE_TOOLTIP,
- //PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE),
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILE_ID),
- parent);
- }
-
- /**
- * Constructor when you want to supply your own label, tooltip and image
- */
- public SystemNewFileAction(String text,String tooltip,ImageDescriptor image,Shell parent)
- {
- super(text, tooltip, image, parent);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- allowOnMultipleSelection(false);
- }
-
- /**
- * Override of parent to create the wizard
- */
- protected IWizard createWizard()
- {
- SystemNewFileWizard newFileWizard = new SystemNewFileWizard();
- // newFileWizard.setInputObject(getValue());
- return newFileWizard;
- }
-
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof IAdaptable){
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)selectedObject).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null){
- ISubSystem ss = adapter.getSubSystem(selectedObject);
- if (ss != null){
- if (ss.isOffline()){
- return false;
- }
- }
- }
- }
- return true;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterAction.java
deleted file mode 100644
index 102e93dc0..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterAction.java
+++ /dev/null
@@ -1,134 +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) - [175680] Deprecate obsolete ISystemRegistry methods
- * David McKnight (IBM) - [238158] Can create duplicate filters
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
-import org.eclipse.rse.files.ui.widgets.SystemFileFilterStringEditPane;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * The action that displays the New File Filter wizard.
- * File Filters are typed filters that allow users to get a list of files meeting the filtering criteria.
- */
-public class SystemNewFileFilterAction
- extends SystemNewFilterAction
-{
- //private RemoteFileSubSystemConfiguration inputSubsystemConfiguration;
- private SubSystem _selectedSubSystem;
-
- /**
- * Constructor
- */
- public SystemNewFileFilterAction(IRemoteFileSubSystemConfiguration subsystemConfiguration, ISystemFilterPool parentPool, Shell shell)
-
- {
- super(shell, parentPool, SystemFileResources.ACTION_NEWFILTER_LABEL, SystemFileResources.ACTION_NEWFILTER_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTER_ID));
-
- //setHelp(RSEUIPlugin.HELPPREFIX+"anff0000");
- //setDialogHelp(RSEUIPlugin.HELPPREFIX+"wnff0000");
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0042"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX+"wnfr0000"); //$NON-NLS-1$
- }
-
- /**
- * Set the parent filter pool that the new-filter actions need.
- */
- public void setParentFilterPool(ISystemFilterPool parentPool)
- {
- this.parentPool = parentPool;
- setValue(null); // dwd setting the parent pool negates any value from the previous run of this action
- }
- /**
- * Parent intercept.
- * <p>
- * Overridable extension. For those cases when you don't want to create your
- * own wizard subclass, but prefer to simply configure the default wizard.
- * <p>
- * Note, at the point this is called, all the base configuration, based on the
- * setters for this action, have been called.
- * <p>
- * We do it here versus via setters as it defers some work until the user actually
- * selects this action.
- */
- protected void configureNewFilterWizard(SystemNewFilterWizard wizard)
- {
- // configuration that used to only be possible via subclasses...
- wizard.setWizardPageTitle(SystemFileResources.RESID_NEWFILEFILTER_PAGE1_TITLE);
- wizard.setWizardImage(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERWIZARD_ID));
- wizard.setPage1Description(SystemFileResources.RESID_NEWFILEFILTER_PAGE1_DESCRIPTION);
- wizard.setFilterStringEditPane(new SystemFileFilterStringEditPane(wizard.getShell()));
- }
-
- public void run()
- {
- if (_selectedSubSystem != null){
- setAllowFilterPoolSelection(_selectedSubSystem.getFilterPoolReferenceManager().getReferencedSystemFilterPools());
- }
- else {
- // disallow filter pool select (because this is from a filter pool)
- setAllowFilterPoolSelection((ISystemFilterPool[])null);
- setAllowFilterPoolSelection((ISystemFilterPoolWrapperInformation)null);
-
- callbackConfigurator = null;
- callbackConfiguratorCalled = false;
- }
- super.run();
- }
-
- /**
- * Called when the selection changes in the systems view. This determines
- * the input object for the command and whether to enable or disable
- * the action.
- *
- * @param selection the current seleciton
- * @return whether to enable or disable the action
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- _selectedSubSystem = null;
- Iterator e = selection.iterator();
- Object selected = e.next();
-
- if (selected != null && selected instanceof SubSystem)
- {
- _selectedSubSystem = (SubSystem) selected;
- }
-
- return super.updateSelection(selection);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterFromFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterFromFolderAction.java
deleted file mode 100644
index 23f1d9c22..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileFilterFromFolderAction.java
+++ /dev/null
@@ -1,131 +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) - [238158] Can create duplicate filters
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Class for defining a new filter from a preselected folder
- */
-public class SystemNewFileFilterFromFolderAction extends SystemNewFileFilterAction
-{
- private RemoteFile _selected;
-
- /**
- * Constructor for SystemNewFileFilterFromFolderAction
- * @param parent
- */
- public SystemNewFileFilterFromFolderAction(Shell parent)
- {
- // initially use null, but update based on selection
- super(null, null, parent);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0112"); //$NON-NLS-1$
- }
-
-
- public void run()
- {
- IRemoteFileSubSystem fileSubsystem = _selected.getParentRemoteFileSubSystem();
-
- ISystemFilterPool defaultFilterPool = ((SubSystem)fileSubsystem).getConnectionPrivateFilterPool(true);
- if (defaultFilterPool == null){
- ISystemFilterPoolManager mgr = fileSubsystem.getFilterPoolReferenceManager().getDefaultSystemFilterPoolManager();
- defaultFilterPool = mgr.getFirstDefaultSystemFilterPool();
- }
-
- setParentFilterPool(defaultFilterPool);
- setAllowFilterPoolSelection(fileSubsystem.getFilterPoolReferenceManager().getReferencedSystemFilterPools());
- super.run();
- }
-
- /**
- * Called when the selection changes in the systems view. This determines
- * the input object for the command and whether to enable or disable
- * the action.
- *
- * @param selection the current seleciton
- * @return whether to enable or disable the action
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = false;
-
- Iterator e = selection.iterator();
- Object selected = e.next();
-
- if (selected != null && selected instanceof IRemoteFile)
- {
- _selected = (RemoteFile) selected;
- //if (!_selected.isFile())
- {
- enable = true;
- }
- }
-
-
-
- return enable;
- }
-
-
- /**
- * <i>Output method. Do not override.</i><br>
- * Get the contextual system filter pool reference manager provider. Will return non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider.
- */
- public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
- {
- return _selected.getParentRemoteFileSubSystem().getFilterPoolReferenceManager().getProvider();
- }
-
- /**
- * Parent intercept.
- * <p>
- * Overridable extension. For those cases when you don't want to create your
- * own wizard subclass, but prefer to simply configure the default wizard.
- * <p>
- * Note, at the point this is called, all the base configuration, based on the
- * setters for this action, have been called.
- * <p>
- * We do it here versus via setters as it defers some work until the user actually
- * selects this action.
- */
- protected void configureNewFilterWizard(SystemNewFilterWizard wizard)
- {
- super.configureNewFilterWizard(wizard);
- String[] filters = new String[1];
- ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)_selected.getAdapter(ISystemRemoteElementAdapter.class);
- filters[0] = adapter.getFilterStringFor(_selected);
- wizard.setDefaultFilterStrings(filters);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFolderAction.java
deleted file mode 100644
index 2f70fbc9b..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFolderAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [261019] New File/Folder actions available in Work Offline mode
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.wizards.SystemNewFolderWizard;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseWizardAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * An action for prompting the user with a wizard, for creating a new folder
- */
-public class SystemNewFolderAction extends SystemBaseWizardAction
-{
-
- /**
- * Constructor when you want to use the default label, tooltip and image
- */
- public SystemNewFolderAction(Shell parent)
- {
- this(FileResources.ACTION_NEWFOLDER_LABEL,
- FileResources.ACTION_NEWFOLDER_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFOLDER_ID),
- parent);
- }
-
- /**
- * Constructor when you want to supply your own label, tooltip and image
- */
- public SystemNewFolderAction(String text, String tooltip, ImageDescriptor image, Shell parent)
- {
- super(text, tooltip, image, parent);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- allowOnMultipleSelection(false);
- }
-
- /**
- * Override of parent to create the wizard
- */
- protected IWizard createWizard()
- {
- SystemNewFolderWizard newFolderWizard = new SystemNewFolderWizard();
- return newFolderWizard;
- }
-
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof IAdaptable){
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)selectedObject).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null){
- ISubSystem ss = adapter.getSubSystem(selectedObject);
- if (ss != null){
- if (ss.isOffline()){
- return false;
- }
- }
- }
- }
- return true;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileLineOpenWithMenu.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileLineOpenWithMenu.java
deleted file mode 100644
index 11aaf9c02..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileLineOpenWithMenu.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.subsystems.IRemoteLineReference;
-import org.eclipse.rse.files.ui.resources.ISystemTextEditor;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-
-/**
- * Open With menu class for openning remote files to a certain line number
- */
-public class SystemRemoteFileLineOpenWithMenu extends SystemRemoteFileOpenWithMenu
-{
- protected IRemoteLineReference _remoteLine;
-
-
- public void updateSelection(IStructuredSelection selection)
- {
- if (selection.size() == 1)
- {
- Object element = selection.getFirstElement();
- if (element instanceof IRemoteLineReference)
- {
-
- _remoteLine = (IRemoteLineReference)element;
- _remoteFile = outputToFile(_remoteLine);
- if (_remoteFile == null)
- {
- return;
- }
-
- }
- }
- }
-
- public void fill(Menu menu, int index)
- {
-
- super.fill(menu, index);
- }
-
-
- protected IEditorRegistry getEditorRegistry()
- {
- return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
- }
-
- protected IEditorDescriptor getDefaultTextEditor()
- {
- IEditorRegistry registry = getEditorRegistry();
- return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
-
-
-
- public static IRemoteFile outputToFile(IRemoteLineReference output)
- {
- IRemoteFile file = null;
- Object parent = output.getParent();
- IRemoteFileSubSystem fs = null;
- if (parent instanceof IRemoteCommandShell)
- {
- fs = RemoteFileUtility.getFileSubSystem(((IRemoteCommandShell)parent).getCommandSubSystem().getHost());
- }
- else if (parent instanceof IRemoteFile)
- {
- return (IRemoteFile) parent;
- }
-
- if (fs != null)
- {
- String path = output.getAbsolutePath();
- if (path != null && path.length() > 0)
- {
- Object obj = null;
- try
- {
- obj = fs.getObjectWithAbsoluteName(path);
- }
- catch (Exception e)
- {
- return null;
- }
- if (obj != null && obj instanceof IRemoteFile)
- {
- file = (IRemoteFile) obj;
- if (file.isFile())
- {
- return file;
- }
- return null;
- }
- }
- }
-
- return file;
- }
-
-
-
- protected void openEditor(IRemoteFile file, IEditorDescriptor descriptor)
- {
- SystemEditableRemoteFile editableFile = new SystemEditableRemoteFile(file, descriptor);
- editableFile.open(SystemBasePlugin.getActiveWorkbenchShell());
- handleGotoLine();
- }
-
-
- protected void handleGotoLine()
- {
- handleGotoLine(_remoteFile, _remoteLine.getLine(), _remoteLine.getCharStart(), _remoteLine.getCharEnd());
- }
-
-
- public static void handleGotoLine(IRemoteFile remoteFile, int line, int charStart, int charEnd)
- {
- //if (line > 0)
- {
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
- IEditorPart editor = null;
- String fileName = remoteFile.getAbsolutePath();
- IEditorReference[] editors = persp.getEditorReferences();
- for (int i = 0; i < editors.length; i++)
- {
- IEditorReference ref = editors[i];
- IEditorPart editorp = ref.getEditor(false);
- if (editorp != null)
- {
- IEditorInput einput = editorp.getEditorInput();
- if (einput instanceof IFileEditorInput)
- {
- IFileEditorInput input = (IFileEditorInput) einput;
- IFile efile = input.getFile();
-
- SystemIFileProperties properties = new SystemIFileProperties(efile);
- String comparePath = properties.getRemoteFilePath();
-
- if (comparePath != null && (comparePath.replace('\\','/').equals(fileName.replace('\\','/'))))
- {
- editor = editorp;
- persp.bringToTop(editor);
- if (editor instanceof ISystemTextEditor)
- {
- ISystemTextEditor lpex = (ISystemTextEditor)editor;
- lpex.gotoLine(line);
- lpex.selectText(charStart, charEnd);
-
- }
- else
- {
- try
- {
- IMarker marker = efile.createMarker(IMarker.TEXT);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.CHAR_START, charStart);
- marker.setAttribute(IMarker.CHAR_END, charEnd);
-
- IDE.gotoMarker(editor, marker);
-
-
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileOpenWithMenu.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileOpenWithMenu.java
deleted file mode 100644
index 3f7721a56..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileOpenWithMenu.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 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
- * David McKnight (IBM) - [189873] DownloadJob changed to DownloadAndOpenJob
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * David McKnight (IBM) - [277141] System Editor Passed Incorrect Cache Information in Presence of Case-Differentiated-Only filenames
- * David McKnight (IBM) - [284596] [regression] Open with-> problem when descriptor doesn't match previous
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Hashtable;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourceAttributes;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.files.ui.view.DownloadAndOpenJob;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.EditorSelectionDialog;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.part.FileEditorInput;
-
-
-/**
- * Open with menu class for remote files
- */
-public class SystemRemoteFileOpenWithMenu extends ContributionItem
-{
- protected IWorkbenchPage page;
- protected IRemoteFile _remoteFile;
- protected IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
-
- private static Hashtable imageCache = new Hashtable(11);
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".OpenWithMenu";//$NON-NLS-1$
-
- /*
- * Compares the labels from two IEditorDescriptor objects
- */
- private static final Comparator comparer = new Comparator()
- {
- private Collator collator = Collator.getInstance();
-
- public int compare(Object arg0, Object arg1) {
- String s1 = ((IEditorDescriptor)arg0).getLabel();
- String s2 = ((IEditorDescriptor)arg1).getLabel();
- return collator.compare(s1, s2);
- }
- };
-
-
-/**
- * Constructs a new instance of <code>SystemOpenWithMenu</code>.
- */
-public SystemRemoteFileOpenWithMenu()
-{
- super(ID);
- this.page = null;
- _remoteFile = null;
-}
-
-/*
- * Initializes the IRemoteFile
- */
-public void updateSelection(IStructuredSelection selection)
-{
- if (selection.size() == 1)
- {
- _remoteFile = (IRemoteFile)selection.getFirstElement();
- }
-}
-
-/**
- * Returns an image to show for the corresponding editor descriptor.
- *
- * @param editorDesc the editor descriptor, or null for the system editor
- * @return the image or null
- */
-protected Image getImage(IEditorDescriptor editorDesc) {
- ImageDescriptor imageDesc = getImageDescriptor(editorDesc);
- if (imageDesc == null) {
- return null;
- }
- Image image = (Image) imageCache.get(imageDesc);
- if (image == null) {
- image = imageDesc.createImage();
- imageCache.put(imageDesc, image);
- }
- return image;
-}
-
-private String getFileName()
-{
- return _remoteFile.getName();
-}
-
-/**
- * Returns the image descriptor for the given editor descriptor,
- * or null if it has no image.
- */
-private ImageDescriptor getImageDescriptor(IEditorDescriptor editorDesc) {
- ImageDescriptor imageDesc = null;
- if (editorDesc == null) {
- imageDesc = registry.getImageDescriptor(getFileName());
- }
- else {
- imageDesc = editorDesc.getImageDescriptor();
- }
- if (imageDesc == null && editorDesc != null) {
- if (editorDesc.getId().equals(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID))
- imageDesc = registry.getSystemExternalEditorImageDescriptor(getFileName());
- }
- return imageDesc;
-}
-/**
- * Creates the menu item for the editor descriptor.
- *
- * @param menu the menu to add the item to
- * @param descriptor the editor descriptor, or null for the system editor
- * @param preferredEditor the descriptor of the preferred editor, or <code>null</code>
- */
-protected void createMenuItem(Menu menu, final IEditorDescriptor descriptor, final IEditorDescriptor preferredEditor)
-{
- // XXX: Would be better to use bold here, but SWT does not support it.
- final MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
- boolean isPreferred = preferredEditor != null && descriptor.getId().equals(preferredEditor.getId());
- menuItem.setSelection(isPreferred);
- menuItem.setText(descriptor.getLabel());
- Image image = getImage(descriptor);
- if (image != null) {
- menuItem.setImage(image);
- }
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Selection:
- if(menuItem.getSelection())
- {
- openEditor(_remoteFile, descriptor);
- }
- break;
- }
- }
- };
- menuItem.addListener(SWT.Selection, listener);
-}
-
-/**
- * Creates the Other... menu item
- *
- * @param menu the menu to add the item to
- */
-private void createOtherMenuItem(final Menu menu, final IRemoteFile remoteFile) {
-
- new MenuItem(menu, SWT.SEPARATOR);
- final MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
- menuItem.setText(FileResources.OpenWithMenu_Other);
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Selection:
- EditorSelectionDialog dialog = new EditorSelectionDialog(
- menu.getShell());
- dialog
- .setMessage(NLS
- .bind(
- FileResources.OpenWithMenu_OtherDialogDescription,
- remoteFile.getName()));
- if (dialog.open() == Window.OK) {
- IEditorDescriptor editor = dialog.getSelectedEditor();
- if (editor != null) {
- openEditor(remoteFile, editor);
- }
- }
- break;
- }
- }
- };
- menuItem.addListener(SWT.Selection, listener);
-}
-
-
-protected void openEditor(IRemoteFile remoteFile, IEditorDescriptor descriptor) {
-
- SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, descriptor);
- if (editable == null){
- // case for cancelled operation when user was prompted to save file of different case
- return;
- }
-
- boolean systemEditor = descriptor != null && descriptor.getId().equals(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
-
- if (isFileCached(editable, remoteFile)) {
-
- try {
- if (systemEditor) {
- editable.openSystemEditor();
- }
- else {
- if (descriptor != null){
- hackOpenEditor(editable, descriptor);
- }
- else {
- editable.openEditor();
- }
- }
- }
- catch (Exception e) {}
- }
- else {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, systemEditor);
- oJob.schedule();
- }
-}
-
-/**
- * This method is a hack to deal with bug 284596 while no API exists to set the editor descriptor for a
- * given SystemEditableRemoteFile. The code here is essentially a modified version of
- * SystemEditableRemoteFile.openEditor()
- */
-private void hackOpenEditor(SystemEditableRemoteFile editable, IEditorDescriptor descriptor) throws PartInitException
-{
- IWorkbenchPage activePage = this.page;
- IWorkbench wb = PlatformUI.getWorkbench();
- if (activePage == null)
- {
- activePage = wb.getActiveWorkbenchWindow().getActivePage();
- }
- IFile file = editable.getLocalResource();
-
- IRemoteFile remoteFile = editable.getRemoteFile();
- // get fresh remote file object
- remoteFile.markStale(true); // make sure we get the latest remote file (with proper permissions and all)
- IRemoteFileSubSystem ss = remoteFile.getParentRemoteFileSubSystem();
- if (!remoteFile.getParentRemoteFileSubSystem().isOffline()){
- try{
- remoteFile = ss.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){
- SystemMessageDialog.displayExceptionMessage(SystemMessageDialog.getDefaultShell(), e);
- return;
- }
- }
- editable.setRemoteFile(remoteFile);
-
- boolean readOnly = !remoteFile.canWrite();
- ResourceAttributes attr = file.getResourceAttributes();
- if (attr!=null) {
- attr.setReadOnly(readOnly);
- try {
- file.setResourceAttributes(attr);
- }
- catch (Exception e)
- {}
- }
-
- // set editor as preferred editor for this file
- String editorId = descriptor.getId();
- IDE.setDefaultEditor(file, editorId);
-
- FileEditorInput finput = new FileEditorInput(file);
-
- IEditorPart editor = null;
- if (descriptor.isOpenExternal()){
- editor = ((WorkbenchPage)activePage).openEditorFromDescriptor(new FileEditorInput(file), descriptor, true, null);
- }
- else {
- editor = activePage.openEditor(finput, descriptor.getId());
- }
- editable.setEditor(editor);
-
- SystemIFileProperties properties = new SystemIFileProperties(file);
- properties.setRemoteFileObject(this);
-}
-
-private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile)
-{
- // DY: check if the file exists and is read-only (because it was previously opened
- // in the system editor)
- IFile file = editable.getLocalResource();
- SystemIFileProperties properties = new SystemIFileProperties(file);
- boolean newFile = !file.exists();
-
- // detect whether there exists a temp copy already
- if (!newFile && file.exists())
- {
- // we have a local copy of this file, so we need to compare timestamps
-
- // get stored modification stamp
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
-
- // get updated remoteFile so we get the current remote timestamp
- //remoteFile.markStale(true);
- IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
- try
- {
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
-
- }
-
- // get the remote modified stamp
- long remoteModifiedStamp = remoteFile.getLastModified();
-
- // get dirty flag
- boolean dirty = properties.getDirty();
-
- boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp);
-
- String remoteEncoding = remoteFile.getEncoding();
- String storedEncoding = properties.getEncoding();
-
- boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding));
-
- boolean usedBinary = properties.getUsedBinaryTransfer();
- boolean isBinary = remoteFile.isBinary();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- !encodingChanged);
- }
- return false;
-}
-
-/**
- * Get the local cache of the remote file, or <code>null</code> if none.
- * @param remoteFile the remote file.
- * @return the local cached resource, or <code>null</code> if none.
- */
-private IFile getLocalResource(IRemoteFile remoteFile)
-{
- return (IFile)UniversalFileTransferUtility.getTempFileFor(remoteFile);
-}
-
-/**
- * Returns the preferred editor for the remote file. If the remote file has a cached local resource,
- * then returns the default editor associated with that resource, by calling <code>IDE.getDefaultEditor(IFile)</code>.
- * Otherwise, get the default editor associated with that remote file name from the editor registry.
- * @param remoteFile the remote file.
- * @return the preferred editor for the remote file, or <code>null</code> if none.
- */
-protected IEditorDescriptor getPreferredEditor(IRemoteFile remoteFile) {
-
- IFile localFile = getLocalResource(remoteFile);
-
- if (localFile == null) {
- return registry.getDefaultEditor(remoteFile.getName());
- }
- else {
- return IDE.getDefaultEditor(localFile);
- }
-}
-
-
-protected IEditorDescriptor getDefaultEditor(IRemoteFile remoteFile)
-{
- IFile localFile = getLocalResource(remoteFile);
-
- if (localFile == null || !localFile.exists()) {
- return registry.getDefaultEditor(remoteFile.getName());
- }
- else
- {
- IEditorDescriptor descriptor = IDE.getDefaultEditor(localFile);
- if (descriptor == null)
- {
- descriptor = getDefaultTextEditor();
- }
- return descriptor;
- }
-}
-
-protected void setDefaultEditor(IRemoteFile remoteFile, String editorId)
-{
- IFile localFile = getLocalResource(remoteFile);
-
- if (localFile == null) {
- registry.setDefaultEditor(remoteFile.getName(), editorId);
- }
- else {
- IDE.setDefaultEditor(localFile, editorId);
- }
-}
-
-
-protected IEditorRegistry getEditorRegistry()
-{
- return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
-}
-
-protected IEditorDescriptor getDefaultTextEditor()
-{
- IEditorRegistry registry = getEditorRegistry();
- return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
-}
-
-/* (non-Javadoc)
- * Fills the menu with perspective items.
- */
-public void fill(Menu menu, int index)
-{
- if (_remoteFile == null) {
- return;
- }
-
- IEditorDescriptor defaultEditor = registry.findEditor("org.eclipse.ui.DefaultTextEditor"); // may be null //$NON-NLS-1$
- IEditorDescriptor preferredEditor = getPreferredEditor(_remoteFile); // may be null
-
- Object[] editors = registry.getEditors(getFileName());
- Collections.sort(Arrays.asList(editors), comparer);
-
- boolean defaultFound = false;
-
- //Check that we don't add it twice. This is possible
- //if the same editor goes to two mappings.
- ArrayList alreadyMapped= new ArrayList();
-
- for (int i = 0; i < editors.length; i++) {
- IEditorDescriptor editor = (IEditorDescriptor) editors[i];
- if(!alreadyMapped.contains(editor)){
- createMenuItem(menu, editor, preferredEditor);
- if (defaultEditor != null && editor.getId().equals(defaultEditor.getId()))
- defaultFound = true;
- alreadyMapped.add(editor);
- }
- }
-
- // Only add a separator if there is something to separate
- if (editors.length > 0)
- new MenuItem(menu, SWT.SEPARATOR);
-
- // Add default editor. Check it if it is saved as the preference.
- if (!defaultFound && defaultEditor != null) {
- createMenuItem(menu, defaultEditor, preferredEditor);
- }
-
- // Add system editor (should never be null)
- IEditorDescriptor descriptor = registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
- createMenuItem(menu, descriptor, preferredEditor);
-
- //DKM- disable inplace editor for now
- /*
- // Add system in-place editor (can be null)
- descriptor = registry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
- if (descriptor != null) {
- createMenuItem(menu, descriptor, preferredEditor);
- }
- */
- createDefaultMenuItem(menu, _remoteFile);
-
- // create other menu
- createOtherMenuItem(menu, _remoteFile);
-
-}
-
-
-/* (non-Javadoc)
- * Returns whether this menu is dynamic.
- */
-public boolean isDynamic()
-{
- return true;
-}
-
-
-/**
- * Creates the menu item for clearing the current selection.
- *
- * @param menu the menu to add the item to
- * @param file the file bing edited
- */
-protected void createDefaultMenuItem(Menu menu, final IRemoteFile file)
-{
- final MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
- IEditorDescriptor defaultEditor = getDefaultEditor(file);
- menuItem.setSelection(defaultEditor == null);
- menuItem.setText(FileResources.DefaultEditorDescription_name);
-
- Listener listener = new Listener()
- {
- public void handleEvent(Event event)
- {
- switch (event.type)
- {
- case SWT.Selection:
- if(menuItem.getSelection())
- {
- setDefaultEditor(file, null);
-
- IEditorDescriptor defaultEditor = null;
-
- try {
- defaultEditor = getEditorDescriptor(file);
- openEditor(file, defaultEditor);
- }
- catch (PartInitException e) {
- SystemBasePlugin.logError("Error getting default editor descriptor", e); //$NON-NLS-1$
- }
- }
- break;
- }
- }
- };
-
- menuItem.addListener(SWT.Selection, listener);
-}
-
-protected IEditorDescriptor getEditorDescriptor(IRemoteFile file) throws PartInitException {
- return IDE.getEditorDescriptor(file.getName(), true);
-}
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSearchOpenWithMenu.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSearchOpenWithMenu.java
deleted file mode 100644
index b2e3cfdd2..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSearchOpenWithMenu.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.services.search.IHostSearchResult;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteSearchResult;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-
-/**
- * Open with menu for remote search result openning
- *
- */
-public class SystemRemoteFileSearchOpenWithMenu extends
- SystemRemoteFileLineOpenWithMenu
-{
- protected IRemoteSearchResult _searchResult;
- public void updateSelection(IStructuredSelection selection)
- {
- if (selection.size() == 1)
- {
- Object element = selection.getFirstElement();
- if (element instanceof IRemoteSearchResult)
- {
- _searchResult = (IRemoteSearchResult)element;
- _remoteFile = outputToFile(_searchResult);
- }
- }
- }
-
- protected void handleGotoLine()
- {
- handleGotoLine(_remoteFile, _searchResult);
- }
-
- public static void handleGotoLine(IRemoteFile remoteFile, IHostSearchResult searchResult) {
-
- int line = searchResult.getLine();
-
- if (line > 0) {
-
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
- IEditorPart editor = null;
- String fileName = remoteFile.getAbsolutePath();
- IEditorReference[] editors = persp.getEditorReferences();
-
- for (int i = 0; i < editors.length; i++) {
- IEditorReference ref = editors[i];
- IEditorPart editorp = ref.getEditor(false);
-
- if (editorp != null) {
-
- IEditorInput einput = editorp.getEditorInput();
-
- if (einput instanceof IFileEditorInput) {
- IFileEditorInput input = (IFileEditorInput)einput;
- IFile efile = input.getFile();
-
- SystemIFileProperties properties = new SystemIFileProperties(efile);
- String comparePath = properties.getRemoteFilePath();
-
- if (comparePath != null && (comparePath.replace('\\','/').equals(fileName.replace('\\','/')))) {
- editor = editorp;
- persp.bringToTop(editor);
-
- int firstStartOffset = -1;
- int firstEndOffset = -1;
-
- int matchSize = searchResult.numOfMatches();
-
- if (matchSize > 0) {
- firstStartOffset = searchResult.getCharStart(0);
- firstEndOffset = searchResult.getCharEnd(0);
- }
- /* DKM- always use markers now
- if (editor instanceof ISystemTextEditor) {
- ISystemTextEditor lpex = (ISystemTextEditor)editor;
- lpex.gotoLine(line);
- lpex.selectText(firstStartOffset, firstEndOffset);
- }
- else
- */
- {
-
- try {
-
- // create a marker for the first match
- IMarker firstMarker = createMarker(efile, line, firstStartOffset, firstEndOffset);
-
- int charStart = -1;
- int charEnd = -1;
-
- for (int idx = 1; idx < matchSize; idx++) {
- charStart = searchResult.getCharStart(idx);
- charEnd = searchResult.getCharEnd(idx);
- createMarker(efile, line, charStart, charEnd);
- }
-
- // highlight the first marker (first match)
- IDE.gotoMarker(editor, firstMarker);
- }
- catch (CoreException e) {
- SystemBasePlugin.logError("Error occured trying to create a marker", e); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
- }
- }
-
- protected static IMarker createMarker(IFile file, int line, int charStart, int charEnd) throws CoreException {
- IMarker marker = file.createMarker(IMarker.TEXT);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.CHAR_START, charStart);
- marker.setAttribute(IMarker.CHAR_END, charEnd);
- return marker;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemReplaceWithEditionAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemReplaceWithEditionAction.java
deleted file mode 100644
index b42dd0f78..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemReplaceWithEditionAction.java
+++ /dev/null
@@ -1,39 +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.files.ui.actions;
-
-import org.eclipse.compare.internal.ICompareContextIds;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-public class SystemReplaceWithEditionAction extends SystemEditionAction
-{
-
- public SystemReplaceWithEditionAction(Shell parent)
- {
- super(parent,
- FileResources.ACTION_REPLACEWITH_HISTORY_LABEL,
- FileResources.ACTION_REPLACEWITH_HISTORY_TOOLTIP,
- "org.eclipse.compare.internal.ReplaceWithEditionAction", //$NON-NLS-1$
- true);
-
- this.fHelpContextId= ICompareContextIds.REPLACE_WITH_EDITION_DIALOG;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchAction.java
deleted file mode 100644
index 4bfff2d56..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [261019] New File/Folder actions available in Work Offline mode
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.search.SystemSearchPage;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class SystemSearchAction extends SystemBaseAction {
-
-
- public SystemSearchAction(Shell parent) {
- super(SystemResources.ACTION_SEARCH_LABEL,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SEARCH_ID), parent);
- setToolTipText(SystemResources.ACTION_SEARCH_TOOLTIP);
- setHelp(RSEUIPlugin.HELPPREFIX + "rsdi0000"); //$NON-NLS-1$
-
- allowOnMultipleSelection(false);
- }
-
- public void run() {
- NewSearchUI.openSearchDialog(SystemBasePlugin.getActiveWorkbenchWindow(), SystemSearchPage.SYSTEM_SEARCH_PAGE_ID);
- }
-
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof IAdaptable){
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)selectedObject).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null){
- ISubSystem ss = adapter.getSubSystem(selectedObject);
- if (ss != null){
- if (ss.isOffline()){
- return false;
- }
- }
- }
- }
- return true;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchBrowseFileLineAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchBrowseFileLineAction.java
deleted file mode 100644
index 768a36e6f..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchBrowseFileLineAction.java
+++ /dev/null
@@ -1,54 +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) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteSearchResult;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-
-
-public class SystemSearchBrowseFileLineAction extends SystemSearchEditFileLineAction {
-
- /**
- * Constructor to create an edit action that jumps to a file line.
- * @param text the label for the action.
- * @param tooltip the tooltip for the action.
- * @param image the image for the action.
- * @param parent the parent shell.
- * @param editorDescriptor the editor id.
- * @param remoteFile the remote file that is to be opened.
- * @param searchResult the line number.
- */
- public SystemSearchBrowseFileLineAction(String text, String tooltip, ImageDescriptor image, Shell parent, IEditorDescriptor editorDescriptor, IRemoteFile remoteFile, IRemoteSearchResult searchResult) {
- super(text, tooltip, image, parent, editorDescriptor, remoteFile, searchResult);
- }
-
- /**
- * @see org.eclipse.rse.internal.files.ui.actions.SystemEditFileAction#process(IRemoteFile)
- */
- protected void process(IRemoteFile remoteFile) {
- SystemEditableRemoteFile editableFile = new SystemEditableRemoteFile(remoteFile, _editorDescriptor);
- editableFile.open(SystemBasePlugin.getActiveWorkbenchShell(), true);
- handleGotoLine(_remoteFile, _searchResult);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchEditFileLineAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchEditFileLineAction.java
deleted file mode 100644
index 8c4d66f47..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchEditFileLineAction.java
+++ /dev/null
@@ -1,166 +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) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteSearchResult;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-
-/**
- * Edit action used by search to create markers for all matches in a line and highlight the first match.
- */
-public class SystemSearchEditFileLineAction extends SystemEditFileAction {
-
- protected IRemoteFile _remoteFile;
- protected IRemoteSearchResult _searchResult;
-
- /**
- * Constructor to create an edit action that jumps to a file line.
- * @param text the label for the action.
- * @param tooltip the tooltip for the action.
- * @param image the image for the action.
- * @param parent the parent shell.
- * @param editorId the editor id.
- * @param remoteFile the remote file that is to be opened.
- * @param searchResult the line number.
- */
- public SystemSearchEditFileLineAction(String text, String tooltip, ImageDescriptor image, Shell parent, IEditorDescriptor editorDescriptor, IRemoteFile remoteFile, IRemoteSearchResult searchResult) {
- super(text, tooltip, image, parent, editorDescriptor);
- this._remoteFile = remoteFile;
- this._searchResult = searchResult;
- }
-
- /**
- * Calls process().
- */
- public void run() {
- process(_remoteFile, _searchResult);
- }
-
- /**
- * Process the remote file selection.
- */
- public void process(IRemoteFile remoteFile, IRemoteSearchResult searchResult) {
- super.process(remoteFile);
- handleGotoLine(remoteFile, searchResult);
- }
-
- public static void handleGotoLine(IRemoteFile remoteFile, IRemoteSearchResult searchResult) {
-
- int line = searchResult.getLine();
-
- if (line > 0) {
-
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
- IEditorPart editor = null;
- String fileName = remoteFile.getAbsolutePath();
- IEditorReference[] editors = persp.getEditorReferences();
-
- for (int i = 0; i < editors.length; i++) {
- IEditorReference ref = editors[i];
- IEditorPart editorp = ref.getEditor(false);
-
- if (editorp != null) {
-
- IEditorInput einput = editorp.getEditorInput();
-
- if (einput instanceof IFileEditorInput) {
- IFileEditorInput input = (IFileEditorInput)einput;
- IFile efile = input.getFile();
-
- SystemIFileProperties properties = new SystemIFileProperties(efile);
- String comparePath = properties.getRemoteFilePath();
-
- if (comparePath != null && (comparePath.replace('\\','/').equals(fileName.replace('\\','/')))) {
- editor = editorp;
- persp.bringToTop(editor);
-
- int firstStartOffset = -1;
- int firstEndOffset = -1;
-
- int matchSize = searchResult.numOfMatches();
-
- if (matchSize > 0) {
- firstStartOffset = searchResult.getCharStart(0);
- firstEndOffset = searchResult.getCharEnd(0);
- }
- /* DKM- always use markers now
- if (editor instanceof ISystemTextEditor) {
- ISystemTextEditor lpex = (ISystemTextEditor)editor;
- lpex.gotoLine(line);
- lpex.selectText(firstStartOffset, firstEndOffset);
- }
- else
- */
- {
-
- try {
-
- // create a marker for the first match
- IMarker firstMarker = createMarker(efile, line, firstStartOffset, firstEndOffset);
-
- int charStart = -1;
- int charEnd = -1;
-
- for (int idx = 1; idx < matchSize; idx++) {
- charStart = searchResult.getCharStart(idx);
- charEnd = searchResult.getCharEnd(idx);
- createMarker(efile, line, charStart, charEnd);
- }
-
- // highlight the first marker (first match)
- IDE.gotoMarker(editor, firstMarker);
- }
- catch (CoreException e) {
- SystemBasePlugin.logError("Error occured trying to create a marker", e); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
- }
- }
-
- protected static IMarker createMarker(IFile file, int line, int charStart, int charEnd) throws CoreException {
- IMarker marker = file.createMarker(IMarker.TEXT);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.CHAR_START, charStart);
- marker.setAttribute(IMarker.CHAR_END, charEnd);
- return marker;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSelectFileTypesAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSelectFileTypesAction.java
deleted file mode 100644
index 1d81103d9..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSelectFileTypesAction.java
+++ /dev/null
@@ -1,158 +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) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action for allowing the user to select one or more file types, using the Eclipse
- * dialog for this. The types are from the file editor registry, as specified in the
- * Workbench preferences.
- * <p>
- * To set preselected types, use {@link #setTypes(List)} or {@link #setTypes(String[])}.
- * Or, if you have single string of comma-separated types, call {@link #setTypes(String)}.
- * <p>
- * After running, and checking wasCancelled(), you can query the selected types
- * using one of:
- * <ol>
- * <li>{@link #getTypes()} to retrieve the selected types as a List
- * <li>{@link #getTypesArray()} to retrieve the selected types as a String array
- * <li>{@link #getTypesString()} to retrieve the selected types as a single String of comma-delimited selections
- * <p>
- * Note the types are remembered after running, so a subsequent run will result in the previous types
- * being preselected, assuming you re-use the same instance of this class.
- *
- * @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog
- */
-public class SystemSelectFileTypesAction extends SystemBaseDialogAction
-{
- protected List types = new ArrayList();
-
- /**
- * Constructor
- * To set preselected types, use {@link #setTypes(List)} or {@link #setTypes(String[])}.
- * Note the types are remember after running, so a subsequent run will result in the previous types
- * being preselected.
- */
- public SystemSelectFileTypesAction(Shell shell)
- {
- super(SystemFileResources.ACTION_SELECTFILETYPES_LABEL, SystemFileResources.ACTION_SELECTFILETYPES_TOOLTIP, null, shell);
- }
-
- /**
- * Set the current input types as a String array.
- * Each type is a file name extension, without the dot, as in "java" or "class"
- */
- public void setTypes(String[] types)
- {
- this.types = Arrays.asList(types);
- }
- /**
- * Set the current input types as a java.util List, such as ArrayList
- * Each type is a file name extension, without the dot, as in "java" or "class"
- */
- public void setTypes(List types)
- {
- this.types = types;
- }
- /**
- * Set the current input types given a comma-separated list as a single String.
- */
- public void setTypes(String typeString)
- {
- setTypes(RemoteFileFilterString.parseTypes(typeString));
- }
-
- /**
- * Get the selected file types after running the action. Returns an ArrayList
- */
- public List getTypes()
- {
- return types;
- }
- /**
- * Get the selected file types after running the action. Returns a String array
- */
- public String[] getTypesArray()
- {
- String[] typesArray = new String[types.size()];
- Iterator i = types.iterator();
- int idx=0;
- while (i.hasNext())
- typesArray[idx++] = (String)i.next();
- return typesArray;
- }
- /**
- * Get the selected file types as a concatenated list of strings, comma-separated
- */
- public String getTypesString()
- {
- return RemoteFileFilterString.getTypesString(getTypesArray());
- }
-
- /**
- * Return true if the dialog was cancelled by the user.
- * Only valid after calling run().
- */
- public boolean wasCancelled()
- {
- return (getValue() == null);
- }
-
-
- /**
- * Create and return the dialog
- */
- public Dialog createDialog(Shell parent)
- {
- SystemSelectFileTypesDialog dialog =
- new SystemSelectFileTypesDialog(getShell(), types);
- return dialog;
- }
-
- /**
- * Parent abstract method.
- * Called after dialog runs, to retrieve the value from the dialog.
- * Will return null if dialog cancelled.
- */
- public Object getDialogValue(Dialog dlg)
- {
- Object[] result = ((SystemSelectFileTypesDialog)dlg).getResult();
- if (result != null)
- {
- types = new ArrayList(result.length);
- for (int idx = 0; idx < result.length; idx++)
- types.add(result[idx]);
- return types;
- }
- else
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemUploadConflictAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemUploadConflictAction.java
deleted file mode 100644
index fd62d81d4..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemUploadConflictAction.java
+++ /dev/null
@@ -1,638 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * 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) - [224377] "open with" menu does not have "other" option
- * Xuan Chen (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [235221] Files truncated on exit of Eclipse
- * David McKnight (IBM) - [249544] Save conflict dialog appears when saving files in the editor
- * Kevin Doyle (IBM) - [242389] [usability] RSE Save Conflict dialog should indicate which file is in conflict
- * David McKnight (IBM) - [267247] Wrong encoding
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-
-import org.eclipse.core.resources.IFile;
-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.core.runtime.jobs.Job;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-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.subsystems.SubSystem;
-import org.eclipse.rse.core.subsystems.SubSystem.SystemMessageDialogRunnable;
-import org.eclipse.rse.files.ui.dialogs.FileDialogFactory;
-import org.eclipse.rse.files.ui.dialogs.ISaveAsDialog;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.ui.SystemResources;
-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.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-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.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.part.FileEditorInput;
-
-
-/**
- * This is the default action used to handle upload conflicts
- */
-public class SystemUploadConflictAction extends SystemBaseAction implements Runnable
-{
- private class BackgroundSaveasJob extends Job
- {
- private IRemoteFile _saveasFile;
- public BackgroundSaveasJob(IRemoteFile saveasFile)
- {
- super("Save as"); // need to externalize //$NON-NLS-1$
- _saveasFile = saveasFile;
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- if (_saveasFile != null)
- {
- IRemoteFileSubSystem fs = _saveasFile.getParentRemoteFileSubSystem();
- try
- {
- if (!_saveasFile.exists())
- {
- _saveasFile = fs.createFile(_saveasFile, monitor);
- }
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError("Error in performSaveAs", e); //$NON-NLS-1$
-
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_ERROR_UNEXPECTED,
- IStatus.ERROR, CommonMessages.MSG_ERROR_UNEXPECTED);
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), message);
- SystemMessageDialogRunnable runnable = ((SubSystem)fs).new SystemMessageDialogRunnable(dialog);
- Display.getDefault().asyncExec(runnable);
- }
-
- try
- {
- String srcEncoding = RemoteFileUtility.getSourceEncoding(_tempFile);
- // copy temp file to remote system
- fs.upload(_tempFile.getLocation().makeAbsolute().toOSString(), _saveasFile, srcEncoding, monitor);
-
- // set original time stamp to 0 so that file will be overwritten next download
- SystemIFileProperties properties = new SystemIFileProperties(_tempFile);
- properties.setRemoteFileTimeStamp(0);
- properties.setDirty(false);
- }
- catch (SystemMessageException e)
- {
- //e.printStackTrace();
- }
-
- ReopenAction reopen = new ReopenAction(_tempFile, _saveasFile);
-
- Display.getDefault().asyncExec(reopen);
- }
- return Status.OK_STATUS;
- }
- }
-
- private class BackgroundDownloadJob extends Job
- {
- public BackgroundDownloadJob()
- {
- super("Download"); // need to externalize //$NON-NLS-1$
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- try
- {
- IRemoteFileSubSystem fs = _remoteFile.getParentRemoteFileSubSystem();
- SystemIFileProperties properties = new SystemIFileProperties(_tempFile);
-
- // download remote version
- String srcEncoding = RemoteFileUtility.getSourceEncoding(_tempFile);
-
- fs.download(_remoteFile, _tempFile.getLocation().makeAbsolute().toOSString(), srcEncoding, monitor);
-
- properties.setRemoteFileTimeStamp(_remoteFile.getLastModified());
- //properties.setRemoteFileTimeStamp(-1);
-
- properties.setDirty(false);
- properties.setUsedBinaryTransfer(_remoteFile.isBinary());
- }
- catch (final SystemMessageException e)
- {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- SystemMessageDialog.displayMessage(e);
- }
- });
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return Status.OK_STATUS;
- }
- }
-
- private class BackgroundUploadJob extends Job
- {
-
- public BackgroundUploadJob()
- {
- super("Upload"); // need to externalize //$NON-NLS-1$
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- // user wants to keep the local version
- // and user wants to overwrite the remote file with pending changes
- try
- {
- IRemoteFileSubSystem fs = _remoteFile.getParentRemoteFileSubSystem();
- SystemIFileProperties properties = new SystemIFileProperties(_tempFile);
-
- // making sure we have the same version as is in the cache
- _remoteFile = fs.getRemoteFileObject(_remoteFile.getAbsolutePath(), monitor);
-
- String srcEncoding = RemoteFileUtility.getSourceEncoding(_tempFile);
-
- fs.upload(_tempFile.getLocation().makeAbsolute().toOSString(), _remoteFile, srcEncoding, monitor);
-
- // wait for timestamp to update before re-fetching remote file
- _remoteFile.markStale(true);
- _remoteFile = fs.getRemoteFileObject(_remoteFile.getAbsolutePath(), monitor);
-
- long ts = _remoteFile.getLastModified();
- properties.setRemoteFileTimeStamp(ts);
- properties.setDirty(false);
- }
- catch (RemoteFileSecurityException e)
- {
- }
- catch (RemoteFileIOException e)
- {
- }
- catch (Exception e)
- {
- }
- return Status.OK_STATUS;
- }
- }
-
-
- /**
- * This is the default dialog used to handle upload conflicts
- */
- private class UploadConflictDialog extends SystemPromptDialog implements SelectionListener
- {
- private Button _overwriteLocalButton;
- private Button _overwriteRemoteButton;
- private Button _saveasButton;
- private Button _browseButton;
- private Text _saveasFileEntry;
-
- private boolean _overwriteLocal;
- private boolean _overwriteRemote;
- private boolean _saveas;
-
- private SystemMessage _errorMessage;
-
- private IRemoteFile _saveasLocation;
- private String _uploadFile;
-
- /**
- * Constructor.
- * @param shell the parent shell of the dialog
- */
- public UploadConflictDialog(Shell shell, String file)
- {
- super(shell, FileResources.RESID_CONFLICT_SAVE_TITLE);
- _uploadFile = file;
- //pack();
- }
-
- /**
- * Called when a button is pressed in the dialog
- */
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
- _overwriteLocal = _overwriteLocalButton.getSelection();
- _overwriteRemote = _overwriteRemoteButton.getSelection();
- _saveas = _saveasButton.getSelection();
- close();
- }
-
- /**
- * Returns whether the user decided to overwrite the local file
- * @return whether the user decided to overwrite the local file
- */
- public boolean getOverwriteLocal()
- {
- return _overwriteLocal;
- }
-
- /**
- * Returns whether the user decided to overwrite the remote file
- * @return whether the user decided to overwrite the remote file
- */
- public boolean getOverwriteRemote()
- {
- return _overwriteRemote;
- }
-
- /**
- * Returns whether the user decided to save to a different location
- * @return whether the user decided to save to a different location
- */
- public boolean getSaveas()
- {
- return _saveas;
- }
-
- /**
- * Returns the location where the cached file should be saved to
- * @return the location where the cached file should be saved to
- */
- public IRemoteFile getSaveasLocation()
- {
- return _saveasLocation;
- }
-
- /**
- * Creates the dialog contents.
- */
- public Control createInner(Composite parent)
- {
- Image image = getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION);
-
- Composite c = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- c.setLayout(layout);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite m = new Composite(c, SWT.NONE);
-
- GridLayout mlayout = new GridLayout();
- mlayout.numColumns = 2;
- m.setLayout(mlayout);
- m.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- Label label = new Label(m, SWT.NONE);
- image.setBackground(label.getBackground());
- label.setImage(image);
- label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
-
- Text text = new Text(m, SWT.WRAP | SWT.MULTI);
- text.setEditable(false);
- text.setText(NLS.bind(FileResources.RESID_CONFLICT_SAVE_MESSAGE, _uploadFile));
- GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- text.setLayoutData(textData);
-
- Composite options = new Composite(c, SWT.NONE);
- GridLayout olayout = new GridLayout();
- olayout.numColumns = 1;
- options.setLayout(olayout);
- options.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- _overwriteLocalButton = new Button(options, SWT.RADIO);
- _overwriteLocalButton.setText(FileResources.RESID_CONFLICT_SAVE_REPLACELOCAL);
- _overwriteLocalButton.addSelectionListener(this);
- _overwriteLocalButton.setSelection(true);
-
- _overwriteRemoteButton = new Button(options, SWT.RADIO);
- _overwriteRemoteButton.setText(FileResources.RESID_CONFLICT_SAVE_OVERWRITEREMOTE);
- _overwriteRemoteButton.addSelectionListener(this);
-
- _saveasButton = new Button(options, SWT.RADIO);
- _saveasButton.setText(FileResources.RESID_CONFLICT_SAVE_SAVETODIFFERENT);
- _saveasButton.addSelectionListener(this);
-
- Composite s = new Composite(options, SWT.NONE);
- GridLayout slayout = new GridLayout();
- slayout.numColumns = 2;
- s.setLayout(slayout);
- s.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- _saveasFileEntry = new Text(s, SWT.BORDER);
- _saveasFileEntry.setEnabled(false);
-
- GridData fileEntryData = new GridData(GridData.FILL_BOTH);
- fileEntryData.widthHint = 100;
- _saveasFileEntry.setLayoutData(fileEntryData);
- _saveasFileEntry.setEditable(false);
-
- _browseButton = new Button(s, SWT.PUSH);
- _browseButton.setText(SystemResources.BUTTON_BROWSE);
- _browseButton.addSelectionListener(this);
- _browseButton.setEnabled(false);
-
- setHelp();
-
- return c;
- }
-
- /**
- * Called when a widget is selected
- */
- public void widgetSelected(SelectionEvent e)
- {
- if (_saveasButton.getSelection())
- {
- _browseButton.setEnabled(true);
- _saveasFileEntry.setEnabled(true);
- if (_saveasLocation != null)
- {
- _errorMessage = null;
- setErrorMessage(_errorMessage);
- enableOkButton(true);
- }
- else
- {
- enableOkButton(false);
- _errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_VALIDATE_PATH_EMPTY,
- IStatus.ERROR,
- FileResources.MSG_VALIDATE_PATH_EMPTY,
- FileResources.MSG_VALIDATE_PATH_EMPTY_DETAILS);
-
- setErrorMessage(_errorMessage);
-
- }
- }
- else
- {
- _browseButton.setEnabled(false);
- _saveasFileEntry.setEnabled(false);
- enableOkButton(true);
- _errorMessage = null;
- setErrorMessage(_errorMessage);
- }
-
- if (e.getSource() == _browseButton)
- {
-
- ISaveAsDialog dlg = FileDialogFactory.makeSaveAsDialog(getShell());
- dlg.setMultipleSelectionMode(false);
-
- if (_remoteFile != null)
- {
- dlg.setPreSelection(_remoteFile);
-
- if (dlg.open() == OK)
- {
- Object output = dlg.getOutputObject();
- if (output instanceof IRemoteFile)
- {
- IRemoteFile toCreate = (IRemoteFile) output;
- // validate
- try
- {
- _errorMessage = null;
- _saveasLocation = toCreate;
- _saveasFileEntry.setText(toCreate.getAbsolutePath());
-
- enableOkButton(_errorMessage == null);
-
- setErrorMessage(_errorMessage);
- }
- catch (Exception ex)
- {
- }
- }
- }
- }
- }
-
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
-
- /**
- * Returns the initial focus control
- * @return the initial focus control
- */
- protected Control getInitialFocusControl()
- {
- enableOkButton(true);
- return _overwriteLocalButton;
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "scdl0000"); //$NON-NLS-1$
- }
- }
-
- /**
- * Action used to close a specified editor
- */
- public class CloseEditorAction implements Runnable
- {
- public IEditorPart _editor;
-
- public CloseEditorAction(IEditorPart editor)
- {
- _editor = editor;
- }
-
- public void run()
- {
- // close old editor
- SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().closeEditor(_editor, false);
- }
- }
-
- /**
- * Action used to reopen the editor for a cached file with a remote file from a different location
- */
- public class ReopenAction implements Runnable
- {
- private IRemoteFile _saveasFile;
-
- public ReopenAction(IFile tempFile, IRemoteFile saveasFile)
- {
- _saveasFile = saveasFile;
- }
-
- private IEditorPart getEditorFor(IFile tempFile)
- {
-
- IWorkbenchWindow window = SystemBasePlugin.getActiveWorkbenchWindow();
- if (window != null)
- {
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- {
- IEditorPart editor = page.getActiveEditor();
- IEditorInput input = editor.getEditorInput();
- if (input instanceof FileEditorInput)
- {
- FileEditorInput finput = (FileEditorInput) input;
- if (finput.getFile().getFullPath().equals(tempFile.getFullPath()))
- {
- return editor;
- }
- }
- }
- }
-
- return null;
- }
-
- public void run()
- {
- try
- {
- _saveasFile = _saveasFile.getParentRemoteFileSubSystem().getRemoteFileObject(_saveasFile.getAbsolutePath(), new NullProgressMonitor());
- RSECorePlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(_saveasFile.getParentRemoteFile(), ISystemResourceChangeEvents.EVENT_REFRESH, null));
-
- }
- catch (SystemMessageException e)
- {
- e.printStackTrace();
- }
-
- // close editor
- IEditorPart editor = getEditorFor(_tempFile);
- if (editor != null)
- {
- String id = editor.getEditorSite().getId();
-
- // open editor on new file
- SystemEditableRemoteFile edit = new SystemEditableRemoteFile(_saveasFile);
- try
- {
- edit.download(getShell());
- edit.addAsListener();
- edit.setLocalResourceProperties();
-
- // open new editor
- edit.openEditor();
-
- // close old editor
- CloseEditorAction closeAction = new CloseEditorAction(editor);
- Display.getDefault().asyncExec(closeAction);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
-
- private IFile _tempFile;
- private IRemoteFile _remoteFile;
-
- /**
- * Constructor.
- * @param shell the parent shell of the action
- * @param tempFile the cached local file that is in conflict with the remote file
- * @param remoteFile the remote file
- * @param remoteNewer indicates whether the remote file has changed since it was last downloaded
- */
- public SystemUploadConflictAction(Shell shell, IFile tempFile, IRemoteFile remoteFile, boolean remoteNewer)
- {
- super(FileResources.RESID_CONFLICT_SAVE_TITLE, shell);
- _tempFile = tempFile;
- _remoteFile = remoteFile;
- }
-
- /**
- * Called when this action is invoked
- */
- public void run()
- {
- SystemIFileProperties properties = new SystemIFileProperties(_tempFile);
-
- UploadConflictDialog cnfDialog = new UploadConflictDialog(SystemBasePlugin.getActiveWorkbenchShell(), _remoteFile.getName());
- if (cnfDialog.open() == Window.OK)
- {
- // does user want to open local or replace local with remote?
- if (cnfDialog.getOverwriteRemote())
- {
- // user wants to keep the local version
- // and user wants to overwrite the remote file with pending changes
- BackgroundUploadJob ujob = new BackgroundUploadJob();
- ujob.schedule();
- }
- else if (cnfDialog.getOverwriteLocal())
- {
- // user wants to replace local copy with the remote version
- BackgroundDownloadJob djob = new BackgroundDownloadJob();
- djob.schedule();
- }
- else if (cnfDialog.getSaveas())
- {
- IRemoteFile remoteFile = cnfDialog.getSaveasLocation();
- BackgroundSaveasJob sjob = new BackgroundSaveasJob(remoteFile);
- sjob.schedule();
- }
- }
- else
- {
- // cancelled dialog, so no remote synchronization
- // set dirty flag!
- properties.setDirty(true);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SaveAsDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SaveAsDialog.java
deleted file mode 100644
index 35642a962..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SaveAsDialog.java
+++ /dev/null
@@ -1,87 +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:
- * {Name} (company) - description of contribution.
- * Xuan Chen (IBM) - [220999] [api] Need to change class SystemSelectRemoteFileAction to use SystemRemoteFileDialog
- * Move SystemSelectRemoteFileOrFolderDialog to internal package first.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.dialogs;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.files.ui.dialogs.ISaveAsDialog;
-import org.eclipse.rse.files.ui.widgets.SaveAsForm;
-import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class SaveAsDialog extends SystemSelectRemoteFileOrFolderDialog implements ISaveAsDialog {
-
-
- private SaveAsForm form;
-
- /**
- * Constructor
- *
- * @param shell The shell to hang the dialog off of
- *
- */
- public SaveAsDialog(Shell shell)
- {
- super(shell, false);
- }
- /**
- * Constructor when you want to supply your own title.
- *
- * @param shell The shell to hang the dialog off of
- * @param title The title to give the dialog
- */
- public SaveAsDialog(Shell shell, String title)
- {
- super(shell, title, true);
- }
-
-
- protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode)
- {
- //System.out.println("INSIDE GETFORM");
- //if (form == null)
- //{
- form = new SaveAsForm(getMessageLine(), this, fileMode);
- super.getForm(fileMode);
-
- //}
- return form;
- }
-
- public Object getOutputObject()
- {
- IRemoteFile file = (IRemoteFile) super.getOutputObject();
- if (file.isFile())
- {
- return file;
- }
-
- try
- {
- return file.getParentRemoteFileSubSystem().getRemoteFileObject(file, form.getFileName(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
- return null;
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java
deleted file mode 100644
index 0f65c5ca0..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java
+++ /dev/null
@@ -1,609 +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:
- * Kevin Doyle (IBM) - Added a double click listener that closes the dialog if appropriate
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * Xuan Chen (IBM) - [220999] [api] Need to change class SystemSelectRemoteFileAction to use SystemRemoteFileDialog
- * Move SystemSelectRemoteFileOrFolderDialog to internal package first.
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.dialogs;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.files.ui.ISystemAddFileListener;
-import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Dialog for allowing users to select a remote file or folder. This is a thin dialog wrapper on top of
- * the SystemSelectRemoteFileOrFolderForm widget, which you could optionally imbed directly into your own
- * dialog or wizard page.
- * <p>
- * Call these methods to configure the functionality of the dialog
- * <ul>
- * <li>{@link #setSystemConnection(IHost) or #setDefaultConnection(SystemConnection)}
- * <li>{@link #setShowNewConnectionPrompt(boolean)}
- * <li>{@link #setSystemTypes(IRSESystemType[])}
- * <li>{@link #setAutoExpandDepth(int)}
- * <li>{@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)}
- * <li>{@link #setFileTypes(String[])} or {@link #setFileTypes(String)}
- * <li>{@link #setShowPropertySheet(boolean)}
- * <li>{@link #enableAddMode(ISystemAddFileListener)}
- * <li>{@link #setMultipleSelectionMode(boolean)}
- * <li>{@link #setSelectionValidator(IValidatorRemoteSelection)}
- * </ul>
- * <p>
- * Call these methods to configure the text on the dialog
- * <ul>
- * <li>{@link #setMessage(String)}
- * <li>{@link #setSelectionTreeToolTipText(String)}
- * </ul>
- * <p>
- * After running, call these methods to get the output:
- * <ul>
- * <li>{@link #getSelectedObject()} or {@link #getSelectedObjects()}
- * <li>{@link #getSelectedConnection()}
- * </ul>
- *
- * @see org.eclipse.rse.files.ui.actions.SystemSelectRemoteFileAction
- * @see org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction
- *
- * @deprecated should be using SystemRemoteResourceDialog now
- * @see org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog
- * @see org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog
- *
- */
-public class SystemSelectRemoteFileOrFolderDialog
- extends SystemPromptDialog
- //implements ISystemFileConstants
-{
- public static final boolean FILE_MODE = true;
- public static final boolean FOLDER_MODE = false;
- protected SystemSelectRemoteFileOrFolderForm form;
- private boolean multipleSelectionMode;
- protected IHost outputConnection;
- private ISystemAddFileListener addButtonCallback = null;
-
- /**
- * Constructor
- *
- * @param shell The shell to hang the dialog off of
- * @param fileMode True if selecting files, false if selecting folders
- *
- */
- public SystemSelectRemoteFileOrFolderDialog(Shell shell, boolean fileMode)
- {
- this(shell,
- fileMode ? SystemFileResources.RESID_SELECTFILE_TITLE : SystemFileResources.RESID_SELECTDIRECTORY_TITLE,
- fileMode);
- }
-
- /**
- * Constructor when you want to supply your own title.
- *
- * @param shell The shell to hang the dialog off of
- * @param title The title to give the dialog
- * @param fileMode True if selecting files, false if selecting folders
- */
- public SystemSelectRemoteFileOrFolderDialog(Shell shell, String title, boolean fileMode)
- {
- super(shell, title);
- super.setBlockOnOpen(true); // always modal
- form = getForm(fileMode);
- //pack();
- }
-
- // ------------------
- // PUBLIC METHODS...
- // ------------------
- /**
- * indicate whether selections from different parents are allowed
- */
- public void setAllowForMultipleParents(boolean flag)
- {
- form.setAllowForMultipleParents(flag);
- }
-
- /**
- * Set the system connection to restrict the user to selecting files or folders from
- */
- public void setSystemConnection(IHost conn)
- {
- form.setSystemConnection(conn);
- }
- /**
- * Set the connection to default the selection to
- */
- public void setDefaultConnection(IHost conn)
- {
- form.setDefaultConnection(conn);
- }
-
- /**
- * Set the system types to restrict what connections the user sees,
- * and what types of connections they can create.
- *
- * @param systemTypes An array of system types, or
- * <code>null</code> to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemTypes(IRSESystemType[] systemTypes)
- {
- form.setSystemTypes(systemTypes);
- }
- /**
- * Set to true if a "New Connection..." special connection is to be shown for creating new connections
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- form.setShowNewConnectionPrompt(show);
- }
- /**
- * Set the message shown at the top of the form
- */
- public void setMessage(String message)
- {
- form.setMessage(message);
- }
- /**
- * Set the tooltip text for the remote systems tree from which an item is selected.
- */
- public void setSelectionTreeToolTipText(String tip)
- {
- form.setSelectionTreeToolTipText(tip);
- }
- /**
- * Specify the zero-based auto-expand level for the tree. The default is zero, meaning
- * only show the connections.
- */
- public void setAutoExpandDepth(int depth)
- {
- form.setAutoExpandDepth(depth);
- }
-
- /**
- * Set the root folder from which to start listing folders or files.
- * This version identifies the folder via a connection object and absolute path.
- * There is another overload that identifies the folder via a single IRemoteFile object.
- *
- * @param connection The connection to the remote system containing the root folder
- * @param folderAbsolutePath The fully qualified folder to start listing from (eg: "\folder1\folder2")
- *
- * @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString
- */
- public void setRootFolder(IHost connection, String folderAbsolutePath)
- {
- form.setRootFolder(connection, folderAbsolutePath);
- }
- /**
- * Set the root folder from which to start listing folders.
- * This version identifies the folder via an IRemoteFile object.
- * There is another overload that identifies the folder via a connection and folder path.
- * <p>
- * This call effectively transforms the select dialog by:
- * <ul>
- * <li>Preventing the user from selecting other connections
- * <li>Preventing the user from selecting other filter strings
- * </ul>
- *
- * @param rootFolder The IRemoteFile object representing the remote folder to start the list from
- *
- * @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString
- */
- public void setRootFolder(IRemoteFile rootFolder)
- {
- form.setRootFolder(rootFolder);
- }
- /**
- * Set a file or folder to preselect. This will:
- * <ul>
- * <li>Set the parent folder as the root folder
- * <li>Pre-expand the parent folder
- * <li>Pre-select the given file or folder after expansion
- * </ul>
- * If there is no parent, then we were given a root. In which case we will
- * <ul>
- * <li>Force setRestrictFolders to false
- * <li>Pre-expand the root drives (Windows) or root files (Unix)
- * <li>Pre-select the given root drive (Windows only)
- * </ul>
- */
- public void setPreSelection(IRemoteFile selection)
- {
- form.setPreSelection(selection);
- }
-
- /**
- * For files mode, restrict the files list by an array of file types
- * <p>
- * This must be called BEFORE setRootFolder!
- */
- public void setFileTypes(String[] fileTypes)
- {
- form.setFileTypes(fileTypes);
- }
- /**
- * For files mode, restrict the files list by a comman-delimited array of file types.
- * The last type must also end in a comma. Eg "java, class," or "class,".
- * <p>
- * This must be called BEFORE setRootFolder!
- */
- public void setFileTypes(String fileTypes)
- {
- form.setFileTypes(fileTypes);
- }
- /**
- * Specify whether setRootFolder should prevent the user from being able to see or select
- * any other folder. This causes two effects:
- * <ol>
- * <li>The special filter for root/drives is not shown
- * <li>No subfolders are listed in the target folder, if we are listing files. Of course, they are shown
- * if we are listing folders, else it would be an empty list!
- * </ol>
- */
- public void setRestrictFolders(boolean restrict)
- {
- form.setRestrictFolders(restrict);
- }
- /**
- * Enable Add mode. This means the OK button is replaced with an Add button, and
- * the Cancel with a Close button. When Add is pressed, the caller is called back.
- * The dialog is not exited until Close is pressed.
- * <p>
- * When a library is selected, the caller is called back to decide to enable the Add
- * button or not.
- */
- public void enableAddMode(ISystemAddFileListener caller)
- {
- this.addButtonCallback = caller;
- form.enableAddMode(caller);
- setShowAddButton(true);
- enableAddButton(false);
- setShowOkButton(false);
- setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
- }
- /**
- * Overloaded method that allows setting the label and tooltip text of the Add button.
- * If you pass null for the label, the default is used ("Add").
- */
- public void enableAddMode(ISystemAddFileListener caller, String addLabel, String addToolTipText)
- {
- enableAddMode(caller);
- if (addLabel != null)
- setAddButtonLabel(addLabel);
- if (addToolTipText != null)
- setAddButtonToolTipText(addToolTipText);
- }
-
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * This overload always shows the property sheet
- * <p>
- * Default is false
- */
- public void setShowPropertySheet(boolean show)
- {
- form.setShowPropertySheet(show);
- }
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * This overload shows a Details>>> button so the user can decide if they want to see the
- * property sheet.
- * <p>
- * @param show True if show the property sheet within the dialog
- * @param initialState True if the property is to be initially displayed, false if it is not
- * to be displayed until the user presses the Details button.
- */
- public void setShowPropertySheet(boolean show, boolean initialState)
- {
- if (show)
- {
- form.setShowPropertySheet(initialState);
- setShowDetailsButton(true, !initialState);
- }
- }
-
- /**
- * Set multiple selection mode. Default is single selection mode
- * <p>
- * If you turn on multiple selection mode, you must use the getSelectedObjects()
- * method to retrieve the list of selected objects.
- * <p>
- * Further, if you turn this on, it has the side effect of allowing the user
- * to select any remote object. The assumption being if you are prompting for
- * files, you also want to allow the user to select a folder, with the meaning
- * being that all files within the folder are implicitly selected.
- *
- * @see #getSelectedObjects()
- */
- public void setMultipleSelectionMode(boolean multiple)
- {
- this.multipleSelectionMode = multiple;
- form.setMultipleSelectionMode(multiple);
- }
- /**
- * Specify a validator to use when the user selects a remote file or folder.
- * This allows you to decide if OK should be enabled or not for that remote file or folder.
- */
- public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
- {
- form.setSelectionValidator(selectionValidator);
- }
-
- // ------------------
- // OUTPUT METHODS...
- // ------------------
-
- /**
- * Return selected file or folder
- */
- public Object getSelectedObject()
- {
- if (getOutputObject() instanceof Object[])
- return ((Object[])getOutputObject())[0];
- else
- return getOutputObject();
- }
- /**
- * Return all selected objects. This method will return an array of one
- * unless you have called setMultipleSelectionMode(true)!
- * @see #setMultipleSelectionMode(boolean)
- */
- public Object[] getSelectedObjects()
- {
- if (getOutputObject() instanceof Object[])
- return (Object[])getOutputObject();
- else if (getOutputObject() != null)
- return new Object[] {getOutputObject()};
- else
- return null;
- }
-
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
- /**
- * Return the multiple selection mode as set by setMultipleSelectionMode(boolean)
- */
- public boolean getMultipleSelectionMode()
- {
- return multipleSelectionMode;
- }
-
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
- /**
- * Private method.
- * @see SystemPromptDialog#createContents(Composite)
- */
- protected Control createContents(Composite parent)
- {
- Control control = super.createContents(parent);
- form.getSystemTree().addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
- return control;
- }
-
- /**
- * Handles double clicks in viewer.
- * Closes the dialog if a file is double clicked
- */
- protected void handleDoubleClick(DoubleClickEvent event)
- {
- ISystemTree tree = form.getSystemTree();
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (element == null)
- return;
- if (FILE_MODE && form.isPageComplete() && !tree.isExpandable(element))
- {
- setReturnCode(OK);
- if (processOK())
- {
- okPressed = true;
- close();
- }
- }
- }
-
- /**
- * Private method.
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return form.getInitialFocusControl();
- }
-
- /**
- * Private method.
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- return form.createContents(getShell(), parent);
- }
-
- /**
- * Private method.
- * Get the contents.
- */
- protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode)
- {
- //System.out.println("INSIDE GETFORM");
- //if (form == null)
- //{
- form = new SystemSelectRemoteFileOrFolderForm(getMessageLine(), this, fileMode);
- // reset output variables just to be safe
- setOutputObject(null);
- outputConnection = null;
- //}
- return form;
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- ISystemMessageLine msgLine = super.createMessageLine(c);
- if (form != null)
- form.setMessageLine(msgLine);
- return msgLine;
- }
-
-
- /**
- * Private method.
- * <p>
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- boolean closeDialog = form.verify();
- if (closeDialog)
- {
- outputConnection = form.getSelectedConnection();
- if (multipleSelectionMode)
- setOutputObject(form.getSelectedObjects());
- else
- setOutputObject(form.getSelectedObject());
- }
- else
- setOutputObject(null);
- return closeDialog;
- }
-
- /**
- * Private method.
- * <p>
- * Called when user presses Add button.
- */
- protected boolean processAdd()
- {
- Object errMsg = addButtonCallback.addButtonPressed(form.getSelectedConnection(), (IRemoteFile[])form.getSelectedObjects());
- if (errMsg != null)
- {
- if (errMsg instanceof String)
- setErrorMessage((String)errMsg);
- else
- setErrorMessage((SystemMessage)errMsg);
- }
- else
- clearErrorMessage();
- enableAddButton(false); // presumably you won't add the same thing twice!
- return false;
- }
- /**
- * Private method.
- * <p>
- * Called when user presses DETAILS button.
- * <p>
- * Note the text is automatically toggled for us! We need only
- * do whatever the functionality is that we desire
- *
- * @param hideMode the current state of the details toggle, prior to this request. If we return true from
- * this method, this state and the button text will be toggled.
- *
- * @return true if the details state toggle was successful, false if it failed.
- */
- protected boolean processDetails(boolean hideMode)
- {
- form.toggleShowPropertySheet(getShell(), getContents());
- return true;
- }
-
-
- public void setPageComplete(boolean complete)
- {
- if (addButtonCallback != null)
- enableAddButton(complete);
- else
- super.setPageComplete(complete);
- }
-
- /**
- * We have to override close to ensure that we reset the form to null
- */
- public boolean close()
- {
- if (super.close())
- {
- if (form != null)
- {
- form.dispose();
- }
- form = null;
- return true;
- }
- return false;
- }
-
- /**
- * Add viewer filter.
- * @param filter a viewer filter.
- */
- public void addViewerFilter(ViewerFilter filter) {
-
- if (form != null) {
- form.addViewerFilter(filter);
- }
- }
-
- /**
- * Sets whether to allow folder selection. The default selection validator will use this to
- * determine whether the OK button will be enabled when a folder is selected. The default
- * is <code>true</code>. This call only makes sense if the dialog is in file selection mode.
- * @param allow <code>true</code> to allow folder selection, <code>false</code> otherwise.
- */
- public void setAllowFolderSelection(boolean allow) {
-
- if (form != null) {
- form.setAllowFolderSelection(allow);
- }
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java
deleted file mode 100644
index 74580a93a..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java
+++ /dev/null
@@ -1,101 +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) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [217556] remove service subsystem types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.propertypages;
-
-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.ISubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystemConfiguration;
-import org.eclipse.rse.ui.propertypages.ServicesPropertyPage;
-import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServiceElement;
-
-
-public class FileServicesPropertyPage extends ServicesPropertyPage
-{
-
- private IFileServiceSubSystemConfiguration _currentFactory;
-
- protected FileServiceSubSystem getFileServiceSubSystem()
- {
- return (FileServiceSubSystem)getElement();
- }
-
- protected ServiceElement[] getServiceElements()
- {
- FileServiceSubSystem subSystem = getFileServiceSubSystem();
-
- IHost host = subSystem.getHost();
- _currentFactory = (IFileServiceSubSystemConfiguration)subSystem.getParentRemoteFileSubSystemConfiguration();
- IFileServiceSubSystemConfiguration[] factories = getFileServiceSubSystemConfigurations(host.getSystemType());
-
-
- // create elements for each
- ServiceElement[] elements = new ServiceElement[factories.length];
- for (int i = 0; i < factories.length; i++)
- {
- IFileServiceSubSystemConfiguration factory = factories[i];
- elements[i] = new FactoryServiceElement(host, factory);
- if (factory == _currentFactory)
- {
- elements[i].setSelected(true);
- }
- }
-
- return elements;
- }
-
- protected IFileServiceSubSystemConfiguration[] getFileServiceSubSystemConfigurations(IRSESystemType systemType)
- {
- List results = new ArrayList();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, false);
-
- for (int i = 0; i < factories.length; i++)
- {
- ISubSystemConfiguration factory = factories[i];
- if (factory instanceof IFileServiceSubSystemConfiguration)
- {
- results.add(factory);
- }
- }
-
- return (IFileServiceSubSystemConfiguration[])results.toArray(new IFileServiceSubSystemConfiguration[results.size()]);
- }
-
-
- protected ISubSystemConfiguration getCurrentSubSystemConfiguration()
- {
- return _currentFactory;
- }
-
- public void setSubSystemConfiguration(ISubSystemConfiguration factory)
- {
- _currentFactory = (IFileServiceSubSystemConfiguration)factory;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemCachePreferencePage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemCachePreferencePage.java
deleted file mode 100644
index 452458a0d..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemCachePreferencePage.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2009 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) - 176488: adding some text for the cache limit checkbox
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * 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) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [239459] Clear Cached Files action should not delete project metadata
- * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.propertypages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.SystemTableViewProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.model.AdaptableList;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * Preference page for generic Remote System cache preferences
- */
-public class SystemCachePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener
-{
-
- private Button _clearButton;
- private Button _limitCacheCheckbox;
- private Text _maxCacheSize;
- private Label maxCacheSizeLabel;
-
- /**
- * Constructor
- */
- public SystemCachePreferencePage()
- {
- super();
- setPreferenceStore(RSEUIPlugin.getDefault().getPreferenceStore());
-// setDescription(FileResources.RESID_PREF_CACHE_DESCRIPTION); dwd descriptions are not readable by screen reader
- }
-
- /**
- * Configure the composite. We intercept to set the help.
- */
- public void createControl(Composite parent)
- {
- super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), RSEUIPlugin.HELPPREFIX + "fchp0000"); //$NON-NLS-1$
- }
-
- /**
- *
- */
- protected Control createContents(Composite gparent)
- {
- Composite parent = SystemWidgetHelpers.createComposite(gparent, 2);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- _limitCacheCheckbox = SystemWidgetHelpers.createCheckBox(parent, FileResources.RESID_PREF_CACHE_LIMIT_CACHE_SIZE_LABEL, this);
- _limitCacheCheckbox.setToolTipText(FileResources.RESID_PREF_CACHE_LIMIT_CACHE_SIZE_TOOLTIP);
- _limitCacheCheckbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
- ((GridData)_limitCacheCheckbox.getLayoutData()).horizontalSpan = 2;
-
- maxCacheSizeLabel = new Label(parent, SWT.NONE);
- maxCacheSizeLabel.setText(FileResources.RESID_PREF_CACHE_MAX_CACHE_SIZE_LABEL);
- maxCacheSizeLabel.setToolTipText(FileResources.RESID_PREF_CACHE_MAX_CACHE_SIZE_TOOLTIP);
- maxCacheSizeLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
-
- _maxCacheSize = new Text(parent, SWT.BORDER);
- GridData gd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- gd.widthHint = 75;
- _maxCacheSize.setLayoutData(gd);
- _maxCacheSize.setTextLimit(5);
- _maxCacheSize.setToolTipText(FileResources.RESID_PREF_CACHE_MAX_CACHE_SIZE_TOOLTIP);
- _maxCacheSize.addVerifyListener(new VerifyListener()
- {
- public void verifyText(VerifyEvent e)
- {
- e.doit = true;
- for (int loop = 0; loop < e.text.length(); loop++)
- {
- if (!Character.isDigit(e.text.charAt(loop)))
- e.doit = false;
- }
- }
- });
-
-// Composite clearComp = SystemWidgetHelpers.createComposite(parent, 2);
-// layout = new GridLayout();
-// layout.numColumns = 2;
-// clearComp.setLayout(layout);
-// clearComp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
-// SystemWidgetHelpers.createLabel(
-// clearComp,
-// FileResources.RESID_PREF_CACHE_CLEAR_LABEL);
- _clearButton = SystemWidgetHelpers.createPushButton(parent, FileResources.RESID_PREF_CACHE_CLEAR, this);
- _clearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
- ((GridData)_clearButton.getLayoutData()).horizontalSpan = 2;
- _clearButton.setToolTipText(FileResources.RESID_PREF_CACHE_CLEAR_TOOLTIP);
-// gd = new GridData();
-// gd.widthHint = 75;
-// _clearButton.setLayoutData(gd);
-
-// Composite warningComp = SystemWidgetHelpers.createComposite(clearComp, 2);
-// gd = new GridData();
-// gd.horizontalSpan = 2;
-// warningComp.setLayoutData(gd);
-
-// Display display = getControl().getDisplay();
-// Label warningLabel =
-// SystemWidgetHelpers.createLabel(
-// warningComp,
-// FileResources.RESID_PREF_CACHE_CLEAR_WARNING_LABEL);
-// FontData oldData = warningLabel.getFont().getFontData()[0];
-// FontData data = new FontData(oldData.getName(), oldData.getHeight(), SWT.BOLD);
-// Font fFont = new Font(display, data);
-// warningLabel.setFont(fFont);
-
- Text warning = new Text(parent, SWT.READ_ONLY);
-// SystemWidgetHelpers.createReadonlyTextField(parent);
- warning.setBackground(parent.getBackground());
- warning.setText(FileResources.RESID_PREF_CACHE_CLEAR_WARNING_DESCRIPTION);
- warning.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
- ((GridData)warning.getLayoutData()).horizontalSpan = 2;
-
- (new Mnemonics()).setOnPreferencePage(true).setMnemonics(parent);
-
- initControls();
- return parent;
- }
-
- private void initControls()
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- boolean enableMaxSize = store.getBoolean(ISystemFilePreferencesConstants.LIMIT_CACHE);
- _maxCacheSize.setEnabled(enableMaxSize);
-
- String maxCacheSizeStr = store.getString(ISystemFilePreferencesConstants.MAX_CACHE_SIZE);
-
- if (maxCacheSizeStr == null || maxCacheSizeStr.equals("")) { //$NON-NLS-1$
- maxCacheSizeStr = ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE;
- }
-
- _maxCacheSize.setText(maxCacheSizeStr);
- _limitCacheCheckbox.setSelection(enableMaxSize);
- }
-
- /**
- * Inherited method.
- */
- public void init(IWorkbench workbench)
- {
-
- }
-
- /**
- * @see FieldEditorPreferencePage#performDefaults()
- */
- protected void performDefaults()
- {
- super.performDefaults();
-
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
-
- boolean enableMaxSize = store.getDefaultBoolean(ISystemFilePreferencesConstants.LIMIT_CACHE);
- _limitCacheCheckbox.setSelection(enableMaxSize);
-
- maxCacheSizeLabel.setEnabled(enableMaxSize);
-
- _maxCacheSize.setEnabled(enableMaxSize);
- _maxCacheSize.setText(store.getDefaultString(ISystemFilePreferencesConstants.MAX_CACHE_SIZE));
- }
-
- /**
- * Set default preferences for the communications preference page.
- *
- * @param store PreferenceStore used for this preference page.
- * @deprecated moved to Activator
- */
- public static void initDefaults(IPreferenceStore store)
- {
- // no longer needed here - moved to Activator
- }
-
- /**
- * @see FieldEditorPreferencePage#performOk()
- */
- public boolean performOk()
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- String size = _maxCacheSize.getText();
-
- if (size == null || size.trim().equals("")) { //$NON-NLS-1$
- size = ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE;
- }
-
- store.setValue(ISystemFilePreferencesConstants.MAX_CACHE_SIZE, size);
- store.setValue(ISystemFilePreferencesConstants.LIMIT_CACHE, _limitCacheCheckbox.getSelection());
-
- return super.performOk();
- }
-
- private class ClearTempFilesRunnable implements IRunnableWithProgress
- {
- /**
- * Returns false if the member is a dot file under the project, otherwise true
- * @param member
- * @return whether to delete this file
- */
- private boolean isDeletable(IResource member)
- {
- if (member instanceof IFile){
- String name = member.getName();
- if (name.startsWith(".")){ //$NON-NLS-1$
- return false;
- }
- }
- return true;
- }
-
- public void run(IProgressMonitor monitor)
- {
- SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance();
- // if no temp file project, nothing to do
- if (!mgr.doesRemoteEditProjectExist())
- {
- return;
- }
-
- IProject tempFiles = mgr.getRemoteEditProject();
- if (tempFiles != null)
- {
- try
- {
- IResource[] members = tempFiles.members();
- if (members != null)
- {
- for (int i = 0; i < members.length; i++)
- {
- IResource member = members[i];
- if (isDeletable(member))
- {
- // DKM - passing true now so that out-of-synch temp files are deleted too (i.e. generated .evt files)
- // this solves the worse part of 58951
- member.delete(true, monitor);
- }
- }
- }
-
- }
- catch (Exception e)
- {
- }
- finally
- {
- mgr.getRemoteEditProject();
- }
-
- }
- }
- }
-
- protected IRunnableContext getRunnableContext(Shell shell)
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc != null)
- {
- return irc;
- }
- else
- {
- // for other cases, use statusbar
- IWorkbenchWindow win = SystemBasePlugin.getActiveWorkbenchWindow();
- if (win != null)
- {
- Shell winShell = SystemBasePlugin.getActiveWorkbenchShell();
- if (winShell != null && winShell.isVisible() && !winShell.isDisposed())
- {
- shell = winShell;
- return win;
- }
- else
- {
- win = null;
- }
- }
-
- return new ProgressMonitorDialog(shell);
- }
- }
- public void handleEvent(Event e)
- {
- if (e.widget == _clearButton)
- {
-
- if (checkDirtyEditors())
- {
- IRunnableContext runnableContext = getRunnableContext(SystemBasePlugin.getActiveWorkbenchShell());
- try
- {
- // currently we don't run this in a thread because
- // in some cases dialogs are launched in the operation
- // (widgets can only be legally used on the main thread)
- runnableContext.run(false, true, new ClearTempFilesRunnable());
- // inthread, cancellable, IRunnableWithProgress
- }
- catch (java.lang.reflect.InvocationTargetException exc)
- {
- }
- catch (java.lang.InterruptedException ex)
- {
- }
- }
-
- }
- else if (e.widget == _limitCacheCheckbox)
- {
- _maxCacheSize.setEnabled(_limitCacheCheckbox.getSelection());
- }
- }
-
- protected boolean getDirtyReplicas(IContainer parent, List dirtyReplicas)
- {
- try
- {
- IResource[] children = parent.members();
- for (int i = 0; i < children.length; i++)
- {
- IResource child = children[i];
- if (child instanceof IFile)
- {
- SystemIFileProperties properties = new SystemIFileProperties(child);
- if (properties.getDirty())
- {
- if (properties.getRemoteFileObject() != null)
- {
- ISystemEditableRemoteObject editable =
- (ISystemEditableRemoteObject) properties.getRemoteFileObject();
- dirtyReplicas.add(editable);
- }
- // get the modified timestamp from the File, not the IFile
- // for some reason, the modified timestamp from the IFile does not always return
- // the right value. There is a Javadoc comment saying the value from IFile might be a
- // cached value and that might be the cause of the problem.
- else if (properties.getDownloadFileTimeStamp() != child.getLocation().toFile().lastModified())
- {
- String ssString = properties.getRemoteFileSubSystem();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISubSystem subsystem = registry.getSubSystem(ssString);
- if (subsystem != null)
- {
- String path = properties.getRemoteFilePath();
- try
- {
- IAdaptable remoteFile = (IAdaptable) subsystem.getObjectWithAbsoluteName(path);
- if (remoteFile != null)
- {
- ISystemRemoteElementAdapter adapter =
- (ISystemRemoteElementAdapter) remoteFile.getAdapter(
- ISystemRemoteElementAdapter.class);
- ISystemEditableRemoteObject editable =
- adapter.getEditableRemoteObject(remoteFile);
- editable.openEditor();
- // need this to get a reference back to the object
- properties.setRemoteFileObject(editable);
- dirtyReplicas.add(editable);
- }
- else
- {
- return false;
- }
- }
- catch (Exception e)
- {
- return false;
- }
- }
- }
- }
- }
- else if (child instanceof IContainer)
- {
- if (!getDirtyReplicas((IContainer) child, dirtyReplicas))
- {
- return false;
- }
- }
- }
- }
- catch (Exception e)
- {
- return false;
- }
- return true;
- }
-
- protected boolean getDirtyReplicas(List results)
- {
- SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance();
- IProject tempFilesProject = mgr.getRemoteEditProject();
- if (!getDirtyReplicas(tempFilesProject, results))
- {
- return false;
- }
- if (!getDirtyEditors(results))
- {
- return false;
- }
- return true;
- }
-
- protected boolean getDirtyEditors(List results)
- {
- SystemRemoteEditManager editMgr = SystemRemoteEditManager.getInstance();
-
- // if there's no temp file project, there's no dirty editors
- if (!editMgr.doesRemoteEditProjectExist())
- return false;
-
- IProject tempFilesProject = editMgr.getRemoteEditProject();
- IWorkbenchWindow activeWindow = SystemBasePlugin.getActiveWorkbenchWindow();
- IWorkbenchPage activePage = activeWindow.getActivePage();
-
- IEditorReference[] activeReferences = activePage.getEditorReferences();
-
- IEditorPart part;
-
- for (int k = 0; k < activeReferences.length; k++)
- {
- part = activeReferences[k].getEditor(false);
-
- if (part != null)
- {
- IEditorInput editorInput = part.getEditorInput();
-
- if (editorInput instanceof IFileEditorInput)
- {
- IFile file = ((IFileEditorInput) editorInput).getFile();
- if (file.getProject() == tempFilesProject)
- {
- if (part.isDirty())
- {
- SystemIFileProperties properties = new SystemIFileProperties(file);
- if (properties.getDirty())
- {
- // then this is already added via getDirtyReplicas()
- }
- else
- {
-
- if (properties.getRemoteFileObject() != null)
- {
- ISystemEditableRemoteObject editable =
- (ISystemEditableRemoteObject) properties.getRemoteFileObject();
- results.add(editable);
- }
- else
- {
- String ssString = properties.getRemoteFileSubSystem();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISubSystem subsystem = registry.getSubSystem(ssString);
- if (subsystem != null)
- {
- String path = properties.getRemoteFilePath();
- try
- {
-
- IAdaptable remoteFile =
- (IAdaptable) subsystem.getObjectWithAbsoluteName(path);
- if (remoteFile != null)
- {
- ISystemRemoteElementAdapter adapter =
- (ISystemRemoteElementAdapter) remoteFile.getAdapter(
- ISystemRemoteElementAdapter.class);
- ISystemEditableRemoteObject editable =
- adapter.getEditableRemoteObject(remoteFile);
- editable.openEditor();
- // need this to get a reference back to the object
- properties.setRemoteFileObject(editable);
- results.add(editable);
- }
- }
- catch (Exception e)
- {
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return true;
- }
-
- protected ISystemEditableRemoteObject getEditableFor(IAdaptable selected)
- {
- ISystemRemoteElementAdapter adapter =
- (ISystemRemoteElementAdapter) selected.getAdapter(ISystemRemoteElementAdapter.class);
- if (adapter.canEdit(selected))
- {
- ISystemEditableRemoteObject editable = adapter.getEditableRemoteObject(selected);
- try
- {
- editable.setLocalResourceProperties();
- }
- catch (Exception e)
- {
- }
- return editable;
- }
- return null;
- }
-
- protected boolean checkDirtyEditors()
- {
- SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance();
- if (!mgr.doesRemoteEditProjectExist())
- {
- return true;
- }
-
- List dirtyEditors = new ArrayList();
- if (!getDirtyReplicas(dirtyEditors))
- {
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_CACHE_UNABLE_TO_SYNCH,
- IStatus.ERROR, FileResources.MSG_CACHE_UNABLE_TO_SYNCH);
- SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
- dlg.open();
-
-
- return false;
- }
- if (dirtyEditors.size() > 0)
- {
- AdaptableList input = new AdaptableList();
- for (int i = 0; i < dirtyEditors.size(); i++)
- {
- ISystemEditableRemoteObject rmtObj = (ISystemEditableRemoteObject) dirtyEditors.get(i);
- input.add(rmtObj.getRemoteObject());
- }
-
- WorkbenchContentProvider cprovider = new WorkbenchContentProvider();
- SystemTableViewProvider lprovider = new SystemTableViewProvider();
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_CACHE_UPLOAD_BEFORE_DELETE,
- IStatus.ERROR, FileResources.MSG_CACHE_UPLOAD_BEFORE_DELETE);
-
- ListSelectionDialog dlg =
- new ListSelectionDialog(getShell(), input, cprovider, lprovider, msg.getLevelOneText());
-
- dlg.setInitialSelections(input.getChildren());
- // TODO: Cannot use WorkbenchMessages -- it's internal
- dlg.setTitle(FileResources.EditorManager_saveResourcesTitle);
-
- int result = dlg.open();
-
- //Just return false to prevent the operation continuing
- if (result == IDialogConstants.CANCEL_ID)
- return false;
-
- Object[] filesToSave = dlg.getResult();
- for (int s = 0; s < filesToSave.length; s++)
- {
- IAdaptable rmtObj = (IAdaptable) filesToSave[s];
- ISystemEditableRemoteObject editable = getEditableFor(rmtObj);
- if (!editable.doImmediateSaveAndUpload())
- {
- return false;
- }
- }
- }
- return true;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java
deleted file mode 100644
index 2e5e7a950..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/********************************************************************************
- * Copyright (c) 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) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
- * David McKnight (IBM) - [209703] apply encoding and updating remote file when apply on property page
- * Martin Oberhuber (Wind River) - [234038] Force refresh IRemoteFile after changing permissions
- * David McKnight (IBM) - [234038] [files][refresh] Changing file permissions does not update property sheet or refresh tree
- * David McKnight (IBM) - [234045] [ftp] Errors while changing file permissions are not displayed to the user
- *********************************************************************************/
-package org.eclipse.rse.internal.files.ui.propertypages;
-
-import org.eclipse.core.runtime.IAdaptable;
-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.core.runtime.jobs.Job;
-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.internal.files.ui.FileResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.IFilePermissionsService;
-import org.eclipse.rse.services.files.IHostFilePermissions;
-import org.eclipse.rse.services.files.PendingHostFilePermissions;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Property page for viewing and changing the user, group and permissions
- * for a particular file.
- * */
-public class SystemFilePermissionsPropertyPage extends SystemBasePropertyPage {
-
- private Button _userRead;
- private Button _userWrite;
- private Button _userExecute;
- private Button _groupRead;
- private Button _groupWrite;
- private Button _groupExecute;
- private Button _otherRead;
- private Button _otherWrite;
- private Button _otherExecute;
-
- private Text _userEntry;
- private Text _groupEntry;
-
- private IHostFilePermissions _permissions;
- private String _owner;
- private String _group;
-
- /**
- * Get the input remote file object
- */
- protected IRemoteFile getRemoteFile()
- {
- Object element = getElement();
- IRemoteFile file = (IRemoteFile)element;
-
-
- return file;
- }
-
- protected Control createContentArea(Composite parent) {
-
-
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 1);
-
- IRemoteFile file = getRemoteFile();
- IFilePermissionsService service = getPermissionsService(file);
- if (service == null ||
- (service.getCapabilities(file.getHostFile()) & IFilePermissionsService.FS_CAN_GET_PERMISSIONS) == 0){
- // not supported
- SystemWidgetHelpers.createLabel(parent, FileResources.MESSAGE_FILE_PERMISSIONS_NOT_SUPPORTED);
- }
- else
- {
- Group permissionsGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts,4, FileResources.RESID_PREF_PERMISSIONS_PERMISSIONS_LABEL);
- GridData data = new GridData();
- data.horizontalSpan = 5;
- data.horizontalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = false;
- data.verticalAlignment = SWT.BEGINNING;
- data.grabExcessVerticalSpace = false;
- permissionsGroup.setLayoutData(data);
-
- Label userTypeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_TYPE_LABEL);
-
- Label readLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_READ_LABEL);
- data = new GridData();
- data.horizontalIndent = 20;
- readLabel.setLayoutData(data);
-
- Label writeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_WRITE_LABEL);
- data = new GridData();
- data.horizontalIndent = 20;
- writeLabel.setLayoutData(data);
-
- Label executeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_EXECUTE_LABEL);
- data = new GridData();
- data.horizontalIndent = 20;
- executeLabel.setLayoutData(data);
-
-
- Label userLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_USER_LABEL);
- _userRead = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _userRead.setLayoutData(data);
-
- _userWrite = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _userWrite.setLayoutData(data);
-
- _userExecute = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _userExecute.setLayoutData(data);
-
- Label groupLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_GROUP_LABEL);
-
- _groupRead = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _groupRead.setLayoutData(data);
-
- _groupWrite = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _groupWrite.setLayoutData(data);
-
- _groupExecute = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _groupExecute.setLayoutData(data);
-
- Label otherLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_OTHERS_LABEL);
- _otherRead = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _otherRead.setLayoutData(data);
-
- _otherWrite = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _otherWrite.setLayoutData(data);
-
- _otherExecute = new Button(permissionsGroup, SWT.CHECK);
- data = new GridData();
- data.horizontalIndent = 20;
- _otherExecute.setLayoutData(data);
-
- Group ownerGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts, 2, FileResources.RESID_PREF_PERMISSIONS_OWNERSHIP_LABEL);
- data = new GridData();
- data.horizontalSpan = 1;
- data.verticalSpan = 5;
- data.horizontalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = false;
- data.verticalAlignment = SWT.BEGINNING;
- data.grabExcessVerticalSpace = false;
- ownerGroup.setLayoutData(data);
-
- Label userOwnerLabel = SystemWidgetHelpers.createLabel(ownerGroup, FileResources.RESID_PREF_PERMISSIONS_USER_LABEL);
- _userEntry = new Text(ownerGroup, SWT.BORDER);
- data = new GridData();
- data.widthHint = 100;
- _userEntry.setLayoutData(data);
-
- Label groupOwnerLabel = SystemWidgetHelpers.createLabel(ownerGroup, FileResources.RESID_PREF_PERMISSIONS_GROUP_LABEL);
- _groupEntry = new Text(ownerGroup, SWT.BORDER);
- data = new GridData();
- data.widthHint = 100;
- _groupEntry.setLayoutData(data);
-
-
- initFields();
- }
-
- return composite_prompts;
- }
-
- protected boolean verifyPageContents() {
- return true;
- }
-
- private void enableOwnershipFields(boolean enabled) {
-
- _userEntry.setEnabled(enabled);
- _groupEntry.setEnabled(enabled);
- }
-
- private void enablePermissionFields(boolean enabled){
-
- _groupExecute.setEnabled(enabled);
- _groupRead.setEnabled(enabled);
- _groupWrite.setEnabled(enabled);
-
- _userExecute.setEnabled(enabled);
- _userRead.setEnabled(enabled);
- _userWrite.setEnabled(enabled);
-
- _otherExecute.setEnabled(enabled);
- _otherRead.setEnabled(enabled);
- _otherWrite.setEnabled(enabled);
- }
-
- private IFilePermissionsService getPermissionsService(IRemoteFile remoteFile){
-
- if (remoteFile instanceof IAdaptable){
- return (IFilePermissionsService)((IAdaptable)remoteFile).getAdapter(IFilePermissionsService.class);
- }
-
- return null;
- }
-
-
-
-
- private void initFields() {
- IRemoteFile remoteFile = getRemoteFile();
-
- IFilePermissionsService ps = getPermissionsService(remoteFile);
- if (ps == null){
- enablePermissionFields(false);
- enableOwnershipFields(false);
- }
- else {
- initPermissionFields(remoteFile, ps);
- }
- }
-
- private void initPermissionFields(IRemoteFile file, IFilePermissionsService service){
- _permissions = null; // null set so that we make sure we're getting fresh permissions
-
- final IRemoteFile rFile = file;
- final IFilePermissionsService pService = service;
-
- int capabilities = service.getCapabilities(file.getHostFile());
- if ((capabilities & IFilePermissionsService.FS_CAN_SET_PERMISSIONS) != 0){
- enablePermissionFields(true);
- }
- else {
- enablePermissionFields(false);
- }
-
- if ((capabilities & IFilePermissionsService.FS_CAN_SET_OWNER) != 0){
- enableOwnershipFields(true);
- }
- else {
- enableOwnershipFields(false);
- }
-
- if ((capabilities & IFilePermissionsService.FS_CAN_GET_PERMISSIONS) != 0){
- _permissions = file.getPermissions();
- if (_permissions == null || _permissions instanceof PendingHostFilePermissions){
- Job deferredFetch = new Job(FileResources.MESSAGE_GETTING_PERMISSIONS)
- {
- public IStatus run(IProgressMonitor monitor){
- try
- {
- _permissions = pService.getFilePermissions(rFile.getHostFile(), monitor);
-
- // notify change
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run()
- {
- _userRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_READ));
- _userWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_WRITE));
- _userExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_EXECUTE));
- _groupRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_READ));
- _groupWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_WRITE));
- _groupExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_EXECUTE));
- _otherRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_READ));
- _otherWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_WRITE));
- _otherExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_EXECUTE));
-
- _owner = _permissions.getUserOwner();
- _group = _permissions.getGroupOwner();
-
- _userEntry.setText(_owner);
- _groupEntry.setText(_group);
-
- }
- });
- }
- catch (SystemMessageException e)
- {
- setMessage(e.getSystemMessage());
- }
- return Status.OK_STATUS;
- }
- };
- deferredFetch.schedule();
- }
- else {
- _userRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_READ));
- _userWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_WRITE));
- _userExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_EXECUTE));
- _groupRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_READ));
- _groupWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_WRITE));
- _groupExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_EXECUTE));
- _otherRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_READ));
- _otherWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_WRITE));
- _otherExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_EXECUTE));
-
- _owner = _permissions.getUserOwner();
- _group = _permissions.getGroupOwner();
-
- _userEntry.setText(_owner);
- _groupEntry.setText(_group);
- }
- }
- else {
- enablePermissionFields(false);
- enableOwnershipFields(false);
- }
- }
-
-
-
- public boolean performOk() {
- IRemoteFile remoteFile = getRemoteFile();
-
- boolean changed = false;
-
- // permission changes
- if (_permissions != null){
- IFilePermissionsService service = getPermissionsService(remoteFile);
-
- int capabilities = service.getCapabilities(remoteFile.getHostFile());
- if ((capabilities & IFilePermissionsService.FS_CAN_SET_PERMISSIONS) != 0){
- try
- {
- IHostFilePermissions newPermissions = (IHostFilePermissions)_permissions.clone();
-
- if (_permissions.getPermission(IHostFilePermissions.PERM_USER_READ) != _userRead.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_USER_READ, _userRead.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_USER_WRITE) != _userWrite.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_USER_WRITE, _userWrite.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_USER_EXECUTE) != _userExecute.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_USER_EXECUTE, _userExecute.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_GROUP_READ) != _groupRead.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_GROUP_READ, _groupRead.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_GROUP_WRITE) != _groupWrite.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_GROUP_WRITE, _groupWrite.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_GROUP_EXECUTE) != _groupExecute.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_GROUP_EXECUTE, _groupExecute.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_OTHER_READ) != _otherRead.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_OTHER_READ, _otherRead.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_OTHER_WRITE) != _otherWrite.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_OTHER_WRITE, _otherWrite.getSelection());
- }
- if (_permissions.getPermission(IHostFilePermissions.PERM_OTHER_EXECUTE) != _otherExecute.getSelection()){
- changed = true;
- newPermissions.setPermission(IHostFilePermissions.PERM_OTHER_EXECUTE, _otherExecute.getSelection());
- }
-
- if (_owner != _userEntry.getText()){
- changed = true;
- newPermissions.setUserOwner(_userEntry.getText());
- }
- if (_group != _groupEntry.getText()){
- changed = true;
- newPermissions.setGroupOwner(_groupEntry.getText());
- }
-
-
- if (changed){
- //mark file stale even if an exception is thrown later, to ensure proper re-get
- remoteFile.markStale(true, true);
- // assuming permissions are good
- service.setFilePermissions(remoteFile.getHostFile(), newPermissions, new NullProgressMonitor());
-
- _permissions = newPermissions;
- }
- }
- catch (SystemMessageException e){
- setMessage(e.getSystemMessage());
- }
- catch (CloneNotSupportedException e){
- // unexpected, not showing but logging
- SystemBasePlugin.logError(e.getMessage());
- }
- }
- }
-
- if (changed){
- remoteFile.markStale(true);
- // notify views of change
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- // refresh the file, since ftp and ssh will need new file objects
- registry.fireEvent(new SystemResourceChangeEvent(remoteFile, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, remoteFile));
-
- //registry.fireEvent(new SystemResourceChangeEvent(remoteFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, remoteFile));
- }
-
-
- return super.performOk();
- }
-
- protected boolean wantDefaultAndApplyButton()
- {
- return true;
- }
-
- protected void performApply() {
- performOk();
- }
-
- protected void performDefaults() {
- IRemoteFile file = getRemoteFile();
- IFilePermissionsService service = (IFilePermissionsService)((IAdaptable)file).getAdapter(IFilePermissionsService.class);
- initPermissionFields(file, service);
- }
-
- public void setVisible(boolean visible) {
- if (visible){
- IRemoteFile file = getRemoteFile();
- if (file.isStale()){ // has file changed?
- try
- {
- file = file.getParentRemoteFileSubSystem().getRemoteFileObject(file.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (SystemMessageException e){
- // unexpected, logging but not showing user
- SystemBasePlugin.logMessage(e.getSystemMessage());
- }
- setElement((IAdaptable)file);
-
- // reset according to the changed file
- performDefaults();
- }
- }
- super.setVisible(visible);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePropertyPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePropertyPage.java
deleted file mode 100644
index fee82d3f3..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePropertyPage.java
+++ /dev/null
@@ -1,676 +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
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [160776] format file size according to client system conventions and locale
- * David McKnight (IBM) - [173518] [refresh] Read only changes are not shown in RSE until the parent folder is refreshed
- * Kevin Doyle (IBM) - [197976] Changing a file to read-only when it is open doesn't update local copy
- * Kevin Doyle (IBM) - [186125] Changing encoding of a file is not reflected when it was opened before
- * David McKnight (IBM) - [209660] use parent encoding as default, rather than system encoding
- * David McKnight (IBM) - [209703] apply encoding and updating remote file when apply on property page
- * 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) - [226574][api] Add ISubSystemConfiguration#supportsEncoding()
- * Xuan Chen (IBM) - [228707] get NPE when click ok on the properties page of an I5/OS IFS file
- * David McKnight (IBM) - [230001] Property page contains invalid values
- * David McKnight (IBM) - [199596] [refresh][ftp] Changing a file/folder's Read-Only attribute doesn't always update IRemoteFile
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.propertypages;
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-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.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEncodingManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.ide.IDEEncoding;
-
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.NumberFormat;
-
-
-/**
- * The remote property page for remote file properties.
- * This is an output-only page.
- * The plugin.xml file registers this for remote file system objects.
- */
-public class SystemFilePropertyPage extends SystemBasePropertyPage
- implements SelectionListener
-{
-
- protected Label labelNamePrompt, labelTypePrompt, labelPathPrompt, labelSizePrompt,
- labelModifiedPrompt;
- //protected Button cbReadablePrompt, cbWritablePrompt;
- protected Button cbReadonlyPrompt, cbHiddenPrompt;
- protected Label labelName, labelType, labelPath, labelSize, labelModified, labelReadable, labelWritable, labelHidden;
- protected Button defaultEncodingButton, otherEncodingButton;
- protected Combo otherEncodingCombo;
- protected String errorMessage;
- protected boolean initDone = false;
- protected boolean wasReadOnly = false;
- protected String prevEncoding;
-
- private boolean encodingFieldAdded = false;
- private String defaultEncoding = null;
- private boolean isValidBefore = true;
-
- /**
- * Constructor for SystemFilterPropertyPage
- */
- public SystemFilePropertyPage()
- {
- super();
- }
-
-
- /**
- * Create the page's GUI contents.
- */
- protected Control createContentArea(Composite parent)
- {
- IRemoteFile file = getRemoteFile();
-
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // Name display
- labelNamePrompt = SystemWidgetHelpers.createLabel(
- composite_prompts, SystemFileResources.RESID_PP_FILE_NAME_LABEL, SystemFileResources.RESID_PP_FILE_NAME_TOOLTIP);
- labelName = SystemWidgetHelpers.createLabel(
- composite_prompts, ""); //$NON-NLS-1$
- labelName.setToolTipText(SystemFileResources.RESID_PP_FILE_NAME_TOOLTIP);
-
- // Type display
- labelTypePrompt = SystemWidgetHelpers.createLabel(
- composite_prompts, SystemFileResources.RESID_PP_FILE_TYPE_LABEL, SystemFileResources.RESID_PP_FILE_TYPE_TOOLTIP);
- labelType = SystemWidgetHelpers.createLabel(
- composite_prompts, ""); //$NON-NLS-1$
- labelType.setToolTipText(SystemFileResources.RESID_PP_FILE_TYPE_TOOLTIP);
-
- // Path display
- if (!file.isRoot())
- {
- labelPathPrompt = SystemWidgetHelpers.createLabel(
- composite_prompts, SystemFileResources.RESID_PP_FILE_PATH_LABEL, SystemFileResources.RESID_PP_FILE_PATH_TOOLTIP);
- labelPath = SystemWidgetHelpers.createLabel(
- composite_prompts, ""); //$NON-NLS-1$
- labelPath.setToolTipText(SystemFileResources.RESID_PP_FILE_PATH_TOOLTIP);
- }
-
- // Size display
- if (!file.isDirectory())
- {
- labelSizePrompt = SystemWidgetHelpers.createLabel(
- composite_prompts, SystemFileResources.RESID_PP_FILE_SIZE_LABEL, SystemFileResources.RESID_PP_FILE_SIZE_TOOLTIP);
- labelSize = SystemWidgetHelpers.createLabel(
- composite_prompts, ""); //$NON-NLS-1$
- labelSize.setToolTipText(SystemFileResources.RESID_PP_FILE_SIZE_TOOLTIP);
- }
-
- // Modified display
- if (!file.isRoot())
- {
- labelModifiedPrompt = SystemWidgetHelpers.createLabel(
- composite_prompts, SystemFileResources.RESID_PP_FILE_MODIFIED_LABEL, SystemFileResources.RESID_PP_FILE_MODIFIED_TOOLTIP);
- labelModified = SystemWidgetHelpers.createLabel(
- composite_prompts, ""); //$NON-NLS-1$
- labelModified.setToolTipText(SystemFileResources.RESID_PP_FILE_MODIFIED_TOOLTIP);
- }
-
- // Readonly display
- if (!file.isRoot())
- {
- if (file.showReadOnlyProperty())
- {
- cbReadonlyPrompt = SystemWidgetHelpers.createCheckBox(
- composite_prompts, null, SystemFileResources.RESID_PP_FILE_READONLY_LABEL, SystemFileResources.RESID_PP_FILE_READONLY_TOOLTIP);
- }
- }
-
- /*
- // Readable display
- if (!file.isRoot())
- {
- cbReadablePrompt = SystemWidgetHelpers.createCheckBox(
- composite_prompts, null, SystemFileResources.RESID_PP_FILE_READABLE_ROOT);
- }
-
- // Writable display
- if (!file.isRoot())
- {
- cbWritablePrompt = SystemWidgetHelpers.createCheckBox(
- composite_prompts, null, SystemFileResources.RESID_PP_FILE_WRITABLE_ROOT);
- }
- */
-
- // Hidden display
- if (!file.isRoot())
- {
- cbHiddenPrompt = SystemWidgetHelpers.createCheckBox(
- composite_prompts, null, SystemFileResources.RESID_PP_FILE_HIDDEN_LABEL, SystemFileResources.RESID_PP_FILE_HIDDEN_TOOLTIP);
- //((GridData)cbHiddenPrompt.getLayoutData()).horizontalSpan = nbrColumns;
- }
-
- // check if an encodings field should be added. Add only if the subsystem
- // indicates that it supports encodings
- IRemoteFileSubSystem subSys = file.getParentRemoteFileSubSystem();
- IHost host = subSys.getHost();
- if (subSys.getSubSystemConfiguration().supportsEncoding(host)) {
- SystemWidgetHelpers.createLabel(composite_prompts, "", 2); //$NON-NLS-1$
-
- // encoding field
- Group encodingGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts, 2, SystemFileResources.RESID_PP_FILE_ENCODING_GROUP_LABEL);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = SWT.BEGINNING;
- data.grabExcessVerticalSpace = false;
- encodingGroup.setLayoutData(data);
-
- SelectionAdapter defaultButtonSelectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEncodingGroupState(defaultEncodingButton.getSelection());
- updateValidState();
- }
- };
-
- // default encoding field
- IRemoteFile parentFile = file.getParentRemoteFile();
- if (parentFile == null){
- defaultEncoding = file.getParentRemoteFileSubSystem().getRemoteEncoding();
- }
- else {
- defaultEncoding = parentFile.getEncoding();
- }
-
- String defaultEncodingLabel = SystemFileResources.RESID_PP_FILE_ENCODING_DEFAULT_LABEL;
- int idx = defaultEncodingLabel.indexOf('%');
-
- if (idx != -1) {
- defaultEncodingLabel = defaultEncodingLabel.substring(0, idx) +
- defaultEncoding +
- defaultEncodingLabel.substring(idx+2);
- }
-
- defaultEncodingButton = SystemWidgetHelpers.createRadioButton(encodingGroup, null, defaultEncodingLabel, SystemFileResources.RESID_PP_FILE_ENCODING_DEFAULT_TOOLTIP);
- data = new GridData();
- data.horizontalSpan = 2;
- defaultEncodingButton.setLayoutData(data);
- defaultEncodingButton.addSelectionListener(defaultButtonSelectionListener);
-
- Composite otherComposite = new Composite(encodingGroup, SWT.NONE);
- GridLayout otherLayout = new GridLayout();
- otherLayout.numColumns = 2;
- otherLayout.marginWidth = 0;
- otherLayout.marginHeight = 0;
- otherComposite.setLayout(otherLayout);
- otherComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- // other encoding field
- otherEncodingButton = SystemWidgetHelpers.createRadioButton(otherComposite, null, SystemFileResources.RESID_PP_FILE_ENCODING_OTHER_LABEL, SystemFileResources.RESID_PP_FILE_ENCODING_OTHER_TOOLTIP);
-
- SelectionAdapter otherButtonSelectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEncodingGroupState(!otherEncodingButton.getSelection());
- updateValidState();
- }
- };
-
- otherEncodingButton.addSelectionListener(otherButtonSelectionListener);
-
- // other encoding combo
- otherEncodingCombo = SystemWidgetHelpers.createCombo(otherComposite, null, SystemFileResources.RESID_PP_FILE_ENCODING_ENTER_TOOLTIP);
- data = new GridData();
- data.horizontalAlignment = SWT.BEGINNING;
- data.grabExcessHorizontalSpace = true;
- otherEncodingCombo.setLayoutData(data);
-
- otherEncodingCombo.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- updateValidState();
- }
- });
-
- otherEncodingCombo.addKeyListener(new KeyAdapter(){
- public void keyReleased(KeyEvent e) {
- updateValidState();
- }
- });
-
- SystemWidgetHelpers.createLabel(encodingGroup, ""); //$NON-NLS-1$
-
- SystemWidgetHelpers.createLabel(composite_prompts, "", 2); //$NON-NLS-1$
-
- encodingFieldAdded = true;
- }
- else {
- encodingFieldAdded = false;
- }
-
- if (!initDone)
- doInitializeFields();
-
- if (!file.isRoot() && file.showReadOnlyProperty())
- cbReadonlyPrompt.addSelectionListener(this);
-
- return composite_prompts;
- }
-
- /**
- * Update the encoding group state.
- * @param useDefault whether to update the state with default option on. <code>true</code> if the default option
- * should be on, <code>false</code> if it should be off.
- */
- private void updateEncodingGroupState(boolean useDefault) {
- defaultEncodingButton.setSelection(useDefault);
- otherEncodingButton.setSelection(!useDefault);
-
- if (useDefault) {
- otherEncodingCombo.setText(getDefaultEncoding());
- }
-
- otherEncodingCombo.setEnabled(!useDefault);
- updateValidState();
- }
-
- /**
- * Updates the valid state of the encoding group.
- */
- private void updateValidState() {
- boolean isValid = isEncodingValid();
-
- if (isValid != isValidBefore) {
- isValidBefore = isValid;
-
- if (isValidBefore) {
- clearErrorMessage();
- }
- else {
- // TODO make this a SystemMessage
- setErrorMessage(FileResources.MESSAGE_ENCODING_NOT_SUPPORTED);
- }
- }
- }
-
- /**
- * Returns the default encoding.
- * @return the default encoding
- */
- protected String getDefaultEncoding() {
- return defaultEncoding;
- }
-
- /**
- * Returns the currently selected encoding.
- * @return the currently selected encoding.
- */
- protected String getSelectedEncoding() {
- if (null != defaultEncodingButton && defaultEncodingButton.getSelection()) {
- return defaultEncoding;
- }
-
- if (otherEncodingCombo != null)
- {
- return otherEncodingCombo.getText();
- }
-
- return null;
- }
-
- /**
- * Returns whether the encoding is valid.
- * @return <code>true</code> if the encoding is valid, <code>false</code> otherwise.
- */
- private boolean isEncodingValid() {
- return defaultEncodingButton.getSelection() || isEncodingValid(otherEncodingCombo.getText());
- }
-
- /**
- * Returns whether or not the given encoding is valid.
- * @param encoding the encoding.
- * @return <code>true</code> if the encoding is valid, <code>false</code> otherwise.
- */
- private boolean isEncodingValid(String encoding) {
- try {
- return Charset.isSupported(encoding);
- }
- catch (IllegalCharsetNameException e) {
- return false;
- }
- }
-
- /**
- * Get the input remote file object
- */
- protected IRemoteFile getRemoteFile()
- {
- Object element = getElement();
- IRemoteFile file = (IRemoteFile)element;
-
- return file;
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- IRemoteFile file = getRemoteFile();
- // name
- String name = file.getName();
- if (name.length() > 100)
- {
- String shortName = name.substring(0, 97).concat("..."); //$NON-NLS-1$
- labelName.setText(shortName);
- }
- else
- {
- labelName.setText(name);
- }
-
- // type
- if (file.isRoot())
- labelType.setText(SystemFileResources.RESID_PP_FILE_TYPE_ROOT_VALUE);
- else if (file.isDirectory())
- labelType.setText(SystemFileResources.RESID_PP_FILE_TYPE_FOLDER_VALUE);
- else
- labelType.setText(SystemFileResources.RESID_PP_FILE_TYPE_FILE_VALUE);
- // path
- if (labelPath != null)
- {
- String path = file.getParentPath();
- if (path != null)
- labelPath.setText(file.getParentPath());
- }
- // size
- if (labelSize != null) {
- NumberFormat fmt = NumberFormat.getIntegerInstance();
- String formattedNumber = fmt.format(file.getLength());
- labelSize.setText(formattedNumber);
- }
- // modified
- if (labelModified != null)
- {
- Date date = file.getLastModifiedDate();
- if (date != null)
- {
- DateFormat datefmt = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL);
- String formattedDate = datefmt.format(date);
- labelModified.setText(formattedDate);
- }
- }
- // readonly
- if (file.showReadOnlyProperty()) {
- if (cbReadonlyPrompt != null)
- {
- cbReadonlyPrompt.setSelection(!file.canWrite());
- wasReadOnly = !file.canWrite();
- if (file instanceof IVirtualRemoteFile)
- cbReadonlyPrompt.setEnabled(false);
- }
- }
- /*
- // readable
- if (cbReadablePrompt != null)
- {
- cbReadablePrompt.setSelection(file.canRead());
- cbReadablePrompt.setEnabled(false);
- }
- // writable
- if (cbWritablePrompt != null)
- {
- cbWritablePrompt.setSelection(file.canWrite());
- cbWritablePrompt.setEnabled(false);
- }
- */
- // hidden
- if (cbHiddenPrompt != null)
- {
- cbHiddenPrompt.setSelection(file.isHidden());
- cbHiddenPrompt.setEnabled(false);
- }
-
- // the file encoding group
- if (encodingFieldAdded) {
- List encodings = IDEEncoding.getIDEEncodings();
- String[] encodingStrings = new String[encodings.size()];
- encodings.toArray(encodingStrings);
- otherEncodingCombo.setItems(encodingStrings);
-
- String encoding = file.getEncoding();
- prevEncoding = encoding;
-
- // if the encoding is the same as the default encoding, then we want to choose the default encoding option
- if (encoding.equalsIgnoreCase(defaultEncoding)) {
- updateEncodingGroupState(true);
- }
- // otherwise choose the other encoding option
- else {
- otherEncodingCombo.setText(encoding);
- updateEncodingGroupState(false);
- }
- }
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- boolean ok = super.performOk();
- boolean readOnlySelected = cbReadonlyPrompt != null ? cbReadonlyPrompt.getSelection() : false;
- IRemoteFile remoteFile = getRemoteFile();
-
- if (ok && (cbReadonlyPrompt!=null) &&
- ((readOnlySelected && !wasReadOnly) ||
- (!readOnlySelected && wasReadOnly)))
- {
- try
- {
- // get old can write attribute
- boolean oldCanWrite = remoteFile.canWrite();
-
- //set readonly
- remoteFile.getParentRemoteFileSubSystem().setReadOnly(remoteFile,readOnlySelected, new NullProgressMonitor());
-
- // get the new can write attribute
- boolean updatedValue = remoteFile.canWrite();
-
- // check if the file is open in an editor
- SystemEditableRemoteFile editable = new SystemEditableRemoteFile(remoteFile);
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) {
- // Need to keep local copy and remote copies up to date
- editable.setReadOnly(readOnlySelected);
- }
-
- // if the values haven't changed, then we need to
- // refresh
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- remoteFile.markStale(true);
-
- // oldCanWrite and updatedValue may not be the same depending on the underlying file service
- // If the file service updates the underlying object, then there is no need for a remote refresh
- if (oldCanWrite == updatedValue)
- {
- if (remoteFile.isDirectory())
- {
- sr.fireEvent(new SystemResourceChangeEvent(remoteFile.getParentRemoteFile(),ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE,
- remoteFile.getParentRemoteFile()
- ));
- }
- else
- {
- sr.fireEvent(new SystemResourceChangeEvent(remoteFile,ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, remoteFile));
- }
- }
- else
- {
- sr.fireEvent(new SystemResourceChangeEvent(remoteFile,ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,null));
- }
- }
- catch (RemoteFileIOException exc) {
- String msgDetails = NLS.bind(FileResources.FILEMSG_IO_ERROR_DETAILS, exc.getMessage());
- setMessage(new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_IO_ERROR,
- IStatus.ERROR, FileResources.FILEMSG_IO_ERROR, msgDetails));
-
- }
- catch (RemoteFileSecurityException exc) {
- String msgDetails = NLS.bind(FileResources.FILEMSG_SECURITY_ERROR_DETAILS, exc.getMessage());
- setMessage(new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_SECURITY_ERROR,
- IStatus.ERROR, FileResources.FILEMSG_SECURITY_ERROR, msgDetails));
-
- }
- catch (SystemMessageException e) {
- setMessage(e.getSystemMessage());
- }
- }
-
- // set the encoding
- String selectedEncoding = getSelectedEncoding();
-
-
- if (ok && encodingFieldAdded && prevEncoding != null && !prevEncoding.equals(selectedEncoding)) {
- IRemoteFile rfile = getRemoteFile();
- IRemoteFileSubSystem subsys = rfile.getParentRemoteFileSubSystem();
- String hostName = subsys.getHost().getHostName();
-
- RemoteFileEncodingManager mgr = RemoteFileEncodingManager.getInstance();
- if (defaultEncodingButton.getSelection())
- {
- mgr.setEncoding(hostName, rfile.getAbsolutePath(),null);
- }
- else
- {
- mgr.setEncoding(hostName, rfile.getAbsolutePath(), getSelectedEncoding());
- }
-
-
- SystemEditableRemoteFile editable = new SystemEditableRemoteFile(remoteFile);
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) {
- IFile file = editable.getLocalResource();
- try {
- file.setCharset(selectedEncoding, null);
- } catch (CoreException e) {
- }
- }
-
- }
-
- return ok;
- }
-
- protected boolean wantDefaultAndApplyButton()
- {
- return true;
- }
-
- protected void performApply() {
- performOk();
- }
-
- protected void performDefaults() {
- doInitializeFields();
- }
-
-
- /**
- * Validate all the widgets on the page
- * <p>
- * Subclasses should override to do full error checking on all
- * the widgets on the page.
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- public void widgetDefaultSelected(SelectionEvent event)
- {
-
- }
- public void widgetSelected(SelectionEvent event)
- {
-
- }
-
-
- public void setVisible(boolean visible) {
- if (visible){
- IRemoteFile file = getRemoteFile();
- if (file.isStale()){ // has file changed?
- try
- {
- file = file.getParentRemoteFileSubSystem().getRemoteFileObject(file.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){
- }
- setElement((IAdaptable)file);
-
- // reset according to the changed file
- performDefaults();
- }
- }
- super.setVisible(visible);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java
deleted file mode 100644
index df5c48942..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2010 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) - [207178] changing list APIs for file service and subsystems
- * David McKnight (IBM) - [208951] no longer used editor registry for file type associations
- * David McKnight (IBM) - [203114] Usability improvements for file transfer mode prefs
- * David McKnight (IBM) - [210142] for accessibility need transfer mode toggle button
- * 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
- * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
- * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
- * David McKnight (IBM) - [283033] remoteFileTypes extension point should include "xml" type
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.propertypages;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.DecorationOverlayIcon;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.internal.subsystems.files.core.model.SystemFileTransferModeMapping;
-import org.eclipse.rse.internal.subsystems.files.core.model.SystemFileTransferModeRegistry;
-import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
-import org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.dialogs.FileExtensionDialog;
-
-/**
- * "Files" Preference page within the Remote Systems preference node.
- * This allows users to specify, per file extension, whether files are
- * source or binary.
- */
-public class UniversalPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage, Listener, ICellModifier
-{
-
-
-
- protected Label resourceTypeLabel;
- protected Table resourceTypeTable;
- protected Button addResourceTypeButton;
- protected Button removeResourceTypeButton;
- protected Button toggleModeButton;
-
- protected Button doSuperTransferButton;
-
- protected Button defaultBinaryButton;
- protected Button defaultTextButton;
-
- protected SystemFileTransferModeRegistry modeRegistry;
-
- protected ArrayList modeMappings;
- protected ArrayList imagesToDispose;
-
- protected Combo archiveTypeCombo;
- protected Combo defaultArchiveTypeCombo;
-
- protected Text downloadBufferSize;
- protected Text uploadBufferSize;
-
- protected Image fileImage;
- protected Image binaryFileImage;
-
- protected String[] columnProperties = { "P_ICON", "P_TYPE", "P_CONTENT" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /**
- * Constructor
- */
- public UniversalPreferencePage() {
- super(GRID);
- setPreferenceStore(RSEUIPlugin.getDefault().getPreferenceStore());
-// setDescription(FileResources.RESID_PREF_UNIVERSAL_FILES_TITLE);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, RSEUIPlugin.HELPPREFIX+"ufpf0000"); //$NON-NLS-1$
- }
-
-
- protected void createFieldEditors() {
-
- modeRegistry = SystemFileTransferModeRegistry.getInstance();
-
- modeMappings = new ArrayList();
- imagesToDispose = new ArrayList();
-
- Composite parent = getFieldEditorParent();
-
-
-
- // define container and its layout
- Composite pageComponent = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- pageComponent.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- pageComponent.setLayoutData(data);
-
- // file types label
- resourceTypeLabel = new Label(pageComponent, SWT.LEFT);
- resourceTypeLabel.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_LABEL);
- resourceTypeLabel.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_TOOLTIP);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- resourceTypeLabel.setLayoutData(data);
-
- // file types table
- resourceTypeTable = new Table(pageComponent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- resourceTypeTable.addListener(SWT.Selection, this);
- resourceTypeTable.addListener(SWT.DefaultSelection, this);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = resourceTypeTable.getItemHeight() * 12;
- data.grabExcessHorizontalSpace = true;
- resourceTypeTable.setLayoutData(data);
-
-
-
- // container for buttons
- Composite groupComponent= new Composite(pageComponent, SWT.NULL);
- groupComponent.setLayout(new GridLayout());
- data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- groupComponent.setLayoutData(data);
-
- // add button
- addResourceTypeButton = new Button(groupComponent, SWT.PUSH);
- addResourceTypeButton.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_ADDBUTTON_LABEL);
- addResourceTypeButton.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_ADDBUTTON_TOOLTIP);
- addResourceTypeButton.addListener(SWT.Selection, this);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, addResourceTypeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- addResourceTypeButton.setLayoutData(data);
-
- // remove button
- removeResourceTypeButton = new Button(groupComponent, SWT.PUSH);
- removeResourceTypeButton.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_REMOVEBUTTON_LABEL);
- removeResourceTypeButton.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_REMOVEBUTTON_TOOLTIP);
- removeResourceTypeButton.addListener(SWT.Selection, this);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, removeResourceTypeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeResourceTypeButton.setLayoutData(data);
-
- toggleModeButton = new Button(groupComponent, SWT.PUSH);
- toggleModeButton.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TOGGLEBUTTON_LABEL);
- toggleModeButton.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TOGGLEBUTTON_TOOLTIP);
- toggleModeButton.addListener(SWT.Selection, this);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, toggleModeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- toggleModeButton.setLayoutData(data);
-
-
-
- Composite afterTableComposite = new Composite(parent, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.verticalSpacing = 10;
- layout.horizontalSpacing = 10;
- afterTableComposite.setLayout(layout);
- data = new GridData();
- data.horizontalSpan = 2;
- afterTableComposite.setLayoutData(data);
-
- // default file transfer mode
- Group defaultModeGroup = new Group(afterTableComposite, SWT.SHADOW_ETCHED_IN);
- defaultModeGroup.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_DEFAULT_MODE_LABEL);
- defaultModeGroup.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_DEFAULT_MODE_TOOLTIP);
-
- layout = new GridLayout();
- layout.numColumns = 1;
- //layout.verticalSpacing = 10;
- layout.horizontalSpacing = 10;
- defaultModeGroup.setLayout(layout);
- data = new GridData();//GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- data.grabExcessHorizontalSpace = true;
- defaultModeGroup.setLayoutData(data);
-
- // add the binary radio button
- defaultBinaryButton = new Button(defaultModeGroup, SWT.RADIO);
- defaultBinaryButton.addListener(SWT.Selection, this);
- defaultBinaryButton.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL);
- defaultBinaryButton.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_TOOLTIP);
-
- // add the text radio button
- defaultTextButton = new Button(defaultModeGroup, SWT.RADIO);
- defaultTextButton.addListener(SWT.Selection, this);
- defaultTextButton.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL);
- defaultTextButton.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_TOOLTIP);
-
-
- Composite propertiesComposite = new Composite(afterTableComposite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 1;
-
- data = new GridData();
- data.horizontalSpan = 1;
- propertiesComposite.setLayout(layout);
- propertiesComposite.setLayoutData(data);
-
-
- // Add the boolean field editor for users to choose whether
- // hidden files should be displayed
- BooleanFieldEditor showHiddenEditor = new BooleanFieldEditor(
- ISystemFilePreferencesConstants.SHOWHIDDEN,
- FileResources.RESID_PREF_UNIVERSAL_SHOWHIDDEN_LABEL,
- propertiesComposite);
-
- addField(showHiddenEditor);
-
-
- // field to indicate whether or not to preserve timestamps during copy
- BooleanFieldEditor preserveTimestamps = new BooleanFieldEditor(
- ISystemFilePreferencesConstants.PRESERVETIMESTAMPS,
- FileResources.RESID_PREF_UNIVERSAL_PRESERVE_TIMESTAMPS_LABEL,
- propertiesComposite);
-
- addField(preserveTimestamps);
-
-
- // field to indicate whether or not to share cached files between different connections
- // to the same remote host
- BooleanFieldEditor shareCachedFiles = new BooleanFieldEditor (
- ISystemFilePreferencesConstants.SHARECACHEDFILES,
- FileResources.RESID_PREF_UNIVERSAL_SHARE_CACHED_FILES_LABEL,
- propertiesComposite);
-
- addField(shareCachedFiles);
-
- // download and upload buffer size
- Group transferGroup = new Group(parent, SWT.NULL);
- transferGroup.setText(FileResources.RESID_FILES_PREFERENCES_BUFFER);
-
- GridLayout tlayout = new GridLayout();
- tlayout.numColumns = 4;
- transferGroup.setLayout(tlayout);
- transferGroup.setLayoutData(new GridData());//GridData.FILL_HORIZONTAL));
-
- Label downloadBufferLabel = new Label(transferGroup, SWT.NULL);
- downloadBufferLabel.setText(FileResources.RESID_FILES_PREFERENCES_DOWNLOAD_BUFFER_SIZE_LABEL);
- downloadBufferLabel.setToolTipText(FileResources.RESID_FILES_PREFERENCES_DOWNLOAD_BUFFER_SIZE_TOOLTIP);
-
- downloadBufferSize = SystemWidgetHelpers.createTextField(transferGroup, this);
- GridData tgd = new GridData();
- tgd.widthHint = 75;
- downloadBufferSize.setLayoutData(tgd);
- downloadBufferSize.setTextLimit(10);
- downloadBufferSize.setText(getDownloadBufferSize() + ""); //$NON-NLS-1$
- downloadBufferSize.addVerifyListener(new VerifyListener()
- {
- public void verifyText(VerifyEvent e)
- {
- e.doit = true;
- for (int loop = 0; loop < e.text.length(); loop++)
- {
- if (!Character.isDigit(e.text.charAt(loop)))
- e.doit = false;
- }
- }
- });
-
- Label uploadBufferLabel = new Label(transferGroup, SWT.NULL);
- uploadBufferLabel.setText(FileResources.RESID_FILES_PREFERENCES_UPLOAD_BUFFER_SIZE_LABEL);
- uploadBufferLabel.setToolTipText(FileResources.RESID_FILES_PREFERENCES_UPLOAD_BUFFER_SIZE_TOOLTIP);
- uploadBufferSize = SystemWidgetHelpers.createTextField(transferGroup, this);
- tgd = new GridData();
- tgd.widthHint = 75;
- uploadBufferSize.setLayoutData(tgd);
- uploadBufferSize.setTextLimit(10);
- uploadBufferSize.setText(getUploadBufferSize() +""); //$NON-NLS-1$
- uploadBufferSize.addVerifyListener(new VerifyListener()
- {
- public void verifyText(VerifyEvent e)
- {
- e.doit = true;
- for (int loop = 0; loop < e.text.length(); loop++)
- {
- if (!Character.isDigit(e.text.charAt(loop)))
- {
- e.doit = false;
- }
- }
- }
- });
-
-
- // archive transfer
- Composite archiveGroup = new Composite(parent, SWT.NULL);
- GridLayout alayout = new GridLayout();
- alayout.numColumns = 2;
- archiveGroup.setLayout(alayout);
- archiveGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
-
- doSuperTransferButton = SystemWidgetHelpers.createCheckBox(archiveGroup, FileResources.RESID_SUPERTRANSFER_PREFS_ENABLE, this);
- GridData cdata = new GridData();
- cdata.horizontalSpan = 2;
- doSuperTransferButton.setLayoutData(cdata);
-
- archiveTypeCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(archiveGroup, null, FileResources.RESID_SUPERTRANSFER_PREFS_TYPE_LABEL, FileResources.RESID_SUPERTRANSFER_PREFS_TYPE_TOOLTIP);
- archiveTypeCombo.setItems(ArchiveHandlerManager.getInstance().getRegisteredExtensions());
-
- boolean doSuperTransfer = getDoSuperTransfer();
- doSuperTransferButton.setSelection(doSuperTransfer);
-
-
- archiveTypeCombo.setTextLimit(6);
- archiveTypeCombo.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e)
- {
- setSuperTransferTypePreference(archiveTypeCombo.getText());
- }
- });
-
- archiveTypeCombo.setEnabled(doSuperTransfer);
-
-
-
-
- fillResourceTypeTable();
-
- if (resourceTypeTable.getItemCount() > 0) {
- resourceTypeTable.setSelection(0);
- resourceTypeTable.setFocus();
- }
-
- updateEnabledState();
-
- (new Mnemonics()).setOnPreferencePage(true).setMnemonics(parent);
-
- }
-
- public void init(IWorkbench workbench)
- {
- }
-
- /**
- *
- * @deprecated moved to Activator
- */
- public static void initDefaults(IPreferenceStore store)
- {
- // no longer needed here - moved to Activator
- }
-
-
- /**
- * Fill the resource type table
- */
- protected void fillResourceTypeTable() {
-
-
-
- // Setup the columns (icon, type)
- TableLayout tableLayout = new TableLayout();
- resourceTypeTable.setLayout(tableLayout);
- resourceTypeTable.setHeaderVisible(true);
- resourceTypeTable.setLinesVisible(true);
-
- // cell modifier stuff so that we can change the transfer
- // mode directly from the cell
- TableViewer tableViewer = new TableViewer(resourceTypeTable);
- tableViewer.setCellModifier(this);
-
- ColumnLayoutData layoutData = new ColumnPixelData(20, false);
- tableLayout.addColumnData(layoutData);
- TableColumn tableCol = new TableColumn(resourceTypeTable, SWT.NONE, 0);
- tableCol.setResizable(false);
- tableCol.pack();
- tableCol.setWidth(20);
- tableCol.setText(""); //$NON-NLS-1$
-
-
- layoutData = new ColumnWeightData(40, true);
- tableLayout.addColumnData(layoutData);
- tableCol = new TableColumn(resourceTypeTable, SWT.NONE, 1);
- tableCol.setResizable(true);
- tableCol.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_LABEL);
- tableCol.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_TOOLTIP);
- tableCol.pack();
- tableCol.setWidth(100);
-
-
- layoutData = new ColumnWeightData(60, true);
- tableLayout.addColumnData(layoutData);
- tableCol = new TableColumn(resourceTypeTable, SWT.NONE, 2);
- tableCol.setResizable(true);
- tableCol.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_LABEL);
- tableCol.setToolTipText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TOOLTIP);
- tableCol.pack();
- tableCol.setWidth(200);
-
-
-
- String[] contentTypes = new String[3];
- contentTypes[0] = FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL;
- contentTypes[1] = FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL;
- contentTypes[2] = FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_LABEL;
-
- CellEditor editors[] = new CellEditor[3];
- editors[0] = null;
- editors[1] = new TextCellEditor(resourceTypeTable);
- editors[2] = new ComboBoxCellEditor(resourceTypeTable, contentTypes, SWT.READ_ONLY);
-
-
- tableViewer.setColumnProperties(columnProperties);
- tableViewer.setCellEditors(editors);
-
-
- initControls();
-
- }
-
- private void initControls()
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
-
- // init mode mappings for resource type table control
- ISystemFileTransferModeMapping[] mappings = getModeMappings();
- for (int i = 0; i < mappings.length; i++) {
- newResourceTableItem(mappings[i], i, false);
- }
-
- // init default file transfer controls
- int defaultFileTransferMode = getFileTransferModeDefaultPreference();
- if (defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY)
- {
- defaultBinaryButton.setSelection(true);
- }
- else if (defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT)
- {
- defaultTextButton.setSelection(true);
- }
-
- // init super transfer controls
- String superTransferArcType = store.getString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
- archiveTypeCombo.setText(superTransferArcType);
-
- boolean doSuperTransfer = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
- doSuperTransferButton.setSelection(doSuperTransfer);
-
- // buffer sizes
- int downloadSize = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE);
- downloadBufferSize.setText(downloadSize + ""); //$NON-NLS-1$
-
- int uploadSize = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE);
- uploadBufferSize.setText(uploadSize + ""); //$NON-NLS-1$
-
- }
-
- protected ISystemFileTransferModeMapping[] getModeMappings()
- {
- // cloning the registry ones so that we can restore later
- ISystemFileTransferModeMapping[] mappings = modeRegistry.getModeMappings();
-
- ISystemFileTransferModeMapping[] clonedMappings = new ISystemFileTransferModeMapping[mappings.length];
- for (int i = 0; i < mappings.length; i++){
- SystemFileTransferModeMapping mapping = (SystemFileTransferModeMapping)mappings[i];
- clonedMappings[i] = (ISystemFileTransferModeMapping)mapping.clone();
- }
- return clonedMappings;
- }
-
- /**
- * Used during reset defaults
- */
- protected void resetResourceTypeTable()
- {
- //clear table and reload defaults
- modeRegistry.renit();
- modeMappings.clear();
- resourceTypeTable.setRedraw(false);
- resourceTypeTable.removeAll();
-
- ISystemFileTransferModeMapping[] mappings = getModeMappings();
- for (int i = 0; i < mappings.length; i++)
- {
- newResourceTableItem(mappings[i], i, false);
- }
- resourceTypeTable.setRedraw(true);
-
- IEclipsePreferences prefs = new DefaultScope().getNode(RSEUIPlugin.getDefault().getBundle().getSymbolicName());
-
- int defaultFileTransferMode = prefs.getInt(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT, ISystemFilePreferencesConstants.DEFAULT_FILETRANSFERMODE);
-
- defaultBinaryButton.setSelection(defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY);
- defaultTextButton.setSelection(defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT);
-
- if (resourceTypeTable.getItemCount() > 0)
- {
- resourceTypeTable.setSelection(0);
- resourceTypeTable.setFocus();
- }
-
- updateEnabledState();
-
- archiveTypeCombo.setEnabled(false);
- }
-
- protected void resetSuperTransferPrefs()
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- String superTransferArcType = store.getDefaultString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
- archiveTypeCombo.setText(superTransferArcType);
-
- boolean doSuperTransfer = store.getDefaultBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
- doSuperTransferButton.setSelection(doSuperTransfer);
- }
-
- protected void resetBufferSizePrefs()
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
-
- int downloadSize = store.getDefaultInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE);
- downloadBufferSize.setText(downloadSize + ""); //$NON-NLS-1$
-
- int uploadSize = store.getDefaultInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE);
- uploadBufferSize.setText(uploadSize + ""); //$NON-NLS-1$
- }
-
-
- private Image applyBinaryDecoration(Image source) {
- ImageDescriptor binaryOverlay = Activator.getImageDescriptor("/icons/full/ovr16/binary_ovr.gif"); //$NON-NLS-1$
- DecorationOverlayIcon icon = new DecorationOverlayIcon(source, binaryOverlay, 3);
- return icon.createImage();
- }
-
- private Image getImageFor(ISystemFileTransferModeMapping mapping)
- {
- if (fileImage == null){
- fileImage = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).createImage();
- }
- if (binaryFileImage == null)
- {
- binaryFileImage = applyBinaryDecoration(fileImage);
- }
-
-
- // for now just always using the same image
- if (mapping.isBinary() || mapping.isXML())
- {
- return binaryFileImage;
- }
- else
- {
- return fileImage;
- }
- }
-
- /**
- * Create a new <code>TableItem</code> to represent the resource
- * type editor description supplied.
- */
- protected TableItem newResourceTableItem(ISystemFileTransferModeMapping mapping, int index, boolean selected) {
-
- modeMappings.add(index, mapping);
-
- Image image = getImageFor(mapping);
- if (image != null)
- imagesToDispose.add(image);
-
- TableItem item = new TableItem(resourceTypeTable, SWT.NULL, index);
- item.setData(mapping);
- item.setImage(0, image);
- item.setText(1, mapping.getLabel());
-
-
- boolean isText = mapping.isText();
- boolean isXML = mapping.isXML();
-
- if (isText){
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL);
- }
- else if (isXML){
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_LABEL);
- }
- else {
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL);
- }
-
- if (selected)
- resourceTypeTable.setSelection(index);
-
- return item;
- }
-
-
- /**
- * The preference page is going to be disposed. So deallocate all allocated
- * SWT resources that aren't disposed automatically by disposing the page
- * (i.e. fonts, cursors, etc). Subclasses should reimplement this method to
- * release their own allocated SWT resources.
- */
- public void dispose() {
-
- super.dispose();
-
- if(imagesToDispose != null) {
-
- for (Iterator e = imagesToDispose.iterator(); e.hasNext();) {
- ((Image)e.next()).dispose();
- }
-
- imagesToDispose = null;
- }
- }
-
-
- /**
- * @see Listener#handleEvent(Event)
- */
- public void handleEvent(Event event) {
-
- if ((event.widget == addResourceTypeButton) && (event.type == SWT.Selection)) {
- promptForResourceType();
- }
- else if ((event.widget == removeResourceTypeButton) && (event.type == SWT.Selection)) {
- removeSelectedResourceType();
- }
- else if ((event.widget == toggleModeButton) && (event.type == SWT.Selection)) {
- toggleSelectedResourceTypeMode();
- }
- else if ((event.widget == doSuperTransferButton) && (event.type == SWT.Selection))
- {
- doSuperTransferButtonSelected();
- }
- updateEnabledState();
- }
-
-
- /**
- * Prompt for file type
- */
- public void promptForResourceType() {
-
- FileExtensionDialog dialog = new FileExtensionDialog(getControl().getShell());
-
- if (dialog.open() == Window.OK) {
-
- String name = dialog.getName();
- String extension = dialog.getExtension();
-
- // add the resource type
- addResourceType(name, extension);
- }
- }
-
-
- /**
- * Remove the type from the table
- */
- public void removeSelectedResourceType() {
-
- int index = resourceTypeTable.getSelectionIndex();
-
- modeMappings.remove(index);
-
- TableItem[] items = resourceTypeTable.getSelection();
-
- if (items.length > 0) {
- items[0].dispose();
- }
- }
-
- public void toggleSelectedResourceTypeMode() {
-
- TableItem item= resourceTypeTable.getSelection()[0];
- SystemFileTransferModeMapping mapping = (SystemFileTransferModeMapping)item.getData();
-
- if (mapping.isBinary()){
- mapping.setAsText();
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL);
- item.setImage(getImageFor(mapping));
- }
- else if (mapping.isText()){
- mapping.setAsBinary();
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL);
- item.setImage(getImageFor(mapping));
- }
- else if (mapping.isXML()){
- mapping.setAsXML();
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_LABEL);
- item.setImage(getImageFor(mapping));
- }
- }
-
- /**
- * Add a new resource type to the collection shown in the top of the page.
- * This is typically called after the extension dialog is shown to the user.
- */
- public void addResourceType(String newName, String newExtension) {
-
- if (newName == null || newName.length() < 1) {
- newName = "*"; //$NON-NLS-1$
- }
- else {
-
- int index = newName.indexOf('*');
-
- if (index > -1) {
-
- // if the name is more than one character, and it has a '*' in it
- if (!(index == 0 && newName.length() == 1)) {
-// Note by DWD - this path is never taken because the dialog that gathers resource types checks for this condition.
- SystemMessageFile mf = RSEUIPlugin.getPluginMessageFile();
- Shell shell = getControl().getShell();
- String msgTxt = FileResources.MSG_ERROR_FILENAME_INVALID;
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILENAME_INVALID,
- IStatus.ERROR, msgTxt);
- SystemMessageDialog.displayErrorMessage(shell, message);
- return;
- }
- }
- }
-
- // Find the index at which to insert the new entry.
- String newFileName = null;
-
- if (newExtension == null || newExtension.length() < 1) {
- newFileName = newName.toUpperCase();
- }
- else {
- newFileName = (newName + "." + newExtension).toUpperCase(); //$NON-NLS-1$
- }
-
-
- boolean found = false;
- int i = 0;
- SystemFileTransferModeMapping mapping = null;
-
- while (i < modeMappings.size() && !found) {
-
- mapping = (SystemFileTransferModeMapping)(modeMappings.get(i));
-
- int result = newFileName.compareTo(mapping.getLabel().toUpperCase());
-
- // if the type already exists
- if (result == 0) {
-
- MessageDialog.openInformation(getControl().getShell(),
- // TODO: Cannot use WorkbenchMessages -- it's internal
- FileResources.FileEditorPreference_existsTitle,
- // TODO: Cannot use WorkbenchMessages -- it's internal
- FileResources.FileEditorPreference_existsMessage);
-
- // select the existing mapping
- resourceTypeTable.select(i);
- return;
- }
-
- if (result < 0)
- {
- found = true;
- }
- else
- i++;
- }
-
-
- // Create the new type and insert it
- mapping = new SystemFileTransferModeMapping(newName,newExtension);
-
- // default to default
- if (defaultBinaryButton.getSelection()) {
- mapping.setAsBinary();
- }
- else {
- mapping.setAsText();
- }
-
- newResourceTableItem(mapping, i, true);
-
- resourceTypeTable.setFocus();
- }
-
-
- private void doSuperTransferButtonSelected()
- {
- if (doSuperTransferButton.getSelection())
- {
- archiveTypeCombo.setEnabled(true);
- }
- else
- {
- archiveTypeCombo.setEnabled(false);
- }
- }
-
-
-
- /**
- * Update enabled state of buttons
- */
- public void updateEnabledState() {
-
- boolean resourceTypeSelected = resourceTypeTable.getSelectionIndex() != -1;
- removeResourceTypeButton.setEnabled(resourceTypeSelected);
- }
-
-
- protected void performDefaults()
- {
- super.performDefaults();
-
-
- resetResourceTypeTable();
-
- resetSuperTransferPrefs();
- resetBufferSizePrefs();
- }
-
- /**
- * Stuff to do when ok is pressed
- */
- public boolean performOk() {
-
- super.performOk();
- if (modeMappings != null)
- {
- //IFileEditorMapping[] originalMappingArray = editorRegistry.getFileEditorMappings();
-
- // first save the transfer mode registry
- Object[] array1 = modeMappings.toArray();
- SystemFileTransferModeMapping[] mappingArray1 = new SystemFileTransferModeMapping[array1.length];
-
- for (int i = 0; i < array1.length; i++) {
- mappingArray1[i] = (SystemFileTransferModeMapping)(array1[i]);
- }
-
- modeRegistry.setModeMappings(mappingArray1);
- modeRegistry.saveAssociations();
-
- // editorRegistry.removePropertyListener(this);
- int defaultFileTransferMode = ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY;
- if (defaultBinaryButton.getSelection())
- {
- defaultFileTransferMode = ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY;
- }
- else
- {
- defaultFileTransferMode = ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT;
- }
- setFileTransferModeDefaultPreference(defaultFileTransferMode);
- setDoSuperTransfer(doSuperTransferButton.getSelection());
- setSuperTransferTypePreference(archiveTypeCombo.getText());
- setDownloadBufferSize(downloadBufferSize.getText());
- setUploadBufferSize(uploadBufferSize.getText());
- }
- return true;
- }
-
- /**
- * 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);
- }
- /**
- * Set the default file transfer mode to use for unspecified file types
- */
- public static void setFileTransferModeDefaultPreference(int defaultMode)
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- store.setValue(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT,defaultMode);
- savePreferenceStore();
- }
-
- /**
- * Return whether to compress directories before transferring them over the network
- */
- public static String getSuperTransferTypePreference()
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- return store.getString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
- }
- /**
- * Set the default as to whether or not to compress directories before remote transfer
- */
- public static void setSuperTransferTypePreference(String type)
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- store.setValue(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE,type);
- savePreferenceStore();
- }
-
- public static boolean getDoSuperTransfer()
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
- }
-
- public static int getDownloadBufferSize()
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- int result = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE);
- if (result == 0)
- {
- result = ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE;
- }
- return result;
- }
-
- public static int getUploadBufferSize()
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- int result = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE);
- if (result == 0)
- {
- result = ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE;
- }
- return result;
- }
-
- public static void setDoSuperTransfer(boolean flag)
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER,flag);
- savePreferenceStore();
- }
-
- public static void setDownloadBufferSize(String size)
- {
- setDownloadBufferSize(Integer.parseInt(size));
- }
-
- public static void setUploadBufferSize(String size)
- {
- setUploadBufferSize(Integer.parseInt(size));
- }
-
- public static void setDownloadBufferSize(int size)
- {
- if (size > 0)
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- store.setValue(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE, size);
- savePreferenceStore();
- }
- }
-
- public static void setUploadBufferSize(int size)
- {
- if (size > 0)
- {
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- store.setValue(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE, size);
- savePreferenceStore();
- }
- }
-
- /**
- * Save the preference store
- */
- private static void savePreferenceStore()
- {
- RSEUIPlugin.getDefault().savePluginPreferences();
- }
-
- public boolean canModify(Object element, String property) {
- if (property.equals(columnProperties[2]))
- {
- return true;
- }
- else if (property.equals(columnProperties[1]))
- {
- return true;
- }
- return false;
- }
-
- public Object getValue(Object element, String property) {
- SystemFileTransferModeMapping mapping = (SystemFileTransferModeMapping)element;
- if (property.equals(columnProperties[2])){
- return mapping.isBinary() ? new Integer(0) : new Integer(1);
- }
- else if (property.equals(columnProperties[1])){
- return mapping.getLabel();
- }
- return null;
- }
-
- public void modify(Object element, String property, Object value)
- {
- TableItem item = (TableItem)element;
- SystemFileTransferModeMapping mapping = (SystemFileTransferModeMapping)item.getData();
- if (mapping != null)
- {
- if (property.equals(columnProperties[2])){
-
- if (value instanceof Integer)
- {
- int index = ((Integer)value).intValue();
- if (index == 0) {
- mapping.setAsBinary();
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL);
- }
- else if (index == 1){
- mapping.setAsText();
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_TEXT_LABEL);
- }
- else if (index == 2){
- mapping.setAsXML();
- item.setText(2, FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_XML_LABEL);
- }
- item.setImage(getImageFor(mapping));
- }
-
- }
- else if (property.equals(columnProperties[1])){
- if (value instanceof String)
- {
- String nameExtension = (String)value;
-
- int dotIndex = nameExtension.lastIndexOf('.');
- if (dotIndex != -1)
- {
- String name = nameExtension.substring(0, dotIndex);
-
- String ext = nameExtension.substring(dotIndex + 1);
-
- mapping.setName(name);
- mapping.setExtension(ext);
- item.setText(1, nameExtension);
- }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java
deleted file mode 100644
index e51d40d17..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [195285] mount path mapper changes
- * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.resources;
-
-import java.io.File;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-public class DefaultMountPathMapper implements ISystemMountPathMapper
-{
-
- public boolean handlesMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- return false;
- }
-
- public String getActualHostFor(String hostname, String remotePath)
- {
- return hostname;
- }
-
- public String getWorkspaceMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subSystem)
- {
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- boolean shareCachedFiles = store.getBoolean(ISystemFilePreferencesConstants.SHARECACHEDFILES);
-
- // if we're not sharing cached files, then we need a unique path for each connection
- if (!shareCachedFiles){
- // prefix with the connection alias
- String alias = subSystem.getHostAliasName();
- String configID = subSystem.getConfigurationId();
- return alias + '.' + configID + File.separatorChar + remotePath;
- }
- else {
- return remotePath;
- }
- }
-
- /**
- * Returns the remote path.
- */
- public String getMountedMappingFor(String hostname, String remotePath)
- {
- return remotePath;
- }
-
- public int getPriority(String hostname, String remotePath,
- IRemoteFileSubSystem subsystem) {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/ISystemRemoteCoreConstants.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/ISystemRemoteCoreConstants.java
deleted file mode 100644
index be74af06f..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/ISystemRemoteCoreConstants.java
+++ /dev/null
@@ -1,28 +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.files.ui.resources;
-
-/**
- * Interface that contains all constants needed for remote resource management.
- */
-public interface ISystemRemoteCoreConstants {
-
-
-
- public static final int M_MARKERS_DIRTY = 0x1000;
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemFileNameHelper.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemFileNameHelper.java
deleted file mode 100644
index b5b06c5b2..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemFileNameHelper.java
+++ /dev/null
@@ -1,81 +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) - [168975] Move RSE Events API to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.resources;
-
-import java.io.File;
-
-import org.eclipse.rse.core.model.SystemEscapeCharHelper;
-
-
-/**
- * This class converts a remote file name (including path) to a valid local one by
- * escaping invalid characters in local file names with an _xx escape sequence.
- */
-public class SystemFileNameHelper {
-
-
-
-// protected static final char[] array = {' ', ':', ';', '*', '?', '\'', '"', '<', '>', '|'};
- protected static final char[] array = {' ', ':', '*', '?', '"', '<', '>', '|'};
-
-
-
-
- /**
- * Get the escaped path name. Changes unsupported characters to _xyz.
- */
- public static String getEscapedPath(String path)
- {
- char c = File.separatorChar;
-
- // NOTE: if it's Linux, Unix or iSeries, we don't like '\\' character, i.e. escape it
- if (c == '/') {
- c = '\\';
- }
- // or if Windows, we don't like '/' character, i.e. escape it
- else if (c == '\\')
- {
- c = '/';
- }
-
- // first escape char
- array[0] = c;
-
-
- SystemEscapeCharHelper helper = new SystemEscapeCharHelper(array);
-
- int index = path.indexOf(':');
-
- // DKM - 56907
- if (index == -1 || path.charAt(0)==File.separatorChar)
- {
- return helper.getStringForFileName(path);
- }
- else
- {
- return (path.substring(0, index + 1) + helper.getStringForFileName(path.substring(index + 1)));
- }
- }
-
- /**
- * Gets the unescaped path name. Changes all _xyz to the original unsupported character.
- */
- public static String getUnescapedPath( String path ){
- SystemEscapeCharHelper helper = new SystemEscapeCharHelper(array);
- return helper.getStringFromFileName( path );
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java
deleted file mode 100644
index 5f2cb11f3..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java
+++ /dev/null
@@ -1,894 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * David McKnight (IBM) - [195285] mount path mapper changes
- * David McKnight (IBM) - [228343] RSE unable to recover after RemoteSystemsTempfiles deletion
- * David McKnight (IBM) - [253262] Cache Cleanup is removing .settings directory
- * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache
- * David McKnight (IBM) - [276103] Files with names in different cases are not handled properly
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.resources;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-
-
-/**
- * This is a singleton class that manages the remote editing
- */
-
-public class SystemRemoteEditManager
-{
- public static final String REMOTE_EDIT_PROJECT_NAME = "RemoteSystemsTempFiles"; //$NON-NLS-1$
- public static final String REMOTE_EDIT_PROJECT_NATURE_ID = "org.eclipse.rse.ui.remoteSystemsTempNature"; //$NON-NLS-1$
- public static final String REMOTE_EDIT_PROJECT_BUILDER_ID = "org.eclipse.rse.ui.remoteSystemsTempBuilder"; //$NON-NLS-1$
-
- private static SystemRemoteEditManager inst;
- //private RSEUIPlugin plugin;
- private List _mountPathMappers;
-
- /**
- * Constructor for SystemRemoteEditManager
- */
- private SystemRemoteEditManager()
- {
- super();
- //plugin = RSEUIPlugin.getDefault();
- registerMountPathMappers();
- }
-
- /**
- * Get the singleton instance
- */
- public static SystemRemoteEditManager getInstance()
- {
- if (inst == null)
- inst = new SystemRemoteEditManager();
- return inst;
- }
-
- /**
- * Return the hostname that corresponds to the resource specified on the host specified. If
- * the resource is actually on the specified host, then the result will be the same as hostname. If
- * the resource is mounted then a mount path mapper has the opportunity to return the actual host.
- * @param hostname the system on which a resource is obtained (may contain the file via a mount)
- * @param remotePath the path on the host where the resource is obtained
- * @param subsystem the subsystem
- * @return the actual host where the resource exists
- */
- public String getActualHostFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- ISystemMountPathMapper mapper = getMountPathMapperFor(hostname, remotePath, subsystem);
- if (mapper != null)
- {
- return mapper.getActualHostFor(hostname, remotePath);
- }
- else
- {
- return hostname;
- }
- }
-
- /**
- * Return the path to use on the system (i.e. Windows) for saving from the workspace to remote
- * @param hostname the remote host
- * @param remotePath the file path on the remote host
- * @param subsystem the subsystem
- * @return the system path
- */
- public String getMountPathFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- ISystemMountPathMapper mapper = getMountPathMapperFor(hostname, remotePath, subsystem);
- if (mapper != null)
- {
- return mapper.getMountedMappingFor(hostname, remotePath);
- }
- else
- {
- return remotePath;
- }
- }
-
-
- /**
- * Return the path to use relative to the hostname in the
- * RemoteSystemsTempFiles project for saving a local replica
- *
- * @param hostname the originating remote host
- * @param remotePath the file path on the system (i.e. Windows)
- * @param subsystem the remote subsystem. The subsystem may be null if none
- * is available.
- * @return the relative replica path
- */
- public String getWorkspacePathFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- ISystemMountPathMapper mapper = getMountPathMapperFor(hostname, remotePath, subsystem);
-
- if (mapper != null)
- {
- return mapper.getWorkspaceMappingFor(hostname, remotePath, subsystem);
- }
- else
- {
- return remotePath;
- }
- }
-
- /**
- * Return the appropriate registered mapper for a host & path
- *
- * @param hostname the originating remote host
- * @param remotePath the file path on the system (i.e. Windows)
- * @param subsystem the remote subsystem. The subsystem may be null if none
- * is available.
- * @return appropriate mapper
- */
- public ISystemMountPathMapper getMountPathMapperFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- ISystemMountPathMapper result = null;
- for (int i = 0; i < _mountPathMappers.size(); i++)
- {
- ISystemMountPathMapper mapper = (ISystemMountPathMapper) _mountPathMappers.get(i);
- if (mapper != null)
- {
- if (mapper.handlesMappingFor(hostname, remotePath, subsystem))
- {
- if (result == null) {
- result = mapper;
- }
- else if (mapper.getPriority(hostname, remotePath, subsystem) < result.getPriority(hostname, remotePath, subsystem)){
- result = mapper;
- }
- }
- }
- }
-
- // no result - fall back to the default
- if (result == null){
- return new DefaultMountPathMapper();
- }
-
- return result;
- }
-
- protected void registerMountPathMappers()
- {
- _mountPathMappers = new ArrayList();
-
- // Get reference to the plug-in registry
- IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- // Get configured extenders
- IConfigurationElement[] systemTypeExtensions = registry.getConfigurationElementsFor("org.eclipse.rse.ui", "mountPathMappers"); //$NON-NLS-1$ //$NON-NLS-2$
-
- for (int i = 0; i < systemTypeExtensions.length; i++)
- {
- try
- {
- _mountPathMappers.add(systemTypeExtensions[i].createExecutableExtension("class")); //$NON-NLS-1$
- }
- catch (Exception e)
- {
- }
- }
- }
-
- /**
- * Check if a remote edit project exists
- * @return true if it does
- */
- public boolean doesRemoteEditProjectExist()
- {
- IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot();
-
- IProject editProject = root.getProject(REMOTE_EDIT_PROJECT_NAME);
-
- if ((editProject != null) && (editProject.exists()) && (editProject.isOpen()))
- return true;
- return false;
- }
-
- /**
- * Get the project that in which all folders and files are held temporarily
- * for remote editing. Create the project if it doesn't exist already, and opens
- * it if it is not already open.
- * @return the project where all files should be stored during remote edit.
- */
- public IProject getRemoteEditProject()
- {
- IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot();
-
- IProject editProject = root.getProject(REMOTE_EDIT_PROJECT_NAME);
-
- if ((editProject != null) && (editProject.exists()) && (editProject.isOpen()))
- {
- try
- {
- /* no more java support
- if (!editProject.hasNature(JavaCore.NATURE_ID))
- {
- addJavaSupport(editProject);
- }
- * no need for this anymore
- * normally there is no cdt - so let's not do this everytime
- if (!editProject.hasNature("org.eclipse.cdt.core.cnature"))
- {
- addCSupport(editProject);
- }
- */
- }
- catch (Exception e)
- {
-
- }
- return editProject;
- }
-
- if ((editProject == null) || !(editProject.exists()) || !(editProject.isOpen()))
- editProject = createRemoteEditProject();
-
- return editProject;
- }
-
- /**
- * Creates the remote project, and opens it if it not open.
- * @return the project where all files should be stored during remote editing
- */
- private IProject createRemoteEditProject()
- {
- IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot();
-
- IProject editProject = root.getProject(REMOTE_EDIT_PROJECT_NAME);
-
- if ((editProject != null) && (editProject.exists()) && (editProject.isOpen()))
- {
- /*
- try
- {
- // no java or c support - this needs to be contributed from elsewhere
- if (!editProject.hasNature(JavaCore.NATURE_ID))
- {
- addJavaSupport(editProject);
- }
-
- if (!editProject.hasNature("org.eclipse.cdt.core.cnature"))
- {
- addCSupport(editProject);
- }
-
- }
- catch (CoreException e)
- {
- }
- */
- return editProject;
- }
-
- if (editProject == null)
- {
- // log error and throw an exception
- }
-
- try
- {
- if (editProject != null)
- {
- IProgressMonitor monitor = new NullProgressMonitor();
- if (!editProject.exists())
- editProject.create(monitor);
-
- if (!editProject.isOpen()){
- try {
- editProject.open(monitor);
- }
- catch (CoreException e) {
- // probably no .project file
- // time to start again!
- editProject.delete(true, monitor);
- editProject.create(monitor);
- editProject.open(monitor);
- }
- }
-
- IProjectDescription description = editProject.getDescription();
- String[] natures = description.getNatureIds();
- String[] newNatures = new String[natures.length + 1];
-
- // copy all previous natures
- for (int i = 0; i < natures.length; i++)
- {
- newNatures[i] = natures[i];
- }
-
-
- newNatures[newNatures.length - 1] = REMOTE_EDIT_PROJECT_NATURE_ID;
-
- description.setNatureIds(newNatures);
- editProject.setDescription(description, null);
- // editProject.setDefaultCharset(SystemEncodingUtil.ENCODING_UTF_8, new NullProgressMonitor());
-
-
- // add java support
- //addJavaSupport(editProject);
-
- // add c support
- //addCSupport(editProject);
- }
- }
- catch (CoreException e)
- {
- SystemBasePlugin.logError("Error creating temp project", e); //$NON-NLS-1$
- }
- return editProject;
- }
-/*
- public void addCSupport(IProject editProject)
- {
-
- try
- {
- IProjectDescription description = editProject.getDescription();
- String[] natures = description.getNatureIds();
- ICommand[] buildSpecs = description.getBuildSpec();
-
- String[] newNatures = new String[natures.length + 2];
-
- // copy all previous natures
- for (int i = 0; i < natures.length; i++)
- {
- newNatures[i] = natures[i];
- }
-
- newNatures[newNatures.length - 2] = "org.eclipse.cdt.core.cnature";
- newNatures[newNatures.length - 1] = "org.eclipse.cdt.core.ccnature";//CCProjectNature.CC_NATURE_ID;
-
- description.setNatureIds(newNatures);
-
- // make sure no build specs added
- description.setBuildSpec(buildSpecs);
-
- editProject.setDescription(description, null);
- }
- catch (Exception e)
- {
-
- }
- }
- */
- /*
- public void addJavaSupport(IProject editProject)
- {
-
- try
- {
- IProjectDescription description = editProject.getDescription();
- String[] natures = description.getNatureIds();
- ICommand[] buildSpecs = description.getBuildSpec();
-
- String[] newNatures = new String[natures.length + 1];
-
- // copy all previous natures
- for (int i = 0; i < natures.length; i++)
- {
- newNatures[i] = natures[i];
- }
-
- newNatures[newNatures.length - 1] = JavaCore.NATURE_ID;
-
- description.setNatureIds(newNatures);
- description.setBuildSpec(buildSpecs);
-
-
-
- editProject.setDescription(description, null);
-
-
- IJavaProject proj = JavaCore.create(editProject);
- IPath outputLocation = proj.getOutputLocation();
-
-
- // classpath
- IClasspathEntry[] classpath= new IClasspathEntry[1];
-
- IPath jdkLoc = new Path("org.eclipse.jdt.launching.JRE_CONTAINER");
- ClasspathEntry jreEntry = new ClasspathEntry(
- IPackageFragmentRoot.K_BINARY,
- IClasspathEntry.CPE_CONTAINER,
- jdkLoc,
- ClasspathEntry.INCLUDE_ALL,
- ClasspathEntry.EXCLUDE_NONE,
- null, // source attachment
- null, // source attachment root
- null, // specific output folder
- false);
- classpath[0]=jreEntry;
-
-
- proj.setRawClasspath(classpath, outputLocation, null);
-
- ((JavaProject)proj).deconfigure();
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- */
-
-
- /**
- * Get the location of the project used for remote editing
- */
- public IPath getRemoteEditProjectLocation()
- {
- //if (!doesRemoteEditProjectExist())
- // return null;
- // DKM - originally return null if it doesn't exist
- // but looks like lots of calls reference this expected to get something back
- // so I'll let project creation happen here
-
- return getRemoteEditProject().getLocation();
- }
-
- /**
- * Get the absolute path of the project used for remote editing
- */
- public String getRemoteEditProjectAbsolutePath()
- {
- return getRemoteEditProjectLocation().makeAbsolute().toOSString();
- }
-
- protected int caculateCacheSize()
- {
- if (!doesRemoteEditProjectExist())
- {
- return 0;
- }
- IProject project = getRemoteEditProject();
- String path = project.getLocation().toOSString();
- File file = new File(path);
- return calculateSize(file);
- }
-
- private int calculateSize(File file)
- {
- int size = 0;
- if (file.isFile())
- {
- size = (int) file.length();
- }
- else if (file.isDirectory())
- {
- File[] children = file.listFiles();
- for (int i = 0; i < children.length; i++)
- {
- size += calculateSize(children[i]);
- }
- }
-
- return size;
- }
-
- protected IFile getLeastRecentlyChangedFile(List deletedList)
- {
- // if no project exists, then no file exists
- if (!doesRemoteEditProjectExist())
- return null;
-
- IProject project = getRemoteEditProject();
-
- IFile result = getLeastRecentlyChangedFile(project, deletedList);
- deletedList.add(result);
- return result;
- }
-
- private IFile getLeastRecentlyChangedFile(IContainer file, List deletedList)
- {
-
- IFile result = null;
- try
- {
- IResource[] children = file.members();
- for (int i = 0; i < children.length; i++)
- {
- IFile candidate = null;
- IResource child = children[i];
- if (child instanceof IFolder)
- {
- if (!child.getName().equals(".settings")){ //$NON-NLS-1$
- candidate = getLeastRecentlyChangedFile((IFolder) child, deletedList);
- }
- }
- else
- {
- candidate = (IFile) child;
- }
-
- if (candidate != null && !deletedList.contains(candidate) && !candidate.getName().startsWith(".") && !isFileInUse(candidate, true)) //$NON-NLS-1$
- {
- if (result == null)
- {
- result = candidate;
- }
- else if (candidate.getLocation().toFile().lastModified() < result.getLocation().toFile().lastModified())
- {
- result = candidate;
- }
- }
- }
- }
- catch (Exception e)
- {
- }
- return result;
- }
-
- public ISystemEditableRemoteObject getEditableFor(IFile fileToDelete, boolean quickCheck)
- {
- SystemIFileProperties properties = new SystemIFileProperties(fileToDelete);
- Object object = properties.getRemoteFileObject();
- if (object != null)
- {
- ISystemEditableRemoteObject editableFile = (ISystemEditableRemoteObject) object;
- return editableFile;
- }
- else if (!quickCheck)
- {
- // no object in memory, so try to reconstruct it from ids
- String subsystemStr = properties.getRemoteFileSubSystem();
- String pathStr = properties.getRemoteFilePath();
- if (subsystemStr != null && pathStr != null)
- {
- ISubSystem subsystem = RSECorePlugin.getTheSystemRegistry().getSubSystem(subsystemStr);
- if (subsystem != null)
- {
- Object rmtObject = null;
- try
- {
- rmtObject = subsystem.getObjectWithAbsoluteName(pathStr, new NullProgressMonitor());
- }
- catch (Exception e)
- {
- return null;
- }
- if (rmtObject != null && rmtObject instanceof IAdaptable)
- {
- ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter) ((IAdaptable) rmtObject).getAdapter(ISystemRemoteElementAdapter.class);
- if (adapter != null)
- {
- return adapter.getEditableRemoteObject(rmtObject);
- }
- }
- }
- }
- }
- return null;
- }
-
- public class DeleteFileRunnable implements Runnable
- {
- private IFile _theFile;
- public DeleteFileRunnable(IFile theFile)
- {
- _theFile = theFile;
- }
-
- public void run()
- {
- if (!inUse())
- {
- //System.out.println("deleting " + _theFile.getName());
- _theFile.getLocation().toFile().delete();
- }
- }
-
- public boolean inUse()
- {
- // if no temp files project, not in use
- if (!doesRemoteEditProjectExist())
- return false;
-
- IWorkbenchWindow activeWindow = SystemBasePlugin.getActiveWorkbenchWindow();
- IWorkbenchPage activePage = activeWindow.getActivePage();
-
- IEditorReference[] activeReferences = activePage.getEditorReferences();
-
- IEditorPart part;
-
- for (int k = 0; k < activeReferences.length; k++)
- {
- part = activeReferences[k].getEditor(true);
-
- if (part != null)
- {
- IEditorInput editorInput = part.getEditorInput();
-
- if (editorInput instanceof IFileEditorInput)
- {
- IFile file = ((IFileEditorInput) editorInput).getFile();
- if (file.equals(_theFile))
- {
- //System.out.println(file.getName() + " is in use");
- return true;
- }
- }
- }
-
- }
- return false;
- }
- }
-
- public boolean isFileInUse(IFile fileToDelete, boolean quickCheck)
- {
- // first check for dirty flag
- SystemIFileProperties properties = new SystemIFileProperties(fileToDelete);
- boolean isDirty = properties.getDirty();
- if (isDirty)
- {
- return true;
- }
- else
- {
-
- ISystemEditableRemoteObject editable = getEditableFor(fileToDelete, quickCheck);
- if (editable != null && quickCheck)
- {
- return true;
- }
-
- if (editable != null)
- {
- try
- {
- boolean result = editable.checkOpenInEditor() == ISystemEditableRemoteObject.NOT_OPEN;
- if (!result)
- {
- return !result;
- }
- }
- catch (Exception e)
- {
- }
- }
- }
- return false;
- }
-
- protected void cleanupCache()
- {
-
- IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- boolean enableMaxSize = store.getBoolean(ISystemFilePreferencesConstants.LIMIT_CACHE);
- if (enableMaxSize)
- {
- int max = Integer.parseInt(ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE) * 1000000;
-
- // get the cache limit
- try {
- String maxSize = store.getString(ISystemFilePreferencesConstants.MAX_CACHE_SIZE);
-
- if (maxSize != null && !maxSize.equals("")) { //$NON-NLS-1$
- max = Integer.parseInt(maxSize) * 1000000;
- }
- }
- catch (NumberFormatException nfe) {
- SystemBasePlugin.logError("Could not get max cache size", nfe); //$NON-NLS-1$
- max = Integer.parseInt(ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE) * 1000000;
- }
-
- try {
-
- // get the current cache size
- int currentSize = caculateCacheSize();
- if (currentSize > max)
- {
- // determine what to get rid of
- int delta = currentSize - max;
-
- List deletedList = new ArrayList();
- while (delta > 0)
- {
-
- // need to purge delta from the cache
- IFile leastRecent = getLeastRecentlyChangedFile(deletedList);
- if (leastRecent != null)
- {
-
- File theFile = leastRecent.getLocation().toFile();
-
- int sizeSaved = (int) theFile.length();
- Display.getDefault().asyncExec(new DeleteFileRunnable(leastRecent));
-
- // delete file
- delta -= sizeSaved;
- }
- else
- {
- delta = 0;
- }
- }
- }
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError("Error occured trying to clean cache", e); //$NON-NLS-1$
- // e.printStackTrace();
- }
- }
- }
-
- /**
- * Refresh the remote edit project
- */
- public void refreshRemoteEditProject()
- {
- // no temp files project, then nothing to refresh
- if (!doesRemoteEditProjectExist())
- {
- return;
- }
- try
- {
- IProject project = getRemoteEditProject();
- if (!project.getWorkspace().isTreeLocked())
- {
- cleanupCache();
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError("Error refreshing remote edit project", e); //$NON-NLS-1$
- }
- }
-
- /**
- * Refresh the remote edit project
- */
- public void refreshRemoteEditContainer(IContainer parent)
- {
- // no project exists, then nothing to refresh
- if (!doesRemoteEditProjectExist())
- return;
-
- try
- {
-
- IProject project = getRemoteEditProject();
- if (!project.getWorkspace().isTreeLocked())
- {
- cleanupCache();
- parent.refreshLocal(IResource.DEPTH_ONE, null);
- }
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError("Error refreshing remote edit project", e); //$NON-NLS-1$
- }
- }
-
-
- public static SystemEditableRemoteFile getEditableRemoteObject(Object element, IEditorDescriptor descriptor)
- {
- SystemEditableRemoteFile editable = null;
- RemoteFile remoteFile = (RemoteFile) element;
- if (remoteFile.isFile())
- {
- try
- {
- IFile file = (IFile)UniversalFileTransferUtility.getTempFileFor(remoteFile);
- if (file != null)
- {
- SystemIFileProperties properties = new SystemIFileProperties(file);
-
- Object obj = properties.getRemoteFileObject();
- if (obj != null && obj instanceof SystemEditableRemoteFile)
- {
- editable = (SystemEditableRemoteFile) obj;
-
- String remotePath = remoteFile.getAbsolutePath();
- String replicaRemotePath = editable.getAbsolutePath();
- // first make sure that the correct remote file is referenced (might be difference because of different case)
- if (!replicaRemotePath.equals(remotePath)){ // for bug 276103
-
- IEditorPart editor = editable.getEditorPart();
- boolean editorWasClosed = false;
- if (editor.isDirty()){
- editorWasClosed = editor.getEditorSite().getPage().closeEditor(editor, true);
- if (editorWasClosed)
- editable.doImmediateSaveAndUpload();
- }
- else {
- editorWasClosed = editor.getEditorSite().getPage().closeEditor(editor, true);
- }
-
- if (!editorWasClosed){
- // use cancelled operation so we need to get out of here
- return null;
- }
-
- try {
- IFile originalFile = editable.getLocalResource();
- originalFile.delete(true, new NullProgressMonitor());
- }
- catch (CoreException e){
- }
- // fall through and let the new editable get created
- }
- else {
- return editable;
- }
- }
- }
-
- if (descriptor != null){
- editable = new SystemEditableRemoteFile(remoteFile, descriptor);
- }
- else {
- editable = new SystemEditableRemoteFile(remoteFile);
- }
- }
- catch (Exception e)
- {
- }
- }
- return editable;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarker.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarker.java
deleted file mode 100644
index 13d75b762..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarker.java
+++ /dev/null
@@ -1,288 +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:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.resources;
-
-import java.util.Map;
-
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarker;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteResource;
-
-/**
- * This class is an internal implementation of the ISystemRemoteMarker
- * interface.
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class SystemRemoteMarker implements ISystemRemoteMarker {
-
- /**
- * Resource with which this marker is associated.
- */
- protected ISystemRemoteResource resource;
-
- /**
- * The marker id.
- */
- protected long id;
-
- /**
- * Constructor for SystemRemoteMarker.
- */
- public SystemRemoteMarker(ISystemRemoteResource resource, long id) {
- this.resource = resource;
- this.id = id;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#delete()
- */
- public void delete() {
- SystemRemoteMarkerManager.getInstance().removeMarker(getResource(), getId());
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#equals(Object)
- */
- public boolean equals(Object object) {
-
- if (!(object instanceof ISystemRemoteMarker)) {
- return false;
- }
- else {
- ISystemRemoteMarker other = (ISystemRemoteMarker)object;
- return (id == other.getId()) && (resource.equals(other.getResource()));
- }
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#exists()
- */
- public boolean exists() {
- return getInfo() != null;
- }
-
- /**
- * Get the marker info.
- * @return the marker info.
- */
- private SystemRemoteMarkerInfo getInfo() {
- return SystemRemoteMarkerManager.getInstance().findMarkerInfo(getResource(), getId());
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getAttribute(String)
- */
- public Object getAttribute(String attributeName) {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return null;
- }
-
- return info.getAttribute(attributeName);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getAttribute(String, int)
- */
- public int getAttribute(String attributeName, int defaultValue) {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return defaultValue;
- }
-
- Object value = info.getAttribute(attributeName);
-
- if ((value != null) && (value instanceof Integer)) {
- return ((Integer)value).intValue();
- }
-
- return defaultValue;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getAttribute(String, String)
- */
- public String getAttribute(String attributeName, String defaultValue) {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return defaultValue;
- }
-
- Object value = info.getAttribute(attributeName);
-
- if ((value != null) && (value instanceof String)) {
- return (String)value;
- }
-
- return defaultValue;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getAttribute(String, boolean)
- */
- public boolean getAttribute(String attributeName, boolean defaultValue) {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return defaultValue;
- }
-
- Object value = info.getAttribute(attributeName);
-
- if ((value != null) && (value instanceof Integer)) {
- return ((Boolean)value).booleanValue();
- }
-
- return defaultValue;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getAttributes()
- */
- public Map getAttributes() {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return null;
- }
-
- return info.getAttributes();
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getAttributes(String[])
- */
- public Object[] getAttributes(String[] attributeNames) {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return new Object[0];
- }
-
- return info.getAttributes(attributeNames);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getCreationTime()
- */
- public long getCreationTime() {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return -1;
- }
-
- return info.getCreationTime();
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getId()
- */
- public long getId() {
- return id;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getResource()
- */
- public ISystemRemoteResource getResource() {
- return resource;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#getType()
- */
- public String getType() {
- SystemRemoteMarkerInfo info = getInfo();
-
- if (info == null) {
- return null;
- }
-
- return info.getType();
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#isSubtypeOf(String)
- */
- public boolean isSubtypeOf(String superType) {
- String type = getType();
-
- if (type == null) {
- return false;
- }
-
- return SystemRemoteMarkerManager.getInstance().getCache().isSubtype(type, superType);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#setAttribute(String, int)
- */
- public void setAttribute(String attributeName, int value) {
- setAttribute(attributeName, new Integer(value));
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#setAttribute(String, Object)
- */
- public void setAttribute(String attributeName, Object value) {
- SystemRemoteMarkerManager manager = SystemRemoteMarkerManager.getInstance();
- SystemRemoteMarkerInfo info = getInfo();
- info.setAttribute(attributeName, value);
-
- if (manager.isPersistent(info)) {
- ((SystemRemoteResource)resource).getResourceInfo().set(ISystemRemoteCoreConstants.M_MARKERS_DIRTY); // need to change this
- }
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#setAttribute(String, boolean)
- */
- public void setAttribute(String attributeName, boolean value) {
- setAttribute(attributeName, value ? Boolean.TRUE : Boolean.FALSE);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#setAttributes(String[], Object[])
- */
- public void setAttributes(String[] attributeNames, Object[] values) {
- SystemRemoteMarkerManager manager = SystemRemoteMarkerManager.getInstance();
- SystemRemoteMarkerInfo info = getInfo();
- info.setAttributes(attributeNames, values);
-
- if (manager.isPersistent(info)) {
- ((SystemRemoteResource)resource).getResourceInfo().set(ISystemRemoteCoreConstants.M_MARKERS_DIRTY); // need to change this
- }
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarker#setAttributes(Map)
- */
- public void setAttributes(Map attributes) {
- SystemRemoteMarkerManager manager = SystemRemoteMarkerManager.getInstance();
- SystemRemoteMarkerInfo info = getInfo();
- info.setAttributes(attributes);
-
- if (manager.isPersistent(info)) {
- ((SystemRemoteResource)resource).getResourceInfo().set(ISystemRemoteCoreConstants.M_MARKERS_DIRTY); // need to change this
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerInfo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerInfo.java
deleted file mode 100644
index 27dbbf5b2..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerInfo.java
+++ /dev/null
@@ -1,236 +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.files.ui.resources;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarkerSetElement;
-
-/**
- * Objects of this type contain marker information.
- */
-public class SystemRemoteMarkerInfo implements ISystemRemoteMarkerSetElement, Cloneable {
-
-
-
- // undefined static id
- protected static final long UNDEFINED_ID = -1;
-
- // marker identifier
- protected long id = UNDEFINED_ID;
-
- // marker type
- protected String type = null;
-
- // marker attributes
- protected Map attributes = null;
-
- // marker creation type
- protected long creationTime = 0;
-
- /**
- * Constructor for SystemRemoteMarkerInfo.
- */
- public SystemRemoteMarkerInfo() {
- super();
- }
-
- /**
- * Set the marker id.
- * @param id the id
- */
- public void setId(long id) {
- this.id = id;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteMarkerSetElement#getId()
- */
- public long getId() {
- return id;
- }
-
- /**
- * Set the type.
- * @param type the marker type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Get the type.
- * @return the marker type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Set the attributes.
- * @param attributes the attributes
- */
- public void setAttributes(Map attributes) {
- this.attributes = attributes;
- }
-
- /**
- * Get the attributes.
- * @return the attributes
- */
- public Map getAttributes() {
- return getAttributes(true);
- }
-
- /**
- * Get the attributes.
- * @param makeCopy specify whether to return a copy or the actual map
- * @return the attribute map
- */
- public Map getAttributes(boolean makeCopy) {
-
- if (attributes == null) {
- return null;
- }
-
- if (makeCopy) {
- HashMap newAttributes = new HashMap();
- newAttributes.putAll(attributes);
- return newAttributes;
- }
- else {
- return attributes;
- }
- }
-
- /**
- * Set the creation time.
- * @param creationTime the creation time
- */
- public void setCreationTime(long creationTime) {
- this.creationTime = creationTime;
- }
-
- /**
- * Get the creation time.
- * @return the creation time
- */
- public long getCreationTime() {
- return creationTime;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- protected Object clone() throws CloneNotSupportedException {
- SystemRemoteMarkerInfo copy = (SystemRemoteMarkerInfo)(super.clone());
- copy.setAttributes(getAttributes());
- return copy;
- }
-
- /**
- * Get attribute values given the attribute names.
- * @param attributeNames the array of attribute names
- * @return the array of attribute values
- */
- public Object[] getAttributes(String[] attributeNames) {
- Object[] result = new Object[attributeNames.length];
-
- for (int i = 0; i < attributeNames.length; i++)
- result[i] = getAttribute(attributeNames[i]);
-
- return result;
- }
-
- /**
- * Get the attribute value given the attribute name.
- * @param attributeName the attribute name
- * @return the attribute value
- */
- public Object getAttribute(String attributeName) {
-
- if (attributes == null) {
- return null;
- }
- else {
- return attributes.get(attributeName);
- }
- }
-
- /**
- * Checks if attribute value is valid.
- * @param value the attribute value
- * @return true if value is null, or a String, or an Integer, or a Boolean
- */
- protected static boolean isValidAttributeValue(Object value) {
- return (value == null || value instanceof String || value instanceof Integer || value instanceof Boolean);
- }
-
- /**
- * Set the value of an attribute.
- * @param attributeName the attribute name
- * @param value the value of the attribute
- */
- public void setAttribute(String attributeName, Object value) {
-
- if (!isValidAttributeValue(value)) {
- return;
- }
-
- if (attributes == null) {
-
- if (value == null) {
- return;
- }
- else {
- attributes = new HashMap();
- attributes.put(attributeName, value);
- }
- }
- else {
-
- if (value == null) {
- attributes.remove(attributeName);
-
- if (attributes.isEmpty()) {
- attributes = null;
- }
- }
- else {
- attributes.put(attributeName, value);
- }
- }
- }
-
- /**
- * Set the values of an array of attributes
- * @param attributeNames the attribute names
- * @param values the attribute values
- */
- public void setAttributes(String[] attributeNames, Object[] values) {
-
- if (!(attributeNames.length == values.length)) {
- return;
- }
-
- for (int i = 0; i < attributeNames.length; i++) {
- setAttribute(attributeNames[i], values[i]);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerManager.java
deleted file mode 100644
index 362e02990..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerManager.java
+++ /dev/null
@@ -1,405 +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.files.ui.resources;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteManager;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarker;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarkerSetElement;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteResource;
-
-/**
- * This singleton class manages all remote markers.
- */
-public class SystemRemoteMarkerManager implements ISystemRemoteManager {
-
-
-
- private static SystemRemoteMarkerManager instance;
-
- // cache of marker type definitions
- private SystemRemoteMarkerTypeDefinitionCache cache;
-
- // the next marker id
- private long nextMarkerId = 0;
-
- // constant to indicate no marker infos
- private static final SystemRemoteMarkerInfo[] NO_MARKER_INFO = new SystemRemoteMarkerInfo[0];
-
- // constant to indicate no markers
- private static final ISystemRemoteMarker[] NO_MARKER = new ISystemRemoteMarker[0];
-
- /**
- * Constructor for SystemRemoteMarkerManager.
- */
- private SystemRemoteMarkerManager() {
- super();
- cache = new SystemRemoteMarkerTypeDefinitionCache();
- }
-
- /**
- * Get the singleton instance.
- * @return the manager object
- */
- public static SystemRemoteMarkerManager getInstance() {
-
- if (instance == null) {
- instance = new SystemRemoteMarkerManager();
- }
-
- return instance;
- }
-
- /**
- * Get the cache.
- * @return the cache
- */
- public SystemRemoteMarkerTypeDefinitionCache getCache() {
- return cache;
- }
-
- /**
- * Get the next marker id.
- * @return the next marker id
- */
- public long getNextMarkerId() {
- return nextMarkerId++;
- }
-
- /**
- * Adds the given markers to the given resource.
- * @param resource the resource
- * @param newMarkers the marker infos
- */
- public void add(ISystemRemoteResource resource, SystemRemoteMarkerInfo[] newMarkers) {
-
- if (newMarkers.length == 0)
- return;
-
- SystemRemoteResource target = (SystemRemoteResource) resource;
- SystemRemoteResourceInfo info = target.getResourceInfo();
-
- if (info == null) {
- return;
- }
-
- // set the flag to indicate that the resource's markers have changed
- if (isPersistent(newMarkers))
- info.set(ISystemRemoteCoreConstants.M_MARKERS_DIRTY);
-
- SystemRemoteMarkerSet markers = info.getMarkers();
-
- if (markers == null) {
- markers = new SystemRemoteMarkerSet(newMarkers.length);
- }
-
- basicAdd(resource, markers, newMarkers);
-
- if (!markers.isEmpty()) {
- info.setMarkers(markers);
- }
- }
-
- /**
- * Adds the new markers to the given set of markers for the given resource.
- * @param the resource
- * @param the set of markers for the resource
- * @param the new marker infos
- */
- private void basicAdd(ISystemRemoteResource resource, SystemRemoteMarkerSet markers, SystemRemoteMarkerInfo[] newMarkers) {
-
- for (int i = 0; i < newMarkers.length; i++) {
-
- SystemRemoteMarkerInfo newMarker = newMarkers[i];
- newMarker.setId(getNextMarkerId());
- markers.add(newMarker);
- }
- }
-
- /**
- * Removes a marker.
- * @param resource the resource.
- * @param id the marker id
- */
- public void removeMarker(ISystemRemoteResource resource, long id) {
- SystemRemoteMarkerInfo markerInfo = findMarkerInfo(resource, id);
-
- if (markerInfo == null)
- return;
-
- SystemRemoteResourceInfo info = ((SystemRemoteResource)(resource)).getResourceInfo();
-
- if (info == null) {
- return;
- }
-
- SystemRemoteMarkerSet markers = info.getMarkers();
- int size = markers.size();
- markers.remove(markerInfo);
-
- // if that was the last marker remove the set to save space.
- if (markers.size() == 0) {
- info.setMarkers(null);
- }
-
- // if we actually did remove a marker, post a delta for the change.
- if (markers.size() != size) {
-
- if (isPersistent(markerInfo)) {
- info.set(ISystemRemoteCoreConstants.M_MARKERS_DIRTY);
- }
- }
- }
-
- /**
- * Finds a marker info given a resource, and the marker id.
- * @param resource the resource.
- * @param id the marker id
- * @return the marker info
- */
- public SystemRemoteMarkerInfo findMarkerInfo(ISystemRemoteResource resource, long id) {
- SystemRemoteResourceInfo info = ((SystemRemoteResource)(resource)).getResourceInfo();
-
- if (info == null) {
- return null;
- }
-
- SystemRemoteMarkerSet markers = info.getMarkers();
-
- if (markers == null) {
- return null;
- }
-
- return (SystemRemoteMarkerInfo)(markers.get(id));
- }
-
- /**
- * Removes markers of the given type, and optionally all the subtypes, from
- * the given resource.
- * @param resource the resource
- * @param type the type
- * @param includeSubtypes flag indicating whether to include subtypes
- */
- public void removeMarkers(ISystemRemoteResource resource, String type, boolean includeSubtypes) {
- SystemRemoteResourceInfo info = ((SystemRemoteResource)(resource)).getResourceInfo();
-
- if (info == null) {
- return;
- }
-
- SystemRemoteMarkerSet markers = info.getMarkers();
-
- if (markers == null) {
- return;
- }
-
- ISystemRemoteMarkerSetElement[] matching;
-
- // if type is null, then we want all the markers
- // otherwise we need a subset
- if (type == null) {
- matching = markers.elements();
- info.setMarkers(null);
- }
- else {
- matching = basicFindMatching(markers, type, includeSubtypes);
-
- // if nothing matches, simply return
- if (matching.length == 0) {
- return;
- }
- else {
- markers.removeAll(matching);
-
- // if the marker set is empty, then make it null to save memory
- if (markers.size() == 0) {
- info.setMarkers(null);
- }
- }
- }
- }
-
- /**
- * Returns the markers in the given set of markers which match the given type,
- * and optionally including subtypes.
- * @param the marker set
- * @param the type
- * @param flag indicating whether to include subtypes
- */
- private SystemRemoteMarkerInfo[] basicFindMatching(SystemRemoteMarkerSet markers, String type, boolean includeSubtypes) {
- int size = markers.size();
-
- if (size <= 0) {
- return NO_MARKER_INFO;
- }
-
- List result = new ArrayList(size);
-
- ISystemRemoteMarkerSetElement[] elements = markers.elements();
-
- for (int i = 0; i < elements.length; i++) {
- SystemRemoteMarkerInfo marker = (SystemRemoteMarkerInfo)(elements[i]);
-
- // if the type is null, then we are looking for all types of markers
- if (type == null) {
- result.add(marker);
- }
- else {
- if (includeSubtypes) {
-
- if (cache.isSubtype(marker.getType(), type)) {
- result.add(marker);
- }
- }
- else {
-
- if (marker.getType().equals(type)) {
- result.add(marker);
- }
- }
- }
- }
-
- size = result.size();
-
- if (size <= 0) {
- return NO_MARKER_INFO;
- }
-
- return (SystemRemoteMarkerInfo[])(result.toArray(new SystemRemoteMarkerInfo[size]));
- }
-
- /**
- * Returns the marker with the given id or <code>null</code> if none is found.
- * @param resource the resource
- * @param id the id of the marker to find
- * @return the marker, or <code>null</code> if none s found.
- */
- public ISystemRemoteMarker findMarker(ISystemRemoteResource resource, long id) {
- SystemRemoteMarkerInfo info = findMarkerInfo(resource, id);
- return info == null ? null : new SystemRemoteMarker(resource, info.getId());
- }
-
- /**
- * Returns all markers of the specified type on the given target, and optionally the subtypes as well.
- * Passing <code>null</code> for the type specifies a matching target for all types.
- * @param resource the resource
- * @param type the type
- * @param includeSubtypes flag indicating whether to include subtypes
- */
- public ISystemRemoteMarker[] findMarkers(ISystemRemoteResource resource, String type, boolean includeSubtypes) {
- SystemRemoteResourceInfo info = ((SystemRemoteResource)resource).getResourceInfo();
-
- if (info == null) {
- return NO_MARKER;
- }
-
- ArrayList result = new ArrayList();
-
- SystemRemoteMarkerSet markers = info.getMarkers();
-
- // add the matching markers for this resource
- if (markers != null) {
-
- ISystemRemoteMarkerSetElement[] matching;
-
- if (type == null) {
- matching = markers.elements();
- }
- else {
- matching = basicFindMatching(markers, type, includeSubtypes);
- }
-
- buildMarkers(resource, matching, result);
- }
-
- return (ISystemRemoteMarker[])(result.toArray(new ISystemRemoteMarker[result.size()]));
- }
-
- /**
- * Adds the markers on the given target which match the specified type to the list.
- * @param the target resource
- * @param the marker elements
- * @param the list to add to
- */
- private void buildMarkers(ISystemRemoteResource resource, ISystemRemoteMarkerSetElement[] markers, ArrayList list) {
-
- if (markers.length == 0) {
- return;
- }
-
- list.ensureCapacity(list.size() + markers.length);
-
- for (int i = 0; i < markers.length; i++) {
- list.add(new SystemRemoteMarker(resource, ((SystemRemoteMarkerInfo)markers[i]).getId()));
- }
- }
-
- /**
- * Returns whether marker info is persistent.
- * @param info the marker info
- * @return true if the given marker represented by this info is persistent,
- * and false otherwise.
- */
- public boolean isPersistent(SystemRemoteMarkerInfo info) {
- return cache.isPersistent(info.getType());
- }
-
- /**
- * Returns whether given marker is persistent.
- * @param marker the marker
- * @return true if the given marker is persistent, and false
- * otherwise.
- */
- public boolean isPersistent(ISystemRemoteMarker marker) {
- return cache.isPersistent(marker.getType());
- }
-
- /**
- * Returns whether any of the marker infos are persistent.
- * @param infos the marker infos
- * @return true if the a marker represented by any of the infos is persistent,
- * and false otherwise.
- */
- public boolean isPersistent(SystemRemoteMarkerInfo[] infos) {
-
- for (int i = 0; i < infos.length; i++) {
-
- if (cache.isPersistent(infos[i].getType())) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteManager#startup(IProgressMonitor)
- */
- public void startup(IProgressMonitor monitor) {
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteManager#shutdown(IProgressMonitor)
- */
- public void shutdown(IProgressMonitor monitor) {
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerSet.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerSet.java
deleted file mode 100644
index 181c4d3e3..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerSet.java
+++ /dev/null
@@ -1,357 +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.files.ui.resources;
-
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarkerSetElement;
-
-/**
- * This class represents a set of markers.
- */
-public class SystemRemoteMarkerSet {
-
-
-
- /**
- * constant indicating the minimum size
- */
- private static final int MINIMUM_SIZE = 5;
-
- /**
- * Number of elements in the set
- */
- private int elementCount = 0;
-
- /**
- * Array of elements in the set
- */
- private ISystemRemoteMarkerSetElement[] elements;
-
- /**
- * Constructor for SystemRemoteMarkerSet.
- */
- public SystemRemoteMarkerSet() {
- this(MINIMUM_SIZE);
- }
-
- /**
- * Constructor for SystemRemoteMarkerSet.
- * @param capacity the initial capacity
- */
- public SystemRemoteMarkerSet(int capacity) {
- super();
- this.elements = new ISystemRemoteMarkerSetElement[Math.max(MINIMUM_SIZE, capacity * 2)];
- }
-
- /**
- * Add an element to the set.
- * @param element the element to add to the set
- */
- public void add(ISystemRemoteMarkerSetElement element) {
-
- if (element == null)
- return;
-
- int hash = hashFor(element.getId()) % elements.length;
-
- // search for an empty slot at the end of the array
- for (int i = hash; i < elements.length; i++) {
-
- if (elements[i] == null) {
- elements[i] = element;
- elementCount++;
-
- // grow if necessary
- if (shouldGrow()) {
- expand();
- }
-
- return;
- }
- }
-
- // search for an empty slot at the beginning of the array
- for (int i = 0; i < hash - 1; i++) {
-
- if (elements[i] == null) {
- elements[i] = element;
- elementCount++;
-
- // grow if necessary
- if (shouldGrow()) {
- expand();
- }
-
- return;
- }
- }
-
- // if we didn't find a free slot, then try again with the expanded set
- expand();
- add(element);
- }
-
- /**
- * Add multiple elements.
- * @param elements the elements to add to the set
- */
- public void addAll(ISystemRemoteMarkerSetElement[] elements) {
-
- for (int i = 0; i < elements.length; i++) {
- add(elements[i]);
- }
- }
-
- /**
- * Returns whether the set contains an element with the given id.
- * @param id the id to search for
- * @return true if there is an element with the given id, false otherwise
- */
- public boolean contains(long id) {
- return get(id) != null;
- }
-
- /**
- * Get the elements in the set as an array.
- * @return an array of elements that are in the set
- */
- public ISystemRemoteMarkerSetElement[] elements() {
- ISystemRemoteMarkerSetElement[] result = new ISystemRemoteMarkerSetElement[elementCount];
-
- int j = 0;
-
- for (int i = 0; i < elements.length; i++) {
-
- ISystemRemoteMarkerSetElement element = elements[i];
-
- if (element != null) {
- result[j] = element;
- j++;
- }
- }
-
- return result;
- }
-
- /**
- * Doubles the size of the internal array, and rehash all the values
- */
- private void expand() {
- ISystemRemoteMarkerSetElement[] array = new ISystemRemoteMarkerSetElement[elements.length * 2];
-
- int maxArrayIndex = array.length - 1;
-
- for (int i = 0; i < elements.length; i++) {
-
- ISystemRemoteMarkerSetElement element = elements[i];
-
- if (element != null) {
-
- int hash = hashFor(element.getId()) % array.length;
-
- while (array[hash] != null) {
-
- hash++;
-
- if (hash > maxArrayIndex) {
- hash = 0;
- }
- }
-
- array[hash] = element;
- }
- }
-
- elements = array;
- }
-
- /**
- * Returns the set element with the given id, or null if none
- * is found.
- * @param id the id to search for
- * @return the element, if found, or null
- */
- public ISystemRemoteMarkerSetElement get(long id) {
-
- if (elementCount == 0) {
- return null;
- }
-
- int hash = hashFor(id) % elements.length;
-
- // search the last half of the array
- for (int i = hash; i < elements.length; i++) {
-
- ISystemRemoteMarkerSetElement element = elements[i];
-
- if (element == null) {
- return null;
- }
-
- if (element.getId() == id) {
- return element;
- }
- }
-
- // search the beginning of the array
- for (int i = 0; i < hash - 1; i++) {
-
- ISystemRemoteMarkerSetElement element = elements[i];
-
- if (element == null) {
- return null;
- }
-
- if (element.getId() == id) {
- return element;
- }
- }
-
- // no element found, so return null
- return null;
- }
-
- /**
- * Hash key for the id.
- * @param the id
- * @return the hash value
- */
- private int hashFor(long id) {
- return Math.abs((int) id);
- }
-
- /**
- * Returns if the set is empty.
- * @return true if the set is empty, false otherwise.
- */
- public boolean isEmpty() {
- return elementCount == 0;
- }
-
- /**
- * Does a rehash when the element from the given index is removed.
- * @param the index of the element removed.
- */
- private void rehashTo(int anIndex) {
- int target = anIndex;
- int index = anIndex + 1;
-
- if (index >= elements.length) {
- index = 0;
- }
-
- ISystemRemoteMarkerSetElement element = elements[index];
-
- while (element != null) {
-
- int hashIndex = hashFor(element.getId()) % elements.length;
- boolean match;
-
- if (index < target) {
- match = !(hashIndex > target || hashIndex <= index);
- }
- else {
- match = !(hashIndex > target && hashIndex <= index);
- }
- if (match) {
- elements[target] = element;
- target = index;
- }
-
- index++;
-
- if (index >= elements.length) {
- index = 0;
- }
-
- element = elements[index];
- }
-
- elements[target] = null;
- }
-
- /**
- * Removes an element with the given id from the set.
- * @param id the id of the element to remove.
- */
- public void remove(long id) {
- int hash = hashFor(id) % elements.length;
-
- for (int i = hash; i < elements.length; i++) {
-
- ISystemRemoteMarkerSetElement element = elements[i];
-
- if (element == null) {
- return;
- }
- if (element.getId() == id) {
- rehashTo(i);
- elementCount--;
- }
- }
-
- for (int i = 0; i < hash - 1; i++) {
-
- ISystemRemoteMarkerSetElement element = elements[i];
-
- if (element == null) {
- return;
- }
- if (element.getId() == id) {
- rehashTo(i);
- elementCount--;
- }
- }
- }
-
- /**
- * Removes the given element from the set. Uses the element id
- * to search for the element in the set.
- * @param element the element
- */
- public void remove(ISystemRemoteMarkerSetElement element) {
- remove(element.getId());
- }
-
- /**
- * Removes all of the elements in the given array from the set.
- * @param elements the array of elements to remove
- */
- public void removeAll(ISystemRemoteMarkerSetElement[] elements) {
-
- for (int i = 0; i < elements.length; i++) {
- remove(elements[i]);
- }
- }
-
- /**
- * Returns whether the internal storage should grow. Currently, returns <code>true</coe>
- * if internal array is more that 75% full.
- * @return true if the internal storage should grow, false otherwise
- */
- private boolean shouldGrow() {
- return elementCount > elements.length * 0.75;
- }
-
- /**
- * Returns the number of elements in the set.
- * @return the number of elements in the set.
- */
- public int size() {
- return elementCount;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinition.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinition.java
deleted file mode 100644
index a892ee479..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinition.java
+++ /dev/null
@@ -1,142 +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.files.ui.resources;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-
-/**
- * This class represents a marker type definition.
- */
-public class SystemRemoteMarkerTypeDefinition {
-
-
-
- protected String type = null;
- protected String name = null;
- protected boolean isPersistent = false;
- protected Set superTypes = null;
- protected Set attributeNames = null;
-
- /**
- * Constructor for SystemRemoteMarkerTypeDefinition.
- */
- public SystemRemoteMarkerTypeDefinition(IExtension ext) {
- super();
- this.type = ext.getUniqueIdentifier();
- this.name = ext.getLabel();
- process(ext);
- }
-
- /**
- * Processes the extension
- * @param the extension
- */
- private void process(IExtension ext) {
- Set types = null;
- Set attributes = null;
- IConfigurationElement[] elements = ext.getConfigurationElements();
-
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
-
- // supertype
- if (element.getName().equalsIgnoreCase("super")) { //$NON-NLS-1$
- String type = element.getAttribute("type"); //$NON-NLS-1$
-
- if (type != null) {
-
- if (types == null) {
- types = new HashSet(3);
- }
-
- types.add(type);
- }
- }
-
- // attribute name
- if (element.getName().equalsIgnoreCase("attribute")) { //$NON-NLS-1$
- String name = element.getAttribute("name"); //$NON-NLS-1$
-
- if (name != null) {
-
- if (attributes == null) {
- attributes = new HashSet(3);
- }
-
- attributes.add(name);
- }
- }
-
- // persistence
- if (element.getName().equalsIgnoreCase("persistent")) { //$NON-NLS-1$
- String bool = element.getAttribute("value"); //$NON-NLS-1$
-
- if (bool != null) {
- this.isPersistent = (new Boolean(bool)).booleanValue();
- }
- }
- }
-
- this.superTypes = types;
- this.attributeNames = attributes;
- }
-
- /**
- * Get the type.
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Get the name.
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns whether it is persistent.
- * @return true if persistent, false othwerwise
- */
- public boolean isPersistent() {
- return isPersistent;
- }
-
- /**
- * Get super types.
- * @return the super types
- */
- public Set getSuperTypes() {
- return superTypes;
- }
-
- /**
- * Get the attribute names.
- * @return the attribute names
- */
- public Set getAttributeNames() {
- return attributeNames;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinitionCache.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinitionCache.java
deleted file mode 100644
index 947e470af..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteMarkerTypeDefinitionCache.java
+++ /dev/null
@@ -1,125 +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.files.ui.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarker;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is a cache of all marker type definitions.
- */
-public class SystemRemoteMarkerTypeDefinitionCache {
-
-
-
- // cache of marker definitions
- protected HashMap definitions;
-
- // cache of marker type hierarchies
- protected HashMap lookup;
-
- /**
- * Constructor for SystemRemoteMarkerTypeDefinitionCache.
- */
- public SystemRemoteMarkerTypeDefinitionCache() {
- super();
- initializeCache();
- }
-
- /**
- * Initialize the cache.
- */
- private void initializeCache() {
- loadDefinitions();
- lookup = new HashMap(definitions.size());
-
- for (Iterator i = definitions.keySet().iterator(); i.hasNext();) {
- computeSuperTypes((String)(i.next()));
- }
- }
-
- /**
- * Load marker type definitions.
- */
- private void loadDefinitions() {
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(RSEUIPlugin.PLUGIN_ID, ISystemRemoteMarker.EXTENSION_POINT_ID);
- IExtension[] types = point.getExtensions();
- definitions = new HashMap(types.length);
-
- for (int i = 0; i < types.length; i++) {
- definitions.put(types[i].getUniqueIdentifier(), new SystemRemoteMarkerTypeDefinition(types[i]));
- }
- }
-
- /**
- * Compute the super types given a marker id.
- * @param a marker id
- */
- private void computeSuperTypes(String id) {
- Set entry = new HashSet(5);
- List queue = new ArrayList(5);
- queue.add(id);
-
- while (!queue.isEmpty()) {
- String type = (String)(queue.remove(0));
- entry.add(type);
- SystemRemoteMarkerTypeDefinition def = (SystemRemoteMarkerTypeDefinition)(definitions.get(type));
-
- if (def != null) {
- Set newEntries = def.getSuperTypes();
-
- if (newEntries != null)
- queue.addAll(newEntries);
- }
- }
-
- lookup.put(id, entry);
- }
-
- /**
- * Returns whether the given marker type is defined to be persistent.
- * @param type the marker type
- * @return true if marker type is persistent, false otherwise
- */
- public boolean isPersistent(String type) {
- SystemRemoteMarkerTypeDefinition def = (SystemRemoteMarkerTypeDefinition)(definitions.get(type));
- return (def != null) && (def.isPersistent());
- }
-
- /**
- * Returns whether the given type is a subtype of the given supertype.
- * @param type a marker type
- * @param superType another marker type
- * @return true if type is a subtype of supertype, false otherwise
- */
- public boolean isSubtype(String type, String superType) {
- Set entry = (Set)(lookup.get(type));
- return (entry != null) && (entry.contains(superType));
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemotePath.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemotePath.java
deleted file mode 100644
index dbf67757d..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemotePath.java
+++ /dev/null
@@ -1,99 +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.files.ui.resources;
-
-import org.eclipse.rse.files.ui.resources.ISystemRemotePath;
-
-/**
- * A default implementation of a remote path.
- */
-public class SystemRemotePath implements ISystemRemotePath {
-
-
-
- public static final ISystemRemotePath ROOT = new SystemRemotePath("", "", "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- protected String profileName;
- protected String connectionName;
- protected String path;
-
- /**
- * Constructor for SystemRemotePath.
- * @param profileName profile name
- * @param connectionName connection name
- * @param path
- */
- public SystemRemotePath(String profileName, String connectionName, String path) {
- super();
- setProfileName(profileName);
- setConnectionName(connectionName);
- setPath(path);
- }
-
- /**
- * Set the profile name.
- * @param profileName the profile name
- */
- public void setProfileName(String profileName) {
- this.profileName = profileName;
- }
-
- /**
- * Set the connection name.
- * @param connectionName the connection name
- */
- public void setConnectionName(String connectionName) {
- this.connectionName = connectionName;
- }
-
- /**
- * Set the remote path.
- * @param path the path
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemotePath#getProfileName()
- */
- public String getProfileName() {
- return profileName;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemotePath#getConnectionName()
- */
- public String getConnectionName() {
- return connectionName;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemotePath#getPath()
- */
- public String getPath() {
- return path;
- }
-
- /**
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object obj) {
- return (profileName.equalsIgnoreCase(profileName)) && (connectionName.equalsIgnoreCase(connectionName)) && (path.equalsIgnoreCase(path));
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResource.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResource.java
deleted file mode 100644
index 7c00cd885..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResource.java
+++ /dev/null
@@ -1,179 +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.files.ui.resources;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteMarker;
-import org.eclipse.rse.files.ui.resources.ISystemRemotePath;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteResource;
-
-/**
- * This class is the internal implementation of the ISystemRemoteResource interface.
- */
-public class SystemRemoteResource implements ISystemRemoteResource {
-
-
-
- protected ISystemRemotePath path;
-
- /**
- * Constructor for SystemRemoteResource.
- */
- public SystemRemoteResource(ISystemRemotePath path) {
- this.path = path;
- }
-
- /**
- * Get the resource info.
- * @return the resource info for the resource
- */
- public SystemRemoteResourceInfo getResourceInfo() {
- return SystemRemoteResourceManager.getInstance().getResourceInfo(path);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#createMarker(String)
- */
- public ISystemRemoteMarker createMarker(String type){
- SystemRemoteResourceInfo resourceInfo = getResourceInfo();
-
- if (resourceInfo == null) {
- return null;
- }
-
- SystemRemoteMarkerInfo info = new SystemRemoteMarkerInfo();
- info.setType(type);
- info.setCreationTime(System.currentTimeMillis());
- SystemRemoteMarkerManager.getInstance().add(this, new SystemRemoteMarkerInfo[] { info });
- return new SystemRemoteMarker(this, info.getId());
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#deleteMarkers(String, boolean)
- */
- public void deleteMarkers(String type, boolean includeSubtypes) {
- SystemRemoteMarkerManager.getInstance().removeMarkers(this, type, includeSubtypes);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#findMarker(long)
- */
- public ISystemRemoteMarker findMarker(long id) {
- return SystemRemoteMarkerManager.getInstance().findMarker(this, id);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#findMarkers(String, boolean)
- */
- public ISystemRemoteMarker[] findMarkers(String type, boolean includeSubtypes) {
- return SystemRemoteMarkerManager.getInstance().findMarkers(this, type, includeSubtypes);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#getMarker(long)
- */
- public ISystemRemoteMarker getMarker(long id) {
- return new SystemRemoteMarker(this, id);
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#exists()
- */
- public boolean exists() {
- return false;
- }
-
- /**
- *
- */
- public ISystemRemotePath getLocation() {
- return null;
- }
-
-
- /**
- *
- */
- public boolean existsLocally() {
- return false;
- }
-
- /**
- *
- */
- public File getLocalCopy() {
- return null;
- }
-
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#getPersistentProperty(QualifiedName)
- */
- public String getPersistentProperty(QualifiedName key) {
- return null;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#getSessionProperty(QualifiedName)
- */
- public Object getSessionProperty(QualifiedName key) {
- return null;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#setPersistentProperty(QualifiedName, String)
- */
- public void setPersistentProperty(QualifiedName key, String value) {
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#setSessionProperty(QualifiedName, Object)
- */
- public void setSessionProperty(QualifiedName key, Object value) {
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#getLocalLastModifiedTime()
- */
- public boolean getLocalLastModifiedTime() {
- return false;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#getRemoteLastModifiedTime()
- */
- public boolean getRemoteLastModifiedTime() {
- return false;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#isExistsLocally()
- */
- public boolean isExistsLocally() {
- return false;
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteResource#isSynchronized()
- */
- public boolean isSynchronized() {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceInfo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceInfo.java
deleted file mode 100644
index 59cbc1f6d..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceInfo.java
+++ /dev/null
@@ -1,92 +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.internal.files.ui.resources;
-
-/**
- * Class that keeps information about a remote resource. Clients should not
- * use this class.
- */
-public class SystemRemoteResourceInfo {
-
-
-
- /**
- * Set of flags which reflect various states of the info.
- */
- private int flags = 0;
-
- /**
- * The set of markers belonging to the resource.
- */
- private SystemRemoteMarkerSet markers;
-
- /**
- * Constructor for SystemRemoteResourceInfo.
- */
- public SystemRemoteResourceInfo() {
- super();
- }
-
- /**
- * Sets all of the bits indicated by the mask.
- * @param mask the mask
- */
- public void set(int mask) {
- flags |= mask;
- }
-
- /**
- * Clears all of the bits indicated by the mask.
- * @param mask the mask
- */
- public void clear(int mask) {
- flags &= ~mask;
- }
-
- /**
- * Returns the flags for this info.
- * @return the flags
- */
- public int getFlags() {
- return flags;
- }
-
- /**
- * Sets the flags for this info.
- */
- public void setFlags(int value) {
- flags = value;
- }
-
- /**
- * Set the markers for the resource info. <code>null</code> can be used
- * to indicate that the resource has no markers.
- * @param markerSet the marker set
- */
- public void setMarkers(SystemRemoteMarkerSet markerSet) {
- this.markers = markerSet;
- }
-
- /**
- * Get the markers from the resource info.
- * @return the marker set
- */
- public SystemRemoteMarkerSet getMarkers() {
- return markers;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceManager.java
deleted file mode 100644
index c1304990e..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteResourceManager.java
+++ /dev/null
@@ -1,87 +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.files.ui.resources;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.files.ui.resources.ISystemRemoteManager;
-import org.eclipse.rse.files.ui.resources.ISystemRemotePath;
-
-/**
- * This class manages remote resources.
- */
-public class SystemRemoteResourceManager implements ISystemRemoteManager {
-
-
-
- private static SystemRemoteResourceManager instance;
-
- // resource info hash table
- private Hashtable resourceInfos = new Hashtable();
-
- /**
- * Constructor for SystemRemoteResourceManager.
- */
- private SystemRemoteResourceManager() {
- super();
- restore();
- }
-
- /**
- * Get the singleton instance.
- * @return the singleton instance.
- */
- public static SystemRemoteResourceManager getInstance() {
-
- if (instance == null) {
- instance = new SystemRemoteResourceManager();
- }
-
- return instance;
- }
-
- /**
- * Get a resource info given a path.
- */
- public SystemRemoteResourceInfo getResourceInfo(ISystemRemotePath path) {
- return (SystemRemoteResourceInfo)(resourceInfos.get(path.toString()));
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteManager#startup(IProgressMonitor)
- */
- public void startup(IProgressMonitor monitor) {
- }
-
- /**
- * @see org.eclipse.rse.files.ui.resources.ISystemRemoteManager#shutdown(IProgressMonitor)
- */
- public void shutdown(IProgressMonitor monitor) {
- }
-
- /**
- * Read all resource information from disk.
- */
- public void restore() {}
-
- /**
- * Write all resource information to disk.
- */
- public void save() {}
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemOpenSearchPageAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemOpenSearchPageAction.java
deleted file mode 100644
index 08b8f5a82..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemOpenSearchPageAction.java
+++ /dev/null
@@ -1,62 +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:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.search;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-
-public class SystemOpenSearchPageAction implements IWorkbenchWindowActionDelegate {
-
- private IWorkbenchWindow window;
-
- /**
- * Constructor for open remote search page action.
- */
- public SystemOpenSearchPageAction() {
- super();
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- NewSearchUI.openSearchDialog(window, SystemSearchPage.SYSTEM_SEARCH_PAGE_ID);
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchPage.java
deleted file mode 100644
index 675e3ea32..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchPage.java
+++ /dev/null
@@ -1,1620 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [182024] Folder field only initialized if selection supports search
- * Kevin Doyle (IBM) - [189430] Limited System Types displayed in Folder Dialog
- * Kevin Doyle (IBM) - [187427] Selecting an Archive will check Search Archives checkbox
- * Martin Oberhuber (Wind River) - [196936] Hide disabled system types
- * 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) - [243495] [api] New: Allow file name search in Remote Search to not be case sensitive
- * David McKnight (IBM) - [279307] NPE when select a filter remove search dialog
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.search;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-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.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.ui.view.search.SystemSearchUI;
-import org.eclipse.rse.internal.ui.view.search.SystemSearchViewPart;
-import org.eclipse.rse.services.clientserver.SystemSearchString;
-import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
-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.clientserver.search.SystemSearchUtil;
-import org.eclipse.rse.services.search.HostSearchResultSet;
-import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
-import org.eclipse.rse.services.search.IHostSearchResultSet;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This class provides the universal search page in the Search.
- */
-public class SystemSearchPage extends DialogPage implements ISearchPage {
-
- public static final String SYSTEM_SEARCH_PAGE_ID = "org.eclipse.rse.internal.files.ui.search.searchPage"; //$NON-NLS-1$
-
- // search utility
- private SystemSearchUtil util;
-
- // search page container
- private ISearchPageContainer container;
-
- // flag to indicate whether showing the dialog for the first time
- private boolean isFirstShow = true;
-
- // search string controls
- private Label stringLabel;
- private Combo stringCombo;
- private Button caseButton;
- private Label stringHintLabel;
- private Button stringRegexButton;
- private boolean initialCaseSensitive;
- private boolean initialStringRegex;
-
- // file name controls
- private Label fileNameLabel;
- private Combo fileNameCombo;
- private Button fileNameBrowseButton;
- private Label fileNameHintLabel;
- private Button fileNameCaseSensitiveButton;
- private boolean initialFileNameCaseSensitive;
- private Button fileNameRegexButton;
- private boolean initialFileNameRegex;
-
-
- // file name editor
- private FileNameEditor fileNameEditor;
-
- // folder name controls
- private Label folderNameLabel;
- private Combo folderNameCombo;
- private Button folderNameBrowseButton;
-
- // folder name editor
- private FolderNameEditor folderNameEditor;
-
- // advanced controls
- private Button searchArchivesButton;
- private Button searchSubfoldersButton;
- private boolean initialSearchArchives;
- private boolean initialSearchSubfolders;
-
- // constants for storing configuration
- private static final String REMOTE_SEARCH_PAGE_NAME = "RemoteSearchPage"; //$NON-NLS-1$
- private static final String STORE_CONFIG_CASE_SENSITIVE = "caseSensitive"; //$NON-NLS-1$
- private static final String STORE_CONFIG_STRING_REGEX = "stringRegex"; //$NON-NLS-1$
- private static final String STORE_CONFIG_FILENAME_CASE_SENSITIVE = "fileNameCaseSensitive"; //$NON-NLS-1$
- private static final String STORE_CONFIG_FILENAME_REGEX = "fileNameRegex"; //$NON-NLS-1$
- private static final String STORE_CONFIG_INCLUDE_ARCHIVES = "includeArchives"; //$NON-NLS-1$
- private static final String STORE_CONFIG_INCLUDE_SUBFOLDERS = "includeSubfolders"; //$NON-NLS-1$
-
- private static final String STORE_CONFIG_DATA_SIZE = "dataSize"; //$NON-NLS-1$
-
- // constants for storing data
- private static final String STORE_DATA_PREFIX = REMOTE_SEARCH_PAGE_NAME + ".data"; //$NON-NLS-1$
- private static final String STORE_DATA_SEARCH_STRING = "searchString"; //$NON-NLS-1$
- private static final String STORE_DATA_CASE_SENSITIVE = "caseSensitive"; //$NON-NLS-1$
- private static final String STORE_DATA_STRING_REGEX = "stringRegex"; //$NON-NLS-1$
- private static final String STORE_DATA_FILE_NAMES = "fileNames"; //$NON-NLS-1$
- private static final String STORE_DATA_FILE_NAME_CASE_SENSITIVE = "fileNameCaseSensitive"; //$NON-NLS-1$
- private static final String STORE_DATA_FILE_NAME_REGEX = "fileNameRegex"; //$NON-NLS-1$
- private static final String STORE_DATA_PROFILE_NAME = "profileName"; //$NON-NLS-1$
- private static final String STORE_DATA_CONNECTION_NAME = "connectionName"; //$NON-NLS-1$
- private static final String STORE_DATA_FOLDER_NAME = "folderName"; //$NON-NLS-1$
- private static final String STORE_DATA_INCLUDE_ARCHIVES = "includeArchives"; //$NON-NLS-1$
- private static final String STORE_DATA_INCLUDE_SUBFOLDERS = "includeSubfolders"; //$NON-NLS-1$
-
- // a list to hold previous search data
- private List previousSearchData = new ArrayList();
-
- // maximum size of data list
- private static final int MAX_DATA_SIZE = 20;
-
- // inner class to hold search data
- private class RemoteSearchData {
-
- private String searchString;
- private boolean caseSensitive;
- private boolean stringRegex;
- private String fileNames;
- private boolean fileNameCaseSensitive;
- private boolean fileNameRegex;
- private String profileName;
- private String connectionName;
- private String folderName;
- private boolean includeArchives;
- private boolean includeSubfolders;
-
- /**
- * Constructor for search data.
- * @param searchString the search string.
- * @param caseSensitive <code>true</code> if case sensitive, <code>false</code> otherwise.
- * @param stringRegex <code>true</code> if search string is a regular expression, <code>false</code> otherwise.
- * @param fileNames set of file names.
- * @param fileNameCaseSensitive <code>true</code> if the file name is searched case sensitively, <code>false</code> otherwise.
- * @param fileNameRegex <code>true</code> if the file name is a regular expression, <code>false</code> otherwise.
- * @param profileName the profile name.
- * @param connectionName the connection name.
- * @param folderName the folder name.
- * @param includeArchives <code>true</code> if archives should also be searched, <code>false</code> otherwise.
- * @param includeSubfolders <code>true</code> if subfolders should also be searched, <code>false</code> otherwise.
- */
- private RemoteSearchData(String searchString, boolean caseSensitive, boolean stringRegex,
- String fileNames, boolean fileNameCaseSensitive, boolean fileNameRegex, String profileName, String connectionName,
- String folderName, boolean includeArchives, boolean includeSubfolders) {
- this.searchString = searchString;
- this.caseSensitive = caseSensitive;
- this.stringRegex = stringRegex;
- this.fileNames = fileNames;
- this.fileNameCaseSensitive = fileNameCaseSensitive;
- this.fileNameRegex = fileNameRegex;
- this.profileName = profileName;
- this.connectionName = connectionName;
- this.folderName = folderName;
- this.includeArchives = includeArchives;
- this.includeSubfolders = includeSubfolders;
- }
- }
-
- // abstract inner class for handling a combo and browse button combination
- abstract private class CommonEditor extends SelectionAdapter implements DisposeListener {
-
- protected Combo nameCombo;
- protected Button browseButton;
-
- /**
- * Constructor for editor.
- * @param nameCombo the combo.
- * @param browseButton the browse button.
- */
- private CommonEditor(Combo nameCombo, Button browseButton) {
- this.nameCombo = nameCombo;
- this.browseButton = browseButton;
-
- // add dispose listeners to both the combo and the button
- // we make them null when they are disposed for cleanup to occur
- nameCombo.addDisposeListener(this);
- browseButton.addDisposeListener(this);
-
- // add selection listener to the browse button
- browseButton.addSelectionListener(this);
- }
-
- /**
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
- */
- public void widgetDisposed(DisposeEvent e) {
-
- if (e.widget == nameCombo) {
- nameCombo = null;
- }
- else if (e.widget == browseButton) {
- browseButton = null;
- }
- }
-
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
-
- if (e.widget == browseButton) {
- handleBrowseSelected();
- }
- }
-
- protected abstract void handleBrowseSelected();
- }
-
- // inner class to handle file name editing
- private class FileNameEditor extends CommonEditor {
-
- /**
- * Constructor for folder name editor.
- * @param fileCombo the file combo.
- * @param browseButton the file types browse button.
- */
- private FileNameEditor(Combo fileCombo, Button browseButton) {
- super(fileCombo, browseButton);
- }
-
- /**
- * @see org.eclipse.rse.internal.files.ui.search.SystemSearchPage.CommonEditor#handleBrowseSelected()
- */
- protected void handleBrowseSelected() {
-
- // get the shell from the page
- Shell shell = SystemSearchPage.this.getShell();
-
- // create select file types action that opens the select file types dialog
- SystemSearchSelectFileTypesAction action = new SystemSearchSelectFileTypesAction(shell);
-
- // get current types list from the combo
- List prevTypes = util.typesStringToList(getFileNamesText());
-
- // set the preselection of the select file types dialog to the current list of types in the combo
- action.setTypes(prevTypes);
-
- // run the action
- action.run();
-
- // if the user did not cancel from the dialog
- if (!action.wasCancelled()) {
-
- // get the types the user chose in the dialog
- List newTypes = action.getTypes();
-
- // set the combo to have the new types
- setFileNamesText(util.typesListToString(newTypes));
- }
- }
-
- /**
- * Sets the file names text.
- * @param fileNames the file names string.
- */
- private void setFileNamesText(String fileNames) {
- nameCombo.setText(fileNames);
- }
-
- /**
- * Gets the text in the file names combo.
- * @return the file names text.
- */
- private String getFileNamesText() {
- return nameCombo.getText();
- }
- }
-
- // inner class to handle folder name editing
- private class FolderNameEditor extends CommonEditor {
-
- // holds info for each item in the folder combo
- private class Info {
- private String profileName;
- private String connectionName;
- private String folderPath;
-
- private Info(String profileName, String connectionName, String folderPath) {
- this.profileName = profileName;
- this.connectionName = connectionName;
- this.folderPath = folderPath;
- }
- }
-
- // the current info
- // TODO: needs to go when we show profile name in the folder combo
- private Info currInfo;
-
- /**
- * Constructor for folder name editor.
- * @param folderCombo the folder name combo.
- * @param browseButton the folder browse button.
- */
- private FolderNameEditor(Combo folderCombo, Button browseButton) {
- super(folderCombo, browseButton);
-
- // add selection listener to the folder combo
- folderCombo.addSelectionListener(this);
- }
-
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
-
- // if the selected widget is the browse button, let the super class handle it
- if (e.widget == browseButton) {
- super.widgetSelected(e);
- }
- // otherwise if the selected widget is the folder combo, then get the selection index
- // and get the data associated with that index
- // TODO: needs to go when we show profile name in the folder combo
- else if (e.widget == nameCombo){
- int selectionIndex = nameCombo.getSelectionIndex();
- currInfo = getInfo(selectionIndex);
- }
- else {
- super.widgetSelected(e);
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.files.ui.search.SystemSearchPage.CommonEditor#handleBrowseSelected()
- */
- protected void handleBrowseSelected() {
-
- // get the shell from the page
- Shell shell = SystemSearchPage.this.getShell();
-
- // create select folder action which opens the select folder dialog
- SystemSearchRemoteFolderAction selectFolderAction = new SystemSearchRemoteFolderAction(shell);
- selectFolderAction.setShowNewConnectionPrompt(true);
- selectFolderAction.setShowPropertySheet(true, false);
- selectFolderAction.setNeedsProgressMonitor(true);
- selectFolderAction.setMultipleSelectionMode(false);
-
- // preselection
- if (nameCombo.getText().length() > 0)
- {
- String preconnectionname = getConnectionName();
- if (preconnectionname != null && preconnectionname.length() > 0)
- {
- ISystemProfile profile = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getDefaultPrivateSystemProfile();
- IHost prehost = RSECorePlugin.getTheSystemRegistry().getHost(profile, preconnectionname);
- if (prehost != null)
- {
- // host preselection
- selectFolderAction.setDefaultConnection(prehost);
-
- String prepath = getFolderPath();
- if (prepath != null && prepath.length() > 0)
- {
- IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(prehost);
- try
- {
- IRemoteFile selection = ss.getRemoteFileObject(prepath, new NullProgressMonitor());
- if (selection != null)
- {
- // path preselection
- selectFolderAction.setPreSelection(selection);
- }
- }
- catch (Exception e)
- {}
- }
- }
- }
- }
-
- // limit the system types displayed to those that can support search
- List types = new LinkedList();
- IRSESystemType[] allSystemTypes = SystemWidgetHelpers.getValidSystemTypes(null);
- for (int i = 0; i < allSystemTypes.length; i++)
- {
- IRemoteFileSubSystemConfiguration rfssc = RemoteFileUtility.getFileSubSystemConfiguration(allSystemTypes[i]);
- if (rfssc != null && rfssc.supportsSearch())
- {
- types.add(allSystemTypes[i]);
- }
- }
-
- IRSESystemType[] allowedTypes = new IRSESystemType[types.size()];
- types.toArray(allowedTypes);
-
- selectFolderAction.setSystemTypes(allowedTypes);
-
- // run the action
- selectFolderAction.run();
-
- // if the user did not cancel out of the dialog
- if (!selectFolderAction.wasCancelled()) {
- // store remote path
- IRemoteFile remoteFile = selectFolderAction.getSelectedFolder();
- if (remoteFile == null){
- // could have selected a filter reference
- Object value = selectFolderAction.getValue();
- if (value instanceof ISystemFilterReference){
- ISystemFilterReference fref = (ISystemFilterReference)value;
- ISubSystem ss = fref.getSubSystem();
-
- // target for filter should give the most relevant folder
- Object target = ss.getTargetForFilter(fref);
- if (target instanceof IRemoteFile){
- remoteFile = (IRemoteFile)target;
- }
- }
-
- }
- String folderPath = remoteFile.getAbsolutePath();
-
- // store connection and profile
- IHost conn = selectFolderAction.getSelectedConnection();
- String profileName = conn.getSystemProfileName();
- String connectionName = conn.getAliasName();
-
- setFolderText(profileName, connectionName, folderPath);
-
- String absPath = remoteFile.getAbsolutePath();
- boolean supportsSearch = remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsSearch();
- boolean supportsArchiveManagement = remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- // if the file/folder is part of an archive select the search archives checkbox
- if (supportsSearch && supportsArchiveManagement && (remoteFile.isArchive() || (absPath.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR) > 0)))
- searchArchivesButton.setSelection(true);
- }
- }
-
- /**
- * Sets the folder name combo text. Also sets the profile name, connection name and folder path.
- * @param profileName the profile name.
- */
- private void setFolderText(String profileName, String connectionName, String folderPath) {
-
- String text = getFormattedText(profileName, connectionName, folderPath);
-
- // get existing items in the combo
- String[] currItems = nameCombo.getItems();
- int selectionIndex = -1;
- boolean matchFound = false;
-
- // see if one of the entries match
- for (int i = 0; i < currItems.length; i++) {
-
- if (currItems[i].equals(text)) {
- selectionIndex = i;
- matchFound = true;
- break;
- }
- }
-
- // if no matches found, we add our text to the end of the list of items in the combo and select it
- // note that we can't simply call setText() because this is a read-only combo
- if (!matchFound) {
- int oldLength = currItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currItems, 0, newItems, 0, currItems.length);
- newItems[oldLength] = text;
- nameCombo.setItems(newItems);
- selectionIndex = oldLength;
-
- // TODO: needs to go when we show profile name in the folder combo
- addData(selectionIndex, profileName, connectionName, folderPath);
- }
-
- // select from the current index
- nameCombo.select(selectionIndex);
-
- currInfo = getInfo(selectionIndex);
- }
-
- /**
- * Convert to text.
- * @return the string representation.
- */
- private String getFormattedText(String profileName, String connectionName, String folderPath) {
- // TODO: prefix with profile name after checking preference ??
- // then we will no longer need to store data in the combo, which is a very inelegant solution
- // we can simply parse whatever comes out of getText() and get profile name, connection name
- // and folder path
- return connectionName + ":" + folderPath; //$NON-NLS-1$
- }
-
- /**
- * Add data.
- * @param index the index for which this data applies.
- * @param profileName the profile name.
- * @param connectionName the connection name.
- * @param folderPath the folder path.
- */
- private void addData(int index, String profileName, String connectionName, String folderPath) {
- Info info = new Info(profileName, connectionName, folderPath);
- nameCombo.setData(String.valueOf(index), info);
- }
-
- /**
- * Gets the info for a given index.
- * @param index the index.
- * @return the info for the index.
- */
- private Info getInfo(int index) {
- return (Info)(nameCombo.getData(String.valueOf(index)));
- }
-
- /**
- * Returns the profile name.
- * @return the profile name, or <code>null</code> if none specified.
- */
- private String getProfileName() {
- return currInfo.profileName;
- }
-
- /**
- * Returns the connection name.
- * @return the connection name, or <code>null</code> if none specified.
- */
- private String getConnectionName() {
- return currInfo.connectionName;
- }
-
- /**
- * Returns the folder path.
- * @return the folder path, or <code>null</code> if none specified.
- */
- private String getFolderPath() {
- return currInfo.folderPath;
- }
- }
-
- /**
- * This contructor instantiates a remote search page.
- */
- public SystemSearchPage() {
- super();
- this.util = SystemSearchUtil.getInstance();
- }
-
- /**
- * Gets the search data from current state of the dialog. If the search string matches a previous
- * search data search string, then that data is deleted and replaced with the new data.
- * @return the search data corresponding to the current state of the dialog.
- */
- private RemoteSearchData getSearchData() {
- RemoteSearchData data = null;
- String searchString = stringCombo.getText();
-
- int i = previousSearchData.size() - 1;
-
- boolean matchFound = false;
-
- // go through stored search data, and see if one has the search string
- // matching our current search string
- while (i >= 0) {
- data = (RemoteSearchData)previousSearchData.get(i);
-
- if (searchString.equals(data.searchString)) {
- matchFound = true;
- break;
- }
-
- i--;
- }
-
- // if a match has been found, modify its properties
- if (matchFound && data != null) {
- data.searchString = searchString;
- data.caseSensitive = caseButton.getSelection();
- data.stringRegex = stringRegexButton.getSelection();
- data.fileNames = getFileNames();
- data.fileNameCaseSensitive = fileNameCaseSensitiveButton.getSelection();
- data.fileNameRegex = fileNameRegexButton.getSelection();
- data.profileName = getProfileName();
- data.connectionName = getConnectionName();
- data.folderName = getFolderName();
- data.includeArchives = searchArchivesButton.getSelection();
- data.includeSubfolders = searchSubfoldersButton.getSelection();
-
- // remove data from the list because it will be later added
- // we want to basically move the data to the end of the list
- previousSearchData.remove(data);
- }
- // otherwise create new data
- else {
- data = new RemoteSearchData(searchString, caseButton.getSelection(), stringRegexButton.getSelection(),
- getFileNames(), fileNameCaseSensitiveButton.getSelection(), fileNameRegexButton.getSelection(), getProfileName(), getConnectionName(),
- getFolderName(), searchArchivesButton.getSelection(), searchSubfoldersButton.getSelection());
- }
-
- // if the data size is the maximum size allowable,
- // remove the first entry from the list
- if (previousSearchData.size() == MAX_DATA_SIZE) {
- previousSearchData.remove(0);
- }
-
- // now add the data to the data list
- previousSearchData.add(data);
-
- return data;
- }
-
- /**
- * Gets the file names string.
- * @return the file names string.
- */
- private String getFileNames() {
- return fileNameEditor.getFileNamesText();
- }
-
- /**
- * Gets the profile name from the folder selection.
- * @return the profile name.
- */
- private String getProfileName() {
- return folderNameEditor.getProfileName();
- }
-
- /**
- * Gets the connection name from the folder selection.
- * @return the connection name.
- */
- private String getConnectionName() {
- return folderNameEditor.getConnectionName();
- }
-
- /**
- * Gets the folder name from the folder selection.
- * @return the folder name.
- */
- private String getFolderName() {
- return folderNameEditor.getFolderPath();
- }
-
- /**
- * @see org.eclipse.search.ui.ISearchPage#performAction()
- */
- public boolean performAction() {
-
- // if the string is a regex, check that the regular expression is valid
- // if not show error and return false
- if (stringRegexButton.getSelection()) {
- String searchString = stringCombo.getText();
-
- if (searchString != null && searchString.length() != 0) {
-
- if (!util.isValidRegex(searchString)) {
-
- String msgTxt = FileResources.MSG_REMOTE_SEARCH_INVALID_REGEX;
- String msgDetails = NLS.bind(FileResources.MSG_REMOTE_SEARCH_INVALID_REGEX_DETAILS, searchString);
-
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_REMOTE_SEARCH_INVALID_REGEX,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(getShell(), message);
-
- stringCombo.setFocus();
- return false;
- }
- }
- }
-
- // if the file name is a regex, check that the regular expression is valid
- // if not show error and return false
- if (fileNameRegexButton.getSelection()) {
- String fileNameString = fileNameEditor.getFileNamesText();
-
- if (fileNameString != null && fileNameString.length() != 0) {
-
- if (!util.isValidRegex(fileNameString)) {
- String msgTxt = FileResources.MSG_REMOTE_SEARCH_INVALID_REGEX;
- String msgDetails = NLS.bind(FileResources.MSG_REMOTE_SEARCH_INVALID_REGEX_DETAILS, fileNameString);
-
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_REMOTE_SEARCH_INVALID_REGEX,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(getShell(), message);
-
- fileNameCombo.setFocus();
- return false;
- }
- }
- }
-
- // get the data corresponding to the current dialog state
- RemoteSearchData data = getSearchData();
-
- SystemSearchString searchString = new SystemSearchString(data.searchString, data.caseSensitive, data.stringRegex, data.fileNames, data.fileNameCaseSensitive, data.fileNameRegex, data.includeArchives, data.includeSubfolders);
-
- IRemoteFileSubSystem subsys = getRemoteFileSubSystem(data.profileName, data.connectionName);
-
- if (subsys == null) {
- return false;
- }
-
- IRemoteFile remoteFile;
-
- try {
- remoteFile = subsys.getRemoteFileObject(data.folderName, new NullProgressMonitor());
- }
- catch (SystemMessageException e) {
- // TODO: show error
- SystemBasePlugin.logError("Error occured trying to get remote file object", e); //$NON-NLS-1$
- return false;
- }
-
-
-
-
- // create a search result set to contain all the results
- IHostSearchResultSet set = new HostSearchResultSet();
-
- if (subsys instanceof FileServiceSubSystem)
- {
-
-
- // set the name
- String name = remoteFile.getAbsolutePath() + " - " + searchString.getFileNamesString() + "(" + searchString.getTextString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- set.setName(name);
-
- FileServiceSubSystem ss = (FileServiceSubSystem)subsys;
- IHostSearchResultConfiguration config = ss.createSearchConfiguration(set, remoteFile, searchString);
-
- // show results in remote search view
- showInView(set);
-
- // kick off the search
- ss.search(config);
-
- // save the configuration
- writeConfiguration();
-
- // finally save the data
- writeData();
- }
-
-
-
-
- return true;
- }
-
- /**
- * Show the search results in the remote search view.
- * @param resultSet the search result set.
- */
- private void showInView(IHostSearchResultSet resultSet)
- {
- SystemSearchUI searchUI = SystemSearchUI.getInstance();
- SystemSearchViewPart searchPart = searchUI.activateSearchResultView();
- searchPart.addSearchResult((IAdaptable)resultSet);
- }
-
-
-
- /**
- * @see org.eclipse.search.ui.ISearchPage#setContainer(org.eclipse.search.ui.ISearchPageContainer)
- */
- public void setContainer(ISearchPageContainer container) {
- this.container = container;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
-
- // if we are to become visible
- if (visible) {
-
- // if it is the very first time, then set the items for the string combo and file name combo
- // and initialize from selection
- if (isFirstShow) {
- isFirstShow = false;
-
- // read in the data
- readData();
-
- // we set items and text here, rather than during createControl() to prevent page from resizing
- setPreviousSearchStrings();
- setPreviousFileNames();
- setPreviousFolderNames();
- initialize();
- }
-
- // set focus to the string combo every time we become visible
- stringCombo.setFocus();
-
- // indicate whether search is allowed
- container.setPerformActionEnabled(isValid());
- }
-
- super.setVisible(visible);
- }
-
- /**
- * Obtains the search strings from previous search data and adds them to the search string combo.
- */
- private void setPreviousSearchStrings() {
- int size = previousSearchData.size();
-
- // array to hold previous search strings
- String[] searchStrings = new String[size];
-
- for (int i = 0; i < size; i++) {
- searchStrings[i] = ((RemoteSearchData)previousSearchData.get(size - 1 - i)).searchString;
- }
-
- stringCombo.setItems(searchStrings);
- }
-
- /**
- * Obtains the file name strings from previous search data and adds them to the file name combo.
- */
- private void setPreviousFileNames() {
- int size = previousSearchData.size();
-
- // list to hold type strings
- List typesStringList = new ArrayList(size);
-
- // go through the search data starting from the end
- for (int i = size - 1; i >= 0; i--) {
- RemoteSearchData data = (RemoteSearchData)previousSearchData.get(i);
-
- // now get the types string representing the list of types in the data
- String typeString = data.fileNames;
-
- // check if we already have this types string in the types string list
- // if not, add it
- if (!typesStringList.contains(typeString)) {
- typesStringList.add(typeString);
- }
- }
-
- String[] typesStringArray = (String[])typesStringList.toArray(new String[typesStringList.size()]);
-
- fileNameCombo.setItems(typesStringArray);
- }
-
- /**
- * Obtains the folder name strings from previous search data and adds them to the folder name combo.
- */
- private void setPreviousFolderNames() {
- int size = previousSearchData.size();
-
- // list to hold folder names
- List folderNamesList = new ArrayList(size);
-
- int j = 0;
-
- // go through the search data starting from the end
- for (int i = size - 1; i >= 0; i--) {
- RemoteSearchData data = (RemoteSearchData)previousSearchData.get(i);
-
- // get the string from the folder name editor
- String folderNameString = folderNameEditor.getFormattedText(data.profileName, data.connectionName, data.folderName);
-
- if (!folderNamesList.contains(folderNameString)) {
- folderNamesList.add(folderNameString);
-
- // add combo data
- // TODO: needs to go when we show profile name in the folder name combo
- folderNameEditor.addData(j, data.profileName, data.connectionName, data.folderName);
- j++;
- }
- }
-
- String[] folderNamesArray = (String[])folderNamesList.toArray(new String[folderNamesList.size()]);
-
- folderNameCombo.setItems(folderNamesArray);
- }
-
- /**
- * Initializes the dialog.
- */
- private void initialize() {
-
- ISelection selection = container.getSelection();
-
- String text = null;
- String fileName = null;
- String profileName = null;
- String connectionName = null;
- String folderName = null;
- boolean isPartOfArchive = false;
-
- // if selection is not empty, we handle structured selection or text selection
- if (selection != null && !selection.isEmpty()) {
-
- // if it is a structured selection
- if (selection instanceof IStructuredSelection) {
- Object obj = ((IStructuredSelection)selection).getFirstElement();
-
- // check if it is a remote file
- if (obj instanceof IRemoteFile) {
-
- IRemoteFile remoteFile = (IRemoteFile)obj;
- boolean supportsArchiveManagement = remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- boolean supportsSearch = remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsSearch();
-
- // if it's a file, but not an archive, get the file name, connection info, and parent folder name
- if (supportsSearch && remoteFile.isFile() && !remoteFile.isArchive()) {
- fileName = remoteFile.getName();
- IHost conn = remoteFile.getHost();
- profileName = conn.getSystemProfileName();
- connectionName = conn.getAliasName();
- folderName = remoteFile.getParentPath();
- }
- // otherwise if it's a folder or an archive, get the connection info and the name
- else if (supportsSearch && (remoteFile.isDirectory() || (remoteFile.isArchive() && supportsArchiveManagement))) {
- IHost conn = remoteFile.getHost();
- profileName = conn.getSystemProfileName();
- connectionName = conn.getAliasName();
- folderName = remoteFile.getAbsolutePath();
- }
- String absPath = remoteFile.getAbsolutePath();
- // Determine if we support search + archives and selection is part of an archive
- isPartOfArchive = supportsSearch && supportsArchiveManagement && (remoteFile.isArchive() || (absPath.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR) > 0));
- }
- }
- // otherwise, if it is a text selection
- else if (selection instanceof ITextSelection) {
- ITextSelection textSelection = (ITextSelection)selection;
- text = textSelection.getText();
- }
- }
-
- // if text is null, then make it "*"
- if (text == null || text.equals("")) { //$NON-NLS-1$
- text = "*"; //$NON-NLS-1$
- }
- // otherwise, make sure to escape the special characters so that we actually search for the
- // string with the special characters
- else {
- text = insertEscapeChar(text);
- }
-
- stringCombo.setText(text);
-
- // if the file name is still null, set it to "*"
- if (fileName == null) {
- fileName = "*"; //$NON-NLS-1$
- }
-
- // set the file name
- fileNameEditor.setFileNamesText(fileName);
-
- // if the file/folder is part of an archive select the search archives checkbox
- if (isPartOfArchive)
- {
- searchArchivesButton.setSelection(true);
- }
-
- // set the remote folder combo properties if profile name, connection name and folder path are
- // not null
- if (profileName != null && connectionName != null && folderName != null) {
- folderNameEditor.setFolderText(profileName, connectionName, folderName);
- }
- }
-
- /**
- * Inserts escape character '\' for literals '*', '?' and '\\'.
- * @param text the text.
- * @return the text with the escape character inserted as needed, or "" if the given text is <code>null</code>,
- * or an error occurs.
- */
- private String insertEscapeChar(String text) {
-
- if (text == null || text.equals("")) { //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
-
- StringBuffer sbIn = new StringBuffer(text);
- BufferedReader reader = new BufferedReader(new StringReader(text));
- int lengthOfFirstLine = 0;
-
- try {
- lengthOfFirstLine = reader.readLine().length();
- }
- catch (IOException ex) {
- return ""; //$NON-NLS-1$
- }
-
- StringBuffer sbOut = new StringBuffer(lengthOfFirstLine + 5);
- int i = 0;
-
- while (i < lengthOfFirstLine) {
- char ch = sbIn.charAt(i);
-
- if (ch == '*' || ch == '?' || ch == '\\') {
- sbOut.append("\\"); //$NON-NLS-1$
- }
-
- sbOut.append(ch);
-
- i = i + 1;
- }
-
- return sbOut.toString();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- // compute horizontal and vertical units
- initializeDialogUnits(parent);
-
- // read configuration
- readConfiguration();
-
- // main composite
- Composite main = new Composite(parent, SWT.NONE);
- GridLayout mainLayout = new GridLayout(3, false);
- mainLayout.horizontalSpacing = 10;
- main.setLayout(mainLayout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gd.horizontalSpan = 3;
- main.setLayoutData(gd);
-
- // create controls for search string
- createSearchStringControls(main);
-
- // create controls for file name
- createFileNameControls(main);
-
- // create controls for folder
- createFolderControls(main);
-
- // create advanced options controls
- createAdvancedControls(main);
-
- // set mnemonics
- Mnemonics m = new Mnemonics();
- StringBuffer usedMnemonics = new StringBuffer(5);
- usedMnemonics.append(Mnemonics.getMnemonic(SearchMessages.SearchDialog_customize));
- usedMnemonics.append(Mnemonics.getMnemonic(SearchMessages.SearchDialog_searchAction));
- m.clear(usedMnemonics.toString());
- m.setMnemonics(parent);
-
- // set the top level control
- setControl(main);
-
- // set help
- SystemWidgetHelpers.setHelp(main, RSEUIPlugin.HELPPREFIX + "rsdi0000"); //$NON-NLS-1$
- }
-
- /**
- * Creates controls for users to specify the search string.
- * @param comp the parent composite.
- */
- private void createSearchStringControls(Composite comp) {
-
- // label introducing string combo
- stringLabel = new Label(comp, SWT.LEFT);
- stringLabel.setText(FileResources.RESID_SEARCH_STRING_LABEL_LABEL);
- stringLabel.setToolTipText(FileResources.RESID_SEARCH_STRING_LABEL_TOOLTIP);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 3;
- stringLabel.setLayoutData(gd);
-
- // string combo
- stringCombo = new Combo(comp, SWT.SINGLE | SWT.BORDER);
- stringCombo.setToolTipText(FileResources.RESID_SEARCH_STRING_COMBO_TOOLTIP);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- stringCombo.setLayoutData(gd);
-
- stringCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- container.setPerformActionEnabled(isValid());
- }
- });
-
- stringCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleStringComboSelected();
- }
- });
-
- // checkbox for case sensitive
- caseButton = new Button(comp, SWT.CHECK);
- caseButton.setText(FileResources.RESID_SEARCH_CASE_BUTTON_LABEL);
- caseButton.setToolTipText(FileResources.RESID_SEARCH_CASE_BUTTON_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- caseButton.setLayoutData(gd);
- caseButton.setSelection(initialCaseSensitive);
-
- // label explaining special characters
- stringHintLabel = new Label(comp, SWT.LEFT);
- stringHintLabel.setText(FileResources.RESID_SEARCH_STRING_HINT_LABEL);
- stringHintLabel.setToolTipText(FileResources.RESID_SEARCH_STRING_HINT_TOOLTIP);
-
- gd = new GridData(GridData.BEGINNING);
- gd.horizontalSpan = 2;
- stringHintLabel.setLayoutData(gd);
-
- // checkbox for regex
- stringRegexButton = new Button(comp, SWT.CHECK);
- stringRegexButton.setText(FileResources.RESID_SEARCH_STRING_REGEX_LABEL);
- stringRegexButton.setToolTipText(FileResources.RESID_SEARCH_STRING_REGEX_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- stringRegexButton.setLayoutData(gd);
- stringRegexButton.setSelection(initialStringRegex);
- stringHintLabel.setVisible(!stringRegexButton.getSelection());
-
- stringRegexButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- stringHintLabel.setVisible(!stringRegexButton.getSelection());
- }
- });
- }
-
- /**
- * Handles selection of an item from the string combo. Sets the dialog state for the
- * selection data corrsponding to the search string selection.
- */
- private void handleStringComboSelected() {
-
- if (stringCombo.getSelectionIndex() < 0) {
- return;
- }
-
- int index = previousSearchData.size() - 1 - stringCombo.getSelectionIndex();
-
- RemoteSearchData data = (RemoteSearchData)previousSearchData.get(index);
-
- if (data == null || !stringCombo.getText().equals(data.searchString)) {
- return;
- }
-
- // set search string properties
- stringCombo.setText(data.searchString);
-
- // set case sensitive
- caseButton.setSelection(data.caseSensitive);
-
- // set string regex
- stringHintLabel.setVisible(!data.stringRegex);
- stringRegexButton.setSelection(data.stringRegex);
-
- // set types list
- fileNameEditor.setFileNamesText(data.fileNames);
-
- // set file name regex
- fileNameHintLabel.setVisible(!data.fileNameRegex);
- fileNameCaseSensitiveButton.setSelection(data.fileNameCaseSensitive);
- fileNameRegexButton.setSelection(data.fileNameRegex);
-
- // set the remote folder properties
- folderNameEditor.setFolderText(data.profileName, data.connectionName, data.folderName);
-
- // set search archive
- searchArchivesButton.setSelection(data.includeArchives);
-
- // set search subfolders
- searchSubfoldersButton.setSelection(data.includeSubfolders);
- }
-
- /**
- * Gets the remote file subsystem for the given profile name and connection name.
- * @return the remote file subsystem, or <code>null</code> if the profile or connection does not exist.
- */
- private IRemoteFileSubSystem getRemoteFileSubSystem(String profName, String connName) {
-
- if (profName == null || connName == null) {
- return null;
- }
- else {
- ISystemRegistry reg = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = reg.getSystemProfile(profName);
-
- if (profile == null) {
- return null;
- }
-
- IHost conn = reg.getHost(profile, connName);
-
- if (conn == null) {
- return null;
- }
-
- return RemoteFileUtility.getFileSubSystem(conn);
- }
- }
-
- /**
- * Creates controls to specify file name.
- * @param comp the parent composite.
- */
- private void createFileNameControls(Composite comp) {
-
- // label introducing file name combo
- fileNameLabel = new Label(comp, SWT.LEFT);
- fileNameLabel.setText(FileResources.RESID_SEARCH_FILENAME_LABEL_LABEL);
- fileNameLabel.setToolTipText(FileResources.RESID_SEARCH_FILENAME_LABEL_TOOLTIP);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 3;
- fileNameLabel.setLayoutData(gd);
-
- // file name combo
- fileNameCombo = new Combo(comp, SWT.SINGLE | SWT.BORDER);
- fileNameCombo.setToolTipText(FileResources.RESID_SEARCH_FILENAME_COMBO_TOOLTIP);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- fileNameCombo.setLayoutData(gd);
-
- fileNameCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- container.setPerformActionEnabled(isValid());
- }
- });
-
- // browse types button
- fileNameBrowseButton = new Button(comp, SWT.PUSH);
- fileNameBrowseButton.setText(FileResources.RESID_SEARCH_FILENAME_BROWSE_LABEL);
- fileNameBrowseButton.setToolTipText(FileResources.RESID_SEARCH_FILENAME_BROWSE_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- fileNameBrowseButton.setLayoutData(gd);
-
- // create the file name editor
- fileNameEditor = new FileNameEditor(fileNameCombo, fileNameBrowseButton);
-
- // label explaining special characters
- fileNameHintLabel = new Label(comp, SWT.LEFT);
- fileNameHintLabel.setText(FileResources.RESID_SEARCH_FILENAME_HINT_LABEL);
- fileNameHintLabel.setToolTipText(FileResources.RESID_SEARCH_FILENAME_HINT_TOOLTIP);
-
- gd = new GridData(GridData.BEGINNING);
- gd.horizontalSpan = 2;
- fileNameHintLabel.setLayoutData(gd);
-
- // checkbox for case sensitivity
- fileNameCaseSensitiveButton = new Button(comp, SWT.CHECK);
- fileNameCaseSensitiveButton.setText(FileResources.RESID_SEARCH_CASE_BUTTON_LABEL);
- fileNameCaseSensitiveButton.setToolTipText(FileResources.RESID_SEARCH_CASE_BUTTON_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- fileNameCaseSensitiveButton.setLayoutData(gd);
- fileNameCaseSensitiveButton.setSelection(initialFileNameCaseSensitive);
-
- // checkbox for regex
- fileNameRegexButton = new Button(comp, SWT.CHECK);
- fileNameRegexButton.setText(FileResources.RESID_SEARCH_FILENAME_REGEX_LABEL);
- fileNameRegexButton.setToolTipText(FileResources.RESID_SEARCH_FILENAME_REGEX_TOOLTIP);
-
- //gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan = 3;
-
- fileNameRegexButton.setLayoutData(gd);
- fileNameRegexButton.setSelection(initialFileNameRegex);
- fileNameHintLabel.setVisible(!fileNameRegexButton.getSelection());
-
- fileNameRegexButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fileNameHintLabel.setVisible(!fileNameRegexButton.getSelection());
- }
- });
- }
-
- /**
- * Creates controls to specify folder name.
- */
- private void createFolderControls(Composite comp) {
-
- // label introducing folder name combo
- folderNameLabel = new Label(comp, SWT.LEFT);
- folderNameLabel.setText(FileResources.RESID_SEARCH_FOLDERNAME_LABEL_LABEL);
- folderNameLabel.setToolTipText(FileResources.RESID_SEARCH_FOLDERNAME_LABEL_TOOLTIP);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 3;
- folderNameLabel.setLayoutData(gd);
-
- // folder name combo
- folderNameCombo = new Combo(comp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- folderNameCombo.setToolTipText(FileResources.RESID_SEARCH_FOLDERNAME_COMBO_TOOLTIP);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- folderNameCombo.setLayoutData(gd);
-
- folderNameCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- container.setPerformActionEnabled(isValid());
- }
- });
-
- // browse types button
- folderNameBrowseButton = new Button(comp, SWT.PUSH);
- folderNameBrowseButton.setText(FileResources.RESID_SEARCH_FOLDERNAME_BROWSE_LABEL);
- folderNameBrowseButton.setToolTipText(FileResources.RESID_SEARCH_FOLDERNAME_BROWSE_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- folderNameBrowseButton.setLayoutData(gd);
-
- // create the folder name editor
- folderNameEditor = new FolderNameEditor(folderNameCombo, folderNameBrowseButton);
- }
-
- /**
- * Creates controls for advanced options.
- */
- private void createAdvancedControls(Composite comp) {
-
- // dummy label
- Label dummyLabel = new Label(comp, SWT.LEFT);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 3;
- dummyLabel.setLayoutData(gd);
-
- // checkbox for search in archive files
- searchArchivesButton = new Button(comp, SWT.CHECK);
- searchArchivesButton.setText(FileResources.RESID_SEARCH_INCLUDE_ARCHIVES_LABEL);
- searchArchivesButton.setToolTipText(FileResources.RESID_SEARCH_INCLUDE_ARCHIVES_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 1;
- searchArchivesButton.setLayoutData(gd);
-
- searchArchivesButton.setSelection(initialSearchArchives);
-
- // checkbox for search in subfolders
- searchSubfoldersButton = new Button(comp, SWT.CHECK);
- searchSubfoldersButton.setText(FileResources.RESID_SEARCH_INCLUDE_SUBFOLDERS_LABEL);
- searchSubfoldersButton.setToolTipText(FileResources.RESID_SEARCH_INCLUDE_SUBFOLDERS_TOOLTIP);
-
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 2;
- gd.horizontalIndent = 20;
- searchSubfoldersButton.setLayoutData(gd);
-
- searchSubfoldersButton.setSelection(initialSearchSubfolders);
- }
-
- /**
- * Returns whether the search string, file name and folder name are all valid.
- * @return <code>true</code> if all are valid, <code>false</code> otherwise.
- */
- private boolean isValid() {
-
- // note that we check folder name first for performance reasons (it is most likely to be
- // invalid since we do not allow empty folder name)
- return isFolderNameValid() && isSearchStringValid() && isFileNameValid();
-
- // TODO: error messages!! But are they even visible in the search dialog?
- }
-
- /**
- * Returns whether search string is valid. Note that search string is valid if empty (we assume empty
- * search string is the same as "*");
- * @return <code>true</code> if search string is not <code>null</code>, <code>false</code> otherwise.
- */
- private boolean isSearchStringValid() {
-
- String searchString = stringCombo.getText();
-
- if (searchString == null) {
- return false;
- }
- else {
- return true;
- }
- }
-
- /**
- * Returns whether file name is valid. Note that file name is valid if empty (we assume empty file
- * name is the same as "*");
- * @return <code>true</code> if file name is not <code>null</code>, <code>false</code> otherwise.
- */
- private boolean isFileNameValid() {
-
- String fileNameString = fileNameCombo.getText();
-
- if (fileNameString == null) {
- return false;
- }
- else {
- return true;
- }
- }
-
- /**
- * Returns whether folder name is valid.
- * @return <code>true</code> if folder name is not <code>null</code> or empty, <code>false</code> otherwise.
- */
- private boolean isFolderNameValid() {
-
- String folderName = folderNameCombo.getText();
-
- if (folderName == null || folderName.trim().length() == 0) {
- return false;
- }
- else {
- return true;
- }
- }
-
- /**
- * Get plugin dialog settings.
- * @return the dialog settings of the plugin.
- */
- private IDialogSettings getPluginDialogSettings() {
- return RSEUIPlugin.getDefault().getDialogSettings();
- }
-
- /**
- * Returns the dialog settings for the remote search page.
- * @return the dialog settings used to store search page configuration.
- */
- private IDialogSettings getConfigDialogSettings() {
- IDialogSettings settings = getPluginDialogSettings();
- IDialogSettings dialogSettings = settings.getSection(REMOTE_SEARCH_PAGE_NAME);
-
- if (dialogSettings == null) {
- dialogSettings = settings.addNewSection(REMOTE_SEARCH_PAGE_NAME);
- }
-
- return dialogSettings;
- }
-
- /**
- * Retrieves the configuration from the dialog settings.
- */
- private void readConfiguration() {
- IDialogSettings s = getConfigDialogSettings();
- initialCaseSensitive = s.getBoolean(STORE_CONFIG_CASE_SENSITIVE);
- initialStringRegex = s.getBoolean(STORE_CONFIG_STRING_REGEX);
- initialFileNameCaseSensitive = s.getBoolean(STORE_CONFIG_FILENAME_CASE_SENSITIVE);
- if (!initialFileNameCaseSensitive){
- // make sure it was set this way as opposed to defaulting
- // in order to preserve the 3.0 behaviour, the default needs to be true
- String value = s.get(STORE_CONFIG_FILENAME_CASE_SENSITIVE);
- if (value == null){
- initialFileNameCaseSensitive = true;
- }
- }
-
- initialFileNameRegex = s.getBoolean(STORE_CONFIG_FILENAME_REGEX);
- initialSearchArchives = s.getBoolean(STORE_CONFIG_INCLUDE_ARCHIVES);
- initialSearchSubfolders = s.getBoolean(STORE_CONFIG_INCLUDE_SUBFOLDERS);
- }
-
- /**
- * Stores the current configuration to the dialog settings.
- */
- private void writeConfiguration() {
- IDialogSettings s = getConfigDialogSettings();
- s.put(STORE_CONFIG_CASE_SENSITIVE, caseButton.getSelection());
- s.put(STORE_CONFIG_STRING_REGEX, stringRegexButton.getSelection());
- s.put(STORE_CONFIG_FILENAME_CASE_SENSITIVE, fileNameCaseSensitiveButton.getSelection());
- s.put(STORE_CONFIG_FILENAME_REGEX, fileNameRegexButton.getSelection());
- s.put(STORE_CONFIG_INCLUDE_ARCHIVES, searchArchivesButton.getSelection());
- s.put(STORE_CONFIG_INCLUDE_SUBFOLDERS, searchSubfoldersButton.getSelection());
- }
-
- /**
- * Reads the data.
- */
- private void readData() {
-
- // store the size
- int size = 0;
-
- try {
- size = getConfigDialogSettings().getInt(STORE_CONFIG_DATA_SIZE);
- }
- catch (NumberFormatException e) {
- // if a number format exception occurs, it doesn't mean there is an error
- // it simply means this is the first time the dialog is opened
- size = 0;
- }
-
- if (size > 0) {
- // take the minimum of stored size and the maximum size allowable
- // this is unnecessary, since the stored size should never be
- // more than the maximum size, but we check just in case
- size = Math.min(size, MAX_DATA_SIZE);
- previousSearchData = new ArrayList(size);
- }
-
- for (int i = 0; i < size; i++) {
- IDialogSettings dataSection = getPluginDialogSettings().getSection(STORE_DATA_PREFIX + i);
- String searchString = dataSection.get(STORE_DATA_SEARCH_STRING);
- boolean caseSensitive = dataSection.getBoolean(STORE_DATA_CASE_SENSITIVE);
- boolean stringRegex = dataSection.getBoolean(STORE_DATA_STRING_REGEX);
-
- String fileNamesString = dataSection.get(STORE_DATA_FILE_NAMES);
- boolean fileNameCaseSensitive = dataSection.getBoolean(STORE_DATA_FILE_NAME_CASE_SENSITIVE);
- boolean fileNameRegex = dataSection.getBoolean(STORE_DATA_FILE_NAME_REGEX);
-
- String profileName = dataSection.get(STORE_DATA_PROFILE_NAME);
- String connectionName = dataSection.get(STORE_DATA_CONNECTION_NAME);
- String folderName = dataSection.get(STORE_DATA_FOLDER_NAME);
-
- boolean searchArchives = dataSection.getBoolean(STORE_DATA_INCLUDE_ARCHIVES);
- boolean searchSubfolders = dataSection.getBoolean(STORE_DATA_INCLUDE_SUBFOLDERS);
-
- RemoteSearchData data = new RemoteSearchData(searchString, caseSensitive, stringRegex, fileNamesString, fileNameCaseSensitive, fileNameRegex, profileName, connectionName, folderName, searchArchives, searchSubfolders);
- previousSearchData.add(data);
- }
- }
-
- /**
- * Writes the data.
- */
- private void writeData() {
-
- // get the size of data
- int size = previousSearchData.size();
-
- // take the minimum of the data size and the maximum size allowable
- // this is unnecessary, since the data size should never be
- // more than the maximum size allowable, but we check just in case
- size = Math.min(size, MAX_DATA_SIZE);
-
- // store the size
- getConfigDialogSettings().put(STORE_CONFIG_DATA_SIZE, size);
-
- IDialogSettings pluginSettings = getPluginDialogSettings();
-
- for (int i = 0; i < size; i++) {
- IDialogSettings dataSection = pluginSettings.getSection(STORE_DATA_PREFIX + i);
-
- if (dataSection == null) {
- dataSection = pluginSettings.addNewSection(STORE_DATA_PREFIX + i);
- }
-
- RemoteSearchData data = (RemoteSearchData)previousSearchData.get(i);
-
- dataSection.put(STORE_DATA_SEARCH_STRING, data.searchString);
- dataSection.put(STORE_DATA_CASE_SENSITIVE, data.caseSensitive);
- dataSection.put(STORE_DATA_STRING_REGEX, data.stringRegex);
-
- dataSection.put(STORE_DATA_FILE_NAMES, data.fileNames);
- dataSection.put(STORE_DATA_FILE_NAME_CASE_SENSITIVE, data.fileNameCaseSensitive);
- dataSection.put(STORE_DATA_FILE_NAME_REGEX, data.fileNameRegex);
-
- dataSection.put(STORE_DATA_PROFILE_NAME, data.profileName);
- dataSection.put(STORE_DATA_CONNECTION_NAME, data.connectionName);
- dataSection.put(STORE_DATA_FOLDER_NAME, data.folderName);
-
- dataSection.put(STORE_DATA_INCLUDE_ARCHIVES, data.includeArchives);
- dataSection.put(STORE_DATA_INCLUDE_SUBFOLDERS, data.includeSubfolders);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java
deleted file mode 100644
index 2e7542db0..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java
+++ /dev/null
@@ -1,474 +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) - [184095] Replace systemTypeName by IRSESystemType
- *******************************************************************************/
-package org.eclipse.rse.internal.files.ui.search;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.files.ui.ISystemAddFileListener;
-import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This action brings up a select dialog for search.
- */
-public class SystemSearchRemoteFolderAction extends SystemSelectRemoteFolderAction {
-
- private IRSESystemType[] systemTypes;
- private IHost systemConnection, outputConnection;
- private IHost rootFolderConnection;
- private IRemoteFile preSelection;
- private String rootFolderAbsPath;
- private String message, treeTip, dlgTitle;
- private String addLabel, addToolTipText;
- private int expandDepth = 0;
- private boolean showNewConnectionPrompt = true;
- private boolean restrictFolders = false;
- private boolean showPropertySheet = false;
- private boolean showPropertySheetDetailsButtonInitialState;
- private boolean showPropertySheetDetailsButton = false;
- private boolean multipleSelectionMode = false;
- private boolean allowForMultipleParents = false;
- private boolean onlyConnection = false;
- private ISystemAddFileListener addButtonCallback = null;
- private IValidatorRemoteSelection selectionValidator;
-
- /**
- * Constructor.
- * @param shell the parent shell.
- */
- public SystemSearchRemoteFolderAction(Shell shell) {
- super(shell);
- }
-
- /**
- * Constructor.
- * @param shell the parent shell.
- * @param label the label to display.
- * @param tooltip the tooltip to display.
- */
- public SystemSearchRemoteFolderAction(Shell shell, String label, String tooltip) {
- super(shell, label, tooltip);
- }
-
- // ------------------------
- // CONFIGURATION METHODS...
- // ------------------------
- /**
- * Set the title for the dialog. The default is "Browse for Folder"
- */
- public void setDialogTitle(String title)
- {
- this.dlgTitle = title;
- }
-
- /**
- * Set the message shown at the top of the form
- */
- public void setMessage(String message)
- {
- this.message = message;
- }
- /**
- * Set the tooltip text for the remote systems tree from which an item is selected.
- */
- public void setSelectionTreeToolTipText(String tip)
- {
- this.treeTip = tip;
- }
-
- /**
- * Set the system connection to restrict the user to seeing in the tree.
- *
- * @see #setRootFolder(IHost, String)
- */
- public void setHost(IHost conn)
- {
- systemConnection = conn;
- onlyConnection = true;
- }
- /**
- * Set the connection to default the selection to
- */
- public void setDefaultConnection(IHost conn)
- {
- systemConnection = conn;
- onlyConnection = false;
- }
-
- /**
- * Set the system types to restrict what connections the user sees,
- * and what types of connections they can create.
- *
- * @param systemTypes An array of system types, or
- * <code>null</code> to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemTypes(IRSESystemType[] systemTypes)
- {
- this.systemTypes = systemTypes;
- }
-
- /**
- * Convenience method to restrict to a single system type.
- * Same as setSystemTypes(new IRSESystemType[] {systemType})
- *
- * @param systemType The system type to restrict to, or
- * <code>null</code> to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemType(IRSESystemType systemType)
- {
- if (systemType == null)
- setSystemTypes(null);
- else
- setSystemTypes(new IRSESystemType[] {systemType});
- }
-
- /**
- * Set to true if a "New Connection..." special connection is to be shown for creating new connections
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- this.showNewConnectionPrompt = show;
- }
- /**
- * Specify the zero-based auto-expand level for the tree. The default is zero, meaning
- * only show the connections.
- */
- public void setAutoExpandDepth(int depth)
- {
- this.expandDepth = depth;
- }
-
- /**
- * Set the root folder from which to start listing files.
- * This version identifies the folder via a connection object and absolute path.
- * There is another overload that identifies the folder via a single IRemoteFile object.
- * <p>
- * This call effectively transforms the select dialog by:
- * <ul>
- * <li>Preventing the user from selecting other connections
- * <li>Preventing the user from selecting other filter strings
- * </ul>
- *
- * @param connection The connection to the remote system containing the root folder
- * @param folderAbsolutePath The fully qualified folder to start listing from (eg: "\folder1\folder2")
- *
- * @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString
- */
- public void setRootFolder(IHost connection, String folderAbsolutePath)
- {
- rootFolderConnection = connection;
- rootFolderAbsPath = folderAbsolutePath;
- }
- /**
- * Set the root folder from which to start listing folders.
- * This version identifies the folder via an IRemoteFile object.
- * There is another overload that identifies the folder via a connection and folder path.
- * <p>
- * This call effectively transforms the select dialog by:
- * <ul>
- * <li>Preventing the user from selecting other connections
- * <li>Preventing the user from selecting other filter strings
- * </ul>
- *
- * @param rootFolder The IRemoteFile object representing the remote folder to start the list from
- *
- * @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString
- */
- public void setRootFolder(IRemoteFile rootFolder)
- {
- setRootFolder(rootFolder.getHost(),rootFolder.getAbsolutePath());
- }
- /**
- * Set a file or folder to preselect. This will:
- * <ul>
- * <li>Set the parent folder as the root folder
- * <li>Pre-expand the parent folder
- * <li>Pre-select the given file or folder after expansion
- * </ul>
- * If there is no parent, then we were given a root. In which case we will
- * <ul>
- * <li>Force setRestrictFolders to false
- * <li>Pre-expand the root drives (Windows) or root files (Unix)
- * <li>Pre-select the given root drive (Windows only)
- * </ul>
- */
- public void setPreSelection(IRemoteFile selection)
- {
- preSelection = selection;
- }
-
- /**
- * Specify whether setRootFolder should prevent the user from being able to see or select
- * any other folder. This causes this effect:
- * <ol>
- * <li>The special filter for root/drives is not shown
- * </ol>
- */
- public void setRestrictFolders(boolean restrict)
- {
- restrictFolders = true;
- }
-
- /**
- * Enable Add mode. This means the OK button is replaced with an Add button, and
- * the Cancel with a Close button. When Add is pressed, the caller is called back.
- * The dialog is not exited until Close is pressed.
- * <p>
- * When a library is selected, the caller is called back to decide to enable the Add
- * button or not.
- */
- public void enableAddMode(ISystemAddFileListener caller)
- {
- this.addButtonCallback = caller;
- }
- /**
- * Overloaded method that allows setting the label and tooltip text of the Add button.
- * If you pass null for the label, the default is used ("Add").
- */
- public void enableAddMode(ISystemAddFileListener caller, String addLabel, String addToolTipText)
- {
- enableAddMode(caller);
- this.addLabel = addLabel;
- this.addToolTipText = addToolTipText;
- }
-
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * Default is false
- */
- public void setShowPropertySheet(boolean show)
- {
- this.showPropertySheet = show;
- }
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * This overload shows a Details>>> button so the user can decide if they want to see the
- * property sheet.
- * <p>
- * @param show True if to show the property sheet within the dialog
- * @param initialState True if the property is to be initially displayed, false if it is not
- * to be displayed until the user presses the Details button.
- */
- public void setShowPropertySheet(boolean show, boolean initialState)
- {
- setShowPropertySheet(show);
- if (show)
- {
- this.showPropertySheetDetailsButton = true;
- this.showPropertySheetDetailsButtonInitialState = initialState;
- }
- }
-
- /**
- * Set multiple selection mode. Default is single selection mode
- * <p>
- * If you turn on multiple selection mode, you must use the getSelectedObjects()
- * method to retrieve the list of selected objects.
- *
- * @see #getSelectedObjects()
- */
- public void setMultipleSelectionMode(boolean multiple)
- {
- this.multipleSelectionMode = multiple;
- }
-
- /*
- * Indicates whether to allow selection of objects from differnet parents
- */
- public void setAllowForMultipleParents(boolean multiple)
- {
- this.allowForMultipleParents = multiple;
- }
-
- /**
- * Specify a validator to use when the user selects a remote file or folder.
- * This allows you to decide if OK should be enabled or not for that remote file or folder.
- */
- public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
- {
- this.selectionValidator = selectionValidator;
- }
-
- // -----------------
- // OUTPUT METHODS...
- // -----------------
-
-
- /**
- * Retrieve selected folder object. If multiple folders selected, returns the first.
- */
- public IRemoteFile getSelectedFolder()
- {
- Object o = getValue();
- if (o instanceof IRemoteFile[])
- return ((IRemoteFile[])o)[0];
- else if (o instanceof IRemoteFile)
- return (IRemoteFile)o;
- else
- return null;
- }
- /**
- * Retrieve selected folder objects. If no folders selected, returns an array of zero.
- * If one folder selected returns an array of one.
- */
- public IRemoteFile[] getSelectedFolders()
- {
- Object o = getValue();
- if (o instanceof Object[]) {
-
- Object[] temp = (Object[])o;
-
- IRemoteFile[] files = new IRemoteFile[temp.length];
-
- // ensure all objects are IRemoteFiles
- for (int i = 0; i < temp.length; i++) {
-
- if (temp[i] instanceof IRemoteFile) {
- files[i] = (IRemoteFile)temp[i];
- }
- // should never happen
- else {
- return new IRemoteFile[0];
- }
- }
-
- return files;
- }
- if (o instanceof IRemoteFile[])
- return (IRemoteFile[])o;
- else if (o instanceof IRemoteFile)
- return new IRemoteFile[] {(IRemoteFile)o};
- else
- return new IRemoteFile[0];
- }
-
- /**
- * Return all selected objects. This method will return an array of one
- * unless you have called setMultipleSelectionMode(true)!
- * <p>
- * It will always return null if the user cancelled the dialog.
- *
- * @see #setMultipleSelectionMode(boolean)
- */
- public Object[] getSelectedObjects()
- {
- Object remoteObject = getValue();
- if (remoteObject == null)
- return null;
- else if (remoteObject instanceof Object[])
- return (Object[])remoteObject;
- else if (remoteObject instanceof IRemoteFile[])
- return (Object[])remoteObject;
- else
- return new Object[] {remoteObject};
- }
-
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
- // -------------------
- // INTERNAL METHODS...
- // -------------------
-
- /**
- * Creates an instance of the select dialog for search {@link SystemSearchRemoteFolderDialog}.
- * @return the dialog to select remote resource from.
- */
- protected Dialog createDialog(Shell shell)
- {
- SystemSearchRemoteFolderDialog dlg = null;
- if (dlgTitle == null)
- dlg = new SystemSearchRemoteFolderDialog(shell);
- else
- dlg = new SystemSearchRemoteFolderDialog(shell, dlgTitle);
- //dlg.setShowNewConnectionPrompt(showNewConnectionPrompt);
- dlg.setMultipleSelectionMode(multipleSelectionMode);
- //dlg.setAllowForMultipleParents(allowForMultipleParents);
-// if (restrictFolders)
- // dlg.setRestrictFolders(true);
- if (message != null)
- dlg.setMessage(message);
- if (treeTip != null)
- dlg.setSelectionTreeToolTipText(treeTip);
- if (systemConnection != null)
- {
- if (onlyConnection)
- dlg.setDefaultSystemConnection(systemConnection, true);
- else
- dlg.setDefaultSystemConnection(systemConnection, false);
- }
- if (systemTypes != null)
- dlg.setSystemTypes(systemTypes);
- //if (expandDepth != 0)
- // dlg.setAutoExpandDepth(expandDepth);
- if (preSelection != null)
- dlg.setPreSelection(preSelection);
- //else if (rootFolderConnection != null)
- // dlg.setRootFolder(rootFolderConnection, rootFolderAbsPath);
- if (showPropertySheet)
- if (showPropertySheetDetailsButton)
- dlg.setShowPropertySheet(true, showPropertySheetDetailsButtonInitialState);
- else
- dlg.setShowPropertySheet(true);
- if (addButtonCallback != null)
- {
- // if ((addLabel!=null) || (addToolTipText!=null))
- // dlg.enableAddMode(addButtonCallback, addLabel, addToolTipText);
- // else
- // dlg.enableAddMode(addButtonCallback);
- }
- if (selectionValidator != null)
- dlg.setSelectionValidator(selectionValidator);
-
- return dlg;
- }
-
- /**
- * Required by parent. We return the selected object
- */
- protected Object getDialogValue(Dialog dlg)
- {
- SystemSearchRemoteFolderDialog ourDlg = (SystemSearchRemoteFolderDialog)dlg;
- Object outputObject = null;
- outputConnection = null;
- if (!ourDlg.wasCancelled())
- {
- if (multipleSelectionMode)
- outputObject = ourDlg.getSelectedObjects();
- else
- outputObject = ourDlg.getSelectedObject();
- outputConnection = ourDlg.getSelectedConnection();
- }
- return outputObject; // parent class calls setValue on what we return
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderDialog.java
deleted file mode 100644
index 23cfe3372..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderDialog.java
+++ /dev/null
@@ -1,67 +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
- *
- * Contributors:
- * Kushal Munir (IBM) - initial API and implementation.
- * Kevin Doyle (IBM) [189433] - Added Viewer Filter to display directories & archives
- * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
- ********************************************************************************/
-package org.eclipse.rse.internal.files.ui.search;
-
-import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Select dialog for search.
- */
-public class SystemSearchRemoteFolderDialog extends SystemRemoteFolderDialog {
-
- private SystemActionViewerFilter _filter;
-
- /**
- * Constructor.
- * @param shell the parent shell.
- */
- public SystemSearchRemoteFolderDialog(Shell shell) {
- super(shell);
- }
-
- /**
- * Contructor.
- * @param shell the parent shell.
- * @param title the the title of the dialog.
- */
- public SystemSearchRemoteFolderDialog(Shell shell, String title) {
- super(shell, title);
- }
-
- public SystemActionViewerFilter getViewerFilter()
- {
- if (_filter == null)
- {
- _filter = new SystemActionViewerFilter();
- Class[] types = {IRemoteFile.class};
- _filter.addFilterCriterion(types, "isDirectory", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- _filter.addFilterCriterion(types, "isArchive", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return _filter;
- }
-
- /**
- * Creates an instance of the select form for search {@link SystemSearchRemoteFolderForm}
- * @see org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog#getForm(boolean)
- */
- /*
- protected SystemSelectRemoteFileOrFolderForm getForm(boolean fileMode) {
- form = new SystemSearchRemoteFolderForm(getMessageLine(), this);
- setOutputObject(null);
- outputConnection = null;
- return form;
- }
- */
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderForm.java
deleted file mode 100644
index 397e5db5a..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderForm.java
+++ /dev/null
@@ -1,46 +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
- *
- * Contributors:
- * Kushal Munir (IBM) - initial API and implementation.
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-package org.eclipse.rse.internal.files.ui.search;
-
-import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
-import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProvider;
-
-/**
- * The selection form to use is search selection dialogs.
- */
-public class SystemSearchRemoteFolderForm extends SystemSelectRemoteFileOrFolderForm {
-
- /**
- * Constructor.
- * @param msgLine the message line.
- * @param caller the caller of the contructor for callbacks.
- */
- public SystemSearchRemoteFolderForm(ISystemMessageLine msgLine, Object caller) {
- super(msgLine, caller, false);
- }
-
- /**
- * Returns an instance of the search input provider {@link SystemSearchRemoteObjectAPIProvider}
- * @see org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm#getInputProvider()
- */
- protected ISystemSelectRemoteObjectAPIProvider getInputProvider() {
-
- if (inputProvider == null) {
- // create the input provider that drives the contents of the tree
- inputProvider = new SystemSearchRemoteObjectAPIProvider(null, ISystemFileRemoteTypes.TYPECATEGORY, true, null); // show new connection prompt, no system type restrictions
- }
-
- return inputProvider;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java
deleted file mode 100644
index c5738c221..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java
+++ /dev/null
@@ -1,93 +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
- *
- * Contributors:
- * Kushal Munir (IBM) - initial API and implementation.
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.search;
-
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl;
-import org.eclipse.rse.services.search.ISearchService;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
-
-/**
- * This is the input provider for selection dialogs related to search.
- */
-public class SystemSearchRemoteObjectAPIProvider extends SystemSelectRemoteObjectAPIProviderImpl {
-
- /**
- * Constructor.
- * @param factoryId the subsystem factory id.
- * @param factoryCategory the subsystem facory category.
- * @param showNewConnectionPrompt whether to show new connection prompt.
- * @param systemTypes the system types to restrict to.
- */
- public SystemSearchRemoteObjectAPIProvider(String factoryId, String factoryCategory, boolean showNewConnectionPrompt, IRSESystemType[] systemTypes) {
- super(factoryId, factoryCategory, showNewConnectionPrompt, systemTypes);
- }
-
- /**
- * Constructor.
- * @param subsystem the subsystem.
- */
- public SystemSearchRemoteObjectAPIProvider(ISubSystem subsystem) {
- super(subsystem);
- }
-
- /**
- * Contrcutor.
- */
- public SystemSearchRemoteObjectAPIProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl#getConnections()
- */
- protected Object[] getConnections() {
-
- Object[] objs = super.getConnections();
- List l = new Vector();
-
- for (int i = 0; i < objs.length; i++) {
- Object obj = objs[i];
-
- if (obj instanceof IHost) {
- IHost host = (IHost)obj;
-
- ISubSystem[] subsystems = sr.getSubSystems(host);
-
- for (int j = 0; j < subsystems.length; j++) {
- ISubSystem subsystem = subsystems[j];
-
- if (subsystem instanceof FileServiceSubSystem) {
- FileServiceSubSystem fileSubSystem = (FileServiceSubSystem)subsystem;
-
- ISearchService searchService = fileSubSystem.getSearchService();
-
- if (searchService != null) {
- l.add(obj);
- break;
- }
- }
- }
- }
- else {
- l.add(obj);
- }
- }
-
- return l.toArray();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesAction.java
deleted file mode 100644
index 5643f70aa..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesAction.java
+++ /dev/null
@@ -1,47 +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 McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-
-package org.eclipse.rse.internal.files.ui.search;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.internal.files.ui.actions.SystemSelectFileTypesAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Action to select file types for the search dialog.
- */
-public class SystemSearchSelectFileTypesAction
- extends SystemSelectFileTypesAction {
-
- /**
- * Creates the action.
- * @param shell
- */
- public SystemSearchSelectFileTypesAction(Shell shell) {
- super(shell);
- }
-
-
- /**
- * @see org.eclipse.rse.ui.actions.SystemBaseDialogAction#createDialog(org.eclipse.swt.widgets.Shell)
- */
- public Dialog createDialog(Shell parent) {
- SystemSearchSelectFileTypesDialog dialog = new SystemSearchSelectFileTypesDialog(getShell(), types);
- return dialog;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesDialog.java
deleted file mode 100644
index 9cdb3202f..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchSelectFileTypesDialog.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.search;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * File types selection dialog for the search page.
- */
-public class SystemSearchSelectFileTypesDialog extends SystemSelectFileTypesDialog {
-
- /**
- * Creates the dialog.
- * @param shell the shell.
- * @param currentTypes types to preselect.
- */
- public SystemSearchSelectFileTypesDialog(Shell shell, Collection currentTypes) {
- super(shell, currentTypes);
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog#checkInitialSelections()
- */
- protected void checkInitialSelections() {
-
- IFileEditorMapping editorMappings[] = PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- ArrayList selectedMappings = new ArrayList();
-
- // go through all editor mappings, and check of those that are in the initial selections
- for (int i = 0; i < editorMappings.length; i++) {
- IFileEditorMapping mapping = editorMappings[i];
-
- if (initialSelections.contains(mapping.getExtension())) {
- listViewer.setChecked(mapping, true);
- selectedMappings.add(mapping.getExtension());
- }
- }
-
- // now find those entries in the initial selections that are not in editor mappings
- // add these entries to the user defined list
- Iterator initialIterator = initialSelections.iterator();
- StringBuffer entries = new StringBuffer();
- boolean first = true;
-
- while(initialIterator.hasNext()) {
- String nextExtension = (String)initialIterator.next();
-
- if(!selectedMappings.contains(nextExtension)) {
-
- if (!first) {
- // if not the first entry, add a comma and a space
- entries.append(TYPE_DELIMITER);
- entries.append(" "); //$NON-NLS-1$
- }
- else {
- first = false;
- }
-
- entries.append(nextExtension);
- }
- }
-
- userDefinedText.setText(entries.toString());
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog#addUserDefinedEntries(java.util.List)
- */
- protected void addUserDefinedEntries(List result) {
- StringTokenizer tokenizer = new StringTokenizer(userDefinedText.getText(), TYPE_DELIMITER);
-
- while (tokenizer.hasMoreTokens()) {
- String currentExtension = tokenizer.nextToken().trim();
-
- if (!currentExtension.equals("")) { //$NON-NLS-1$
- result.add(currentExtension);
- }
- }
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#processOK()
- */
- protected boolean processOK() {
-
- IFileEditorMapping[] children = getInput();
- List list = new ArrayList();
-
- // build a list of selected children
- for (int i = 0; i < children.length; ++i) {
- IFileEditorMapping element = children[i];
-
- if (listViewer.getChecked(element)) {
- list.add(element.getLabel());
- }
- }
-
- addUserDefinedEntries(list);
- setResult(list);
- return true;
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog#validateFileType(java.lang.String)
- */
- protected boolean validateFileType(String filename) {
- return true;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/DownloadAndOpenJob.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/DownloadAndOpenJob.java
deleted file mode 100644
index 3950ec420..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/DownloadAndOpenJob.java
+++ /dev/null
@@ -1,168 +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:
- * Kevin Doyle (IBM) - [194463] Use the result of _editable.download() to decide if file is to be opened
- * David McKnight (IBM) - [189873] Improve remote shell editor open action with background jobs
- * David McKnight (IBM) - [246651] FTP subsystem doesn't handle disconnected situation well
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-
-import org.eclipse.core.resources.IFile;
-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.core.subsystems.ISubSystem;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.files.ui.resources.SystemUniversalTempFileListener;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.actions.SystemRemoteFileLineOpenWithMenu;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.widgets.Display;
-
-public class DownloadAndOpenJob extends Job
-{
- private static class OpenEditorRunnable implements Runnable
- {
- private ISystemEditableRemoteObject _editable;
- private boolean _systemEditor;
- private int _line;
- private int _charStart;
- private int _charEnd;
-
- public OpenEditorRunnable(ISystemEditableRemoteObject editable, boolean systemEditor)
- {
- _editable = editable;
- _systemEditor = systemEditor;
- _line = -1;
- _charStart = -1;
- _charEnd = -1;
- }
-
- public OpenEditorRunnable(ISystemEditableRemoteObject editable, boolean systemEditor, int line, int charStart, int charEnd)
- {
- _editable = editable;
- _systemEditor = systemEditor;
- _line = line;
- _charStart = charStart;
- _charEnd = charEnd;
- }
-
-
- public void run()
- {
- try
- {
- _editable.addAsListener();
- _editable.setLocalResourceProperties();
- if (_systemEditor)
- {
- ((SystemEditableRemoteFile)_editable).openSystemEditor();
- }
- else
- {
- _editable.openEditor();
- }
-
- if (_line > -1 || (_charStart > -1 && _charEnd > -1)){
- SystemRemoteFileLineOpenWithMenu.handleGotoLine((IRemoteFile)_editable.getRemoteObject(), _line, _charStart, _charEnd);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- }
-
- private ISystemEditableRemoteObject _editable;
- private boolean _systemEditor;
- private int _line;
- private int _charStart;
- private int _charEnd;
-
- /**
- * Download job.
- * @param editable the editable remote object.
- * @param systemEditor whether to use the system editor.
- */
- public DownloadAndOpenJob(ISystemEditableRemoteObject editable, boolean systemEditor)
- {
- super(FileResources.RESID_FILES_DOWNLOAD);
- _editable = editable;
- _systemEditor = systemEditor;
- _line = -1;
- _charStart = -1;
- _charEnd = -1;
- }
-
- /**
- * Download job
- * @param editable the editable remote object
- * @param systemEditor whether to use the system editor
- * @param line the line to jump to after opening
- */
- public DownloadAndOpenJob(ISystemEditableRemoteObject editable, boolean systemEditor, int line, int charStart, int charEnd)
- {
- super(FileResources.RESID_FILES_DOWNLOAD);
- _editable = editable;
- _systemEditor = systemEditor;
- _line = line;
- _charStart = charStart;
- _charEnd = charEnd;
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- boolean downloadSuccessful = false;
- try
- {
- IFile localFile = _editable.getLocalResource();
- ISubSystem ss = _editable.getSubSystem();
-
-
- // if we're not connected, connect
- if (!ss.isConnected()){
- ss.connect(monitor, false);
- }
- if (ss.isConnected()){
- SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
- listener.addIgnoreFile(localFile);
- downloadSuccessful = _editable.download(monitor);
- listener.removeIgnoreFile(localFile);
- }
- else {
- return Status.CANCEL_STATUS;
- }
- }
- catch (Exception e)
- {
- }
- if (downloadSuccessful)
- {
- OpenEditorRunnable oe = null;
- if (_line > -1 || (_charStart > -1 && _charEnd > -1)){
- oe = new OpenEditorRunnable(_editable, _systemEditor, _line, _charStart, _charEnd);
- }
- else{
- oe = new OpenEditorRunnable(_editable, _systemEditor);
- }
- Display.getDefault().asyncExec(oe);
- }
-
- return Status.OK_STATUS;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapter.java
deleted file mode 100644
index fb9b33d25..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapter.java
+++ /dev/null
@@ -1,177 +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) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core
- * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-
-import java.util.ArrayList;
-import java.util.Vector;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.files.ui.actions.SystemFileUpdateFilterAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemNewFileAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemNewFileFilterAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemNewFolderAction;
-import org.eclipse.rse.internal.files.ui.wizards.SystemFileNewConnectionWizardPage;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.wizards.newconnection.ISystemNewConnectionWizardPage;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class RemoteFileSubSystemConfigurationAdapter extends SubSystemConfigurationAdapter
-{
-
- SystemNewFileFilterAction _newFileFilterAction;
- SystemFileUpdateFilterAction _changeFilerAction;
-
- Vector _additionalActions;
-
- // -----------------------------------
- // WIZARD PAGE CONTRIBUTION METHODS... (defects 43194 and 42780)
- // -----------------------------------
- /**
- * Optionally return one or more wizard pages to append to the New Connection Wizard if
- * the user selects a system type that this subsystem factory supports.
- * <p>
- * Tip: consider extending AbstractSystemWizardPage for your wizard page class.
- */
- public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration factory, IWizard wizard)
- {
- ISystemNewConnectionWizardPage[] basepages = super.getNewConnectionWizardPages(factory, wizard);
-
- // DKM - for now reverting back to not showing port on wizard page
- // in UCD sessions, users were too confused by that page
- if (false /*isPortEditable()*/)
- {
- SystemFileNewConnectionWizardPage page = new SystemFileNewConnectionWizardPage(wizard, factory);
- ISystemNewConnectionWizardPage[] newPages = new ISystemNewConnectionWizardPage[basepages.length + 1];
- newPages[0] = page;
- for (int i = 0; i < basepages.length; i++)
- {
- newPages[i+1] = basepages[i];
- }
- basepages = newPages;
- }
- return basepages;
- }
-
- /**
- * Overridable parent method to return the action for creating a new filter inside a filter pool
- * Returns new SystemNewFileFilterAction.
- */
- protected IAction getNewFilterPoolFilterAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell)
- {
- if (_newFileFilterAction == null)
- {
- _newFileFilterAction = new SystemNewFileFilterAction((IRemoteFileSubSystemConfiguration)factory, selectedPool, shell);
- }
- else
- {
- _newFileFilterAction.setParentFilterPool(selectedPool);
-
-
- }
- return _newFileFilterAction;
- }
-
- /**
- * Overridable method to return the action for changing an existing filter.
- * Returns new SystemFileUpdateFilterAction.
- */
- protected IAction getChangeFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
- {
- if (_changeFilerAction == null)
- {
- _changeFilerAction = new SystemFileUpdateFilterAction(shell);
- }
- return _changeFilerAction;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getAdditionalFilterActions(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.rse.core.filters.ISystemFilter, org.eclipse.swt.widgets.Shell)
- */
- protected Vector getAdditionalFilterActions(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell)
- {
- if (_additionalActions == null)
- {
- _additionalActions = super.getAdditionalFilterActions(factory, selectedFilter, shell);
- if (selectedFilter.isPromptable())
- return _additionalActions;
- if (_additionalActions == null)
- _additionalActions = new Vector();
-
- // following added by Phil for release 2, Nov 10 2002
- _additionalActions.add(new SystemNewFileAction(shell));
- _additionalActions.add(new SystemNewFolderAction(shell));
-
- // DKM
- // FIXME - can't do this here anymore
- //_additionalActions.add(new SystemCommandAction(shell, true));
-
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
- _additionalActions.add(new SystemPasteFromClipboardAction(shell, clipboard));
- }
- return _additionalActions;
- }
-
- /**
- * Checks the preference setting for hidden files and filters out hidden files if the preference setting is to not show hidden files.
- * @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#applyViewFilters(org.eclipse.rse.ui.view.IContextObject, java.lang.Object[])
- */
- public Object[] applyViewFilters(IContextObject parent, Object[] children) {
-
- boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
-
- if (showHidden) {
- return children;
- }
- else {
-
- ArrayList results = new ArrayList(children.length);
-
- for (int i = 0; i < children.length; i++) {
-
- if (children[i] instanceof IRemoteFile) {
- IRemoteFile remoteFile = (IRemoteFile)(children[i]);
-
- if (!remoteFile.isHidden()) {
- results.add(remoteFile);
- }
- }
- else if (children[i] instanceof ISystemMessageObject){
- results.add(children[i]);
- }
- }
-
- return results.toArray();
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapterFactory.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapterFactory.java
deleted file mode 100644
index 3b158a2cc..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/RemoteFileSubSystemConfigurationAdapterFactory.java
+++ /dev/null
@@ -1,61 +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) - [180519][api] declaratively register adapter factories
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-
-
-public class RemoteFileSubSystemConfigurationAdapterFactory implements IAdapterFactory
-{
-
- private ISubSystemConfigurationAdapter ssFactoryAdapter = new RemoteFileSubSystemConfigurationAdapter();
-
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] {ISubSystemConfigurationAdapter.class};
- }
-
-// /**
-// * Register this factory with the Platform's Adapter Manager.
-// * Can be used for explicit registration, but we prefer doing it
-// * declaratively in plugin.xml so this is currently not used.
-// */
-// public void registerWithManager(IAdapterManager manager)
-// {
-// manager.registerAdapters(this, IRemoteFileSubSystemConfiguration.class);
-// }
-
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- Object adapter = null;
- if (adaptableObject instanceof IRemoteFileSubSystemConfiguration)
- adapter = ssFactoryAdapter;
-
- return adapter;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemRemoteFileSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemRemoteFileSelectionInputProvider.java
deleted file mode 100644
index 3ef3f26ae..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemRemoteFileSelectionInputProvider.java
+++ /dev/null
@@ -1,47 +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) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.view.SystemResourceSelectionInputProvider;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-
-
-public class SystemRemoteFileSelectionInputProvider extends
- SystemResourceSelectionInputProvider
-{
-
- public SystemRemoteFileSelectionInputProvider(IHost connection)
- {
- super(connection);
- setCategory("files"); //$NON-NLS-1$
- }
-
- public SystemRemoteFileSelectionInputProvider()
- {
- super();
- setCategory("files"); //$NON-NLS-1$
- }
-
- protected ISubSystem getSubSystem(IHost selectedConnection)
- {
- return RemoteFileUtility.getFileSubSystem(selectedConnection);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewFileAdapterFactory.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewFileAdapterFactory.java
deleted file mode 100644
index b81b7e13d..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewFileAdapterFactory.java
+++ /dev/null
@@ -1,65 +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) - [180519][api] declaratively register adapter factories
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-
-/**
- * This factory maps requests for an adapter object from a given
- * element object. This is for the universal file system.
- */
-public class SystemViewFileAdapterFactory extends AbstractSystemRemoteAdapterFactory
-{
- private SystemViewRemoteFileAdapter fileAdapter = new SystemViewRemoteFileAdapter();
-
-// /**
-// * Register this factory with the Platform's Adapter Manager.
-// * Can be used for explicit registration, but we prefer doing it
-// * declaratively in plugin.xml so this is currently not used.
-// */
-// public void registerWithManager(IAdapterManager manager)
-// {
-// manager.registerAdapters(this, IRemoteFile.class);
-// }
-
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- Object adapter = null;
- if (adaptableObject instanceof IRemoteFile)
- adapter = fileAdapter;
-
- if ((adapter != null) && (adapterType == IPropertySource.class))
- {
- ((ISystemViewElementAdapter)adapter).setPropertySourceInput(adaptableObject);
- }
- else if (adapter == null)
- {
- SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
- }
- return adapter;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java
deleted file mode 100644
index 0ac736487..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java
+++ /dev/null
@@ -1,3715 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2009 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) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * 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
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186997] No deferred queries in Local Files
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * Xuan Chen (IBM) - [180671] [refresh] It is not possible to refresh editor with double clicking on it
- * David Dykstal (IBM) - [160776] format file size according to client system conventions and locale
- * David McKnight (IBM) - [197089] Need to set the filter when there is no separator in filter string
- * David McKnight (IBM) - [196662] hasChildren() should return false when the file doesn't exist
- * David McKnight (IBM) - [197784] Need to check if last separator is at 0
- * Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
- * David McKnight (IBM) - [199568] Removing synchronized from internalGetChildren
- * Kevin Doyle (IBM) - [197855] Can't Delete/Rename/Move a Read-Only File
- * Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
- * Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file
- * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
- * Kevin Doyle (IBM) - [186125] Changing encoding of a file is not reflected when it was opened before
- * David McKnight (IBM) - [208803] add exists() method
- * David McKnight (IBM) - [209375] download using copyRemoteResourcesToWorkspaceMultiple
- * Rupen Mardirossian (IBM) - [208435] added constructor to nested RenameRunnable class to take in names that are previously used as a parameter for multiple renaming instances
- * David McKnight (IBM) - [209660] need to check if remote encoding has changed before using cached file
- * Xuan Chen (IBM) - [160775] [api] [breaking] [nl] rename (at least within a zip) blocks UI thread
- * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
- * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy
- * David McKnight (IBM) - [189873] DownloadJob changed to DownloadAndOpenJob
- * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
- * David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- * Rupen Mardirossian (IBM) - [210682] Copy collisions will use SystemCopyDialog now instead of renameDialog when there is a copy collision within the same connection
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
- * Rupen Mardirossian (IBM) - [198728] Folder being copied across systems is added to original set of files in order to extract empty (sub)folders in doDrop method
- * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
- * Rupen Mardirossian (IBM) - [227213] Copy and pasting to the parent folder will create a "Copy of" that resource
- * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
- * Anna Dushistova (MontaVista) - [226550] [api] Launch Shell and Launch Terminal actions should be contributed declaratively
- * Martin Oberhuber (Wind River) - [234215] improve API documentation for doDelete and doDeleteBatch
- * David McKnight (IBM) - [251860] Rename a file/folder to a hidden file causes problems
- * David McKnight (IBM) - [261019] New File/Folder actions available in Work Offline mode
- * David McKnight (IBM) - [254769] Don't get latest file when opening a file always
- * David McKnight (IBM) - [264607] Unable to delete a broken symlink
- * David McKnight (IBM) - [276103] Files with names in different cases are not handled properly
- * David McKnight (IBM) - [276534] Cache Conflict After Synchronization when Browsing Remote System with Case-Differentiated-Only Filenames
- * David McKnight (IBM) - [280466] File download keeps running in case sensitive case
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-import java.io.File;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-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.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osgi.util.NLS;
-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.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.SystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemResourceSet;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.model.SystemRemoteResourceSet;
-import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.internal.files.ui.actions.SystemCompareFilesAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemCompareWithEditionAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemEditFilesAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemMoveRemoteFileAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemNewFileAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemNewFileFilterFromFolderAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemNewFolderAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemRemoteFileOpenWithMenu;
-import org.eclipse.rse.internal.files.ui.actions.SystemReplaceWithEditionAction;
-import org.eclipse.rse.internal.files.ui.actions.SystemSearchAction;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.CopyRunnable;
-import org.eclipse.rse.internal.ui.view.ISystemMementoConstants;
-import org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.internal.ui.view.search.SystemSearchTableView;
-import org.eclipse.rse.services.clientserver.PathUtility;
-import org.eclipse.rse.services.clientserver.StringCompare;
-import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
-import org.eclipse.rse.services.clientserver.SystemSearchString;
-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.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.IFilePermissionsService;
-import org.eclipse.rse.services.files.IHostFilePermissions;
-import org.eclipse.rse.services.files.IHostFilePermissionsContainer;
-import org.eclipse.rse.services.files.PendingHostFilePermissions;
-import org.eclipse.rse.services.search.HostSearchResultSet;
-import org.eclipse.rse.services.search.IHostSearchConstants;
-import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
-import org.eclipse.rse.services.search.IHostSearchResultSet;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileRoot;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType;
-import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.operations.SystemFetchOperation;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewDropDestination;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IElementCollector;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.NumberFormat;
-
-/**
- * Adapter for displaying remote file system objects in tree views.
- * These are children of RemoteFileSubSystem filter strings
- */
-public class SystemViewRemoteFileAdapter
- extends AbstractSystemViewAdapter
- implements ISystemRemoteElementAdapter
-{
-
- private String xlatedSize = null;
- private String xlatedCompressedSize = null;
- private String xlatedExpandedSize = null;
-
- private static final Object[] EMPTY_LIST = new Object[0];
- private boolean filesOnly, foldersOnly;
- private SystemNewFileAction addNewFile;
- private SystemNewFolderAction addNewFolder;
- private SystemNewFileFilterFromFolderAction addNewFilter;
-
- private SystemMoveRemoteFileAction moveAction;
-
- private SystemCopyToClipboardAction copyClipboardAction;
- private SystemPasteFromClipboardAction pasteClipboardAction;
-
- private SystemCompareFilesAction compareFilesAction;
- private SystemCompareWithEditionAction compareEditionAction;
- private SystemReplaceWithEditionAction replaceEditionAction;
- // FIXME shells now separate plugin
- //private SystemCommandAction commandAction, shellAction;
-
- private SystemSearchAction searchAction;
-
- private IEditorRegistry registry;
- private SystemRemoteFileOpenWithMenu openWithMenu;
-
- private boolean debug = false; //true;
-
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
- private static PropertyDescriptor[] briefPropertyDescriptorArray = null;
-
- // DKM
- private static PropertyDescriptor[] uniquePropertyDescriptorArray = null;
- private static PropertyDescriptor[] uniqueArchiveDescriptorArray = null;
- private static PropertyDescriptor[] uniqueVirtualDescriptorArray = null;
-
- // MJB
- private static PropertyDescriptor[] archiveDescriptorArray = null;
- private static PropertyDescriptor[] virtualDescriptorArray = null;
-
- static final String _uploadMessage = FileResources.MSG_UPLOADING_PROGRESS;
- static final String _downloadMessage = FileResources.MSG_DOWNLOADING_PROGRESS;
-
- /**
- * Constructor
- */
- public SystemViewRemoteFileAdapter()
- {
- super();
- xlatedSize = FileResources.RESID_PROPERTY_FILE_SIZE_VALUE;
- xlatedCompressedSize = FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE;
- xlatedExpandedSize = FileResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE;
-
- }
-
- private IEditorRegistry getEditorRegistry()
- {
- if (registry == null)
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- registry = workbench.getEditorRegistry();
- }
- return registry;
- }
- /**
- * Constructor for folders or files only
- */
- public SystemViewRemoteFileAdapter(boolean foldersOnly, boolean filesOnly)
- {
- this();
- this.foldersOnly = foldersOnly;
- this.filesOnly = filesOnly;
- }
- /**
- * Set a filter string to subset the list by. For example, "A*.java" or "java,class,".
- * Only valid if filesOnly mode or foldersOnly mode.
- */
- public void setFilterString(String filterString)
- {
- if (filesOnly && (filterString != null) && (filterString.indexOf("/ns") == -1)) //$NON-NLS-1$
- filterString = filterString + " /ns"; //$NON-NLS-1$
- else if (foldersOnly && (filterString != null) && (filterString.indexOf("/nf") == -1)) //$NON-NLS-1$
- filterString = filterString + " /nf"; //$NON-NLS-1$
- super.setFilterString(filterString);
- }
-
- /**
- * Get the current filter string being used to subset the list by.
- * Will be null unless setFilterString has previously been called.
- */
- public String getFilterString()
- {
- return super.getFilterString();
- }
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given filter string object.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- int elementType = 0;
- boolean isArchive = false;
-
- boolean canRead = true;
- boolean supportsSearch = true;
- boolean supportsArchiveManagement = false;
- boolean offline = false;
-
- // perf improvement... phil
- Object firstSelection = selection.getFirstElement();
- IRemoteFile firstFile = null;
- if ((firstSelection != null) && (firstSelection instanceof IRemoteFile))
- {
- firstFile = (IRemoteFile) firstSelection;
- elementType = firstFile.isDirectory() || firstFile.isRoot() ? 1 : 0;
- isArchive = firstFile.isArchive();
- canRead = firstFile.canRead();
-
- IRemoteFileSubSystem fileSubSystem = firstFile.getParentRemoteFileSubSystem();
-
- offline = fileSubSystem.isOffline();
-
- supportsSearch = fileSubSystem.getParentRemoteFileSubSystemConfiguration().supportsSearch();
- supportsArchiveManagement = fileSubSystem.getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- }
- else
- return;
-
-
- if (isArchive)
- {
- Iterator elements = selection.iterator();
- Object element = null;
-
- while (elements.hasNext())
- {
- element = elements.next();
- IRemoteFile remoteObj = (IRemoteFile) element;
- if (!remoteObj.isArchive())
- {
- break;
- }
- }
- }
-
- if ((elementType == 1 || (isArchive && supportsArchiveManagement)))
- {
- if (!foldersOnly)
- {
- if (addNewFile == null)
- {
- addNewFile = new SystemNewFileAction(shell);
- }
- addNewFile.setEnabled(canRead && !offline);
- menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFile);
- }
- if (!filesOnly)
- {
- if (addNewFolder == null)
- {
- addNewFolder = new SystemNewFolderAction(shell);
- }
- addNewFolder.setEnabled(canRead && !offline);
- menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFolder);
-
- if (addNewFilter == null)
- {
- addNewFilter = new SystemNewFileFilterFromFolderAction(shell);
- }
-
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new Separator());
- menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFilter);
- }
-
- }
- else {
- // open
- String label = SystemResources.ACTION_CASCADING_OPEN_LABEL;
- String tooltip = SystemResources.ACTION_CASCADING_OPEN_TOOLTIP;
- SystemEditFilesAction action = new SystemEditFilesAction(label, tooltip, shell);
- menu.add(ISystemContextMenuConstants.GROUP_OPEN, action);
- action.setEnabled(canRead && !offline);
-
- // open with ->
-
- MenuManager submenu =
- new MenuManager(FileResources.ResourceNavigator_openWith,
- ISystemContextMenuConstants.GROUP_OPENWITH);
-
- if (openWithMenu == null)
- {
- openWithMenu = new SystemRemoteFileOpenWithMenu();
- }
- openWithMenu.updateSelection(selection);
- submenu.add(openWithMenu);
- menu.getMenuManager().appendToGroup(ISystemContextMenuConstants.GROUP_OPENWITH, submenu);
- }
-
-
- if (moveAction == null)
- moveAction = new SystemMoveRemoteFileAction(shell);
-
- //ISubSystem subsys = firstFile.getParentRemoteFileSubSystem();
-
- // DKM - clipboard based copy actions
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
-
- if (pasteClipboardAction == null)
- {
- pasteClipboardAction = new SystemPasteFromClipboardAction(shell, clipboard);
- }
- if (copyClipboardAction == null)
- {
- copyClipboardAction = new SystemCopyToClipboardAction(shell, clipboard);
- }
- if (searchAction == null)
- {
- searchAction = new SystemSearchAction(shell);
- }
- if (compareFilesAction == null)
- {
- compareFilesAction = new SystemCompareFilesAction(shell);
- }
- if (compareEditionAction == null)
- {
- compareEditionAction = new SystemCompareWithEditionAction(shell);
- }
- if (replaceEditionAction == null)
- {
- replaceEditionAction = new SystemReplaceWithEditionAction(shell);
- }
- if (supportsSearch)
- {
- //menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, addToArchiveAction);
-
- // add search action
- menu.add(ISystemContextMenuConstants.GROUP_SEARCH, searchAction);
- searchAction.setEnabled(canRead && !offline);
- }
-
- if (!firstFile.isRoot())
- {
- menu.add(menuGroup, copyClipboardAction);
- copyClipboardAction.setEnabled(canRead && !offline);
- if (elementType == 0)
- {
- menu.add(ISystemContextMenuConstants.GROUP_COMPAREWITH, compareFilesAction);
- menu.add(ISystemContextMenuConstants.GROUP_COMPAREWITH, compareEditionAction);
- menu.add(ISystemContextMenuConstants.GROUP_REPLACEWITH, replaceEditionAction);
-
- compareFilesAction.setEnabled(canRead && !offline);
- compareEditionAction.setEnabled(canRead && !offline);
- replaceEditionAction.setEnabled(canRead && !offline);
- }
- }
-
- if (elementType == 1 || (isArchive && supportsArchiveManagement))
- {
- menu.add(menuGroup, pasteClipboardAction);
- pasteClipboardAction.setEnabled(canRead && !offline);
- }
- if (!firstFile.isRoot())
- {
- menu.add(menuGroup, moveAction);
- moveAction.setEnabled(canRead && !offline);
- }
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (file.isFile() || file.isArchive()) // hack to show zips without folder icons
- {
- return getEditorRegistry().getImageDescriptor(file.getName());
- }
- else
- {
- boolean isOpen = false;
- if (getViewer() instanceof AbstractTreeViewer)
- {
- AbstractTreeViewer atv = (AbstractTreeViewer) getViewer();
- isOpen = atv.getExpandedState(element);
- if (!isOpen)
- {
- // if there are children but they are empty then we've queried this but there are no children
- // so we have an empty open folder
- Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance());
- if (contents != null && contents.length == 0)
- isOpen = true;
- }
- }
- if (file.isRoot())
- return RSEUIPlugin.getDefault().getImageDescriptor(isOpen ? ISystemIconConstants.ICON_SYSTEM_ROOTDRIVEOPEN_ID : ISystemIconConstants.ICON_SYSTEM_ROOTDRIVE_ID);
- else if (isOpen)
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- else
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID);
- }
- }
-
- /**
- * Return the label for this object. Uses getName() on the remote file object.
- */
- public String getText(Object element)
- {
- return getName(element);
- }
-
- /**
- * Return the label for this object. Uses getName() on the remote file object.
- */
- public String getAlternateText(Object element)
- {
- return ((IRemoteFile) element).getLabel();
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return ((IRemoteFile) element).getName();
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
-
- if (file.isRoot())
- return SystemViewResources.RESID_PROPERTY_FILE_TYPE_ROOT_VALUE;
- else if (file.isDirectory())
- return SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE;
- else
- return SystemViewResources.RESID_PROPERTY_FILE_TYPE_FILE_VALUE;
- }
-
- /**
- * Return the string to display in the status line when the given object is selected.
- * We return:
- * <getType()>: <getAbsoluteName()>
- */
- public String getStatusLineText(Object element)
- {
- return getType(element) + ": " + getAbsoluteName(element); //$NON-NLS-1$
- }
-
- /**
- * Returns whether the specified element is represented as existing. Note that
- * it's possible that the represented element will been seen to exist when on
- * a remote host it may not - that is because this call does not query the host.
- * Returns whether the remote file representation exists.
- *
- * @param element the element to check
- * @return true if the element exists
- *
- */
- public boolean exists(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (file != null)
- {
- return file.exists();
- }
- return false;
- }
-
- /**
- * Return the parent of this object
- */
- public Object getParent(Object element)
- {
- //System.out.println("Inside getParent for: "+element);
- IRemoteFile file = (IRemoteFile) element;
-
- IRemoteFile parent = file.getParentRemoteFile();
- if ((parent != null) && parent.getAbsolutePath().equals(file.getAbsolutePath()))
- // should never happen but sometimes it does, leading to infinite loop.
- parent = null;
- return parent;
-
- }
-
- /**
- * Return the children of this object.
- * If this is a folder or root, we list all child folders and files.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- return internalGetChildren(element, null, monitor);
- }
-
- /**
- * Return the children of this object.
- * If this is a folder or root, we list all child folders and files.
- */
- public Object[] getChildren(IContextObject context, IProgressMonitor monitor)
- {
- return internalGetChildren(context.getModelObject(), context.getFilterReference(), monitor);
- }
-
- private Object[] internalGetChildren(IAdaptable element, ISystemFilterReference filterReference, IProgressMonitor monitor)
- {
- //System.out.println("Inside getChildren for: "+element);
- IRemoteFile file = (IRemoteFile) element;
- if (file instanceof RemoteFileEmpty) // cut to the chase
- {
- //System.out.println("FileAdapter.getChildren(): empty list-request");
- return EMPTY_LIST;
- }
- else if (file instanceof RemoteFileRoot)
- {
- //System.out.println("FileAdapter.getChildren(): children of root list-request");
- return ((RemoteFileRoot) file).getRootFiles();
- }
- IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
-
-
- /*
- RemoteFileFilterString orgRffs = file.getFilterString();
-
-
- if (orgRffs != null)
- {
- if (foldersOnly)
- {
- RemoteFileFilterString rffs = (RemoteFileFilterString) orgRffs.clone();
- rffs.setPath(null);
- rffs.setShowFiles(false);
- rffs.setShowSubDirs(true);
- filter = rffs.toString();
- }
- else if (filesOnly)
- {
- RemoteFileFilterString rffs = (RemoteFileFilterString) orgRffs.clone();
- rffs.setPath(null);
- rffs.setShowSubDirs(false);
- rffs.setShowFiles(true);
- filter = rffs.toString();
- }
- }
- else
- */
- String filter = null;
- if (filterReference != null)
- {
- ISystemFilter filterObject = filterReference.getReferencedFilter();
- if (filterObject.getFilterStringCount() > 0)
- {
- String filterString = filterObject.getFilterStrings()[0];
- String separator = PathUtility.getSeparator(filterString);
-
- int sepIndex = filterString.lastIndexOf(separator);
- if (sepIndex >= 0)
- {
- filter = filterString.substring(sepIndex + 1);
- }
- else
- {
- // fix for 197089
- filter = filterString;
- }
- }
- }
- else
- {
-
- String filterString = getFilterString();
- if (foldersOnly)
- {
- if (filterString == null)
- filter = "* /nf"; //$NON-NLS-1$
- else
- filter = filterString;
- }
- else if (filesOnly)
- {
- if (filterString == null)
- filter = "* /ns"; //$NON-NLS-1$
- else
- filter = filterString;
- }
- else
- {
- if (filterString == null)
- filter = "*"; //$NON-NLS-1$
- else
- filter = filterString;
- }
- }
-
- Object[] children = null;
-
- Viewer v = getViewer();
-
- if ((v != null) && (v instanceof SystemSearchTableView)) {
-
- SystemSearchTableView view = (SystemSearchTableView)v;
- Iterator iter = view.getResultSet().getSearchConfigurations();
- boolean hasSearchResults = false;
- while (iter.hasNext() && !hasSearchResults)
- {
- IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)(iter.next());
- String searchString = config.getSearchString().getTextString();
-
- hasSearchResults = file.hasContents(RemoteSearchResultsContentsType.getInstance(), searchString);
-
- if (hasSearchResults)
- {
- children = file.getContents(RemoteSearchResultsContentsType.getInstance(), searchString);
- return children;
- }
- }
- }
-
- boolean hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance(), filter);
-
- if (hasChildren && !file.isStale())
- {
- children = file.getContents(RemoteChildrenContentsType.getInstance(), filter);
- children = filterChildren(children);
- }
- else
- {
- try
- {
- if (monitor != null)
- {
-
- children = ss.resolveFilterString(file, filter, monitor);
- }
- else
- {
- children = ss.resolveFilterString(file, filter, new NullProgressMonitor());
- }
-
- if ((children == null) || (children.length == 0))
- {
- children = EMPTY_LIST;
- }
- else
- {
- if (children.length == 1 && children[0] instanceof SystemMessageObject)
- {
- // don't filter children so that the message gets propagated
- }
- else
- {
- children = filterChildren(children);
- }
- }
-
- }
- catch (InterruptedException exc)
- {
- children = new SystemMessageObject[1];
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_EXPAND_CANCELLED,
- IStatus.CANCEL, CommonMessages.MSG_EXPAND_CANCELLED);
- children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_CANCEL, element);
- }
- catch (Exception exc)
- {
- children = new SystemMessageObject[1];
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_EXPAND_FAILED,
- IStatus.ERROR,
- CommonMessages.MSG_EXPAND_FAILED);
- children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, element);
- SystemBasePlugin.logError("Exception resolving file filter strings", exc); //$NON-NLS-1$
- } // message already issued
- }
- file.markStale(false);
- return children;
- }
-
- private Object[] filterChildren(Object[] children) {
-
- boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
-
- if (showHidden) {
- return children;
- }
- else {
-
- ArrayList results = new ArrayList(children.length);
-
- for (int i = 0; i < children.length; i++) {
-
- if (children[i] instanceof IRemoteFile) {
- IRemoteFile remoteFile = (IRemoteFile)(children[i]);
-
- if (!remoteFile.isHidden()) {
- results.add(remoteFile);
- }
- }
- }
-
- return results.toArray();
- }
- }
-
- /**
- * Return true if this object has children.
- * Since we can't predict the outcome of resolving the filter string, we return true.
- */
- public boolean hasChildren(IContextObject element)
- {
- return internalHasChildren(element.getModelObject(), element.getFilterReference());
- }
-
- /**
- * Return true if this object has children.
- * Since we can't predict the outcome of resolving the filter string, we return true.
- */
- public boolean hasChildren(IAdaptable element)
- {
- return internalHasChildren(element, null);
- }
-
- public boolean internalHasChildren(IAdaptable element, ISystemFilterReference filterReference)
- {
- IRemoteFile file = (IRemoteFile) element;
-
- if (!file.exists())
- return false;
-
- boolean supportsArchiveManagement = file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- boolean hasChildren = false;
-
- String filter = "*"; //$NON-NLS-1$
- if (filterReference != null)
- {
- ISystemFilter filterObject = filterReference.getReferencedFilter();
- if (filterObject.getFilterStringCount() > 0)
- {
- String filterString = filterObject.getFilterStrings()[0];
- String separator = PathUtility.getSeparator(filterString);
-
- int sepIndex = filterString.lastIndexOf(separator);
- if (sepIndex > 0)
- {
- filter = filterString.substring(sepIndex + 1);
- }
- }
- }
-
- if (file instanceof IVirtualRemoteFile)
- {
- hasChildren = ((IVirtualRemoteFile)file).isVirtualFolder();
- }
- else
- {
- hasChildren = !file.isFile() || (file.isArchive() && supportsArchiveManagement);
- }
-
- if (!hasChildren) {
-
- Viewer v = getViewer();
-
- if ((v != null) && (v instanceof SystemSearchTableView)) {
-
- SystemSearchTableView view = (SystemSearchTableView)v;
- Iterator iter = view.getResultSet().getSearchConfigurations();
- while (iter.hasNext() && !hasChildren)
- {
- IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)(iter.next());
- String searchString = config.getSearchString().getTextString();
-
- hasChildren = file.hasContents(RemoteSearchResultsContentsType.getInstance(), searchString);
- }
- }
- else {
- hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance(), filter);
- }
- }
- else
- {
- // check that the children are actually there
- //Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance());
- hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance(), filter);
- //if (!hasChildren && !file.isStale())
- if (!hasChildren && file.isStale() && (file.isDirectory() || file.isArchive())) // there are no children, but the resource is stale, therefore it still needs to be queried
- hasChildren = true;
- }
-
- return hasChildren;
- }
-
-
-
- public IPropertyDescriptor[] getUniquePropertyDescriptors()
- {
-
- IRemoteFile file = null;
- if (propertySourceInput instanceof IRemoteFile)
- {
- file = (IRemoteFile) propertySourceInput;
-
- boolean supportsArchiveManagement = file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
-
- boolean isArchive = file.isArchive() && supportsArchiveManagement;
- boolean isVirtual = file instanceof IVirtualRemoteFile && supportsArchiveManagement;
- boolean isRegular = !isArchive && !isVirtual;
-
- if (isRegular && uniquePropertyDescriptorArray == null ||
- isArchive && uniqueArchiveDescriptorArray == null ||
- isVirtual && uniqueVirtualDescriptorArray == null)
- {
-
- int nbrOfArchiveProperties = 2;
- int nbrOfVirtualProperties = 4;
- int nbrOfProperties = 8;
- if (isVirtual) nbrOfProperties += nbrOfVirtualProperties;
- else if (isArchive) nbrOfProperties += nbrOfArchiveProperties;
-
- if (isRegular) uniquePropertyDescriptorArray = new PropertyDescriptor[nbrOfProperties];
- else if (isVirtual) uniqueVirtualDescriptorArray = new PropertyDescriptor[nbrOfProperties];
- else if (isArchive) uniqueArchiveDescriptorArray = new PropertyDescriptor[nbrOfProperties];
- //PropertyDescriptor[] defaultProperties = (PropertyDescriptor[]) getDefaultDescriptors();
-
- int i = -1;
-
- // add our unique property descriptors...
- //RSEUIPlugin plugin = RSEUIPlugin.getDefault();
-
- // classification
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CLASSIFICATION, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_LABEL, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CLASSIFICATION, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_LABEL, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CLASSIFICATION, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_LABEL, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP);
-
- // last modified
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_LASTMODIFIED, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_LABEL, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_LASTMODIFIED, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_LABEL, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_LASTMODIFIED, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_LABEL, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP);
-
- // size
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_SIZE, FileResources.RESID_PROPERTY_FILE_SIZE_LABEL, FileResources.RESID_PROPERTY_FILE_SIZE_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_SIZE, FileResources.RESID_PROPERTY_FILE_SIZE_LABEL, FileResources.RESID_PROPERTY_FILE_SIZE_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_SIZE, FileResources.RESID_PROPERTY_FILE_SIZE_LABEL, FileResources.RESID_PROPERTY_FILE_SIZE_TOOLTIP);
-
- // canonical path
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CANONICAL_PATH, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CANONICAL_PATH, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CANONICAL_PATH, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP);
-
- // file extension
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, FileResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, FileResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, FileResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, FileResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, FileResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, FileResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP);
-
- // file permissions
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP);
-
- // file owner
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, FileResources.RESID_PROPERTY_FILE_OWNER_LABEL, FileResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, FileResources.RESID_PROPERTY_FILE_OWNER_LABEL, FileResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, FileResources.RESID_PROPERTY_FILE_OWNER_LABEL, FileResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP);
-
- // file group
- if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, FileResources.RESID_PROPERTY_FILE_GROUP_LABEL, FileResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP);
- else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, FileResources.RESID_PROPERTY_FILE_GROUP_LABEL, FileResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP);
- else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, FileResources.RESID_PROPERTY_FILE_GROUP_LABEL, FileResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP);
-
-
- if (isVirtual)
- {
- // add virtual property descriptors...
-
- // compressed size
- uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMPRESSEDSIZE, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION);
-
- // compression ratio
- uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMPRESSIONRATIO, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION);
-
- // compression method
- uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMPRESSIONMETHOD, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION);
-
- // comment
- uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMMENT, FileResources.RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION);
- }
- else if (isArchive)
- {
- // add archive property descriptors...
-
- // expanded size
- uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_ARCHIVE_EXPANDEDSIZE, FileResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL, FileResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION);
-
- // comment
- uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_ARCHIVE_COMMENT, FileResources.RESID_PROPERTY_ARCHIVE_COMMENT_LABEL, FileResources.RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION);
- }
- }
-
- // DKM - I commented this stuff out since it's screwing up table view
- ///*
- if (isRegular) return uniquePropertyDescriptorArray;
- else if (isVirtual) return uniqueVirtualDescriptorArray;
- else if (isArchive) return uniqueArchiveDescriptorArray;
- else return uniquePropertyDescriptorArray;
- //*/
- }
- return uniquePropertyDescriptorArray;
- }
-
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- //System.out.println("Inside beg getPropertyDescriptors: "+propertyDescriptorArray);
- // IT TURNS OUT THAT FOR IFS FILES, THE QUERY OF THE FULL SET OF PROPERTIES CAN TAKE UP
- // TO 5 SECONDS, CONSIDERABLY SLOWING DOWN RESPONSE TIME TO THE POINT OF PAIN. TO FIX THIS,
- // WE HAVE MADE IT POSSIBLE FOR REMOTE FILE OBJECTS TO DECIDE TO SHOW ONLY A SUBSET OF THE
- // PROPERTIES, WHICH IFS FILES EXPLOIT. PHIL.
-
- IRemoteFile file = null;
- if (propertySourceInput instanceof IRemoteFile) file = (IRemoteFile) propertySourceInput;
- boolean isArchive = false;//file != null && file.isArchive();
-
- boolean isVirtual = file != null && file instanceof IVirtualRemoteFile;
- boolean isRegular = !isArchive && !isVirtual;
-
- if (isRegular && propertyDescriptorArray == null ||//uniquePropertyDescriptorArray == null ||
- isArchive && archiveDescriptorArray == null ||
- isVirtual && virtualDescriptorArray == null)
- {
- int nbrOfArchiveProperties = 2;
- int nbrOfVirtualProperties = 4;
- int nbrOfProperties = 12;
- int nbrOfBriefProperties = 2;
- if (debug)
- nbrOfProperties += 7;
-
- if (isVirtual) nbrOfProperties += nbrOfVirtualProperties;
- else if (isArchive) nbrOfProperties += nbrOfArchiveProperties;
-
- if (isRegular) propertyDescriptorArray = new PropertyDescriptor[nbrOfProperties];
- else if (isVirtual) virtualDescriptorArray = new PropertyDescriptor[nbrOfProperties];
- else if (isArchive) archiveDescriptorArray = new PropertyDescriptor[nbrOfProperties];
-
- briefPropertyDescriptorArray = new PropertyDescriptor[nbrOfBriefProperties];
- int idx = -1;
- int briefIdx = idx;
-
- // path
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PATH, SystemViewResources.RESID_PROPERTY_FILE_PATH_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PATH_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PATH, SystemViewResources.RESID_PROPERTY_FILE_PATH_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PATH_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PATH, SystemViewResources.RESID_PROPERTY_FILE_PATH_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PATH_TOOLTIP);
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PATH, SystemViewResources.RESID_PROPERTY_FILE_PATH_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PATH_TOOLTIP);
-
- // filter string
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRING, SystemViewResources.RESID_PROPERTY_FILTERSTRING_LABEL,SystemViewResources.RESID_PROPERTY_FILTERSTRING_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRING, SystemViewResources.RESID_PROPERTY_FILTERSTRING_LABEL,SystemViewResources.RESID_PROPERTY_FILTERSTRING_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRING, SystemViewResources.RESID_PROPERTY_FILTERSTRING_LABEL,SystemViewResources.RESID_PROPERTY_FILTERSTRING_TOOLTIP);
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRING, SystemViewResources.RESID_PROPERTY_FILTERSTRING_LABEL,SystemViewResources.RESID_PROPERTY_FILTERSTRING_TOOLTIP);
-
- // canonical path
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CANONICAL_PATH, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL,FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CANONICAL_PATH, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL,FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CANONICAL_PATH, FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_LABEL,FileResources.RESID_PROPERTY_FILE_CANONICAL_PATH_TOOLTIP);
-
- // last modified
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_LASTMODIFIED, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_LABEL, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_LASTMODIFIED, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_LABEL,FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_LASTMODIFIED, FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_LABEL,FileResources.RESID_PROPERTY_FILE_LASTMODIFIED_TOOLTIP);
-
- // size
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_SIZE, FileResources.RESID_PROPERTY_FILE_SIZE_LABEL, FileResources.RESID_PROPERTY_FILE_SIZE_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_SIZE, FileResources.RESID_PROPERTY_FILE_SIZE_LABEL, FileResources.RESID_PROPERTY_FILE_SIZE_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_SIZE, FileResources.RESID_PROPERTY_FILE_SIZE_LABEL, FileResources.RESID_PROPERTY_FILE_SIZE_TOOLTIP);
-
- // classification
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CLASSIFICATION, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_LABEL, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CLASSIFICATION, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_LABEL, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_CLASSIFICATION, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_LABEL, FileResources.RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP);
-
- // readonly
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_READONLY, FileResources.RESID_PROPERTY_FILE_READONLY_LABEL, FileResources.RESID_PROPERTY_FILE_READONLY_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_READONLY, FileResources.RESID_PROPERTY_FILE_READONLY_LABEL, FileResources.RESID_PROPERTY_FILE_READONLY_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_READONLY, FileResources.RESID_PROPERTY_FILE_READONLY_LABEL, FileResources.RESID_PROPERTY_FILE_READONLY_TOOLTIP);
-
- // hidden
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_HIDDEN, FileResources.RESID_PROPERTY_FILE_HIDDEN_LABEL, FileResources.RESID_PROPERTY_FILE_HIDDEN_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_HIDDEN, FileResources.RESID_PROPERTY_FILE_HIDDEN_LABEL, FileResources.RESID_PROPERTY_FILE_HIDDEN_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_HIDDEN, FileResources.RESID_PROPERTY_FILE_HIDDEN_LABEL, FileResources.RESID_PROPERTY_FILE_HIDDEN_TOOLTIP);
-
- // file extension
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, FileResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, FileResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, FileResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, FileResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, FileResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, FileResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP);
-
- // file permissions
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, FileResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP);
-
- // file owner
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, FileResources.RESID_PROPERTY_FILE_OWNER_LABEL, FileResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, FileResources.RESID_PROPERTY_FILE_OWNER_LABEL, FileResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, FileResources.RESID_PROPERTY_FILE_OWNER_LABEL, FileResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP);
-
- // file group
- if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, FileResources.RESID_PROPERTY_FILE_GROUP_LABEL, FileResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP);
- else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, FileResources.RESID_PROPERTY_FILE_GROUP_LABEL, FileResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP);
- else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, FileResources.RESID_PROPERTY_FILE_GROUP_LABEL, FileResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP);
-
-
- if (debug)
- {
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_PARENTREMOTEFILE"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_PARENTREMOTEFILE"); //$NON-NLS-1$
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_PARENT"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_PARENT"); //$NON-NLS-1$
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_PARENTNOROOT"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_PARENTNOROOT"); //$NON-NLS-1$
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_PARENTNAME"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_PARENTNAME"); //$NON-NLS-1$
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_ROOT"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_ROOT"); //$NON-NLS-1$
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_ISROOT"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_ISROOT"); //$NON-NLS-1$
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor("DEBUG_EXISTS"); //$NON-NLS-1$
- briefPropertyDescriptorArray[++briefIdx] = createSimplePropertyDescriptor("DEBUG_EXISTS"); //$NON-NLS-1$
- }
-
- if (isVirtual)
- {
- // add virtual property descriptors...
-
- // compressed size
- virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMPRESSEDSIZE, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_DESCRIPTION);
-
- // compression ratio
- virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMPRESSIONRATIO, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONRATIO_DESCRIPTION);
-
- // compression method
- virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMPRESSIONMETHOD, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSIONMETHOD_DESCRIPTION);
-
- // comment
- virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VIRTUAL_COMMENT, FileResources.RESID_PROPERTY_VIRTUALFILE_COMMENT_LABEL, FileResources.RESID_PROPERTY_VIRTUALFILE_COMMENT_DESCRIPTION);
- }
-
- else if (isArchive)
- {
- // add archive property descriptors...
-
- // expanded size
- archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_ARCHIVE_EXPANDEDSIZE, FileResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_LABEL, FileResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_DESCRIPTION);
-
- // comment
- archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_ARCHIVE_COMMENT, FileResources.RESID_PROPERTY_ARCHIVE_COMMENT_LABEL, FileResources.RESID_PROPERTY_ARCHIVE_COMMENT_DESCRIPTION);
- }
-
- }
-
-// return propertyDescriptorArray;
- // DKM - I've commented this out because it's too expensive to query archive properties during a folder query
- // we need to come back to this and change this do work in a more performance-sensitive way
-
- //System.out.println("Inside end getPropertyDescriptors: "+propertyDescriptorArray.length);
- if ((propertySourceInput instanceof IRemoteFile) && ((IRemoteFile) propertySourceInput).showBriefPropertySet())
- return propertyDescriptorArray;
- //return briefPropertyDescriptorArray;
-
- else
- {
- if (isRegular) return propertyDescriptorArray;
- else if (isVirtual) return virtualDescriptorArray;
- else if (isArchive) return archiveDescriptorArray;
- else return propertyDescriptorArray;
- }
-
- }
-
- /**
- * Create and return a simple string readonly property descriptor. For debug purposes
- */
- protected static PropertyDescriptor createSimplePropertyDescriptor(String keyAndLabel)
- {
- PropertyDescriptor pd = new PropertyDescriptor(keyAndLabel, keyAndLabel);
- return pd;
- }
-
- /**
- * Returns the current value for the named property.
- * @return the current value of the given property
- */
- protected Object internalGetPropertyValue(Object key)
- {
- return getPropertyValue(key, true);
- }
-
-
- public Object getPropertyValue(Object key)
- {
- String name = (String)key;
- if (name.equals(ISystemPropertyConstants.P_NBRCHILDREN))
- {
- IRemoteFile file = (IRemoteFile) propertySourceInput;
- {
- ISystemContainer container = file;
- Object[] contents = container.getContents(RemoteChildrenContentsType.getInstance());
- if (contents == null)
- return "0"; //$NON-NLS-1$
- else
- return Integer.toString(contents.length);
- }
- }
- return super.getPropertyValue(key);
- }
-
- /**
- * Returns the current value for the named property.
- *
- * @param property the name or key of the property as named by its property descriptor
- * @param formatted indication of whether to return the value in formatted or raw form
- * @return the current value of the given property
- */
- public Object getPropertyValue(Object property, boolean formatted)
- {
- String name = (String) property;
- IRemoteFile file = (IRemoteFile) propertySourceInput;
- IVirtualRemoteFile virtualFile = null;
- boolean isVirtual = file instanceof IVirtualRemoteFile;
- if (isVirtual)
- {
- virtualFile = (IVirtualRemoteFile) file;
- }
- if (debug)
- {
- if (name.equals("DEBUG_PARENTREMOTEFILE")) //$NON-NLS-1$
- {
- IRemoteFile parent = file.getParentRemoteFile();
- if (parent == null)
- return "null"; //$NON-NLS-1$
- else
- return "absPath='" + parent.getAbsolutePath() + "'"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- else if (name.equals("DEBUG_PARENT")) //$NON-NLS-1$
- return file.getParentPath();
- else if (name.equals("DEBUG_PARENTNOROOT")) //$NON-NLS-1$
- return file.getParentNoRoot();
- else if (name.equals("DEBUG_PARENTNAME")) //$NON-NLS-1$
- return file.getParentName();
- else if (name.equals("DEBUG_ROOT")) //$NON-NLS-1$
- return file.getRoot();
- else if (name.equals("DEBUG_ISROOT")) //$NON-NLS-1$
- return file.isRoot() ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
- else if (name.equals("DEBUG_EXISTS")) //$NON-NLS-1$
- return file.exists() ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
-
- }
- //
- if (name.equals(ISystemPropertyConstants.P_FILE_LASTMODIFIED))
- {
- Date date = file.getLastModifiedDate();
- if (date != null)
- {
- if (formatted)
- {
- DateFormat datefmt = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM);
- String formattedDate = datefmt.format(date);
- return formattedDate;
- }
- else
- {
- return date;
- }
- }
- return date;
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_SIZE))
- {
- if (formatted)
- {
- NumberFormat fmt = NumberFormat.getIntegerInstance();
- String formattedNumber = fmt.format(file.getLength());
- return sub(xlatedSize, MSG_SUB1, formattedNumber);
- }
- else
- {
- return new Long(file.getLength());
- }
- }
- else if (name.equals(ISystemPropertyConstants.P_ARCHIVE_EXPANDEDSIZE))
- {
- if (!isVirtual || virtualFile == null) return new Long(0);
-
- if (formatted)
- {
- return sub(xlatedExpandedSize, MSG_SUB1, Long.toString(virtualFile.getExpandedSize()));
- }
- else
- {
- return new Long(virtualFile.getExpandedSize());
- }
- }
- else if (name.equals(ISystemPropertyConstants.P_VIRTUAL_COMPRESSEDSIZE))
- {
- if (!isVirtual || virtualFile == null) return new Long(0);
- if (formatted)
- {
- return sub(xlatedCompressedSize, MSG_SUB1, Long.toString(virtualFile.getCompressedSize()));
- }
- else
- {
- return new Long(virtualFile.getCompressedSize());
- }
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_PATH))
- {
- return file.getParentPath();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_CANONICAL_PATH))
- {
- return file.getCanonicalPath();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_EXTENSION))
- {
- if(!file.isDirectory()) {
- String ext = file.getExtension();
- return ext == null?"":ext; //$NON-NLS-1$
- }
- else
- return ""; //$NON-NLS-1$
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_PERMISSIONS))
- {
- IHostFilePermissions permissions = file.getPermissions();
- if (permissions == null){
-
- if (getFilePermissions(file)){
- return FileResources.MESSAGE_PENDING;
- }
- return FileResources.MESSAGE_NOT_SUPPORTED;
- }
- if (permissions instanceof PendingHostFilePermissions){
- return FileResources.MESSAGE_PENDING;
- }
- return permissions.toAlphaString();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_OWNER))
- {
- IHostFilePermissions permissions = file.getPermissions();
- if (permissions == null){
-
- if (getFilePermissions(file)){
- return FileResources.MESSAGE_PENDING;
- }
- return FileResources.MESSAGE_NOT_SUPPORTED;
- }
- if (permissions instanceof PendingHostFilePermissions){
- return FileResources.MESSAGE_PENDING;
- }
- return permissions.getUserOwner();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_GROUP))
- {
- IHostFilePermissions permissions = file.getPermissions();
- if (permissions == null){
-
- if (getFilePermissions(file)){
- return FileResources.MESSAGE_PENDING;
- }
- return FileResources.MESSAGE_NOT_SUPPORTED;
- }
- if (permissions instanceof PendingHostFilePermissions){
- return FileResources.MESSAGE_PENDING;
- }
- return permissions.getGroupOwner();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_CLASSIFICATION))
- {
- return file.getClassification();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_READONLY))
- {
- return file.canWrite() ? getTranslatedNo() : getTranslatedYes();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_READABLE))
- {
- return file.canRead() ? getTranslatedYes() : getTranslatedNo();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_WRITABLE))
- {
- return file.canWrite() ? getTranslatedYes() : getTranslatedNo();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILE_HIDDEN))
- {
- return file.isHidden() ? getTranslatedYes() : getTranslatedNo();
- }
- else if (name.equals(ISystemPropertyConstants.P_FILTERSTRING))
- {
- return file.getFilterString();
- }
- else if (name.equals(ISystemPropertyConstants.P_ARCHIVE_COMMENT) || name.equals(ISystemPropertyConstants.P_VIRTUAL_COMMENT))
- {
- return file.getComment();
- }
- else if (name.equals(ISystemPropertyConstants.P_VIRTUAL_COMPRESSIONMETHOD))
- {
- if (!isVirtual || virtualFile == null) return ""; //$NON-NLS-1$
- return virtualFile.getCompressionMethod();
- }
- else if (name.equals(ISystemPropertyConstants.P_VIRTUAL_COMPRESSIONRATIO))
- {
- if (virtualFile != null)
- {
- Double ratio = new Double(virtualFile.getCompressionRatio());
- if (formatted)
- {
- NumberFormat numfmt = NumberFormat.getPercentInstance();
- return numfmt.format(ratio);
- }
- else
- {
- return ratio;
- }}
- else
- return null;
- }
- else
- return null; //super.getPropertyValue(name);
- }
-
- private boolean getFilePermissions(IRemoteFile file){
- if (file instanceof IAdaptable){
- final IFilePermissionsService service = (IFilePermissionsService)((IAdaptable)file).getAdapter(IFilePermissionsService.class);
-
- if (service != null && (service.getCapabilities(file.getHostFile()) & IFilePermissionsService.FS_CAN_GET_PERMISSIONS) != 0){
-
- final IRemoteFile rFile = file;
- if (rFile.getHostFile() instanceof IHostFilePermissionsContainer){
- ((IHostFilePermissionsContainer)rFile.getHostFile()).setPermissions(new PendingHostFilePermissions());
- }
-
- Job deferredFetch = new Job(NLS.bind(FileResources.MESSAGE_GETTING_PERMISSIONS, file.getAbsolutePath()))
- {
- public IStatus run(IProgressMonitor monitor){
- try
- {
- // service will take care of setting this on the host file
- service.getFilePermissions(rFile.getHostFile(), monitor);
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.fireEvent(new SystemResourceChangeEvent(rFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, rFile));
- }
- catch (Exception e)
- {
- }
- return Status.OK_STATUS;
- }
- };
- deferredFetch.schedule();
-
-
- return true; // query kicked off
- }
- }
- return false; // no query kicked off
- }
-
-
- // Drag and Drop Implementation
-
- /**
- * Indicates whether the specified object can be copied or not.
- * @param element the object we want to try to copy
- * @return whether this object can be copied or not
- */
- public boolean canDrag(Object element)
- {
- if (element instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile)element;
- boolean offline = file.getParentRemoteFileSubSystem().isOffline();
- return file.canRead() && !offline;
- }
- return true;
- }
-
- /**
- * Indicates whether the specified object can have another object copied to it
- * @param element the object we want to try to copy to
- * @return whether this object can be copied to or not
- */
- public boolean canDrop(Object element)
- {
- if (element instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile) element;
- boolean offline = file.getParentRemoteFileSubSystem().isOffline();
- boolean supportsArchiveManagement = file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- return !offline && file.canRead() && file.canWrite() && (file.isDirectory() || file.isRoot() || (file.isArchive() && supportsArchiveManagement));
- }
-
- return false;
- }
-
- /**
- * Return true if it is valid for the src object to be dropped in the target
- * @param srcSet the objects to drop
- * @param target the object which src is dropped in
- * @param sameSystem whether this is the same system
- * @return whether this is a valid operation
- */
- public boolean validateDrop(ISystemResourceSet srcSet, Object target, boolean sameSystem)
- {
- if (target instanceof IRemoteFile)
- {
- IRemoteFile targetFile = (IRemoteFile) target;
- boolean supportsArchiveManagement = targetFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- if (!targetFile.isFile() || (targetFile.isArchive() && supportsArchiveManagement))
- {
- targetFile.canWrite();
- }
- // all objects are of same type, so we only need to use first to validate
- Object first = srcSet.get(0);
- if (first instanceof IRemoteFile)
- {
- return true;
- }
- else if (first instanceof IResource)
- {
- return true;
- }
- else if (first instanceof ISystemFilterReference)
- {
- return true;
- }
- else // akh11: proposed modification -- 01/28/2005
- { // ask source adapter if it supports drop of its type on this target:
- ISystemViewDropDestination adapter = (ISystemViewDropDestination)Platform.getAdapterManager().getAdapter(first,ISystemViewDropDestination.class);
- if (adapter != null)
- return adapter.supportDropDestination(target);
- }
- }
- return false;
- }
-
- /**
- * Return true if it is valid for the src object to be dropped in the target
- * @param src the object to drop
- * @param target the object which src is dropped in
- * @param sameSystem whether this is the same system
- * @return whether this is a valid operation
- */
- public boolean validateDrop(Object src, Object target, boolean sameSystem)
- {
- if (target instanceof IRemoteFile)
- {
- IRemoteFile targetFile = (IRemoteFile) target;
- boolean supportsArchiveManagement = targetFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- if (!targetFile.isFile() || (targetFile.isArchive() && supportsArchiveManagement))
- {
- // get properties
- // this is asynchronous so we call
- // it here to prepare for subsequent operation
- targetFile.canWrite();
-
- if (src instanceof IRemoteFile)
- {
- return true;
- }
- else if (src instanceof IResource)
- {
- return true;
- }
- else if (src instanceof String)
- {
- // check if this is a file
- java.io.File localFile = new java.io.File((String) src);
- if (localFile.exists())
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else if (src instanceof ISystemFilterReference)
- {
- return true;
- }
-
- else // akh11: proposed modification -- 01/28/2005
- { // ask source adapter if it supports drop of its type on this target:
- ISystemViewDropDestination adapter = (ISystemViewDropDestination)Platform.getAdapterManager().getAdapter(src,ISystemViewDropDestination.class);
- if (adapter != null)
- return adapter.supportDropDestination(target);
- }
- }
- }
-
- return false;
- }
-
-
-
- /**
- * Performs a drag copy operation. The source object is uploaded to a temporary location so that it can
- * later be dropped on another remote system.
- * @param element the object which is being copied
- * @param sameSystem an indication whether a transfer is being made between the same types of systems.
- * @param monitor a progress monitor
- * @return the temporary object that was created after the upload
- */
- public Object doDrag(Object element, boolean sameSystem, IProgressMonitor monitor)
- {
-
- // copy all resources into temporary location
- if (element instanceof IRemoteFile)
- {
- IRemoteFile srcFileOrFolder = (IRemoteFile) element;
- return UniversalFileTransferUtility.downloadResourceToWorkspace(srcFileOrFolder, monitor);
- }
- else if (element instanceof File) {
- return UniversalFileTransferUtility.downloadResourceToWorkspace((File)element, monitor);
- }
- else if (element instanceof IResource)
- {
- // if the src is an IResource, then this is our temp object
- return element;
- }
-
- return null;
- }
-
- /**
- * <i><b>Overridable</b> by subclasses, and is iff drag and drop supported.</i><br>
- * Perform the drag on the given objects. This default implementation simply iterates through the
- * set. For optimal performance, this should be overridden.
- *
- * @param set the set of objects to copy
- * @param monitor the progress monitor
- * @return a temporary workspace copies of the object that was copied
- *
- */
- public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
- {
-
- boolean supportsSearch = ((IRemoteFileSubSystemConfiguration)set.getSubSystem().getSubSystemConfiguration()).supportsSearch();
- boolean doSuperTransferProperty = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
- if (!doSuperTransferProperty && supportsSearch)
- {
- //flatset will contain all FILES that will be copied to workspace in UniversalFileTransferUtility and create corresponding folders. Empty folders will be ignored
- SystemRemoteResourceSet flatSet = new SystemRemoteResourceSet(set.getSubSystem(), set.getAdapter());
- long totalByteSize = getFlatRemoteResourceSet(set.getResourceSet(), flatSet, monitor);
- flatSet.setByteSize(totalByteSize);
-
- if (monitor != null)
- {
- monitor.beginTask(_downloadMessage, (int)totalByteSize);
- //monitor.done();
- }
-
- //add folders to set that are being copied to the workspace in order to strip out empty folders in UniversalFileTransferUtility
- for (int i=0;i<set.size();i++)
- {
- IRemoteFile remoteFile = (IRemoteFile)set.get(i);
- //make sure it is a folder as files are being accounted for already
- if(remoteFile.isDirectory())
- {
- flatSet.addResource(remoteFile);
- }
- }
-
- try
- {
- //SystemWorkspaceResourceSet flatResult = UniversalFileTransferUtility.copyRemoteResourcesToWorkspace(flatSet, monitor);
- // for bug 209375, using multiple instead of single
- SystemWorkspaceResourceSet flatResult = UniversalFileTransferUtility.downloadResourcesToWorkspaceMultiple(flatSet, monitor);
- if (flatResult.hasMessage())
- {
- return flatResult;
- }
- else
- {
- SystemWorkspaceResourceSet hierarchicalResult = new SystemWorkspaceResourceSet();
- for (int i = 0; i < set.size(); i++)
- {
- IRemoteFile remoteFile = (IRemoteFile)set.get(i);
- IResource tempResource = UniversalFileTransferUtility.getTempFileFor(remoteFile);
- if (tempResource instanceof IContainer)
- {
- UniversalFileTransferUtility.discardReplicasOfDeletedFiles((IRemoteFileSubSystem)set.getSubSystem(), (IContainer)tempResource);
- }
- hierarchicalResult.addResource(tempResource);
- }
- return hierarchicalResult;
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- }
- else
- {
- return UniversalFileTransferUtility.downloadResourcesToWorkspace(set, monitor);
- }
- }
-
- /**
- * Helper method to get the local file subsystem.
- * @return the local file subsystem
- */
- private IRemoteFileSubSystem getLocalFileSubSystem()
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- IHost[] connections = registry.getHosts();
- for (int i = 0; i < connections.length; i++)
- {
- IHost connection = connections[i];
- IRemoteFileSubSystem anFS = RemoteFileUtility.getFileSubSystem(connection);
- if ( anFS != null && anFS.getHost().getSystemType().isLocal())
- {
- return anFS;
- }
- }
-
- return null;
- }
-
- protected long getFlatRemoteResourceSet(List initialResources, SystemRemoteResourceSet flatSet, IProgressMonitor monitor)
- {
- long totalByteSize = 0;
- List configList = new ArrayList();
-
- // create a search result set to contain all the results
- IHostSearchResultSet searchSet = new HostSearchResultSet();
-
- IRemoteFileSubSystem subsys = (IRemoteFileSubSystem)flatSet.getSubSystem();
- if (subsys instanceof FileServiceSubSystem)
- {
- FileServiceSubSystem ss = (FileServiceSubSystem)subsys;
-
- for (int i = 0; i < initialResources.size(); i++)
- {
- IRemoteFile remoteFile = (IRemoteFile)initialResources.get(i);
-
- // get all files within directory
- if (remoteFile.isDirectory())
- {
- SystemSearchString searchString = null;
- if (ArchiveHandlerManager.isVirtual(remoteFile.getAbsolutePath()))
- {
- //If this file to create flatset with is a virtual directory, we want to make sure the includeArchives flag
- //for the searchString is set to true. This way, we could search inside the archive file
- searchString = new SystemSearchString("*", false, false, "*", false, true, true); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else
- {
- searchString = new SystemSearchString("*", false, false, "*", false, false, true); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // create the configuration for this folder
- IHostSearchResultConfiguration config = ss.createSearchConfiguration(searchSet, remoteFile, searchString);
-
- // kick off search for all files in the folder
- subsys.search(config);
- configList.add(config);
- }
- else
- {
- flatSet.addResource(remoteFile);
- }
- }
- }
-
-
-
- SubProgressMonitor submonitor = null;
- if (monitor != null)
- {
- submonitor = new SubProgressMonitor(monitor, configList.size());
- submonitor.setTaskName(FileResources.RESID_SEARCH_MESSAGE_SEARCHING);
-
- }
- // accumulate results
- for (int n = 0; n < configList.size(); n++)
- {
- IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)configList.get(n);
- while (config.getStatus() != IHostSearchConstants.FINISHED)
- {
- if (monitor != null)
- {
- if (monitor.isCanceled())
- {
- return totalByteSize;
- }
- Display display = Display.getCurrent();
- while (display!=null && display.readAndDispatch()) {
- //Process everything on event queue
- }
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //no action
- }
- }
- else
- {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- //no action
- }
- }
- }
-
- if (config.getStatus() == IHostSearchConstants.FINISHED)
- {
- if (submonitor != null)
- submonitor.worked(1);
- Object[] results = config.getResults();
- if (results == null || results.length == 0){
- // make sure search is really done
- System.out.println("waiting for results"); //$NON-NLS-1$
-
- }
-
-
- for (int m = 0; m < results.length; m++)
- {
- Object result = results[m];
- if (result instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile)result;
- flatSet.addResource(file);
- totalByteSize += file.getLength();
- }
- }
- }
- }
- //submonitor.done();
- return totalByteSize;
- }
-
- protected long getFlatWorkspaceResourceSet(List resources, SystemWorkspaceResourceSet flatSet, IProgressMonitor monitor)
- {
- long totalBytes = 0;
- for (int i = 0; i < resources.size(); i++)
- {
- IResource resource = (IResource)resources.get(i);
- if (resource instanceof IFile)
- {
- IFile file = (IFile)resource;
- flatSet.addResource(file);
- File osFile = file.getLocation().toFile();
- totalBytes += osFile.length();
- }
- else if (resource instanceof IContainer)
- {
- IContainer container = (IContainer)resource;
- try
- {
- IResource[] members = container.members();
- totalBytes += getFlatWorkspaceResourceSet(members, flatSet, monitor);
- }
- catch (Exception e)
- {
- }
- }
- }
- return totalBytes;
- }
-
- protected long getFlatWorkspaceResourceSet(IResource[] resources, SystemWorkspaceResourceSet flatSet, IProgressMonitor monitor)
- {
- long totalBytes = 0;
- for (int i = 0; i < resources.length; i++)
- {
- IResource resource = resources[i];
- if (resource instanceof IFile)
- {
- IFile file = (IFile)resource;
- flatSet.addResource(file);
- File osFile = file.getLocation().toFile();
- totalBytes += osFile.length();
- }
- else if (resource instanceof IContainer)
- {
- IContainer container = (IContainer)resource;
- try
- {
- IResource[] members = container.members();
- totalBytes += getFlatWorkspaceResourceSet(members, flatSet, monitor);
- }
- catch (Exception e)
- {
- }
- }
- }
- return totalBytes;
- }
-
-
-
- public static class RenameRunnable implements Runnable
- {
- private IRemoteFile _targetFileOrFolder;
- private String _newName;
- private List _namesInUse = new ArrayList();
- public RenameRunnable(IRemoteFile targetFileOrFolder)
- {
- _targetFileOrFolder = targetFileOrFolder;
- }
- public RenameRunnable(IRemoteFile targetFileOrFolder, List namesInUse)
- {
- _targetFileOrFolder = targetFileOrFolder;
- _namesInUse=namesInUse;
- }
-
- public void run() {
- ValidatorFileUniqueName validator = null;
- SystemRenameSingleDialog dlg;
- if(_namesInUse!=null && _namesInUse.size()>0)
- {
- dlg = new SystemRenameSingleDialog(null, true, _targetFileOrFolder, validator, _namesInUse); // true => copy-collision-mode
- }
- else
- {
- dlg = new SystemRenameSingleDialog(null, true, _targetFileOrFolder, validator); // true => copy-collision-mode
- }
- dlg.open();
- if (!dlg.wasCancelled())
- _newName = dlg.getNewName();
- else
- _newName = null;
- }
-
- public String getNewName()
- {
- return _newName;
- }
- }
-
- /**
- * Perform drop from the "fromSet" of objects to the "to" object
- * @param fromSet the source objects for the drop
- * @param target the target object for the drop
- * @param sameSystemType indication of whether the source and target reside of the same type of system
- * @param sameSystem indication of whether the source and target are on the same system
- * @param srcType the type of objects to be dropped
- * @param monitor the progress monitor
- *
- * @return the set of new objects created from the drop
- *
- */
- public ISystemResourceSet doDrop(ISystemResourceSet fromSet, Object target, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
- {
- SystemRemoteResourceSet resultSet = new SystemRemoteResourceSet(getSubSystem(target), this);
-
- if (!sameSystem && sameSystemType)
- {
- fromSet = doDrag((SystemRemoteResourceSet)fromSet, monitor);
- }
-
- if (target instanceof IRemoteFile)
- {
- IRemoteFile targetFolder = (IRemoteFile) target;
- IRemoteFileSubSystem targetFS = targetFolder.getParentRemoteFileSubSystem();
-
- // make sure properties are uptodate
- try
- {
- //targetFolder.markStale(true);
- targetFolder = targetFS.getRemoteFileObject(targetFolder.getAbsolutePath(), monitor);
- }
- catch (Exception e)
- {
- }
-
- if (!targetFolder.canWrite())
- {
- String msgTxt = FileResources.FILEMSG_SECURITY_ERROR;
- String msgDetails = NLS.bind(FileResources.FILEMSG_SECURITY_ERROR_DETAILS, targetFS.getHostAliasName());
- SystemMessage errorMsg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_SECURITY_ERROR,
- IStatus.ERROR, msgTxt, msgDetails);
- resultSet.setMessage(errorMsg);
- return resultSet;
- }
-
- if (!targetFS.isConnected())
- {
- return null;
- }
-
- List set = fromSet.getResourceSet();
- if (set.size() > 0)
- {
- if (fromSet instanceof SystemWorkspaceResourceSet)
- {
- boolean doSuperTransferProperty = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
- if (!doSuperTransferProperty)
- {
- SystemWorkspaceResourceSet flatFromSet = new SystemWorkspaceResourceSet();
- long totalByteSize = getFlatWorkspaceResourceSet(fromSet.getResourceSet(), flatFromSet, monitor);
-
- if (monitor != null)
- {
- int size = (int)totalByteSize;
- monitor.beginTask(_uploadMessage, size);
- }
- // back to hierarchy
- resultSet = UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true);
- }
- else
- {
- resultSet = UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true);
- }
- if (resultSet.hasMessage())
- {
- SystemMessage msg = resultSet.getMessage();
- if (monitor.isCanceled() && resultSet.size() > 0)
- {
- //Get the moved file names
- Object thisObject = resultSet.get(0);
- String copiedFileNames = null;
- if (thisObject instanceof IRemoteFile)
- {
- copiedFileNames = ((IRemoteFile)thisObject).getName();
- for (int i=1; i<(resultSet.size()); i++)
- {
- if (thisObject instanceof IRemoteFile)
- {
- copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); //$NON-NLS-1$
- }
- }
- }
- //getMessage("RSEG1125").makeSubstitution(movedFileName));
- if (copiedFileNames != null)
- {
- String msgTxt = FileResources.FILEMSG_COPY_INTERRUPTED;
- String msgDetails = NLS.bind(FileResources.FILEMSG_COPY_INTERRUPTED_DETAILS, copiedFileNames);
-
- SystemMessage thisMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_COPY_INTERRUPTED,
- IStatus.ERROR, msgTxt, msgDetails);
- resultSet.setMessage(thisMessage);
- //SystemMessageDialog.displayErrorMessage(shell, thisMessage);
- }
- }
- }
- return resultSet;
- }
- else if (fromSet instanceof SystemRemoteResourceSet)
- {
- SystemRemoteResourceSet rmtSet = (SystemRemoteResourceSet)fromSet;
-
- //ISystemDragDropAdapter srcAdapter = rmtSet.getAdapter();
- ISubSystem srcSubSystem = rmtSet.getSubSystem();
-
- Object first = set.get(0);
- if (first instanceof ISystemFilterReference)
- {
- SystemWorkspaceResourceSet downloadedFilterResults = new SystemWorkspaceResourceSet();
- for (int i = 0; i < set.size(); i++)
- {
- ISystemFilterReference ref = (ISystemFilterReference)set.get(i);
- SystemFilterReference filterReference = (SystemFilterReference) ref;
-
-
- Object[] children = null;
- try
- {
- children = ((SubSystem)srcSubSystem).internalResolveFilterStrings(filterReference.getReferencedFilter().getFilterStrings(), monitor);
- }
- catch (Exception e)
- {
- }
-
- if (children != null)
- {
- for (int c = 0; c < children.length; c++)
- {
- Object child = children[c];
-
- if (child instanceof IAdaptable)
- {
- Object newSrc = child;
-
- if (srcSubSystem != targetFS)
- {
- ISystemDragDropAdapter cAdapter = (ISystemDragDropAdapter) ((IAdaptable) child).getAdapter(ISystemDragDropAdapter.class);
- newSrc = cAdapter.doDrag(child, sameSystemType, monitor);
- if (newSrc instanceof SystemMessage)
- {
- resultSet.setMessage((SystemMessage)newSrc);
- return resultSet;
- }
- else
- {
- downloadedFilterResults.addResource(newSrc);
- }
- }
- }
- }
- }
- }
-
- return doDrop(downloadedFilterResults, target, sameSystemType, srcSubSystem == targetFS, SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE, monitor);
-
- }
- else if (first instanceof IRemoteFile)
- {
- List toCopy = new ArrayList();
- List toCopyNames = new ArrayList();
- //List toCopyBatch = new ArrayList();
- List existing = new ArrayList();
- boolean overwrite=false;
-
- for (int i = 0; i < set.size(); i++)
- {
- IRemoteFile srcFileOrFolder = (IRemoteFile)set.get(i);
- if (!srcFileOrFolder.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND,
- srcFileOrFolder.getAbsolutePath(),
- srcFileOrFolder.getHost().getAliasName());
-
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- resultSet.setMessage(errorMessage);
- return resultSet;
- }
- /* DKM - not sure what this is doing here...
- * maybe there used to be a check for an archive
- if (!srcFileOrFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement())
- {
- SystemMessage errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_ARCHIVEMANAGEMENT_NOTSUPPORTED);
- resultSet.setMessage(errorMessage);
- return resultSet;
- }
- */
-
-
- String name = srcFileOrFolder.getName();
- String originalName = srcFileOrFolder.getName();
- int count = 1;
- boolean go = true;
-
- // same systemfor
- if (sameSystem)
- {
- try
- {
- if (!targetFolder.getAbsolutePath().equals(srcFileOrFolder.getAbsolutePath()))
- {
- //Handle resources being copied to their parent folder. Name = "Copy of " + name
- if(targetFolder.getAbsolutePath().equals(srcFileOrFolder.getParentRemoteFile().getAbsolutePath()))
- {
- name = MessageFormat.format(FileResources.RESID_CONFLICT_COPY_PATTERN, new Object[] {
- new Integer(count), originalName });
- while(go)
- {
- IRemoteFile existingFileOrFolder = ((IRemoteFileSubSystem)srcSubSystem).getRemoteFileObject(targetFolder, name, monitor);
- if (existingFileOrFolder.exists())
- {
- count++;
- name = MessageFormat.format(FileResources.RESID_CONFLICT_COPY_PATTERN, new Object[] {
- new Integer(count), originalName });
- }
- else
- {
- toCopy.add(srcFileOrFolder);
- toCopyNames.add(name);
- go = false;
- }
- }
- }
- else
- {
- // should be better doing a query for all in the set
- IRemoteFile existingFileOrFolder = ((IRemoteFileSubSystem)srcSubSystem).getRemoteFileObject(targetFolder, name, monitor);
- if (existingFileOrFolder.exists())
- {
- /*RenameRunnable rr = new RenameRunnable(existingFileOrFolder, toCopyNames);
- Display.getDefault().syncExec(rr);
- name = rr.getNewName();
- */
- existing.add(existingFileOrFolder);
- }
-
- if (name != null)
- {
- toCopy.add(srcFileOrFolder);
- toCopyNames.add(name);
- //toCopyBatch.add(srcFileOrFolder);
- }
- /*else if (name != null)
- {
- toCopyBatch.add(srcFileOrFolder);
- }*/
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- else // why not same system? should we even get here?
- {
- //System.out.println("HOW DID I GET HERE?!!");
- }
- }
-
-
- if(existing.size()>0)
- {
- CopyRunnable rr = new CopyRunnable(existing);
- Display.getDefault().syncExec(rr);
- overwrite = rr.getOk();
- }
-
-
-
- //Following code used originally with the rename dialog which no longer exists
- //Resources will be copied with same names if an overwrite is desired from the user
- //Resources that are copied to their parent will be renamed to "Copy of " + name of source
- if(existing.size()==0 || overwrite)
- {
- for (int x = 0; x < toCopy.size(); x++)
- {
-
- IRemoteFile srcFileOrFolder = (IRemoteFile)toCopy.get(x);
- String name = (String)toCopyNames.get(x);
-
-
- SystemMessage copyMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPY_PROGRESS);
- copyMessage.makeSubstitution(srcFileOrFolder.getName(), targetFolder.getName());
- if (monitor != null)
- {
- monitor.beginTask(copyMessage.getLevelOneText(), 100);
- }
-
- try
- {
- targetFS.copy(srcFileOrFolder, targetFolder, name, monitor);
- IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor);
- resultSet.addResource(copiedFile);
- }
- catch (SystemMessageException e)
- {
- if (monitor.isCanceled() && resultSet.size() > 0)
- {
- //Get the moved file names
- Object thisObject = resultSet.get(0);
- String copiedFileNames = null;
- if (thisObject instanceof IRemoteFile)
- {
- copiedFileNames = ((IRemoteFile)thisObject).getName();
- for (int i=1; i<(resultSet.size()); i++)
- {
- if (thisObject instanceof IRemoteFile)
- {
- copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); //$NON-NLS-1$
- }
- }
- }
- //getMessage("RSEG1125").makeSubstitution(movedFileName));
- if (copiedFileNames != null)
- {
- String msgTxt = FileResources.FILEMSG_COPY_INTERRUPTED;
- String msgDetails = NLS.bind(FileResources.FILEMSG_COPY_INTERRUPTED_DETAILS, copiedFileNames);
-
- SystemMessage thisMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_COPY_INTERRUPTED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(shell, thisMessage);
- }
- else
- {
- SystemMessageDialog.displayMessage(e);
- }
- }
- else
- {
- SystemMessageDialog.displayMessage(e);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- // deal with batch copies now
- /*if(existing.size()==0 || overwrite)
- {
- IRemoteFile[] srcFileOrFolders = new IRemoteFile[toCopyBatch.size()];
- for (int x = 0; x < toCopyBatch.size(); x++)
- {
- srcFileOrFolders[x] = (IRemoteFile)toCopyBatch.get(x);
- }
- if (toCopyBatch.size() > 0)
- {
- try
- {
- if (targetFS.copyBatch(srcFileOrFolders, targetFolder, monitor))
- {
- for (int x = 0; x < toCopyBatch.size(); x++)
- {
- IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, srcFileOrFolders[x].getName(), monitor);
- resultSet.addResource(copiedFile);
- }
- }
- }
- catch (SystemMessageException e)
- {
- if (monitor.isCanceled() && srcFileOrFolders.length > 1)
- {
- //ISystemViewElementAdapter adapter = fromSet.getViewAdapter();
- for (int i = 0; i < srcFileOrFolders.length; i++)
- {
- IRemoteFile thisCopiedFile = null;
- try
- {
- thisCopiedFile = targetFS.getRemoteFileObject(targetFolder, srcFileOrFolders[i].getName(), null);
- }
- catch (SystemMessageException thsiException)
- {
- thsiException.printStackTrace();
- thisCopiedFile = null;
- }
- if (thisCopiedFile != null && thisCopiedFile.exists())
- {
- //This object has been deleted
- resultSet.addResource(thisCopiedFile);
- }
- }
- if (resultSet.size() > 0)
- {
- //Get the copied file names
- Object thisObject = resultSet.get(0);
- String copiedFileNames = null;
- copiedFileNames = ((IRemoteFile)thisObject).getName();
- for (int i=1; i<(resultSet.size()); i++)
- {
- thisObject = resultSet.get(i);
- copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)resultSet.get(i)).getName(); //$NON-NLS-1$
- }
- String msgTxt = FileResources.FILEMSG_COPY_INTERRUPTED;
- String msgDetails = NLS.bind(FileResources.FILEMSG_COPY_INTERRUPTED_DETAILS, copiedFileNames);
-
- SystemMessage thisMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_COPY_INTERRUPTED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(shell, thisMessage);
- }
- else
- {
- SystemMessageDialog.displayMessage(e);
- }
- }
- else
- {
- SystemMessageDialog.displayMessage(e);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }*/
- }
- }
- }
- }
- return resultSet;
- }
- /**
- * Perform a copy via drag and drop.
- * @param src the object to be copied. If the target and source are not on the same system, then this is a
- * temporary object produced by the doDrag.
- * @param target the object to be copied to.
- * @param sameSystemType indication of whether the source and target reside on the same type of system
- * @param sameSystem an indication whether the target and source reside on the same type of system
- * @param sourceType type of source being transferred
- * @param monitor the progress monitor
- * @return an indication whether the operation was successful or not.
- */
- public Object doDrop(Object src, Object target, boolean sameSystemType, boolean sameSystem, int sourceType, IProgressMonitor monitor)
- {
- Object result = null;
-
- // same system type but not necessarily same computer
- if (sameSystemType && !sameSystem)
- {
- src = doDrag(src, sameSystem, monitor);
- }
-
-
- if (target instanceof IRemoteFile)
- {
- IRemoteFile targetFolder = (IRemoteFile) target;
- IRemoteFileSubSystem targetFS = targetFolder.getParentRemoteFileSubSystem();
-
- // make sure properties are uptodate
- try
- {
- //targetFolder.markStale(true);
- targetFolder = targetFS.getRemoteFileObject(targetFolder.getAbsolutePath(), monitor);
- }
- catch (Exception e)
- {
- }
-
- if (!targetFolder.canWrite())
- {
- String msgTxt = FileResources.FILEMSG_SECURITY_ERROR;
- String msgDetails = NLS.bind(FileResources.FILEMSG_SECURITY_ERROR_DETAILS, targetFS.getHostAliasName());
- SystemMessage errorMsg = null;
-
- errorMsg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_SECURITY_ERROR,
- IStatus.ERROR, msgTxt, msgDetails);
-
- return errorMsg;
- }
-
- if (!targetFS.isConnected())
- {
- return null;
- }
-
- // non-Eclipse file transfer
-
- if (sourceType == SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE)
- {
- if (src instanceof String)
- {
- IRemoteFileSubSystem localFS = getLocalFileSubSystem();
-
- try
- {
- if (localFS != null) {
- IRemoteFile srcFileOrFolder = localFS.getRemoteFileObject((String)src, monitor);
- return doDrop(srcFileOrFolder, target, true, sameSystem, SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE, monitor);
- }
- else {
- File srcFileOrFolder = new File((String)src);
- return doDrop(srcFileOrFolder, target, true, sameSystem, SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE, monitor);
- }
- }
- catch (SystemMessageException e)
- {
- return e.getSystemMessage();
- }
- }
- }
- if (sourceType == SystemDNDTransferRunnable.SRC_TYPE_TEXT)
- {
- if (src instanceof String)
- {
- // noop for now
- }
- }
-
-
- if (sourceType == SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE || sourceType == SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE)
- {
- // Eclipse resource transfer
- if (src instanceof IResource)
- {
- IResource srcFileOrFolder = (IResource) src;
- return UniversalFileTransferUtility.uploadResourceFromWorkspace(srcFileOrFolder, targetFolder, monitor, true);
- }
- }
-
-
- // RSE remote file transfer on same system
- if (sourceType == SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE)
- {
- if (src instanceof ISystemFilterReference)
- {
- SystemFilterReference filterReference = (SystemFilterReference) src;
- Object adapter = filterReference.getAdapter(ISystemViewElementAdapter.class);
- ISystemViewElementAdapter filterAdapter = (ISystemViewElementAdapter) adapter;
- if (filterAdapter != null)
- {
- SubSystem filterSubSystem = (SubSystem) filterAdapter.getSubSystem(filterReference);
- Object[] children = null;
- try
- {
- children = filterSubSystem.internalResolveFilterStrings(filterReference.getReferencedFilter().getFilterStrings(), monitor);
- }
- catch (Exception e)
- {
- }
-
- if (children != null)
- {
- for (int c = 0; c < children.length; c++)
- {
- Object child = children[c];
-
- if (child instanceof IAdaptable)
- {
- Object newSrc = child;
-
- if (filterSubSystem != targetFS)
- {
- ISystemDragDropAdapter cAdapter = (ISystemDragDropAdapter) ((IAdaptable) child).getAdapter(ISystemDragDropAdapter.class);
- newSrc = cAdapter.doDrag(child, sameSystemType, monitor);
- if (newSrc instanceof SystemMessage)
- {
- return newSrc;
- }
- }
- doDrop(newSrc, target, sameSystemType, filterSubSystem == targetFS, SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE, monitor);
- }
- }
- }
- return target;
- }
- }
- else if (src instanceof IRemoteFile)
- {
- try
- {
- IRemoteFile srcFileOrFolder = (IRemoteFile) src;
- if (!srcFileOrFolder.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND,
- srcFileOrFolder.getAbsolutePath(),
- srcFileOrFolder.getHost().getAliasName());
-
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- return errorMessage;
- }
-
- String msgTxt = NLS.bind(CommonMessages.MSG_COPY_PROGRESS, srcFileOrFolder.getName(), targetFolder.getAbsolutePath());
- SystemMessage copyMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_COPY_PROGRESS,
- IStatus.INFO, msgTxt);
-
-
- IRemoteFileSubSystem localFS = srcFileOrFolder.getParentRemoteFileSubSystem();
-
- String name = srcFileOrFolder.getName();
-
- if (localFS == targetFS)
- {
- if (!targetFolder.getAbsolutePath().equals(srcFileOrFolder.getAbsolutePath()))
- {
- IRemoteFile existingFileOrFolder = localFS.getRemoteFileObject(targetFolder, name, monitor);
-
- if (existingFileOrFolder.exists())
- {
- RenameRunnable rr = new RenameRunnable(existingFileOrFolder);
- Display.getDefault().syncExec(rr);
- name = rr.getNewName();
- }
-
- if (name != null)
- {
- monitor.subTask(copyMessage.getLevelOneText());
- targetFS.copy(srcFileOrFolder, targetFolder, name, monitor);
- IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor);
- return copiedFile;
- }
- }
- }
- else
- {
- // Not sure how we can get here since if the source and target subsystems are different, then a doDrag() needs to
- // occur, resulting in a local resource (i.e. IFile) rather than a remote resource (i.e. IRemoteFile).
- // TODO investigate to see if we can get rid of this code
- if (srcFileOrFolder.isFile())
- {
- try
- {
- name = checkForCollision(getShell(), targetFolder, name);
- if (name == null)
- {
- return null;
- }
-
- boolean isTargetArchive = targetFolder.isArchive();
- StringBuffer newPathBuf = new StringBuffer(targetFolder.getAbsolutePath());
- if (isTargetArchive)
- {
- newPathBuf.append(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
- }
- else
- {
- newPathBuf.append(targetFolder.getSeparatorChar());
- }
- newPathBuf.append(name);
-
- String newPath = newPathBuf.toString();
-
- monitor.subTask(copyMessage.getLevelOneText());
-
- targetFS.upload(srcFileOrFolder.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$
-
- result = targetFS.getRemoteFileObject(targetFolder, name, monitor);
- return result;
-
- }
- catch (SystemMessageException e)
- {
- return e.getSystemMessage();
-
- }
- catch (Exception e)
- {
- }
-
- return null;
- }
- else
- {
- // this is a directory
- // recursively copy
- boolean isTargetArchive = targetFolder.isArchive();
- StringBuffer newPathBuf = new StringBuffer(targetFolder.getAbsolutePath());
- if (isTargetArchive)
- {
- newPathBuf.append(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
- }
- else
- {
- newPathBuf.append(targetFolder.getSeparatorChar());
- }
- newPathBuf.append(name);
-
- String newPath = newPathBuf.toString();
-
- IRemoteFile newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
- targetFS.createFolder(newTargetFolder, monitor);
-
- IRemoteFile[] children = localFS.list(srcFileOrFolder, monitor);
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- if (monitor.isCanceled())
- {
- return null;
- }
- else
- {
- IRemoteFile child = children[i];
- if (doDrop(child, newTargetFolder, sameSystemType, sameSystem, sourceType, monitor) == null)
- {
- return null;
- }
- }
- }
- }
-
- return newTargetFolder;
- }
- }
- }
- catch (SystemMessageException e)
- {
- return e.getSystemMessage();
- }
- }
- }
- }
-
-
- return result;
- }
-
- protected String checkForCollision(Shell shell, IRemoteFile targetFolder, String oldName)
- {
- String newName = oldName;
-
- try
- {
-
- IRemoteFileSubSystem ss = targetFolder.getParentRemoteFileSubSystem();
- IRemoteFile targetFileOrFolder = ss.getRemoteFileObject(targetFolder, oldName, new NullProgressMonitor());
-
- //RSEUIPlugin.logInfo("CHECKING FOR COLLISION ON '"+srcFileOrFolder.getAbsolutePath() + "' IN '" +targetFolder.getAbsolutePath()+"'");
- //RSEUIPlugin.logInfo("...TARGET FILE: '"+tgtFileOrFolder.getAbsolutePath()+"'");
- //RSEUIPlugin.logInfo("...target.exists()? "+tgtFileOrFolder.exists());
- if (targetFileOrFolder.exists())
- {
- RenameRunnable rr = new RenameRunnable(targetFileOrFolder);
- Display.getDefault().syncExec(rr);
- newName = rr.getNewName();
- }
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError("SystemCopyRemoteFileAction.checkForCollision()", e); //$NON-NLS-1$
- }
-
- return newName;
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Yes, remote file objects are deletable!
- */
- public boolean canDelete(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- boolean offline = file.getParentRemoteFileSubSystem().isOffline();
-
- if (offline || file.isRoot()){
- return false;
- }
- else {
- /*
- if (file.getHost().getSystemType().isWindows()){
- return true;
- }
- else {
- // for deletion, you need write access to the containing directory
- IRemoteFile parentFile = file.getParentRemoteFile();
- return parentFile.canWrite();
- }*/
- return true;
- }
- }
-
-
- /**
- * {@inheritDoc}
- * <p>
- * Defers request to the remote file subsystem.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
- {
- boolean ok;
- IRemoteFile file = (IRemoteFile) element;
- IRemoteFile parentFile = file.getParentRemoteFile();
-
- IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
- try
- {
- // DKM - propagate the deletion to temp files project
- IResource tmp = UniversalFileTransferUtility.getTempFileFor(file);
- if (tmp.exists())
- {
- try
- {
- tmp.delete(false, null);
-
- // get rid of associated editable if there was one before
- SystemIFileProperties properties = new SystemIFileProperties(tmp);
- properties.setRemoteFileObject(null);
- }
- catch (Exception e)
- {
- }
- }
-
- ss.delete(file, monitor);
- ok = true;
- file.markStale(true);
- parentFile.markStale(true);
- }
- catch (Exception exc)
- {
- ok = false;
- String msgTxt = NLS.bind(FileResources.FILEMSG_DELETE_FILE_FAILED, file.toString());
- String msgDetails = FileResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_DELETE_FILE_FAILED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(shell, msg);
- }
- return ok;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Defers request to the remote file subsystem
- */
- public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception
- {
- IRemoteFileSubSystem ss = null;
- IRemoteFile[] files = new IRemoteFile[resourceSet.size()];
- for (int i = 0; i < resourceSet.size(); i++)
- {
- IRemoteFile file = (IRemoteFile) resourceSet.get(i);
- files[i] = file;
- IRemoteFile parentFile = file.getParentRemoteFile();
- if (ss == null) ss = file.getParentRemoteFileSubSystem();
- try
- {
- // DKM - propagate the deletion to temp files project
- IResource tmp = UniversalFileTransferUtility.getTempFileFor(file);
- if (tmp.exists())
- {
- try
- {
- tmp.delete(false, null);
- }
- catch (Exception e)
- {
- }
- }
- file.markStale(true);
- parentFile.markStale(true);
- }
- catch (Exception exc)
- {
- String msgTxt = NLS.bind(FileResources.FILEMSG_DELETE_FILE_FAILED, file.toString());
- String msgDetails = FileResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_DELETE_FILE_FAILED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(shell, msg);
- }
- }
- if (ss != null)
- {
- ss.deleteBatch(files, monitor);
- }
- return true;
- }
- // FOR COMMON RENAME ACTIONS
- /**
- * Yes, remote file objects are renamable!
- */
- public boolean canRename(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- boolean offline = file.getParentRemoteFileSubSystem().isOffline();
- return !file.isRoot() && file.canRead() && !offline;
- }
-
- private void moveTempResource(IResource localResource, IPath newLocalPath, IRemoteFileSubSystem ss, String newRemotePath)
- {
- if (localResource != null)
- {
- try
- {
- moveTempFileProperties(localResource, ss, newRemotePath);
- localResource.move(newLocalPath, true, null);
-
- }
- catch (Exception e)
- {
- }
-
- }
- }
-
- private void moveTempFileProperties(IResource localResource, IRemoteFileSubSystem ss, String remotePath)
- {
-
- if (localResource instanceof IContainer)
- {
- IContainer localContainer = (IContainer) localResource;
- try
- {
- IResource[] members = localContainer.members();
- for (int i = 0; i < members.length; i++)
- {
- IResource member = members[i];
- moveTempFileProperties(member, ss, remotePath + "/" + member.getName()); //$NON-NLS-1$
- }
- }
- catch (Exception e)
- {
- }
- }
- else if (localResource instanceof IFile)
- {
- IFile localFile = (IFile)localResource;
- try
- {
- SystemIFileProperties properties = new SystemIFileProperties(localFile);
- properties.setRemoteFilePath(remotePath);
-
- Object editableObj = properties.getRemoteFileObject();
- if (editableObj != null)
- {
- SystemEditableRemoteFile editable = (SystemEditableRemoteFile)editableObj;
-
- // is this open?
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN){
- // there's an in-memory editable, so change the associated remote file
- IRemoteFile newRemoteFile = ss.getRemoteFileObject(remotePath, new NullProgressMonitor());
- editable.setRemoteFile(newRemoteFile);
- }
- }
- }
- catch (Exception e)
- {
- }
-
- }
-
- }
-
- /**
- * Perform the rename action. Defers request to the remote file subsystem
- */
- public boolean doRename(Shell shell, Object element, String newName, IProgressMonitor monitor) throws Exception
- {
- IRemoteFile file = (IRemoteFile) element;
- IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
-
-
- String newRemotePath = file.getParentPath() + "/" + newName; //$NON-NLS-1$
- IResource localResource = null;
- if (SystemRemoteEditManager.getInstance().doesRemoteEditProjectExist())
- {
- localResource = UniversalFileTransferUtility.getTempFileFor(file);
- }
-
- ss.rename(file, newName, monitor);
- if (localResource != null && localResource.exists())
- {
-
- IPath newLocalPath = localResource.getParent().getFullPath().append(newName);
- moveTempResource(localResource, newLocalPath, ss, newRemotePath);
- }
-
- // Firing a refresh event before a rename event will cause views to refresh
- // but the TreeItems contain the old data, and refresh will display an error
- // below the TreeItem saying it's not readable as it's using the old name.
- // This is not an issue for the SystemView as it does the refresh in a job, so
- // the rename event is actually handled first then the refresh.
- // Commented out for bug #198576
-// if (file.isDirectory())
-// {
-// // update all tree views showing this remote folder...
-// // Hmm, why do we do this, given SystemView sends a rename event? I think we needed to refresh all child cached references to parent folder name...
-// SystemResourceChangeEvent event = new SystemResourceChangeEvent(file.getParentRemoteFile(), ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null);
-// sr.fireEvent(event);
-// //sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, file, file.getParentRemoteFile(), file.getParentRemoteFileSubSystem(), null, null);
-// }
-// file.markStale(true);
- return true;
-
- }
-
- /**
- * Return a validator for verifying the new name is correct.
- * Defers request to the subsystem factory, calling either getFileNameValidator or getFolderNameValidator.
- */
- public ISystemValidator getNameValidator(Object element)
- {
- if (element instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (file.isDirectory())
- return file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().getFolderNameValidator();
- else
- return file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().getFileNameValidator();
- }
- return null;
- }
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns newName, but uppercased for Windows file systems
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- if (element instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().isUnixStyle())
- return newName;
- else
- return newName.toUpperCase();
- }
- else
- return newName;
- }
- /**
- * Parent override.
- * <p>
- * Compare the name of the given element to the given new name to decide if they are equal.
- * Allows adapters to consider case and quotes as appropriate.
- * <p>
- * For Unix/Linux, returns the result of getName(element).equals(newName), which is to say,
- * it is a case sensitive compare. For windows, it is case insensitive (equalsIgnoreCase).
- */
- public boolean namesAreEqual(Object element, String newName)
- {
- if (element instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().isUnixStyle())
- return getName(element).equals(newName);
- else
- return getName(element).equalsIgnoreCase(newName);
- }
- else
- return super.namesAreEqual(element, newName);
- }
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return ISystemMementoConstants.MEMENTO_KEY_REMOTE;
- }
-
- // --------------------------------------------------------------------
- // METHODS PRESCRIBED BY THE ISYSTEMREMOTEELEMENT ADAPTER INTERFACE...
- // --------------------------------------------------------------------
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- return file.getAbsolutePath();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
- */
- public String getAbsoluteParentName(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- return file.getParentPath();
- }
-
- /**
- * Return subsystem
- */
- public ISubSystem getSubSystem(Object element)
- {
- if (element instanceof IRemoteFile)
- {
- IRemoteFile file = (IRemoteFile) element;
- return file.getParentRemoteFileSubSystem();
- }
- return super.getSubSystem(element);
- }
- /**
- * Return the subsystem factory id that owns this remote object
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getSubSystemConfigurationId(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- return file.getParentRemoteFileSubSystem().getSubSystemConfiguration().getId();
- }
-
- /**
- * Return a value for the type category property for this object
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getRemoteTypeCategory(Object element)
- {
- return ISystemFileRemoteTypes.TYPECATEGORY;
- }
- /**
- * Return the untranslated type for this object.
- * For files, returns the "file"
- * For folders or roots, returns "folder"
- */
- public String getRemoteType(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (!file.isRoot() && !file.isDirectory())
- return ISystemFileRemoteTypes.TYPE_FILE;
- else
- return ISystemFileRemoteTypes.TYPE_FOLDER;
- }
- /**
- * Return the untranslated subtype for this object.
- * For files, returns the file extension. Eg, for abc.java this returns "java".
- * For folders, returns "root" or "subfolder"
- */
- public String getRemoteSubType(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- if (file.isFile())
- return file.getExtension();
- else if (file.isRoot())
- return ISystemFileRemoteTypes.SUBTYPE_ROOT;
- else
- return ISystemFileRemoteTypes.SUBTYPE_SUBFOLDER;
- }
- /**
- * Return the untranslated sub-subtype for this object.
- * Returns null for now.
- */
- public String getRemoteSubSubType(Object element)
- {
- return null;
- }
- /**
- * Return the source type of the selected object. Typically, this only makes sense for compilable
- * source members. For non-compilable remote objects, this typically just returns null.
- * <p>
- * For files, this returns the extension. For folders, it returns null.
- */
- public String getRemoteSourceType(Object element)
- {
- IRemoteFile file = (IRemoteFile) element;
- String srcType = null;
- if (file.isFile())
- {
- srcType = file.getExtension();
- if (srcType == null)
- srcType = "blank"; //$NON-NLS-1$
- else if (srcType.length() == 0)
- srcType = "null"; //$NON-NLS-1$
- }
- return srcType;
- }
- /**
- * Some view has updated the name or properties of this remote object. As a result, the
- * remote object's contents need to be refreshed. You are given the old remote object that has
- * old data, and you are given the new remote object that has the new data. For example, on a
- * rename the old object still has the old name attribute while the new object has the new
- * new attribute.
- * <p>
- * This is called by viewers like SystemView in response to rename and property change events.
- * <p>
- * @param oldElement the element that was found in the tree
- * @param newElement the updated element that was passed in the REFRESH_REMOTE event
- * @return true if you want the viewer that called this to refresh the children of this object,
- * such as is needed on a rename of a folder, say.
- */
- public boolean refreshRemoteObject(Object oldElement, Object newElement)
- {
- if ((oldElement instanceof RemoteFile) && (newElement instanceof IRemoteFile))
- {
- RemoteFile oldFile = (RemoteFile)oldElement;
- RemoteFile newFile = (RemoteFile)newElement;
-
- if ( (oldFile != newFile)
- && ( (oldFile.isFile() && newFile.isFile())
- || (oldFile.isDirectory() && newFile.isDirectory()) )) {
- oldFile.getHostFile().renameTo(newFile.getAbsolutePath());
- }
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Given a remote object, returns it remote parent object. Eg, given a file, return the folder
- * it is contained in.
- * <p>
- * The shell is required in order to set the cursor to a busy state if a remote trip is required.
- *
- * @return an IRemoteFile object for the parent
- */
- public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception
- {
- return ((IRemoteFile) element).getParentRemoteFile();
- }
- /**
- * Given a remote object, return the unqualified names of the objects contained in that parent. This is
- * used for testing for uniqueness on a rename operation, for example. Sometimes, it is not
- * enough to just enumerate all the objects in the parent for this purpose, because duplicate
- * names are allowed if the types are different, such as on iSeries. In this case return only
- * the names which should be used to do name-uniqueness validation on a rename operation.
- *
- * @return an array of all file and folder names in the parent of the given IRemoteFile object
- */
- public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
- { String[] names = EMPTY_STRING_LIST;
-
- IRemoteFile file = (IRemoteFile) element;
- String parentName = file.getParentPath();
- if (parentName == null) // given a root?
- return names; // not much we can do. Should never happen: you can't rename a root!
-
- // changed to do the same as the new file wizards since
- // as per bug 251860, we can't use the cache and we need to bypass the hidden preference
- IRemoteFile parentFolder = file.getParentRemoteFile();
- IRemoteFile[] children = parentFolder.getParentRemoteFileSubSystem().list(parentFolder, monitor);
-
- if ((children == null) || (children.length == 0))
- return names;
-
- names = new String[children.length];
- for (int idx = 0; idx < names.length; idx++)
- {
- names[idx] = (children[idx]).getName();
- }
-
- return names;
- }
-
- /**
- * User has double clicked on an object. We want to open the object in the applicable editor.
- * Return true to indicate that we are handling the double-click event.
- */
- public boolean handleDoubleClick(Object element)
- {
- IRemoteFile remoteFile = (IRemoteFile) element;
- if (!remoteFile.canRead())
- {
- return false;
- }
- /** FIXME commands now separate from this
- else if (testAttribute(remoteFile, "classification", "*executable*") ||
- testAttribute(remoteFile, "classification", "*script") ||
- testAttribute(remoteFile, "classification", "symbolic link(script)*")
- )
- {
- // instead of opening in editor
- // attempt to execute it
- return RemoteCommandHelpers.runUniversalCommand(getShell(), remoteFile.getName(), remoteFile.getParentPath(),
- remoteFile.getParentRemoteFileSubSystem().getCommandSubSystem());
- }
- */
- else if (!remoteFile.isArchive() || !remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement())
- {
- // make sure we're using the latest version of remoteFile
- try {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){
- }
-
- // only handle double click if object is a file
- ISystemEditableRemoteObject editable = getEditableRemoteObject(remoteFile);
- if (editable != null)
- {
- String remotePath = remoteFile.getAbsolutePath();
- String replicaRemotePath = editable.getAbsolutePath();
- // first make sure that the correct remote file is referenced (might be difference because of different case)
- if (!replicaRemotePath.equals(remotePath)){ // for bug 276103
-
- IEditorPart editor = editable.getEditorPart();
- boolean editorWasClosed = false;
- if (editor == null){
- editorWasClosed = true;
- }
- else if (editor.isDirty()){
- editorWasClosed = editor.getEditorSite().getPage().closeEditor(editor, true);
- if (editorWasClosed)
- editable.doImmediateSaveAndUpload();
- }
- else {
- editorWasClosed = editor.getEditorSite().getPage().closeEditor(editor, true);
- }
-
- if (!editorWasClosed){
- // use cancelled operation so we need to get out of here
- return false;
- }
-
- try {
- IFile file = editable.getLocalResource();
- file.delete(true, new NullProgressMonitor());
- }
- catch (CoreException e){
- }
-
- // open new editor for correct replica
- editable = getEditableRemoteObject(remoteFile);
- }
-
- try
- {
- boolean isOpen = editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN;
- boolean isFileCached = isFileCached(editable, remoteFile);
- if (isFileCached)
- {
- if (!isOpen) {
- editable.setLocalResourceProperties();
- editable.addAsListener();
- }
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
-
- }
- catch (Exception e)
- {
- }
-
-
- }
- else if (remoteFile.isDirectory())
- {
- return false;
- }
-
- //SystemDoubleClickEditAction editAction = new SystemDoubleClickEditAction(element);
- //editAction.run();
- return true;
- }
- else
- { // if object is a folder, do not handle it
- return false;
- }
- }
-
- private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile)
- {
- // DY: check if the file exists and is read-only (because it was previously opened
- // in the system editor)
- IFile file = editable.getLocalResource();
- SystemIFileProperties properties = new SystemIFileProperties(file);
- boolean newFile = !file.exists();
-
- // detect whether there exists a temp copy already
- if (!newFile)
- {
- // we have a local copy of this file, so we need to compare timestamps
-
- // get stored modification stamp
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
- long oldRemoteModifiedStamp = remoteFile.getLastModified();
-
- // get updated remoteFile so we get the current remote timestamp
- IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
- if (!subsystem.isOffline()){ // only do this check when online..if offline we assume the temp file is okay
- remoteFile.markStale(true);
- try
- {
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
- }
-
- // make sure that the editable is using an uptodate version
- ((SystemEditableRemoteFile)editable).setRemoteFile(remoteFile);
- }
-
- // get the remote modified stamp
- long remoteModifiedStamp = remoteFile.getLastModified();
-
- // get dirty flag
- boolean dirty = properties.getDirty();
-
- boolean remoteNewer = (oldRemoteModifiedStamp != remoteModifiedStamp) || (storedModifiedStamp != remoteModifiedStamp);
-
- String remoteEncoding = remoteFile.getEncoding();
- String storedEncoding = properties.getEncoding();
-
- boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding));
-
- boolean usedBinary = properties.getUsedBinaryTransfer();
- boolean isBinary = remoteFile.isBinary();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- !encodingChanged);
- }
- return false;
- }
-
- public boolean canEdit(Object element)
- {
- IRemoteFile remoteFile = (IRemoteFile) element;
- if (remoteFile.isFile())
- {
- boolean offline = remoteFile.getParentRemoteFileSubSystem().isOffline();
- return remoteFile.canRead() && !offline;
- }
- return false;
- }
-
- public ISystemEditableRemoteObject getEditableRemoteObject(Object element)
- {
- RemoteFile remoteFile = (RemoteFile) element;
- if (remoteFile.isFile())
- {
- try
- {
- IFile file = getCachedCopy(remoteFile); // Note that this is a case-sensitive check
- if (file != null)
- {
- SystemIFileProperties properties = new SystemIFileProperties(file);
-
- Object obj = properties.getRemoteFileObject();
- if (obj != null && obj instanceof SystemEditableRemoteFile)
- {
- SystemEditableRemoteFile rmtObj = (SystemEditableRemoteFile) obj;
- return rmtObj; // return regardless of whehter it's open - open handling is taken care of after
- }
- }
- return new SystemEditableRemoteFile(remoteFile);
- }
- catch (Exception e)
- {
- }
- }
- return null;
- }
-
- public IFile getCachedCopy(IRemoteFile remoteFile) throws SystemMessageException
- {
- if (SystemRemoteEditManager.getInstance().doesRemoteEditProjectExist())
- {
- IResource replica = UniversalFileTransferUtility.getTempFileFor(remoteFile);
- if (replica != null && replica.exists())
- {
- return (IFile)replica;
- }
- }
- return null;
- }
-
- /**
- * Return a filter string that corresponds to this object.
- * @param object the object to obtain a filter string for
- * @return the corresponding filter string if applicable
- */
- public String getFilterStringFor(Object object)
- {
- if (object instanceof IRemoteFile)
- {
- IRemoteFile remoteFile = (IRemoteFile) object;
- if (remoteFile.isDirectory())
- {
- return remoteFile.getAbsolutePath() + remoteFile.getSeparator() + "*"; //$NON-NLS-1$
- }
- else
- {
- return remoteFile.getAbsolutePath();
- }
- }
- return null;
- }
-
- /**
- * From <samp>IActionFilter</samp>, it exposes properties for decorator and popupMenus extension points.
- * <p>
- * <ol>
- * <li>name="name". The given value must match the name exactly or if ends with an asterisk the beginning must match.
- * (case sensitiveness depends on the subsystem)</li>
- * <li>name="absolutePath". The given value must match the absolute path exactly or if ends with an asterisk the beginning must match.
- * (case sensitiveness depends on the subsystem)</li>
- * <li>name="extension". The given value must match the extension exactly or if ends with an asterisk the beginning must match.
- * (case sensitiveness depends on the subsystem)</li>
- * <li>name="isRoot". If the given value is <code>true</code>, then returns <code>true</code> if the target is a root file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not root.</li>
- * <li>name="isFile". If the given value is <code>true</code>, then returns <code>true</code> if the target is a file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not a file.</li>
- * <li>name="isDirectory". If the given value is <code>true</code>, then returns <code>true</code> if the target is a directory.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not a directory.</li>
- * <li>name="isHidden". If the given value is <code>true</code>, then returns <code>true</code> if the target is a hidden file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not a hidden file.</li>
- * <li>name="canRead". If the given value is <code>true</code>, then returns <code>true</code> if the target is readable.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not readable.</li>
- * <li>name="canWrite". If the given value is <code>true</code>, then returns <code>true</code> if the target is writable.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not writable.</li>
- * <li>name="isBinary". If the given value is <code>true</code>, then returns <code>true</code> if the target is a binary file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not a binary file.</li>
- * <li>name="isText". If the given value is <code>true</code>, then returns <code>true</code> if the target is a text file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not a text file.</li>
- * <li>name="isArchive". If the given value is <code>true</code>, then returns <code>true</code> if the target is an archive file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not an archive file.</li>
- * <li>name="isVirtual". If the given value is <code>true</code>, then returns <code>true</code> if the target is a virtual file.
- * If the given value is <code>false</code>, then returns <code>true</code> if the target is not a virtual file.</li>
- * </ol>
- * <p>
- * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
- */
- public boolean testAttribute(Object target, String name, String value) {
-
- if (target instanceof IRemoteFile)
- {
- IRemoteFile tgt = (IRemoteFile) target;
-
- String inName = name.toLowerCase();
-
-
- if (inName.equals("classification")) //$NON-NLS-1$
- {
- String classification = tgt.getClassification();
-
- if (classification != null)
- {
- return StringCompare.compare(value, classification, true);
- }
- }
- else if (inName.equals("name")) //$NON-NLS-1$
- {
- boolean caseSensitive = tgt.getParentRemoteFileSubSystem().isCaseSensitive();
-
- String tgtName = getName(target);
- String val = value;
-
- // if case does not matter, then lower case the compares
- if (!caseSensitive) {
- tgtName = tgtName.toLowerCase();
- val = val.toLowerCase();
- }
-
- // we have a wild card test, and * is the last character in the value
- if (val.endsWith("*")) { //$NON-NLS-1$
- return tgtName.startsWith(val.substring(0, val.length()-1));
- }
- else {
- return val.equals(tgtName);
- }
- }
- else if (inName.equals("absolutePath".toLowerCase())) { //$NON-NLS-1$
-
- boolean caseSensitive = tgt.getParentRemoteFileSubSystem().isCaseSensitive();
-
- String tgtPath = getAbsoluteName(target);
- String val = value;
-
- // if case does not matter, then lower case the compares
- if (!caseSensitive) {
- tgtPath = tgtPath.toLowerCase();
- val = val.toLowerCase();
- }
-
- // we have a wild card test, and * is the last character in the value
- if (val.endsWith("*")) { //$NON-NLS-1$
- return tgtPath.startsWith(val.substring(0, val.length()-1));
- }
- else {
- return val.equals(tgtPath);
- }
- }
- else if (inName.equals("extension")) { //$NON-NLS-1$
-
- boolean caseSensitive = tgt.getParentRemoteFileSubSystem().isCaseSensitive();
-
- String tgtExtension = tgt.getExtension();
-
- if (tgtExtension == null) {
- return false;
- }
-
- StringTokenizer st = new StringTokenizer(value, " \t\n\r\f,"); //$NON-NLS-1$
-
- String val = null;
-
- while (st.hasMoreTokens()) {
-
- val = st.nextToken();
-
- // if case does not matter, then lower case the compares
- if (!caseSensitive) {
- tgtExtension = tgtExtension.toLowerCase();
- val = val.toLowerCase();
- }
-
- boolean match = false;
-
- // we have a wild card test, and * is the last character in
- // the value
- if (val.endsWith("*")) { //$NON-NLS-1$
- match = tgtExtension.startsWith(val.substring(0, val.length() - 1));
- }
- else {
- match = val.equals(tgtExtension);
- }
-
- // if there is a match, return true, otherwise check against next extension
- if (match) {
- return true;
- }
- }
-
- // return false if no match
- return false;
- }
- else if (inName.equals("isroot")) //$NON-NLS-1$
- {
- return tgt.isRoot() && value.equals("true") || //$NON-NLS-1$
- !tgt.isRoot() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("isfile")) //$NON-NLS-1$
- {
- return tgt.isFile() && value.equals("true") || //$NON-NLS-1$
- !tgt.isFile() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("isdirectory")) //$NON-NLS-1$
- {
- return tgt.isDirectory() && value.equals("true") || //$NON-NLS-1$
- !tgt.isDirectory() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("ishidden")) //$NON-NLS-1$
- {
- return tgt.isHidden() && value.equals("true") || //$NON-NLS-1$
- !tgt.isHidden() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("canread")) //$NON-NLS-1$
- {
- return tgt.canRead() && value.equals("true") || //$NON-NLS-1$
- !tgt.canRead() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("canwrite")) //$NON-NLS-1$
- {
- return tgt.canWrite() && value.equals("true") || //$NON-NLS-1$
- !tgt.canWrite() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("isbinary")) //$NON-NLS-1$
- {
- return tgt.isBinary() && value.equals("true") || //$NON-NLS-1$
- !tgt.isBinary() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("istext")) //$NON-NLS-1$
- {
- return tgt.isText() && value.equals("true") || //$NON-NLS-1$
- !tgt.isText() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("isarchive")) { //$NON-NLS-1$
- return tgt.isArchive() && value.equals("true") || //$NON-NLS-1$
- !tgt.isArchive() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("isvirtual")) //$NON-NLS-1$
- {
- return tgt instanceof IVirtualRemoteFile && value.equals("true") || //$NON-NLS-1$
- !(tgt instanceof IVirtualRemoteFile) && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("isexecutable")) //$NON-NLS-1$
- {
- return tgt.isExecutable() && value.equals("true") || //$NON-NLS-1$
- !tgt.isExecutable() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("islink")) //$NON-NLS-1$
- {
- return tgt.isLink() && value.equals("true") || //$NON-NLS-1$
- !tgt.isLink() && value.equals("false"); //$NON-NLS-1$
- }
- else if (inName.equals("supportspermissions")) //$NON-NLS-1$
- {
- if (value.equals("true")){ //$NON-NLS-1$
- // check service
- if (tgt instanceof IAdaptable){
- IFilePermissionsService service = (IFilePermissionsService)((IAdaptable)tgt).getAdapter(IFilePermissionsService.class);
- if (service != null){
-
- return (service.getCapabilities(tgt.getHostFile()) & IFilePermissionsService.FS_CAN_GET_PERMISSIONS) != 0;
- }
- }
- }
- return false;
- }
- }
-
- return super.testAttribute(target, name, value);
- }
-
- /*
- * Return whether deferred queries are supported.
- */
- public boolean supportsDeferredQueries(ISubSystem subSys)
- {
- return !subSys.getHost().getSystemType().isLocal();
- }
-
-
- protected SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
- {
- return new SystemFetchOperation(null, o, this, collector, true);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultAdapter.java
deleted file mode 100644
index e0b9d5183..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultAdapter.java
+++ /dev/null
@@ -1,823 +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) - [180562] dont implement ISystemOutputRemoteTypes
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-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.jface.action.MenuManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.actions.SystemRemoteFileSearchOpenWithMenu;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.services.search.IHostSearchResult;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter class to enable the output of a search to be "live" in that it has actions and properties.
- */
-public class SystemViewRemoteSearchResultAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter
-{
-
- public class DelayedGotoSearchResultJob extends Job
- {
- private DelayedGotoSearchResult _gotoLine;
- public DelayedGotoSearchResultJob(DelayedGotoSearchResult gotoLine)
- {
- super("Goto Line");
- _gotoLine = gotoLine;
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- try
- {
- // wait for a bit so that download can complete - otherwise
- // we could end up spawning this job too frequently
- Thread.sleep(1000);
- }
- catch (Exception e)
- {
- }
- PlatformUI.getWorkbench().getDisplay().asyncExec(_gotoLine);
- return Status.OK_STATUS;
- }
- }
-
-
-
- public class DelayedGotoSearchResult implements Runnable {
- private IRemoteFile _file;
- private IHostSearchResult _searchResult;
-
- public DelayedGotoSearchResult(IRemoteFile file, IHostSearchResult searchResult) {
- _file = file;
- _searchResult = searchResult;
- }
-
- public void run() {
-
- if (checkEditorOpen()) {
- SystemRemoteFileSearchOpenWithMenu.handleGotoLine(_file, _searchResult);
- }
- else {
- DelayedGotoSearchResultJob job = new DelayedGotoSearchResultJob(this);
- job.schedule();
- }
- }
-
- private boolean checkEditorOpen()
- {
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchPage persp = desktop.getActiveWorkbenchWindow().getActivePage();
-
- String fileName = _file.getAbsolutePath();
- IEditorReference[] editors = persp.getEditorReferences();
- for (int i = 0; i < editors.length; i++)
- {
- IEditorReference ref = editors[i];
- IEditorPart editorp = ref.getEditor(false);
- if (editorp != null)
- {
- IEditorInput einput = editorp.getEditorInput();
- if (einput instanceof IFileEditorInput)
- {
- IFileEditorInput input = (IFileEditorInput) einput;
- IFile efile = input.getFile();
-
- SystemIFileProperties properties = new SystemIFileProperties(efile);
- String comparePath = properties.getRemoteFilePath();
-
- if (comparePath != null && (comparePath.replace('\\','/').equals(fileName.replace('\\','/'))))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- }
-
-
- protected IPropertyDescriptor[] _propertyDescriptors;
-
-
- private SystemCopyToClipboardAction _copyOutputAction = null;
-
- public SystemViewRemoteSearchResultAdapter() {
- }
-
- /**
- * We should not add common actions such as compile and user actions for this adapter.
- * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#addCommonRemoteActions(org.eclipse.rse.ui.SystemMenuManager, org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.swt.widgets.Shell, java.lang.String)
- */
- public void addCommonRemoteActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup) {
-
- if (selection != null && !selection.isEmpty()) {
-
- Iterator iter = selection.iterator();
-
- boolean found = false;
-
- // go through selections and see if there is one IHostSearchResult
- // if there is, we do not add any common remote actions
- while (iter.hasNext()) {
- Object obj = iter.next();
-
- if (obj instanceof IHostSearchResult) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- super.addCommonRemoteActions(menu, selection, shell, menuGroup);
- }
- }
- else {
- super.addCommonRemoteActions(menu, selection, shell, menuGroup);
- }
- }
-
- /**
- * Contributed context menu actions for a remote search result
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- Object firstSelection = selection.getFirstElement();
-
- if (firstSelection != null)
- {
- if (_copyOutputAction == null)
- {
- _copyOutputAction = new SystemCopyToClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard());
- }
- menu.add(menuGroup, _copyOutputAction);
-
- if (selection.size() == 1)
- {
- if (firstSelection instanceof IHostSearchResult)
- {
- // IHostSearchResult result = (IHostSearchResult) firstSelection;
- //SystemSearchCreateEditLineActions createActions = new SystemSearchCreateEditLineActions();
- //createActions.create(menu, selection, shell, menuGroup);
- MenuManager submenu = new MenuManager(FileResources.ResourceNavigator_openWith, ISystemContextMenuConstants.GROUP_OPENWITH);
-
- SystemRemoteFileSearchOpenWithMenu openWithMenu = new SystemRemoteFileSearchOpenWithMenu();
- openWithMenu.updateSelection(selection);
- submenu.add(openWithMenu);
- menu.getMenuManager().appendToGroup(ISystemContextMenuConstants.GROUP_OPENWITH, submenu);
- }
- }
- }
- else
- {
- return;
- }
- }
-
- /**
- * Returns the parent of the search result (i.e. IHostSearchResults)
- */
- public Object getParent(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- IHostSearchResult output = (IHostSearchResult) element;
- return output.getParent();
- }
- return null;
- }
-
- /**
- * Returns the display text for this search result
- */
- public String getText(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- IHostSearchResult output = (IHostSearchResult) element;
- return output.getText();
- }
-
- return null;
- }
-
- /**
- * Returns nothing
- */
- public String getType(Object element)
- {
- return null;
- }
-
- /**
- * Returns nothing
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- return null;
- }
-
- /**
- * Returns false.
- */
- public boolean hasChildren(IAdaptable element)
- {
- return false;
- }
-
- /**
- * Returns the associated remote file for a search result
- * @param output the search result
- * @return the associated remote file
- */
- public static IRemoteFile outputToFile(IHostSearchResult output)
- {
- return (IRemoteFile)output.getParent();
- }
-
-
- /**
- * Opens the appropriate editor for a remote search result object
- */
- public boolean handleDoubleClick(Object element)
- {
- boolean result = false;
- if (element instanceof IHostSearchResult)
- {
-
- IHostSearchResult searchResult = (IHostSearchResult) element;
- IRemoteFile file = outputToFile(searchResult);
- if (file != null && file.isFile())
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)file).getAdapter(ISystemViewElementAdapter.class);
- result = adapter.handleDoubleClick(file);
- int line = searchResult.getLine();
-
- if (result)
- {
- if (line > 0)
- {
- DelayedGotoSearchResult dgoto = new DelayedGotoSearchResult(file, searchResult);
- Display.getDefault().asyncExec(dgoto);
- }
- return true;
- }
- }
- }
-
- return result;
- }
-
-
-
- /**
- * Returns the associated subsystem for this search result
- */
- public ISubSystem getSubSystem(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- IHostSearchResult output = (IHostSearchResult) element;
- Object parent = output.getParent();
-
- if (parent instanceof IRemoteFile) {
- return ((IRemoteFile)parent).getParentRemoteFileSubSystem();
- }
- }
-
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- IHostSearchResult searchResult = (IHostSearchResult)element;
-
- StringBuffer buf = new StringBuffer();
-
- String str = getAbsoluteParentName(element);
-
- if (str == null) {
- return null;
- }
-
- // create the absolute name with this format
- // remoteFilePath:SEARCH<searchString:index>
- buf.append(str);
- buf.append(IHostSearchResult.SEARCH_RESULT_DELIMITER);
- buf.append(IHostSearchResult.SEARCH_RESULT_OPEN_DELIMITER);
- buf.append(searchResult.getMatchingSearchString().toString());
- buf.append(IHostSearchResult.SEARCH_RESULT_INDEX_DELIMITER);
- buf.append(searchResult.getIndex());
- buf.append(IHostSearchResult.SEARCH_RESULT_CLOSE_DELIMITER);
-
- return buf.toString();
- }
-
- return null;
- }
-
- /**
- * Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem
- */
- public String getAbsoluteParentName(Object element)
- {
- Object parent = getParent(element);
-
- if ((parent != null) && (parent instanceof IRemoteFile)) {
- ISystemRemoteElementAdapter parentAdapter = SystemAdapterHelpers.getRemoteAdapter(parent);
-
- if (parentAdapter != null) {
- return parentAdapter.getAbsoluteName(parent);
- }
- }
-
- return null;
- }
-
- /**
- * Return the subsystem factory id that owns this remote object
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getSubSystemConfigurationId(Object element)
- {
- return null;
- }
-
- /**
- * Return a value for the type category property for this object
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getRemoteTypeCategory(Object element)
- {
- return null;
- }
-
- /**
- * Return a value for the type property for this object
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getRemoteType(Object element)
- {
- return null;
- }
-
- /**
- * Return a value for the subtype property for this object.
- * Not all object types support a subtype, so returning null is ok.
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getRemoteSubType(Object element)
- {
- return null;
- }
-
- /**
- * Return a value for the sub-subtype property for this object.
- * Not all object types support a sub-subtype, so returning null is ok.
- * The value must not be translated, so that property pages registered via xml can subset by it.
- */
- public String getRemoteSubSubType(Object element)
- {
- return null;
- }
- /**
- * Return the source type of the selected object. Typically, this only makes sense for compilable
- * source members. For non-compilable remote objects, this typically just returns null.
- */
- public String getRemoteSourceType(Object element)
- {
- return null;
- }
-
- /**
- * Some view has updated the name or properties of this remote object. As a result, the
- * remote object's contents need to be refreshed. You are given the old remote object that has
- * old data, and you are given the new remote object that has the new data. For example, on a
- * rename the old object still has the old name attribute while the new object has the new
- * new attribute.
- * <p>
- * This is called by viewers like SystemView in response to rename and property change events.
- * <p>
- * @param oldElement the element that was found in the tree
- * @param newElement the updated element that was passed in the REFRESH_REMOTE event
- * @return true if you want the viewer that called this to refresh the children of this object,
- * such as is needed on a rename of a folder, say.
- */
- public boolean refreshRemoteObject(Object oldElement, Object newElement)
- {
- return false;
- }
-
- /**
- * Given a remote object, returns it remote parent object. Eg, given a file, return the folder
- * it is contained in.
- */
- public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception
- {
- if (element instanceof IHostSearchResult)
- {
- return ((IHostSearchResult) element).getParent();
- }
- return null;
- }
-
- /**
- * Given a remote object, return the unqualified names of the objects contained in that parent. This is
- * used for testing for uniqueness on a rename operation, for example. Sometimes, it is not
- * enough to just enumerate all the objects in the parent for this purpose, because duplicate
- * names are allowed if the types are different, such as on iSeries. In this case return only
- * the names which should be used to do name-uniqueness validation on a rename operation.
- */
- public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
- {
- return null;
- }
-
- public IPropertyDescriptor[] getUniquePropertyDescriptors()
- {
- return new IPropertyDescriptor[0];
- }
-
- /**
- * Returns the unique property descriptors for a search result
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (_propertyDescriptors == null)
- {
- _propertyDescriptors = new PropertyDescriptor[2];
- int idx = -1;
-
- // path
- _propertyDescriptors[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PATH, SystemViewResources.RESID_PROPERTY_FILE_PATH_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PATH_TOOLTIP);
-
- // char start
- _propertyDescriptors[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_SEARCH_LINE, FileResources.RESID_PROPERTY_SEARCH_LINE_LABEL, FileResources.RESID_PROPERTY_SEARCH_LINE_TOOLTIP);
- //_propertyDescriptors[++idx] = createSimplePropertyDescriptor(P_SEARCH_CHAR_END, SystemViewResources.RESID_PROPERTY_SEARCH_CHAR_END_ROOT);
- }
- return _propertyDescriptors;
- }
-
- /**
- * Returns the current collection of property descriptors.
- * By default returns descriptors for name and type only.
- * Override if desired.
- * @return an array containing all descriptors.
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String) key;
- if (propertySourceInput instanceof IHostSearchResult)
- {
- IHostSearchResult output = (IHostSearchResult) propertySourceInput;
-
- if (name.equals(ISystemPropertyConstants.P_FILE_PATH))
- {
- return output.getAbsolutePath();
- }
- else if (name.equals(ISystemPropertyConstants.P_SEARCH_LINE))
- {
- return new Integer(output.getLine());
- }
- /*
- else if (name.equals(P_SEARCH_CHAR_END))
- {
- return new Integer(output.getCharEnd());
- }
- */
- }
-
- return null;
- }
-
-
- /**
- * Returns the associated image descriptor for a search result
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- ImageDescriptor imageDescriptor = null;
- imageDescriptor = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SEARCH_RESULT_ID);
-
- return imageDescriptor;
- }
- else
- { // return some default
- ImageDescriptor imageDescriptor = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_BLANK_ID);
- return imageDescriptor;
- }
- }
-
- /**
- * Return true if we should show the delete action in the popup for the given element.
- * If true, then canDelete will be called to decide whether to enable delete or not.
- */
- public boolean showDelete(Object element)
- {
- return false;
- }
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- * By default, returns false. Override if your object is deletable.
- */
- public boolean canDelete(Object element)
- {
- return false;
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON REFRESH ACTION...
- // ------------------------------------------
- /**
- * Return true if we should show the refresh action in the popup for the given element.
- */
- public boolean showRefresh(Object element)
- {
- return false;
- }
-
- // ------------------------------------------------------------
- // METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
- // ------------------------------------------------------------
- /**
- * Return true if we should show the refresh action in the popup for the given element.
- */
- public boolean showOpenViewActions(Object element)
- {
- return false;
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON RENAME ACTION...
- // ------------------------------------------
-
- /**
- * Return true if we should show the rename action in the popup for the given element.
- * If true, then canRename will be called to decide whether to enable rename or not.
- */
- public boolean showRename(Object element)
- {
- return false;
- }
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename popup menu item will be enabled.
- * By default, returns false. Override if your object is renamable.
- */
- public boolean canRename(Object element)
- {
- return false;
- }
-
- /**
- * Perform the rename action. By default does nothing. Override if your object is renamable.
- * Return true if this was successful. Return false if it failed and you issued a msg.
- * Throw an exception if it failed and you want to use the generic msg.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- return false;
- }
-
- // Drag and drop
-
- /**
- * Indicates whether the specified object can have another object copied to it
- * @param element the object to copy to
- * @return whether this object can be copied to or not
- */
- public boolean canDrop(Object element)
- {
-
- return false;
- }
-
- /**
- * Indicates whether the specified object can be copied
- * @param element the object to copy
- */
- public boolean canDrag(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Copy the specified remote output object. This method returns a string representing
- * the text of the remote output;
- *
- * @param element the output to copy
- * @param sameSystemType not applicable for remote output
- * @param monitor the progress monitor
- */
- public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
- {
- if (element instanceof List)
- {
- List resultSet = new ArrayList();
- List set = (List)element;
- for (int i = 0; i < set.size(); i++)
- {
- resultSet.add(getText(set.get(i)));
- }
- return resultSet;
- }
- else
- {
- return getText(element);
- }
- }
-
- /**
- * Return true if it is valid for the src object to be dropped in the target
- * @param src the object to drop
- * @param target the object which src is dropped in
- * @param sameSystem whether this is the same system
- * @return whether this is a valid operation
- */
- public boolean validateDrop(Object src, Object target, boolean sameSystem)
- {
- return false;
- }
-
- /**
- * Perform a copy via drag and drop.
- * @param src the object to be copied. If the target and source are not on the same system, then this is a
- * temporary object produced by the doDrag.
- * @param target the object to be copied to.
- * @param sameSystem an indication whether the target and source reside on the same type of system
- * @param srcType indicates the type of source
- * @param monitor the progress monitor
- * @return an indication whether the operation was successful or not.
- */
- public Object doDrop(Object src, Object target, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
- {
- IRemoteFile folder = outputToFile((IHostSearchResult) target);
- if (folder != null)
- {
- ISystemDragDropAdapter adapter = (ISystemDragDropAdapter) ((IAdaptable) folder).getAdapter(ISystemDragDropAdapter.class);
- return adapter.doDrop(src, folder, sameSystemType, sameSystem, srcType, monitor);
- }
- return null;
- }
-
- /**
- * Indicates whether the search result can be opened in an editor
- */
- public boolean canEdit(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- IHostSearchResult output = (IHostSearchResult) element;
- IRemoteFile file = outputToFile(output);
- if (file != null && file.isFile())
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the associated remote editable object for this search result
- */
- public ISystemEditableRemoteObject getEditableRemoteObject(Object element)
- {
- if (element instanceof IHostSearchResult)
- {
- IHostSearchResult output = (IHostSearchResult) element;
- IRemoteFile file = outputToFile(output);
- if (file != null && file.isFile())
- {
- return new SystemEditableRemoteFile(file);
- }
- }
- return null;
- }
-
- /**
- * Return a filter string that corresponds to this object.
- * @param object the object to obtain a filter string for
- * @return the corresponding filter string if applicable
- */
- public String getFilterStringFor(Object object)
- {
- return null;
- }
-
-
-
- /**
- * Returns the current value for the named property.
- *
- * @param property the name or key of the property as named by its property descriptor
- * @param formatted indication of whether to return the value in formatted or raw form
- * @return the current value of the given property
- */
- public Object getPropertyValue(Object property, boolean formatted)
- {
- String name = (String) property;
- if (propertySourceInput instanceof IRemoteCommandShell)
- {
- IRemoteCommandShell cmdShell = (IRemoteCommandShell) propertySourceInput;
- if (name.equals(ISystemPropertyConstants.P_SHELL_STATUS))
- {
- if (cmdShell.isActive())
- {
- return FileResources.RESID_PROPERTY_SEARCH_STATUS_ACTIVE_VALUE;
- }
- else
- {
- return FileResources.RESID_PROPERTY_SEARCH_STATUS_INACTIVE_VALUE;
- }
- }
- else if (name.equals(ISystemPropertyConstants.P_SHELL_CONTEXT))
- {
- Object context = cmdShell.getContext();
- if (context instanceof IRemoteFile)
- {
- IRemoteFile cwd = (IRemoteFile)context;
- return cwd.getAbsolutePath();
- }
- else
- {
- return context;
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultSetAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultSetAdapter.java
deleted file mode 100644
index 1c0777384..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteSearchResultSetAdapter.java
+++ /dev/null
@@ -1,361 +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) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * 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
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.clientserver.messages.CommonMessages;
-import org.eclipse.rse.services.search.IHostSearchResultSet;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteSearchResult;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemRemoveElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-/**
- * Adapter for a search result set.
- */
-public class SystemViewRemoteSearchResultSetAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter, ISystemRemoveElementAdapter
-{
- /**
- * Constructor.
- */
- public SystemViewRemoteSearchResultSetAdapter()
- {
- }
-
- /**
- * No actions are provided on a search results container
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- }
-
- /**
- * Returns false
- */
- public boolean canEdit(Object obj)
- {
- return false;
- }
-
- /**
- * Returns null since a search results container can't be edited
- */
- public ISystemEditableRemoteObject getEditableRemoteObject(Object obj)
- {
- return null;
- }
-
- /**
- * Returns the associated icon for a search handle
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- ImageDescriptor imageDescriptor= RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SEARCH_RESULT_ID);
- return imageDescriptor;
- }
-
- /**
- * Returns null since a search handle has no parent
- */
- public Object getParent(Object element)
- {
- return null;
- }
-
- /**
- * Returns the display text for a search handle. The display text indicates the search string as well as
- * whether the operation is in progress on not.
- */
- public String getText(Object element) {
-
- if (element instanceof IHostSearchResultSet) {
-
- IHostSearchResultSet set = (IHostSearchResultSet)element;
- String name = set.getName();
- String msg = null;
-
- if (set.isRunning()) {
- msg = CommonMessages.MSG_OPERATION_RUNNING;
- }
- else if (set.isFinished()) {
- msg = CommonMessages.MSG_OPERATION_FINISHED;
- }
- else if (set.isCancelled()) {
- msg = CommonMessages.MSG_OPERTION_STOPPED;
- }
- else if (set.isDisconnected()) {
- msg = CommonMessages.MSG_OPERATION_DISCONNECTED;
- }
-
- if (msg != null)
- {
- msg = NLS.bind(msg, name);
- return msg;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the type property of a search.
- */
- public String getType(Object element){
- return null;
- }
-
- /**
- * Returns the search results for the given search handle
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
-
- if (element instanceof IHostSearchResultSet) {
- IHostSearchResultSet output = (IHostSearchResultSet)element;
- return output.getAllResults();
- }
-
- return null;
- }
-
- /**
- * Returns <code>true</code> if it has children, otherwise returns <code>false</code>.
- */
- public boolean hasChildren(IAdaptable element) {
-
- if (element instanceof IHostSearchResultSet) {
- int num = ((IHostSearchResultSet)element).getNumOfResults();
- return num > 0;
- }
-
- return false;
- }
-
- /**
- * Returns false since a search handle can't be edited
- */
- public boolean handleDoubleClick(Object element) {
- return false;
- }
-
- /**
- * Returns the associated file subsystem for this search operation
- */
- public ISubSystem getSubSystem(Object element) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- //FIXME this is forbidden by the API
- return null;
- }
-
- public String getAbsoluteParentName(Object element)
- {
- return null;
- }
-
- public String getSubSystemConfigurationId(Object element)
- {
- return null;
- }
-
- public String getRemoteTypeCategory(Object element)
- {
- return null;
- }
-
- public String getRemoteType(Object element)
- {
- return null;
- }
-
- public String getRemoteSubType(Object element)
- {
- return null;
- }
-
-
- public String getRemoteSubSubType(Object element)
- {
- return null;
- }
-
- /**
- * Return the source type of the selected object. Typically, this only makes sense for compilable
- * source members. For non-compilable remote objects, this typically just returns null.
- */
- public String getRemoteSourceType(Object element)
- {
- return null;
- }
-
- public boolean refreshRemoteObject(Object oldElement, Object newElement)
- {
- return false;
- }
-
- /**
- * Given a remote object, returns it remote parent object. Eg, given a file, return the folder
- * it is contained in.
- *
- */
- public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception
- {
- return null;
- }
-
- /**
- * Given a remote object, return the unqualified names of the objects contained in that parent. This is
- * used for testing for uniqueness on a rename operation, for example. Sometimes, it is not
- * enough to just enumerate all the objects in the parent for this purpose, because duplicate
- * names are allowed if the types are different, such as on iSeries. In this case return only
- * the names which should be used to do name-uniqueness validation on a rename operation.
- */
- public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
- {
- return null;
- }
-
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- return new IPropertyDescriptor[0];
- }
-
- /**
- * Return our unique property values
- */
- protected Object internalGetPropertyValue(Object key)
- {
- return null;
- }
-
- /**
- * Return a filter string that corresponds to this object.
- * @param object the object to obtain a filter string for
- * @return the corresponding filter string if applicable
- */
- public String getFilterStringFor(Object object)
- {
- return null;
- }
-
- /**
- * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#canDelete(java.lang.Object)
- */
- public boolean canDelete(Object element) {
- return false;
- }
-
- /**
- * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#showDelete(java.lang.Object)
- */
- public boolean showDelete(Object element) {
- return false;
- }
-
- /**
- * @see org.eclipse.rse.ui.view.ISystemRemoveElementAdapter#remove(java.lang.Object, java.lang.Object)
- */
- public boolean remove(Object element, Object child) {
-
- if (element instanceof IHostSearchResultSet) {
- IHostSearchResultSet set = (IHostSearchResultSet)element;
-
- // if the child is an IRemoteFile
- if (child instanceof IRemoteFile) {
- set.removeResult(child);
- return true;
- }
- // if child is a result leaf, remove it from its parent
- else if (child instanceof IRemoteSearchResult) {
- IRemoteSearchResult result = (IRemoteSearchResult)child;
- IRemoteFile parent = (IRemoteFile)(result.getParent());
-
- // get contents of parent
- Object[] contents = parent.getContents(RemoteSearchResultsContentsType.getInstance(), result.getMatchingSearchString().toString());
- List contentsList = new ArrayList();
-
- // go through array and add all entries to list that do not match the result
- for (int i = 0; i < contents.length; i++) {
-
- if (contents[i] != result) {
- contentsList.add(contents[i]);
- }
- }
-
- // now set the contents of the parent with the result removed
- parent.setContents(RemoteSearchResultsContentsType.getInstance(), result.getMatchingSearchString().toString(), contentsList.toArray());
-
- return true;
- }
- else {
- return false;
- }
- }
- else {
- return false;
- }
- }
-
- /**
- * @see org.eclipse.rse.ui.view.ISystemRemoveElementAdapter#removeAllChildren(java.lang.Object)
- */
- public boolean removeAllChildren(Object element) {
-
- if (element == null) {
- return false;
- }
-
- if (element instanceof IHostSearchResultSet) {
- IHostSearchResultSet set = (IHostSearchResultSet)element;
- set.removeAllResults();
- return true;
- }
- else {
- return false;
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultAdapterFactory.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultAdapterFactory.java
deleted file mode 100644
index 17b3c2e64..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultAdapterFactory.java
+++ /dev/null
@@ -1,81 +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) - [180519][api] declaratively register adapter factories
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.services.search.IHostSearchResult;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-
-
-/**
- * This factory maps requests for an adapter object from a given
- * element object. A search result adapter factory maps a search
- * result object to a search result adapter.
- */
-public class SystemViewSearchResultAdapterFactory implements IAdapterFactory
-{
- private SystemViewRemoteSearchResultAdapter searchResultAdapter = new SystemViewRemoteSearchResultAdapter();
-
-
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] {ISystemViewElementAdapter.class, ISystemDragDropAdapter.class, ISystemRemoteElementAdapter.class, IPropertySource.class, IWorkbenchAdapter.class, IActionFilter.class};
- }
-
-// /**
-// * Register this factory with the Platform's Adapter Manager.
-// * Can be used for explicit registration, but we prefer doing it
-// * declaratively in plugin.xml so this is currently not used.
-// */
-// public void registerWithManager(IAdapterManager manager)
-// {
-// manager.registerAdapters(this, IHostSearchResult.class);
-// }
-
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- Object adapter = null;
- if (adaptableObject instanceof IHostSearchResult)
- adapter = searchResultAdapter;
-
- if ((adapter != null) && (adapterType == IPropertySource.class))
- {
- ((ISystemViewElementAdapter)adapter).setPropertySourceInput(adaptableObject);
- }
- else if (adapter == null)
- {
- SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
- }
- return adapter;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultSetAdapterFactory.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultSetAdapterFactory.java
deleted file mode 100644
index 70c28c028..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewSearchResultSetAdapterFactory.java
+++ /dev/null
@@ -1,76 +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) - [180519][api] declaratively register adapter factories
- ********************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.view;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.rse.services.search.IHostSearchResultSet;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-
-/**
- * This factory maps requests for an adapter object from a given
- * element object. A search results adapter factory maps a search
- * results object to a search results adapter.
- */
-public class SystemViewSearchResultSetAdapterFactory implements IAdapterFactory
-{
- private SystemViewRemoteSearchResultSetAdapter outputAdapter = new SystemViewRemoteSearchResultSetAdapter();
-
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] {ISystemViewElementAdapter.class, ISystemRemoteElementAdapter.class, IPropertySource.class, IWorkbenchAdapter.class, IActionFilter.class};
- }
-
-// /**
-// * Register this factory with the Platform's Adapter Manager.
-// * Can be used for explicit registration, but we prefer doing it
-// * declaratively in plugin.xml so this is currently not used.
-// */
-// public void registerWithManager(IAdapterManager manager)
-// {
-// manager.registerAdapters(this, IHostSearchResultSet.class);
-// }
-
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- Object adapter = null;
-
- if (adaptableObject instanceof IHostSearchResultSet) {
- adapter = outputAdapter;
- }
-
- if ((adapter != null) && (adapterType == IPropertySource.class))
- {
- ((ISystemViewElementAdapter)adapter).setPropertySourceInput(adaptableObject);
- }
- else if (adapter == null)
- {
- SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
- }
- return adapter;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java
deleted file mode 100644
index 7c89030c0..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/widgets/SystemFileTreeAndListGroup.java
+++ /dev/null
@@ -1,169 +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:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.widgets;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
-import org.eclipse.swt.widgets.Composite;
-
-
-
-
-/**
- * This is a private-use subclass of the internal Eclipse ResourceTreeAndListGroup
- * composite widget. This is for selecting multiple local or remote files. It contains
- * a checkbox tree on the left for selecting the folder, and a checkbox list on the
- * right for selecting the files.
- * <p>
- * We subclass this to add some slight additional functionality, including support for
- * refreshing the contents.
- */
-public class SystemFileTreeAndListGroup extends org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup
-{
- private Object rootObject = null;
- private Object lastSelectedElement = null;
- //private ISelectionProvider selectionProvider = null;
- // CONSTANTS
- private static final RemoteFileEmpty EMPTYROOT = new RemoteFileEmpty();
-
- /**
- * Constructor when there is initial content
- * @param parent org.eclipse.swt.widgets.Composite
- * @param rootObject java.lang.Object
- * @param treeContentProvider supplies the folders for the tree
- * @param treeLabelProvider supplies the names and icons of the folders for the tree
- * @param listContentProvider supplies the files for the tree
- * @param listLabelProvider supplies the names and icons for the files for the list
- * @param style int
- * @param width int
- * @param height int
- */
- public SystemFileTreeAndListGroup(Composite parent,Object rootObject,
- ITreeContentProvider treeContentProvider, ILabelProvider treeLabelProvider,
- IStructuredContentProvider listContentProvider, ILabelProvider listLabelProvider,
- int style,int width,int height)
- {
- // DKM - API change
- //super(parent, rootObject, treeContentProvider, treeLabelProvider,
- // listContentProvider, listLabelProvider, style, width, height);
- super(parent, rootObject, treeContentProvider, treeLabelProvider,
- listContentProvider, listLabelProvider, style, true);
-
- this.rootObject = rootObject;
- }
- /**
- * Constructor when there is no initial content
- * @param parent org.eclipse.swt.widgets.Composite
- * @param treeContentProvider supplies the folders for the tree
- * @param treeLabelProvider supplies the names and icons of the folders for the tree
- * @param listContentProvider supplies the files for the tree
- * @param listLabelProvider supplies the names and icons for the files for the list
- * @param style int
- * @param width int
- * @param height int
- */
- public SystemFileTreeAndListGroup(Composite parent,
- ITreeContentProvider treeContentProvider, ILabelProvider treeLabelProvider,
- IStructuredContentProvider listContentProvider, ILabelProvider listLabelProvider,
- int style,int width,int height)
- {
- this(parent, EMPTYROOT, treeContentProvider, treeLabelProvider,
- listContentProvider, listLabelProvider, style, width, height);
- }
-
-
- // does not work! The viewers are private, and the create methods don't return them!!
- /**
- * Create this group's list viewer.
- * Override of parent so we can record locally the list viewer widget.
- *
- protected void createListViewer(Composite parent, int width, int height)
- {
- listViewer = super.createListViewer(parent, width, height);
- return listViewer;
- }*/
-
- /**
- * Refesh all the contents of the checkbox viewers
- */
- public void refresh()
- {
- if (! (rootObject instanceof RemoteFileEmpty) )
- {
- Object oldRoot = rootObject;
- setRoot(EMPTYROOT);
- setRoot(oldRoot);
- /*
- if ((selectionProvider!=null) && (oldRoot instanceof RemoteFileRootImpl))
- {
- RemoteFileRootImpl root = (RemoteFileRootImpl)oldRoot;
- IRemoteFile rootFile = root.getRootFile();
- if (rootFile != null)
- super.selectionChanged(new SelectionChangedEvent(selectionProvider,
- new StructuredSelection(oldRoot)));
- }
- */
- }
- }
-
- /**
- * Refesh the contents of the file-selection checkbox viewer.
- */
- public void refreshFiles()
- {
- if (lastSelectedElement != null)
- populateListViewer(lastSelectedElement);
- }
-
- /**
- * Handle the selection of an item in the tree viewer.
- * Intercept of parent so we can record the last selected tree node.
- * @param event the selection changed event
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- lastSelectedElement = selection.getFirstElement();
- //selectionProvider = event.getSelectionProvider();
- super.selectionChanged(event);
- }
-
- /**
- * Set the root of the widget to be new Root. Regenerate all of the tables and lists from this
- * value.
- * Intercept of parent so we can refresh internal variables.
- * @param newRoot
- */
- public void setRoot(Object newRoot)
- {
- lastSelectedElement = null;
- rootObject = newRoot;
- super.setRoot(newRoot);
- }
-
- /**
- * Clear the contents
- */
- public void clearAll()
- {
- setRoot(EMPTYROOT);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemFileNewConnectionWizardPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemFileNewConnectionWizardPage.java
deleted file mode 100644
index d9c74a4a4..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemFileNewConnectionWizardPage.java
+++ /dev/null
@@ -1,234 +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 Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.wizards;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorServerPortInput;
-import org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.rse.ui.wizards.ISystemWizardPage;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-
-
-/**
- * A page that prompts for unique universal files information in the New Connection wizard.
- * This page appears for remote Unix, Linux and Windows connections but not for iSeries or Local connections.
- */
-public class SystemFileNewConnectionWizardPage extends AbstractSystemNewConnectionWizardPage
-
-{
-
- protected Label labelPortPrompt;
- protected Text textPort;
- protected ISystemValidator portValidator;
- protected SystemMessage errorMessage;
- protected boolean enablePortSelection = true;//false; // todo: enable in next releaes
-
- // SEE DEFECTS 43194 AND 42780
-
- /**
- * Constructor
- */
- public SystemFileNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory)
- {
- //super(wizard, parentFactory); todo: use this when we enable port selection
- super(wizard, parentFactory, parentFactory.getId(),
- SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_FILES_TITLE,
- SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_FILES_DESCRIPTION);
- if (enablePortSelection)
- getPortValidator();
- }
-
- /**
- * Return true if we support port selection yet
- */
- public boolean isInformationalOnly()
- {
- return !enablePortSelection;
- }
-
- /**
- * @see AbstractSystemWizardPage#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- if (textPort != null)
- return textPort;
- else
- return null;
- }
-
- public void setEnablePortSelection(boolean flag)
- {
- enablePortSelection = flag;
- }
-
- /**
- * Get the port validator. By default returns new ValidatorPortInput
- */
- protected ISystemValidator getPortValidator()
- {
- if (portValidator == null)
- portValidator = new ValidatorServerPortInput();
- return portValidator;
- }
-
- /**
- * @see AbstractSystemWizardPage#createContents(Composite)
- */
- public Control createContents(Composite parent)
- {
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
-
- // Instructional verbiage
- String text = null;
- text = SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBIAGE1;
- //,
- // the following is default English text to use if the string is not found in the mri"
- // "To connect to your remote system, you must first copy and expand the supplied Java server code jar file on that system, and either manually start that server or the supplied daemon. You will find the instructions for this in the Help perspective. ");
- boolean border = false;
- int span = nbrColumns;
- int widthHint = 200;
-
- SystemWidgetHelpers.createVerbiage(composite_prompts, text, span, border, widthHint);
-
- SystemWidgetHelpers.createSpacerLine(composite_prompts, span, false);
-
- text = SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBIAGE2;
- //,
- // the following is default English text to use if the string is not found in the mri"
- // "If you manually start the communications server, you will need to set the port number property for this connection. To do this, expand your newly created connection in the Remote System Explorer perspective. Right click on the Files subsystem and select Properties. You can specify the port to match the port you specified or were assigned for the server.");
-
- SystemWidgetHelpers.createVerbiage(composite_prompts, text, span, border, widthHint);
-
-
- // Port prompt
- if (enablePortSelection)
- {
- String labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_PORT_LABEL);
- labelPortPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
-
- textPort = SystemWidgetHelpers.createTextField(
- composite_prompts,null,SystemResources.RESID_SUBSYSTEM_PORT_TIP);
- textPort.setText("0"); //$NON-NLS-1$
-
- textPort.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePortInput();
- }
- }
- );
- }
-
-
-
- return composite_prompts;
- }
-
-
- /**
- * Return true if the port is editable for this subsystem
- */
- protected boolean isPortEditable()
- {
- return parentFactory.isPortEditable();
- }
-
- /**
- * @see ISystemWizardPage#performFinish()
- */
- public boolean performFinish()
- {
- if (textPort == null)
- return true;
- else
- return (validatePortInput()==null);
- }
-
- /**
- * Return the user-entered port number
- */
- public int getPortNumber()
- {
- Integer iPort = null;
- if (textPort == null)
- {
- iPort = new Integer(0);
- }
- else
- {
- String sPort = textPort.getText().trim();
- try
- {
- iPort = new Integer(sPort);
- }
- catch (Exception exc)
- {
- iPort = new Integer(0);
- }
- }
- return iPort.intValue();
- }
-
- /**
- * Validate port value as it is typed
- */
- protected SystemMessage validatePortInput()
- {
- this.clearErrorMessage();
- errorMessage = getPortValidator().validate(textPort.getText().trim());
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage==null);
- return errorMessage;
- }
-
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- */
- public boolean isPageComplete()
- {
- if (textPort == null)
- return true;
- else
- return (textPort.getText().trim().length()>0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.model.ISystemNewSubSystemProperties#applyValues(org.eclipse.rse.core.subsystems.ISubSystem)
- */
- public boolean applyValues(ISubSystem ss) {
- return true;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizard.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizard.java
deleted file mode 100644
index 2f20a9f63..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizard.java
+++ /dev/null
@@ -1,488 +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:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Rupen Mardirossian (IBM) - [187530] Commented out line 192, in order to stop logging of SystemMessageException
- * Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
- * Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
- * 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
- * David Dykstal (IBM) - [231841] Incorrect create messages being used. Cannot use NLS.bind if no substitution variables
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.wizards;
-
-import java.util.Vector;
-
-import org.eclipse.core.resources.WorkspaceJob;
-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.jface.viewers.Viewer;
-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.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
-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.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
-
-
-public class SystemNewFileWizard
- extends AbstractSystemWizard
-{
-
- private SystemNewFileWizardMainPage mainPage;
- //protected IRemoteFile parentFolder;
- //protected IStructuredSelection selection;
-
- private static final String CLASSNAME = "SystemNewFileWizard"; //$NON-NLS-1$
-
- private class CreateNewFileJob extends WorkspaceJob
- {
- IRemoteFile parentFolder = null;
- String name = null;
- String absName = null;
- String message = null;
-
- /**
- * CreateNewFileJob job.
- * @param message text used as the title of the job
- */
- public CreateNewFileJob(IRemoteFile parentFolder, String name, String absName, String message)
- {
- super(message);
- this.parentFolder = parentFolder;
- this.name = name;
- this.absName = absName;
- this.message = message;
- setUser(true);
- }
-
- public IStatus runInWorkspace(IProgressMonitor monitor)
- {
- boolean ok = true;
- IStatus status = Status.OK_STATUS;
- SystemMessage msg;
- IRemoteFileSubSystem rfss = parentFolder.getParentRemoteFileSubSystem();
-
- // ok, proceed with actual creation...
- IRemoteFile newFile = null;
- try
- {
- IRemoteFile newFilePath = rfss.getRemoteFileObject(parentFolder, name, monitor);
- newFile = rfss.createFile(newFilePath, monitor);
- }
- catch (RemoteFileIOException exc )
- {
- ok = false;
- SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String msgTxt = FileResources.FILEMSG_CREATE_FILE_FAILED;
- String msgDetails = FileResources.FILEMSG_CREATE_FILE_FAILED_DETAILS;
-
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_FILE_FAILED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(null, msg);
- }
- catch (RemoteFileSecurityException e)
- {
- ok = false;
- String msgTxt = FileResources.FILEMSG_CREATE_FILE_FAILED;
- String msgDetails = FileResources.FILEMSG_CREATE_FILE_FAILED_DETAILS;
-
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_FILE_FAILED,
- IStatus.ERROR, msgTxt, msgDetails);
-
-
- SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileSecurityException "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- SystemMessageDialog.displayErrorMessage(null, msg);
- }
- catch (SystemMessageException exc)
- {
- ok = false;
- if (monitor.isCanceled())
- {
- status = Status.CANCEL_STATUS;
- }
- SystemMessageDialog.displayErrorMessage(null, exc.getSystemMessage());
- }
-
- if (ok)
- {
- updateGUI(parentFolder, newFile, getViewer(), isInputAFilter(), getSelectedFilterReference());
- }
-
- return status;
- }
-
- }
-
- /**
- * Constructor
- */
- public SystemNewFileWizard()
- {
- super(FileResources.RESID_NEWFILE_TITLE,
-// RSEUIPlugin.getDefault().getImageDescriptorFromIDE("wizban/newfile_wiz.gif")
- // RSEUIPlugin.getDefault().getImageDescriptor("wizban/newfile_wiz.gif")
-
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILEWIZARD_ID));
- }
-
- /**
- * Creates the wizard pages.
- * This method is an override from the parent Wizard class.
- */
- public void addPages()
- {
- try {
- mainPage = createMainPage();
- addPage(mainPage);
- //super.addPages();
- } catch (Exception exc)
- {
- SystemBasePlugin.logError("New File: Error in createPages: ",exc); //$NON-NLS-1$
- }
- }
-
- /**
- * Creates the wizard's main page.
- * This method is an override from the parent class.
- */
- protected SystemNewFileWizardMainPage createMainPage()
- {
- IRemoteFile[] parentFolders = null;
- SystemMessage errMsg = null;
- try {
- parentFolders = getParentFolders();
- } catch (SystemMessageException exc)
- {
- // hmm, this means there are no valid folders so we are in error mode.
- errMsg = exc.getSystemMessage();
- }
- mainPage = new SystemNewFileWizardMainPage(this, parentFolders);
- if (errMsg != null)
- mainPage.setErrorMessage(errMsg);
- return mainPage;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- boolean ok = true;
- if (mainPage.performFinish())
- {
- SystemMessage msg = null;
- IRemoteFile parentFolder = mainPage.getParentFolder();
- String name = mainPage.getfileName();
- String absName = getNewAbsoluteName(parentFolder, name);
- if (!parentFolder.exists())
- {
- /* Be nice to do this someday...
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_FOLDER_NOTFOUND_WANTTOCREATE);
- msg.makeSubstitution(parentFolder.getAbsolutePath());
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- if (msgDlg.openQuestionNoException())
- {
- try {
- parentFolder = rfss.createFolder(parentFolder);
- }
- catch (RemoteFileIOException exc)
- {
- RSEUIPlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileIOException " );
- msg = (RSEUIPlugin.getPluginMessage(FILEMSG_CREATE_FOLDER_FAILED_EXIST)).makeSubstitution(parentFolder.getAbsolutePath());
- mainPage.setMessage(msg);
- return false;
- }
- catch (RemoteFileSecurityException exc)
- {
- RSEUIPlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileSecurityException " );
- msg = (RSEUIPlugin.getPluginMessage(FILEMSG_CREATE_FOLDER_FAILED)).makeSubstitution(parentFolder.getAbsolutePath());
- mainPage.setMessage(msg);
- return false;
- }
- }
- else
- */
- {
- String msgTxt = NLS.bind(FileResources.FILEMSG_FOLDER_NOTFOUND, parentFolder.getAbsolutePath());
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- msg.makeSubstitution(parentFolder.getAbsolutePath());
- mainPage.setMessage(msg);
- return false;
- }
- }
- // if input is a filter, then we need to test if the new file will meet the filtering criteria of
- // that filter...
- if (isInputAFilter())
- {
- if (!meetsFilterCriteria(getSelectedFilterReference(), parentFolder, absName))
- return false;
- }
- // ok, proceed with actual creation...
-
- String msgTxt = NLS.bind(FileResources.MSG_CREATEFILEGENERIC_PROGRESS, name);
- CreateNewFileJob createNewFileJob = new CreateNewFileJob(parentFolder, name, absName, msgTxt);
- createNewFileJob.schedule();
- }
- return ok;
- }
-
- /**
- * Create a new absolute name from the parent folder, and the new name
- */
- protected static String getNewAbsoluteName(IRemoteFile parentFolder, String newName)
- {
- String newAbsName = null;
- char sep = parentFolder.getSeparatorChar();
- String parentFolderPath = parentFolder.getAbsolutePath();
-
- // hack by Mike to allow virtual files and folders.
- if (parentFolder instanceof IVirtualRemoteFile)
- {
- sep = '/';
- }
- else if (parentFolder.isArchive())
- {
- sep = '/';
- parentFolderPath = parentFolderPath + ArchiveHandlerManager.VIRTUAL_SEPARATOR;
- }
-
- // hack by Phil to fix bug when trying to create file inside root "/"... it
- // tried to create "//file.ext".
- if ((parentFolderPath.length()==1) && (parentFolderPath.charAt(0)=='/') &&
- (parentFolderPath.charAt(0)==sep))
- newAbsName = sep + newName;
- else
- newAbsName = parentFolderPath + sep + newName;
- return newAbsName;
- }
-
- /**
- * Test if the new file/folder will meet the filtering criteria of the selected filter
- */
- protected boolean meetsFilterCriteria(ISystemFilterReference selectedFilterRef, IRemoteFile parentFolder, String newAbsName)
- {
- IRemoteFileSubSystem parentSubSystem = (IRemoteFileSubSystem)selectedFilterRef.getSubSystem();
-
- ISystemFilter filter = selectedFilterRef.getReferencedFilter();
-
- // if the filter is "*", this represents the Drives filter on Windows
- // we can not create a file directly under it since it doesn't actually represent a container
- // if we create a new file or folder by right clicking on this filter, the parent folder defaults to the first drive
- // that shows up when this filter is resolved. Hence we ignore this filter from the filter matching criteria
- String[] strings = filter.getFilterStrings();
-
- if (strings != null) {
-
- for (int idx = 0; idx < strings.length; idx++) {
-
- if (strings[idx].equals("*")) { //$NON-NLS-1$
- return true;
- }
- }
- }
-
- boolean meets = parentSubSystem.doesFilterMatch(filter, newAbsName);
-
- if (!meets)
- {
- String msgTxt = FileResources.FILEMSG_CREATE_RESOURCE_NOTVISIBLE;
- String msgDetails = FileResources.FILEMSG_CREATE_RESOURCE_NOTVISIBLE_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_RESOURCE_NOTVISIBLE,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- if (msgDlg.openQuestionNoException()) // ask user if they want to proceed
- meets = true; // they do, so pretend it meets the criteria
- }
- return meets;
- }
-
-
- /**
- * Called after all a successful create operation to update the GUI in an intuitive way:
- * <ul>
- * <li>The parent folder is refreshed in all views
- * <li>The newly created file or folder is selected in current view
- * </ul>
- */
- protected static void updateGUI(IRemoteFile parentFolder, IRemoteFile newFileOrFolder, Viewer viewer,
- boolean isInputAFilter, ISystemFilterReference selectedFilterRef)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- if (selectedFilterRef != null)
- {
- selectedFilterRef.markStale(true);
- }
-
- // invalidate filters that reference this object
- // TODO: we shouldn't have to do this. Presumably step 0 below should take care of it.
- sr.invalidateFiltersFor(newFileOrFolder, parentFolder.getParentRemoteFileSubSystem());
-
- // step 0: refresh all affected filters...
- ISubSystem fileSS = newFileOrFolder.getParentRemoteFileSubSystem();
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, newFileOrFolder, parentFolder, fileSS, null, viewer);
-
- /*
- // step 1: refresh all occurrences of the parent folder
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(
- parentFolder,ISystemResourceChangeEvent.EVENT_REFRESH_REMOTE, newFileOrFolder);
- event.setOriginatingViewer(viewer); // this allows only the originating view to select the new file
- sr.fireEvent(event);
- */
- // step 2: if the selected input is a filter, vs a folder, refresh that filter...
- if (isInputAFilter && (viewer instanceof ISystemTree))
- {
- // get originating tree view
- ISystemTree treeViewer = (ISystemTree)viewer;
- // select new file/folder in this view only, and expand filter if not already expanded...
- sr.fireEvent((ISystemResourceChangeListener)treeViewer,
- new SystemResourceChangeEvent(newFileOrFolder,ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, selectedFilterRef));
- }
-
- }
-
- /**
- * Return true if input is a system filter reference, versus a folder
- */
- protected boolean isInputAFilter()
- {
- return (getInputObject() instanceof ISystemFilterReference);
- }
- /**
- * Get the selected filter, or null if a filter is not selected.
- */
- protected ISystemFilterReference getSelectedFilterReference()
- {
- if (isInputAFilter())
- return (ISystemFilterReference)getInputObject();
- else
- return null;
- }
-
- /**
- * Deduce the parent remote folder to hold the new folder, by examining the current selection
- */
- protected IRemoteFile[] getParentFolders() throws SystemMessageException
- {
- Object input = getInputObject();
- if (input instanceof IRemoteFile)
- return new IRemoteFile[] {(IRemoteFile)input};
- else if (input instanceof ISystemFilterReference)
- return getParentFolders((ISystemFilterReference)input);
- else
- return null;
- }
-
- /**
- * Given a filter reference, return a list of all the unique root folders, one per filter string at most.
- * If all of these fail to resolve, an exception is thrown. If some fail to resolve, they are just ignored.
- */
- public static IRemoteFile[] getParentFolders(ISystemFilterReference filterRef) throws SystemMessageException
- {
- ISystemFilter filter = filterRef.getReferencedFilter();
- IRemoteFileSubSystem parentSubSystem = (IRemoteFileSubSystem)filterRef.getSubSystem();
- IRemoteFileSubSystemConfiguration parentFactory = parentSubSystem.getParentRemoteFileSubSystemConfiguration();
- String[] filterStrings = filter.getFilterStrings();
- RemoteFileFilterString rffs = null;
- Vector v = new Vector();
- Vector uniqueNames = new Vector();
- IRemoteFile folder = null;
- String pathName = null;
- SystemMessageException lastExc = null;
- for (int idx=0; idx<filterStrings.length; idx++)
- {
- rffs = new RemoteFileFilterString(parentFactory, filterStrings[idx]);
- if (rffs.listRoots())
- {
- try {
- IRemoteFile[] roots = parentSubSystem.listRoots(null);
- for (int rootIdx = 0; (roots!=null) && (rootIdx<roots.length); rootIdx++)
- {
- if (uniqueNames.indexOf(roots[idx].getName())==-1)
- v.add(roots[rootIdx]);
- }
- } catch (Exception exc) {}
- }
- else
- {
- pathName = rffs.getPath();
- if (uniqueNames.indexOf(pathName)==-1)
- {
- uniqueNames.add(pathName);
- try {
- folder = parentSubSystem.getRemoteFileObject(pathName, new NullProgressMonitor());
- // decided to do folder existence checking when Finish pressed
- //if (folder.exists())
- v.add(folder);
- //else
- //{
- // SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_FOLDER_NOTFOUND);
- // msg.makeSubstitution(pathName);
- // lastExc = new SystemMessageException(msg);
- //}
- } catch (SystemMessageException exc)
- {
- lastExc = exc;
- }
- }
- }
- }
- if ((lastExc != null) && (v.size()==0))
- throw lastExc;
- IRemoteFile[] folders = new IRemoteFile[v.size()];
- for (int idx=0; idx<folders.length; idx++)
- folders[idx] = (IRemoteFile)v.elementAt(idx);
- return folders;
- }
-
-} // end class
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizardMainPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizardMainPage.java
deleted file mode 100644
index 995a516e7..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFileWizardMainPage.java
+++ /dev/null
@@ -1,237 +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:
- * Kevin Doyle (IBM) - Changed name Validator to ValidatorFileUniqueName
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [216252] cleaning up system message ids and strings
- * David McKnight (IBM) - [231671] TVT34:TCT171: PLK: No help text for new remote file
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.wizards;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Default main page of the "New File" wizard.
- * This page asks for the following information:
- * <ul>
- * <li>New File name
- * </ul>
- */
-
-public class SystemNewFileWizardMainPage
- extends AbstractSystemWizardPage
-{
-
- protected String fileNameStr;
- protected Text folderName, connectionName, fileName;
- protected Combo folderNames;
- protected SystemMessage errorMessage;
- protected ISystemValidator nameValidator;
- protected IRemoteFile[] parentFolders;
- protected ISystemMessageLine msgLine;
- public String [] allnames;
-
- /**
- * Constructor.
- */
- public SystemNewFileWizardMainPage(Wizard wizard, IRemoteFile[] parentFolders)
- {
- super(wizard, "NewFile", //$NON-NLS-1$
- FileResources.RESID_NEWFILE_PAGE1_TITLE, FileResources.RESID_NEWFILE_PAGE1_DESCRIPTION);
- this.parentFolders = parentFolders;
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- */
- public Control createContents(Composite parent)
- {
-
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // Connection name
- connectionName = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, FileResources.RESID_NEWFILE_CONNECTIONNAME_LABEL, FileResources.RESID_NEWFILE_CONNECTIONNAME_TIP);
-
- //labelConnectionName.
-
- // FolderName
- if ((parentFolders == null) || (parentFolders.length == 1))
- folderName = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null, FileResources.RESID_NEWFILE_FOLDER_LABEL, FileResources.RESID_NEWFILE_FOLDER_TIP);
- else
- folderNames = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, FileResources.RESID_NEWFILE_FOLDER_LABEL, FileResources.RESID_NEWFILE_FOLDER_TIP);
-
- // File Name
- fileName = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, FileResources.RESID_NEWFILE_NAME_LABEL, FileResources.RESID_NEWFILE_NAME_TOOLTIP);
-
- initializeInput();
-
- fileName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
-
- SystemWidgetHelpers.setCompositeHelp(composite_prompts, RSEUIPlugin.HELPPREFIX + ISystemFileConstants.NEW_FILE_WIZARD);
-
- return composite_prompts;
-
- }
-
- /**
- * Return the Control to be given initial focus.
- * Override from parent. Return control to be given initial focus.
- */
- protected Control getInitialFocusControl()
- {
- return fileName;
- }
-
- /**
- * Init values using input data
- */
- protected void initializeInput()
- {
- connectionName.setEditable(false);
-
- // get existing names
- if (parentFolders != null && parentFolders.length > 0)
- {
- IRemoteFile parentFolder = parentFolders[0];
- nameValidator = new ValidatorFileUniqueName(getShell(),parentFolder,false);
- }
- else
- {
- nameValidator = null;
- }
-
- if ((parentFolders == null) || (parentFolders.length == 0))
- {
- folderName.setEditable(false);
- fileName.setEditable(false); // why do we do this??
- setPageComplete(false);
- return;
- }
- IRemoteFileSubSystem rfss = parentFolders[0].getParentRemoteFileSubSystem();
- connectionName.setText(rfss.getHostAliasName());
- connectionName.setToolTipText((rfss.getHost()).getHostName());
-
- if (folderName != null)
- {
- folderName.setText(parentFolders[0].getAbsolutePath());
- folderName.setEditable(false);
- }
- else
- {
- String[] names = new String[parentFolders.length];
- for (int idx=0; idx<names.length; idx++)
- names[idx] = parentFolders[idx].getAbsolutePath();
- folderNames.setItems(names);
- folderNames.select(0);
- }
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage = null;
- this.clearErrorMessage();
- // this.setDescription(SystemResources.RESID_NEWFILE_PAGE1_DESCRIPTION));
- if (nameValidator != null)
- errorMessage= nameValidator.validate(fileName.getText());
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage==null);
- return errorMessage;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
-
- return true;
- }
-
- // --------------------------------- //
- // METHODS FOR EXTRACTING USER DATA ...
- // --------------------------------- //
- /**
- * Return user-entered new file name.
- * Call this after finish ends successfully.
- */
- public String getfileName()
- {
- return fileName.getText();
- }
- /**
- * Return the parent folder selected by the user
- */
- public IRemoteFile getParentFolder()
- {
- if (folderName != null)
- return parentFolders[0];
- else
- {
- int selIdx = folderNames.getSelectionIndex();
- if (selIdx == -1)
- selIdx = 0;
- return parentFolders[selIdx];
- }
- }
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- */
- public boolean isPageComplete()
- {
- return (errorMessage==null) && (fileName.getText().trim().length()>0);
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizard.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizard.java
deleted file mode 100644
index 0ea253e80..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizard.java
+++ /dev/null
@@ -1,342 +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:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David Dykstal (IBM) - [188718] fix error messages showing up as info messages on wizard page
- * Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
- * 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 Dykstal (IBM) [231841] Correcting messages for folder creation
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.wizards;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-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.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
-
-
-public class SystemNewFolderWizard
- extends AbstractSystemWizard
-{
-
- private SystemNewFolderWizardMainPage mainPage;
- //protected IRemoteFile myObject;
- //protected IStructuredSelection selection;
-
- private static final String CLASSNAME = "SystemNewFolderWizard"; //$NON-NLS-1$
-
- private class CreateNewFolderJob extends WorkspaceJob
- {
- IRemoteFile parentFolder = null;
- String name = null;
- String absName = null;
- String message = null;
-
- /**
- * CreateNewFileJob job.
- * @param message text used as the title of the job
- */
- public CreateNewFolderJob(IRemoteFile parentFolder, String name, String absName, String message)
- {
- super(message);
- this.parentFolder = parentFolder;
- this.name = name;
- this.absName = absName;
- this.message = message;
- setUser(true);
- }
-
- public IStatus runInWorkspace(IProgressMonitor monitor)
- {
- boolean ok = true;
- IStatus status = Status.OK_STATUS;
- SystemMessage msg;
- IRemoteFileSubSystem rfss = parentFolder.getParentRemoteFileSubSystem();
-
- // ok, proceed with actual creation...
- IRemoteFile newFolder = null;
- try
- {
- IRemoteFile newFolderPath = rfss.getRemoteFileObject(absName, monitor);
- newFolder = rfss.createFolder(newFolderPath, monitor);
- }
- catch (RemoteFileIOException exc )
- {
- ok = false;
- SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String msgTxt = FileResources.FILEMSG_CREATE_FOLDER_FAILED_EXIST;
- String msgDetails = NLS.bind(FileResources.FILEMSG_CREATE_FOLDER_FAILED_EXIST_DETAILS, absName);
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_FOLDER_FAILED_EXIST,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.displayErrorMessage(null, msg);
- }
- catch (RemoteFileSecurityException e)
- {
- ok = false;
- String msgTxt = FileResources.FILEMSG_CREATE_FOLDER_FAILED;
- String msgDetails = FileResources.FILEMSG_CREATE_FOLDER_FAILED_DETAILS;
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_FOLDER_FAILED,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileSecurityException "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- SystemMessageDialog.displayErrorMessage(null, msg);
- }
- catch (SystemMessageException exc)
- {
- ok = false;
- if (monitor.isCanceled())
- {
- status = Status.CANCEL_STATUS;
- }
- SystemMessageDialog.displayErrorMessage(null, exc.getSystemMessage());
- }
-
- if (ok)
- {
- SystemNewFileWizard.updateGUI(parentFolder, newFolder, getViewer(), isInputAFilter(), getSelectedFilterReference());
- }
-
- return status;
- }
-
- }
-
- /**
- * Constructor
- */
- public SystemNewFolderWizard()
- {
- super(FileResources.RESID_NEWFOLDER_TITLE,
- // RSEUIPlugin.getDefault().getImageDescriptorFromIDE("wizban/newfolder_wiz.gif")
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFOLDERWIZARD_ID)
- );
- }
-
- /**
- * Creates the wizard pages.
- * This method is an override from the parent AbstractSystemWizard class.
- */
- public void addPages()
- {
- try {
- mainPage = createMainPage();
- addPage(mainPage);
- //super.addPages();
- } catch (Exception exc)
- {
- SystemBasePlugin.logError("New File: Error in createPages: ",exc); //$NON-NLS-1$
- }
- }
-
- /**
- * Creates the wizard's main page.
- * This method is an override from the parent class.
- */
- protected SystemNewFolderWizardMainPage createMainPage()
- {
- IRemoteFile[] parentFolders = null;
- SystemMessage errMsg = null;
- try {
- parentFolders = getParentFolders();
- } catch (SystemMessageException exc)
- {
- // hmm, this means there are no valid folders so we are in error mode.
- errMsg = exc.getSystemMessage();
- }
- mainPage = new SystemNewFolderWizardMainPage(this, parentFolders);
- if (errMsg != null)
- mainPage.setErrorMessage(errMsg);
- return mainPage;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- boolean ok = true;
- if (mainPage.performFinish())
- {
- SystemMessage msg = null;
- IRemoteFile parentFolder = mainPage.getParentFolder();
- String name = mainPage.getfolderName();
- String absName = SystemNewFileWizard.getNewAbsoluteName(parentFolder, name);
- if (!parentFolder.exists())
- {
- /* Be nice to do this someday...
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_FOLDER_NOTFOUND_WANTTOCREATE);
- msg.makeSubstitution(parentFolder.getAbsolutePath());
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- if (msgDlg.openQuestionNoException())
- {
- try {
- parentFolder = rfss.createFolder(parentFolder);
- }
- catch (RemoteFileIOException exc)
- {
- RSEUIPlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileIOException " );
- msg = (RSEUIPlugin.getPluginMessage(FILEMSG_CREATE_FOLDER_FAILED_EXIST)).makeSubstitution(parentFolder.getAbsolutePath());
- mainPage.setMessage(msg);
- return false;
- }
- catch (RemoteFileSecurityException exc)
- {
- RSEUIPlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileSecurityException " );
- msg = (RSEUIPlugin.getPluginMessage(FILEMSG_CREATE_FOLDER_FAILED)).makeSubstitution(parentFolder.getAbsolutePath());
- mainPage.setMessage(msg);
- return false;
- }
- }
- else
- */
- {
- String msgTxt = NLS.bind(FileResources.FILEMSG_FILE_NOTFOUND, parentFolder.getAbsolutePath());
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
-
- mainPage.setMessage(msg);
- return false;
- }
- }
- // if input is a filter, then we need to test if the new file will meet the filtering criteria of
- // that filter...
- if (isInputAFilter())
- {
- if (!meetsFilterCriteria(getSelectedFilterReference(), parentFolder, absName))
- return false;
- }
-
- // ok, proceed with actual creation...
- String msgTxt = NLS.bind(FileResources.MSG_CREATEFOLDERGENERIC_PROGRESS, name);
-
- CreateNewFolderJob createNewFolderJob = new CreateNewFolderJob(parentFolder, name, absName, msgTxt);
- createNewFolderJob.schedule();
-
- }
- return ok;
-
- }
- /**
- * Test if the new file/folder will meet the filtering criteria of the selected filter.
- * For folders, since we do not support subsetting by folder names, we simply need to test if any
- * of the filter strings in the filter has showSubDirs() set to true.
- */
- protected boolean meetsFilterCriteria(ISystemFilterReference selectedFilterRef, IRemoteFile parentFolder, String newAbsName)
- {
- boolean meets = false;
- ISystemFilter filter = selectedFilterRef.getReferencedFilter();
- String[] strings = filter.getFilterStrings();
- if (strings != null)
- {
- for (int idx=0; !meets && (idx<strings.length); idx++)
- {
- String filterString = strings[idx];
- if (filterString.indexOf("/ns") == -1) // if this filter string allows folders (no /ns switch) then we have a match! //$NON-NLS-1$
- {
- if (strings.length > 0 && !filterString.startsWith(parentFolder.getAbsolutePath()))
- {
- if (!filterString.equals("./*")) //DKM - ./ will always meet //$NON-NLS-1$
- {
- meets = false;
- }
- else
- {
- meets = true;
- }
- }
- else
- {
- meets = true;
- }
- }
- }
- }
- if (!meets)
- {
- String msgTxt = FileResources.FILEMSG_CREATE_RESOURCE_NOTVISIBLE;
- String msgDetails = FileResources.FILEMSG_CREATE_RESOURCE_NOTVISIBLE_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_RESOURCE_NOTVISIBLE,
- IStatus.WARNING, msgTxt, msgDetails);
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- if (msgDlg.openQuestionNoException()) // ask user if they want to proceed
- meets = true; // they do, so pretend it meets the criteria
- }
- return meets;
- }
-
- /**
- * Return true if input is a system filter reference, versus a folder
- */
- protected boolean isInputAFilter()
- {
- return (getInputObject() instanceof ISystemFilterReference);
- }
- /**
- * Get the selected filter, or null if a filter is not selected.
- */
- protected ISystemFilterReference getSelectedFilterReference()
- {
- if (isInputAFilter())
- return (ISystemFilterReference)getInputObject();
- else
- return null;
- }
-
- /**
- * Deduce the parent remote folder to hold the new folder, by examining the current selection
- */
- protected IRemoteFile[] getParentFolders() throws SystemMessageException
- {
- Object input = getInputObject();
- if (input instanceof IRemoteFile)
- return new IRemoteFile[] {(IRemoteFile)input};
- else if (input instanceof ISystemFilterReference)
- {
- return SystemNewFileWizard.getParentFolders((ISystemFilterReference)input);
- }
- else
- return null;
- }
-
-
-} // end class
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizardMainPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizardMainPage.java
deleted file mode 100644
index cf3d5ed47..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/wizards/SystemNewFolderWizardMainPage.java
+++ /dev/null
@@ -1,238 +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:
- * Kevin Doyle (IBM) - Changed name Validator to ValidatorFileUniqueName
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [216252] cleaning up system message ids and strings
- * David McKnight (IBM) - [231671] TVT34:TCT171: PLK: No help text for new remote file
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.wizards;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorUniqueString;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Default main page of the "New Folder" wizard.
- * This page asks for the following information:
- * <ul>
- * <li>New File name
- * </ul>
- */
-
-public class SystemNewFolderWizardMainPage
- extends AbstractSystemWizardPage
-{
-
- protected String fileNameStr;
- protected Text folderName, connectionName, newfolderName;
- protected Combo folderNames;
- protected SystemMessage errorMessage;
- protected ISystemValidator nameValidator;
- protected IRemoteFile[] parentFolders;
- protected ISystemMessageLine msgLine;
- public String [] allnames;
-
- /**
- * Constructor.
- */
- public SystemNewFolderWizardMainPage(Wizard wizard, IRemoteFile[] parentFolders)
- {
- super(wizard, "NewFolder", //$NON-NLS-1$
- FileResources.RESID_NEWFOLDER_PAGE1_TITLE,
- FileResources.RESID_NEWFOLDER_PAGE1_DESCRIPTION);
- // nameValidator = new ValidatorProfileName(RSECorePlugin.getTheSystemRegistry().getAllSystemProfileNamesVector());
- nameValidator = new ValidatorUniqueString(allnames, true);
- this.parentFolders = parentFolders;
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- */
- public Control createContents(Composite parent)
- {
-
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // Connection name
- connectionName = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, FileResources.RESID_NEWFOLDER_CONNECTIONNAME_LABEL, FileResources.RESID_NEWFOLDER_CONNECTIONNAME_TIP);
-
- //labelConnectionName.
-
- // FolderName
- if (parentFolders.length == 1)
- folderName = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null, FileResources.RESID_NEWFOLDER_FOLDER_LABEL, FileResources.RESID_NEWFOLDER_FOLDER_TIP);
- else
- folderNames = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, FileResources.RESID_NEWFOLDER_FOLDER_LABEL, FileResources.RESID_NEWFOLDER_FOLDER_TIP);
-
- // New Folder Name
- newfolderName = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, FileResources.RESID_NEWFOLDER_NAME_LABEL, FileResources.RESID_NEWFOLDER_NAME_TOOLTIP);
-
- initializeInput();
-
- newfolderName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
-
- SystemWidgetHelpers.setCompositeHelp(composite_prompts, RSEUIPlugin.HELPPREFIX+ISystemFileConstants.NEW_FOLDER_WIZARD);
-
- return composite_prompts;
-
- }
-
- /**
- * Return the Control to be given initial focus.
- * Override from parent. Return control to be given initial focus.
- */
- protected Control getInitialFocusControl()
- {
- return newfolderName;
- }
-
- /**
- * Init values using input data
- */
- protected void initializeInput()
- {
- connectionName.setEditable(false);
- // get existing names
- if (parentFolders != null && parentFolders.length > 0)
- {
- IRemoteFile parentFolder = parentFolders[0];
- nameValidator = new ValidatorFileUniqueName(getShell(),parentFolder, true);
- }
- else
- {
- nameValidator = null;
- }
- if (parentFolders == null)
- {
- folderName.setEditable(false);
- newfolderName.setEditable(false);
- setPageComplete(false);
- return;
- }
- IRemoteFileSubSystem rfss = parentFolders[0].getParentRemoteFileSubSystem();
- connectionName.setText(rfss.getHostAliasName());
- connectionName.setToolTipText((rfss.getHost()).getHostName());
-
- if (folderName != null)
- {
- folderName.setText(parentFolders[0].getAbsolutePath());
- folderName.setEditable(false);
- }
- else
- {
- String[] names = new String[parentFolders.length];
- for (int idx=0; idx<names.length; idx++)
- names[idx] = parentFolders[idx].getAbsolutePath();
- folderNames.setItems(names);
- folderNames.select(0);
- }
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- *
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage = null;
- this.clearErrorMessage();
- // this.setDescription(SystemResources.RESID_NEWFILE_PAGE1_DESCRIPTION));
- if (nameValidator != null)
- errorMessage= nameValidator.validate(newfolderName.getText());
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage==null);
- return errorMessage;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- return true;
- }
-
- // --------------------------------- //
- // METHODS FOR EXTRACTING USER DATA ...
- // --------------------------------- //
- /**
- * Return user-entered new file name.
- * Call this after finish ends successfully.
- */
- public String getfolderName()
- {
- return newfolderName.getText();
- }
- /**
- * Return the parent folder selected by the user
- */
- public IRemoteFile getParentFolder()
- {
- if (folderName != null)
- return parentFolders[0];
- else
- {
- int selIdx = folderNames.getSelectionIndex();
- if (selIdx == -1)
- selIdx = 0;
- return parentFolders[selIdx];
- }
- }
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- */
- public boolean isPageComplete()
- {
- return (errorMessage==null) && (newfolderName.getText().trim().length()>0);
- }
-
-}

Back to the top