Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'rse/plugins/org.eclipse.rse.files.ui/src/org')
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemAddFileListener.java53
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemFileMessages.java37
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java585
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java533
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/compare/SystemCompareInput.java249
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/FileDialogFactory.java51
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ISaveAsDialog.java34
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemPromptForHomeFolderDialog.java131
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteArchiveDialog.java69
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFileDialog.java105
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFolderDialog.java68
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemCachedRemoteResource.java86
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java108
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResource.java36
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResourceManager.java57
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteManager.java43
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarker.java221
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarkerSetElement.java31
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemotePath.java57
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteResource.java176
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemTextEditor.java31
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java2052
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemSafeFileOutputStream.java221
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java800
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java469
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java3185
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/ISystemRemoteFolderBrowseCompleteListener.java34
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SaveAsForm.java244
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java886
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileWidgetHelpers.java121
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java789
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java577
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java1078
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java623
-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.java205
-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.java236
-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.java576
-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.java725
-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.java909
-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.java1628
-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.java3768
-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
115 files changed, 0 insertions, 38250 deletions
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemAddFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemAddFileListener.java
deleted file mode 100644
index 3b50abeee..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemAddFileListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-/**
- * This is an interface used by the actions SystemSelectRemoteFileAction and SystemSelectRemoteFolderAction
- * actions classes (and the dialog and form used by these) and enable the dialog's OK button to
- * be replaced with an Add button. When the user selects and object or presses Add, the caller
- * is informed and able to display a resulting message in the dialog's message line,and affect
- * the enabled state of the Add button.
- * <p>
- * If you call the enableAddButton method you must pass an object that implements this interface.
- * The dialog will call you back when the user presses the Add button, so you can take
- * appropriate action.
- */
-public interface ISystemAddFileListener
-{
-
- /**
- * The user has pressed the Add button.
- * Do something appropriate with the request.
- * <p>
- * If this action fails for some reason, or you wish to display a completion
- * message, return message text that will be displayed in the dialog's message
- * line. Else, return null.
- */
- public Object addButtonPressed(IHost selectedConnection, IRemoteFile[] selectedObjects);
- /**
- * The user has selected a file or folder. Is this valid to be added?
- * <p>
- * If so, return null. If not, return a string to display on the
- * message line indicating why it is not valid, such as it already has
- * been added.
- */
- public Object okToEnableAddButton(IHost selectedConnection, IRemoteFile[] selectedObjects);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemFileMessages.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemFileMessages.java
deleted file mode 100644
index f71ac25b6..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/ISystemFileMessages.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui;
-/**
- * Keys into the core plugin's resource bundle for error messages related
- * to the remote file system framework.
- */
-public interface ISystemFileMessages
-{
- //public static final String PLUGIN_ID ="org.eclipse.rse.ui";
- //public static final String PLUGIN_ID =ISystemMessages.PLUGIN_ID;
- // Message prefix
- //public static final String FILEMSG_PREFIX = PLUGIN_ID+".ui.filemsg.";
-
- // Messages
- //public static final String FILEMSG_VALIDATE_PREFIX = FILEMSG_PREFIX + "Validate.";
-
- public static final String FILEMSG_VALIDATE_FILEFILTERSTRING_EMPTY = "RSEF1006"; //$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$
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java
deleted file mode 100644
index 69e6b557e..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java
+++ /dev/null
@@ -1,585 +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
- * Xuan Chen (IBM) - [220999] [api] Need to change class SystemSelectRemoteFileAction to use SystemRemoteFileDialog
- * Xuan Chen (IBM) - [220999] [api] [breaking] Also need to remove unnecessary APIs
- * Xuan Chen (IBM) - [231346] [api][regression] No longer able to restrict selection to files only in SystemSelectRemoteFileAction
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.actions;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-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.dialogs.SystemRemoteFileDialog;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-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.SystemActionViewerFilter;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action for allowing the user to select a remote file.
- * <p>
- * To configure, call these methods:
- * <ul>
- * <li>{@link #setShowNewConnectionPrompt(boolean)}
- * <li>{@link #setHost(IHost) or #setDefaultConnection(SystemConnection)}
- * <li>{@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])}
- * <li>{@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)}
- * <li>{@link #setShowPropertySheet(boolean)} or {@link #setShowPropertySheet(boolean,boolean)}
- * <li>{@link #setMultipleSelectionMode(boolean)}
- * <li>{@link #setSelectionValidator(IValidatorRemoteSelection)}
- * </ul>
- * <p>
- * Call these methods to configure the text on the dialog
- * <ul>
- * <li>{@link #setDialogTitle(String)}
- * <li>{@link #setMessage(String)}
- * <li>{@link #setSelectionTreeToolTipText(String)}
- * </ul>
- * <p>
- * After running, call these methods to get the output:
- * <ul>
- * <li>{@link #getSelectedFile()} or {@link #getSelectedFiles()}
- * <li>{@link #getSelectedConnection()}
- * </ul>
- */
-public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
-{
- private IRSESystemType[] systemTypes;
- private IHost systemConnection, outputConnection;
- private IHost rootFolderConnection;
- private IRemoteFile preSelection;
- private String rootFolderAbsPath;
- private String message, treeTip, dlgTitle;
- private boolean showNewConnectionPrompt = true;
- private boolean showPropertySheet = false;
- private boolean showPropertySheetDetailsButtonInitialState;
- private boolean showPropertySheetDetailsButton = false;
- private boolean multipleSelectionMode = false;
- private boolean onlyConnection = false;
- private IValidatorRemoteSelection clientProvidedSelectionValidator = null;
- private List viewerFilters = new ArrayList();
- private SystemActionViewerFilter customViewerFilter = null;
- private boolean allowFolderSelection = true;
-
- static class RemoteFileSelectionValidator implements IValidatorRemoteSelection
- {
- private boolean allowFolderSelect = true;
- private IValidatorRemoteSelection previousInChain = null;
- public RemoteFileSelectionValidator(boolean allowFolderSelection, IValidatorRemoteSelection previousInChain)
- {
- super();
- this.allowFolderSelect = allowFolderSelection;
- this.previousInChain = previousInChain;
- }
-
- /**
- * 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.
- SimpleSystemMessage msg = null;
-
- if (selectedObjects == null || selectedObjects.length == 0)
- {
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- IStatus.INFO,
- FileResources.MSG_MAKE_SELECTION);
- return msg;
- }
-
- if (allowFolderSelect == true)
- {
- if (previousInChain != null)
- {
- return previousInChain.isValid(selectedConnection, selectedObjects, remoteAdaptersForSelectedObjects);
- }
- else
- {
- return null;
- }
- }
-
- for (int i = 0; i < selectedObjects.length; i++)
- {
- if (selectedObjects[i] instanceof IRemoteFile)
- {
- IRemoteFile selectedFile = (IRemoteFile)selectedObjects[i];
- if (selectedFile != null && selectedFile.isDirectory()) {
- msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- IStatus.INFO,
- FileResources.MSG_SELECT_FOLDER_NOT_VALID);
- return msg;
- }
- }
- }
-
- if (previousInChain != null)
- {
- return previousInChain.isValid(selectedConnection, selectedObjects, remoteAdaptersForSelectedObjects);
- }
-
- return null;
- }
-
- }
- /**
- * Constructor that uses default action label and tooltip
- *
- * @param shell The shell to hang the dialog off of
- */
- public SystemSelectRemoteFileAction(Shell shell)
- {
- this(shell, FileResources.ACTION_SELECT_FILE_LABEL, FileResources.ACTION_SELECT_FILE_TOOLTIP);
-
- }
- /**
- * Constructor when you have your own action label and tooltip
- *
- * @param shell The shell to hang the dialog off of
- * @param label string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- */
- public SystemSelectRemoteFileAction(Shell shell, String label, String tooltip)
- {
- super(label, tooltip, null, shell);
- super.setNeedsProgressMonitor(true); // the default is to include a monitor. Caller can override
- }
-
-
- // ------------------------
- // CONFIGURATION METHODS...
- // ------------------------
- /**
- * 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 name of 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;
- }
-
- /**
- * 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.
- *
- * @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")
- */
- public void setRootFolder(IHost connection, String folderAbsolutePath)
- {
- rootFolderConnection = connection;
- rootFolderAbsPath = folderAbsolutePath;
-
- IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(rootFolderConnection);
- if (ss != null)
- {
- try
- {
- IRemoteFile rootFolder = ss.getRemoteFileObject(rootFolderAbsPath, new NullProgressMonitor());
- if (rootFolder != null)
- {
- setPreSelection(rootFolder);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- onlyConnection = true;
- }
- /**
- * Set the root folder from which to start listing files.
- * This version identifies the folder via an IRemoteFile object.
- * There is another overload that identifies the folder via a connection and folder path.
- *
- * @param rootFolder The IRemoteFile object representing the remote folder to start the list from
- */
- 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;
- }
-
- /**
- * 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.
- * <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;
- }
- /**
- * 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.clientProvidedSelectionValidator = selectionValidator;
- }
-
-
- // -----------------------------------------------
- // MRI METHODS. THESE ONLY NEED BE
- // CALLED IF YOU WISH TO CHANGE THE DEFAULT MRI...
- // -----------------------------------------------
- /**
- * 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;
- }
-
-
- // -----------------
- // OUTPUT METHODS...
- // -----------------
-
- /**
- * Retrieve selected file object. If multiple files selected, returns the first.
- */
- public IRemoteFile getSelectedFile()
- {
- Object o = getValue();
- if (o instanceof IRemoteFile[])
- return ((IRemoteFile[])o)[0];
- else if (o instanceof IRemoteFile)
- return (IRemoteFile)o;
- else
- return null;
- }
- /**
- * Retrieve selected file objects. If no files selected, returns an array of zero.
- * If one file selected returns an array of one.
- */
- public IRemoteFile[] getSelectedFiles()
- {
- 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;
- }
- return null;
- }
-
- /**
- * Return all selected objects. This method will return an array of one
- * unless you have called setMultipleSelectionMode(true)!
- * @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 null;
- }
-
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
- /**
- * @since 3.0
- */
- public void setCustomViewerFilter(SystemActionViewerFilter filter)
- {
- customViewerFilter = filter;
- }
-
- // -------------------
- // INTERNAL METHODS...
- // -------------------
-
- /**
- * Called by eclipse when user selects this action
- */
- protected Dialog createDialog(Shell shell)
- {
- SystemRemoteFileDialog dlg = null;
- if (dlgTitle == null)
- dlg = new SystemRemoteFileDialog(shell);
- else
- dlg = new SystemRemoteFileDialog(shell, dlgTitle);
-
-
- dlg.setMultipleSelectionMode(multipleSelectionMode);
- dlg.setShowNewConnectionPrompt(showNewConnectionPrompt);
-
- if (systemConnection != null)
- {
- dlg.setDefaultSystemConnection(systemConnection, onlyConnection);
- }
- dlg.setCustomViewerFilter(customViewerFilter);
-
- if (message != null)
- dlg.setMessage(message);
- if (treeTip != null)
- dlg.setSelectionTreeToolTipText(treeTip);
- /*
- if (systemConnection != null)
- {
- if (onlyConnection)
- dlg.setSystemConnection(systemConnection);
- else
- dlg.setDefaultConnection(systemConnection);
- }
- */
-
- if (systemTypes != null)
- dlg.setSystemTypes(systemTypes);
-
- if (preSelection != null)
- dlg.setPreSelection(preSelection);
-
- 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);
- */
- IValidatorRemoteSelection selectionValidator = new RemoteFileSelectionValidator(allowFolderSelection, clientProvidedSelectionValidator);
-
- dlg.setSelectionValidator(selectionValidator);
- /*
- if (!allowFolderSelection) {
- dlg.setAllowFolderSelection(allowFolderSelection);
- }
- */
-
- /*
- // add viewer filters if any
- if (viewerFilters != null) {
- Iterator iter = viewerFilters.iterator();
-
- while (iter.hasNext()) {
- ViewerFilter filter = (ViewerFilter)(iter.next());
- dlg.addViewerFilter(filter);
- }
- }
- */
-
- return dlg;
- }
-
- /**
- * Required by parent. We return the selected object
- */
- protected Object getDialogValue(Dialog dlg)
- {
- SystemRemoteResourceDialog ourDlg = (SystemRemoteResourceDialog)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
- }
-
- /**
- * Add viewer filter.
- * @param filter a viewer filter.
- */
- public void addViewerFilter(ViewerFilter filter) {
- viewerFilters.add(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>.
- * @param allow <code>true</code> to allow folder selection, <code>false</code> otherwise.
- */
- public void setAllowFolderSelection(boolean allow) {
- allowFolderSelection = allow;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java
deleted file mode 100644
index 097f3b733..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java
+++ /dev/null
@@ -1,533 +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
- * Xuan Chen (IBM) - [220995] [api] Need to add setCustomViewFilter API to SystemSelectRemoteFileAction
- * Xuan Chen (IBM) - [220995] [api] Need to remove unnecessary APIs.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.actions;
-import org.eclipse.core.runtime.NullProgressMonitor;
-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.dialogs.SystemRemoteFileDialog;
-import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog;
-import org.eclipse.rse.internal.files.ui.FileResources;
-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.SystemActionViewerFilter;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * The action for allowing the user to select a remote folder.
- * <p>
- * To configure the functionality, call these methods:
- * <ul>
- * <li>{@link #setShowNewConnectionPrompt(boolean)}
- * <li>{@link #setHost(IHost) or #setDefaultConnection(SystemConnection)}
- * <li>{@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])}
- * <li>{@link #setShowPropertySheet(boolean)}
- * <li>{@link #setMultipleSelectionMode(boolean)}
- * <li>{@link #setSelectionValidator(IValidatorRemoteSelection)}
- * </ul>
- * <p>
- * To configure the text on the dialog, call these methods:
- * <ul>
- * <li>{@link #setDialogTitle(String)}
- * <li>{@link #setMessage(String)}
- * <li>{@link #setSelectionTreeToolTipText(String)}
- * </ul>
- * <p>
- * After running, call these methods to get the output:
- * <ul>
- * <li>{@link #getSelectedFolder()} or {@link #getSelectedFolders()}
- * <li>{@link #getSelectedConnection()}
- * </ul>
- */
-public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
-{
- private IRSESystemType[] systemTypes;
- private boolean foldersOnly = false;
- private IHost systemConnection, outputConnection;
- private IHost rootFolderConnection;
- private IRemoteFile preSelection;
- private String rootFolderAbsPath;
- private String message, treeTip, dlgTitle;
- private boolean showNewConnectionPrompt = true;
- private boolean showPropertySheet = false;
- private boolean showPropertySheetDetailsButtonInitialState;
- private boolean showPropertySheetDetailsButton = false;
- private boolean multipleSelectionMode = false;
- private boolean onlyConnection = false;
- private IValidatorRemoteSelection selectionValidator;
- private SystemActionViewerFilter customViewerFilter = null;
-
- /**
- * Constructor that uses default action label and tooltip
- *
- * @param shell The shell to hang the dialog off of
- */
- public SystemSelectRemoteFolderAction(Shell shell)
- {
- this(shell, FileResources.ACTION_SELECT_DIRECTORY_LABEL, FileResources.ACTION_SELECT_DIRECTORY_TOOLTIP);
- }
- /**
- * Constructor when you have your own action label and tooltip
- *
- * @param shell The shell to hang the dialog off of
- * @param label string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- */
- public SystemSelectRemoteFolderAction(Shell shell, String label, String tooltip)
- {
- super(label, tooltip, null, shell);
- super.setNeedsProgressMonitor(true); // the default is to include a monitor. Caller can override
- }
-
-
- // ------------------------
- // CONFIGURATION METHODS...
- // ------------------------
- /**
- * Set the title for the dialog. The default is "Browse for Folder"
- */
- public void setDialogTitle(String title)
- {
- this.dlgTitle = title;
- }
-
- public void setFoldersOnly(boolean flag)
- {
- this.foldersOnly = flag;
- }
-
- /**
- * 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 type names
- *
- * @see org.eclipse.rse.core.IRSESystemType
- */
- public void setSystemTypes(IRSESystemType[] systemTypes)
- {
- this.systemTypes = systemTypes;
- }
- /**
- * Convenience method to restrict to a single system type.
- * Same as setSystemTypes(new String[] {systemType})
- *
- * @param systemType The name of the system type to restrict to,
- * or <code>null</code> to allow all 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;
- }
-
- /**
- * 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;
-
- IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(rootFolderConnection);
- if (ss != null)
- {
- try
- {
- IRemoteFile rootFolder = ss.getRemoteFileObject(rootFolderAbsPath, new NullProgressMonitor());
- if (rootFolder != null)
- {
- setPreSelection(rootFolder);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- onlyConnection = true;
- }
- /**
- * 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;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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 null;
- }
-
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
- /**
- * @since 3.0
- */
- public void setCustomViewerFilter(SystemActionViewerFilter filter)
- {
- customViewerFilter = filter;
- }
-
- // -------------------
- // INTERNAL METHODS...
- // -------------------
-
- /**
- * Called by eclipse when user selects this action
- */
- protected Dialog createDialog(Shell shell)
- {
- SystemRemoteResourceDialog dlg = null;
- if (foldersOnly)
- {
- if (dlgTitle == null)
- {
- dlg = new SystemRemoteFolderDialog(shell);
- }
- else
- {
- dlg = new SystemRemoteFolderDialog(shell, dlgTitle);
- }
- }
- else
- {
- if (dlgTitle == null)
- {
- dlg = new SystemRemoteFileDialog(shell);
- }
- else
- {
- dlg = new SystemRemoteFileDialog(shell, dlgTitle);
- }
- }
- dlg.setMultipleSelectionMode(multipleSelectionMode);
- if (systemConnection != null)
- {
- dlg.setDefaultSystemConnection(systemConnection, onlyConnection);
- }
- dlg.setCustomViewerFilter(customViewerFilter);
-
- /*
- SystemSelectRemoteFileOrFolderDialog dlg = null;
- if (dlgTitle == null)
- dlg = new SystemSelectRemoteFileOrFolderDialog(shell, false); // false => folder vs file mode
- else
- dlg = new SystemSelectRemoteFileOrFolderDialog(shell, dlgTitle, false); // false => folder vs file mode
- */
-
-
- dlg.setShowNewConnectionPrompt(showNewConnectionPrompt);
- dlg.setMultipleSelectionMode(multipleSelectionMode);
-
- /*
- dlg.setAllowForMultipleParents(allowForMultipleParents);
- if (restrictFolders)
- dlg.setRestrictFolders(true);
-
-
- if (systemConnection != null)
- {
- if (onlyConnection)
- dlg.setSystemConnection(systemConnection);
- else
- dlg.setDefaultConnection(systemConnection);
- }
- */
-
- if (message != null)
- dlg.setMessage(message);
- if (treeTip != null)
- dlg.setSelectionTreeToolTipText(treeTip);
-
- 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)
- {
- SystemRemoteResourceDialog ourDlg = (SystemRemoteResourceDialog)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/files/ui/compare/SystemCompareInput.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/compare/SystemCompareInput.java
deleted file mode 100644
index c8c00f3ab..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/compare/SystemCompareInput.java
+++ /dev/null
@@ -1,249 +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) - [186128][refactoring] Move IProgressMonitor last in public base classes
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.compare;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.ZipFileStructureCreator;
-import org.eclipse.compare.internal.BufferedResourceNode;
-import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.DiffTreeViewer;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-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.IProgressMonitor;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class SystemCompareInput extends CompareEditorInput
-{
-
- private static final boolean NORMALIZE_CASE = true;
- private Object fRoot;
-
- class MyDiffNode extends DiffNode
- {
- private boolean fDirty = false;
- private ITypedElement fLastId;
- private String fLastName;
-
- public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, ITypedElement right)
- {
- super(parent, description, ancestor, left, right);
- }
-
- public void fireChange()
- {
- super.fireChange();
- setDirty(true);
- fDirty = true;
- if (_diffViewer != null)
- _diffViewer.refresh(this);
- }
-
- void clearDirty()
- {
- fDirty = false;
- }
-
- public String getName()
- {
- if (fLastName == null)
- fLastName = super.getName();
- if (fDirty)
- return '<' + fLastName + '>';
- return fLastName;
- }
-
- public ITypedElement getId()
- {
- ITypedElement id = super.getId();
- if (id == null)
- return fLastId;
- fLastId = id;
- return id;
- }
- }
-
- private List _remoteEditables;
- private DiffTreeViewer _diffViewer;
- private IResource _leftResource;
- private IResource _rightResource;
-
- public SystemCompareInput(CompareConfiguration configuration)
- {
- super(configuration);
- _remoteEditables = new ArrayList();
- }
-
- /**
- * Creates a <code>IStructureComparator</code> for the given input.
- * Returns <code>null</code> if no <code>IStructureComparator</code>
- * can be found for the <code>IResource</code>.
- */
- private IStructureComparator getStructure(IResource input)
- {
- if (input instanceof IContainer)
- return new BufferedResourceNode(input);
-
- if (input instanceof IFile)
- {
- IStructureComparator rn = new BufferedResourceNode(input);
- IFile file = (IFile) input;
- String type = normalizeCase(file.getFileExtension());
- if ("JAR".equals(type) || "ZIP".equals(type)) //$NON-NLS-2$ //$NON-NLS-1$
- return new ZipFileStructureCreator().getStructure(rn);
- return rn;
- }
- return null;
- }
-
- private String normalizeCase(String s)
- {
- if (NORMALIZE_CASE && s != null)
- return s.toUpperCase();
- return s;
- }
-
- public IResource getLeftResource()
- {
- return _leftResource;
- }
-
- public IResource getRightResource()
- {
- return _rightResource;
- }
-
- public Object prepareInput(IProgressMonitor monitor)
- {
- ISystemEditableRemoteObject ef1 = (ISystemEditableRemoteObject)_remoteEditables.get(0);
- ISystemEditableRemoteObject ef2 = (ISystemEditableRemoteObject)_remoteEditables.get(1);
-
- try
- {
- ef1.download(monitor);
- ef2.download(monitor);
- ef1.addAsListener();
- ef2.addAsListener();
- ef1.setLocalResourceProperties();
- ef2.setLocalResourceProperties();
-
- _leftResource = ef1.getLocalResource();
- _rightResource = ef2.getLocalResource();
-
- String title;
- String format = Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$
- title = NLS.bind(format, _leftResource.getName(), _rightResource.getName());
- setTitle(title);
- }
- catch (Exception e)
- {
- }
-
- IStructureComparator c1 = getStructure(_leftResource);
- IStructureComparator c2 = getStructure(_rightResource);
-
- Differencer d = new Differencer()
- {
- protected Object visit(Object parent, int description, Object ancestor, Object left, Object right)
- {
- return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement) ancestor, (ITypedElement) left, (ITypedElement) right);
- }
- };
-
- fRoot = d.findDifferences(false, monitor, null, null, c1, c2);
- return fRoot;
- }
-
- public Viewer createDiffViewer(Composite parent)
- {
- _diffViewer = new DiffTreeViewer(parent, getCompareConfiguration())
- {
- protected void fillContextMenu(IMenuManager manager)
- {
- super.fillContextMenu(manager);
- }
- };
- return _diffViewer;
- }
-
- public void addRemoteEditable(ISystemEditableRemoteObject file)
- {
- _remoteEditables.add(file);
- }
-
- public void saveChanges(IProgressMonitor pm) throws CoreException
- {
- super.saveChanges(pm);
- if (fRoot instanceof DiffNode)
- {
- try
- {
- commit((DiffNode) fRoot, pm);
- }
- finally
- {
- if (_diffViewer != null)
- _diffViewer.refresh();
- setDirty(false);
- }
- }
-
- }
-
- /*
- * Recursively walks the diff tree and commits all changes.
- */
- private void commit(DiffNode node, IProgressMonitor pm) throws CoreException
- {
- if (node instanceof MyDiffNode)
- ((MyDiffNode) node).clearDirty();
-
- ITypedElement left = node.getLeft();
- if (left instanceof BufferedResourceNode)
- ((BufferedResourceNode) left).commit(pm);
-
- ITypedElement right = node.getRight();
- if (right instanceof BufferedResourceNode)
- ((BufferedResourceNode) right).commit(pm);
-
- IDiffElement[] children = node.getChildren();
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- IDiffElement element = children[i];
- if (element instanceof DiffNode)
- commit((DiffNode) element, pm);
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/FileDialogFactory.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/FileDialogFactory.java
deleted file mode 100644
index e3934896b..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/FileDialogFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xuan Chen (IBM) - [225506] initial contribution
- * Martin Oberhuber (Wind River) - [225506] Adding Javadoc
- *********************************************************************************/
-package org.eclipse.rse.files.ui.dialogs;
-
-import org.eclipse.rse.internal.files.ui.dialogs.SaveAsDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Utility class with factory methods for creating some RSE Standard Dialogs,
- * for working with remote files.
- *
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @since org.eclipse.rse.files.ui 3.0
- */
-public class FileDialogFactory {
-
- /**
- * Create an ISaveAsDialog instance with the given title, initialized for
- * selecting a file to save to.
- *
- * @param shell parent shell for the dialog
- * @param title title for the dialog
- * @return New ISaveAsDialog instance
- */
- public static ISaveAsDialog makeSaveAsDialog(Shell shell, String title)
- {
- return new SaveAsDialog(shell, title);
- }
-
- /**
- * Create an ISaveAsDialog instance, initialized for selecting a folder to
- * save to. The dialog title will be a standard title ("Browse for Folder").
- *
- * @param shell parent shell for the dialog
- * @return new ISaveAsDialog instance
- */
- public static ISaveAsDialog makeSaveAsDialog(Shell shell)
- {
- return new SaveAsDialog(shell);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ISaveAsDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ISaveAsDialog.java
deleted file mode 100644
index 3b6915042..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ISaveAsDialog.java
+++ /dev/null
@@ -1,34 +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.files.ui.dialogs;
-
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-public interface ISaveAsDialog {
-
-
-
- public Object getOutputObject();
-
- public void setMultipleSelectionMode(boolean mode);
-
- public int open();
-
- public void setPreSelection(IRemoteFile selection);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemPromptForHomeFolderDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemPromptForHomeFolderDialog.java
deleted file mode 100644
index c627f7cf8..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemPromptForHomeFolderDialog.java
+++ /dev/null
@@ -1,131 +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.files.ui.dialogs;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.files.ui.widgets.SystemRemoteFolderCombo;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Dialog for prompting the user for his home folder. This is called once when
- * the user first expands his default "/home/username" filter string.
- * <p>NOT USED YET</p>
- */
-public class SystemPromptForHomeFolderDialog
- extends SystemPromptDialog
- implements SelectionListener
-{
- private IHost connection;
- private ISubSystem subsystem;
- private SystemRemoteFolderCombo folderCombo = null;
-
- /**
- * Constructor
- */
- public SystemPromptForHomeFolderDialog(Shell shell, ISystemFilter filter)
- {
- super(shell, SystemFileResources.RESID_HOMEPROMPT_TITLE);
- setBlockOnOpen(true); // always modal
- subsystem = (ISubSystem)filter.getProvider();
- connection = subsystem.getHost();
- //pack();
- }
-
- /**
- * Return initial control to be given focus
- */
- protected Control getInitialFocusControl()
- {
- return folderCombo.getFolderCombo();
- }
-
- /**
- * Create and populate dialog area
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int gridColumns = 1;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);
-
- // verbiage
- boolean wantBorder = false;
- int span = 1;
- int widthHint = 200;
- SystemWidgetHelpers.createVerbiage(composite_prompts, SystemFileResources.RESID_HOMEPROMPT_TITLE, span, wantBorder, widthHint);
-
- // connection\folder prompt
- boolean readOnly = false;
- folderCombo = new SystemRemoteFolderCombo(composite_prompts, SWT.BORDER, null, readOnly);
- folderCombo.setSystemConnection(connection);
- folderCombo.setText("/home/"+connection.getDefaultUserId()); //$NON-NLS-1$
-
- // listen for selections
- //folderCombo.addSelectionListener(this);
-
- return composite_prompts;
- }
-
- /**
- * From SelectionListener interface
- */
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
-
- /**
- * From SelectionListener interface.
- * Called when user selects new item in dropdown
- */
- public void widgetSelected(SelectionEvent event)
- {
- Object src = event.getSource();
- Combo comboWidget = folderCombo.getCombo();
- if (src == comboWidget)
- {
- //clearErrorMessage();
- //clearMessage();
- //String selectedFolder = folderCombo.getText();
- }
- }
-
-
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- boolean ok = true;
- return ok;
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteArchiveDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteArchiveDialog.java
deleted file mode 100644
index 0e12acfd9..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteArchiveDialog.java
+++ /dev/null
@@ -1,69 +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) - [190442] made SystemActionViewerFilter API
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.dialogs;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class SystemRemoteArchiveDialog extends SystemRemoteFileDialog
-{
- private SystemActionViewerFilter _filter;
-
- public SystemRemoteArchiveDialog(Shell shell, String title, IHost defaultConnection)
- {
- super(shell, title, defaultConnection);
- }
-
- public SystemRemoteArchiveDialog(Shell shell, String title)
- {
- super(shell, title);
-
- }
-
- public SystemRemoteArchiveDialog(Shell shell)
- {
- super(shell, SystemFileResources.RESID_SELECTFILE_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;
- }
-
-
- public String getVerbiage()
- {
- return SystemFileResources.RESID_SELECTFILE_VERBIAGE;
- }
-
- public String getTreeTip()
- {
- return SystemFileResources.RESID_SELECTFILE_SELECT_TOOLTIP;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFileDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFileDialog.java
deleted file mode 100644
index 9ecdd94d2..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFileDialog.java
+++ /dev/null
@@ -1,105 +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:
- * Kevin Doyle (IBM) - Added Double Click Listener that closes dialog on file double click
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.dialogs;
-
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.files.ui.view.SystemRemoteFileSelectionInputProvider;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog;
-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;
-
-
-public class SystemRemoteFileDialog extends SystemRemoteResourceDialog
-{
- public SystemRemoteFileDialog(Shell shell, String title, IHost defaultConnection)
- {
- super(shell, title, new SystemRemoteFileSelectionInputProvider(defaultConnection));
- }
-
- public SystemRemoteFileDialog(Shell shell, String title)
- {
- super(shell, title, new SystemRemoteFileSelectionInputProvider());
- }
-
- public SystemRemoteFileDialog(Shell shell)
- {
- super(shell, SystemFileResources.RESID_SELECTFILE_TITLE, new SystemRemoteFileSelectionInputProvider());
- }
-
-
- public String getVerbiage()
- {
- return SystemFileResources.RESID_SELECTFILE_VERBIAGE;
- }
-
- public String getTreeTip()
- {
- return SystemFileResources.RESID_SELECTFILE_SELECT_TOOLTIP;
- }
-
- public SystemActionViewerFilter getViewerFilter()
- {
- return null;
- }
-
- /**
- * Override of parent.
- */
- protected Control createContents(Composite parent)
- {
- Control control = super.createContents(parent);
- 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 = getSystemTree();
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (element == null)
- return;
- if (isPageComplete() && !tree.isExpandable(element))
- {
- setReturnCode(OK);
- if (processOK())
- {
- okPressed = true;
- close();
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFolderDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFolderDialog.java
deleted file mode 100644
index 3ab3eb045..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemRemoteFolderDialog.java
+++ /dev/null
@@ -1,68 +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) - [190442] made SystemActionViewerFilter API
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.dialogs;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class SystemRemoteFolderDialog extends SystemRemoteFileDialog
-{
- private SystemActionViewerFilter _filter;
-
- public SystemRemoteFolderDialog(Shell shell, String title, IHost defaultConnection)
- {
- super(shell, title, defaultConnection);
- }
-
- public SystemRemoteFolderDialog(Shell shell, String title)
- {
- super(shell, title);
-
- }
-
- public SystemRemoteFolderDialog(Shell shell)
- {
- super(shell, SystemFileResources.RESID_SELECTDIRECTORY_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$
- }
- return _filter;
- }
-
-
- public String getVerbiage()
- {
- return SystemFileResources.RESID_SELECTDIRECTORY_VERBIAGE;
- }
-
- public String getTreeTip()
- {
- return SystemFileResources.RESID_SELECTDIRECTORY_SELECT_TOOLTIP;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemCachedRemoteResource.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemCachedRemoteResource.java
deleted file mode 100644
index fc3e2b8f9..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemCachedRemoteResource.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-/**
- * This is the cached remote resource.
- */
-public interface ISystemCachedRemoteResource {
-
-
-
- /**
- * Constant indicating no changes.
- */
- public static final int CHANGES_NONE = 0;
-
- /**
- * Constant indicating local copy has changed, but not server copy.
- */
- public static final int CHANGES_OUTGOING = 1;
-
- /**
- * Constant indicating server copy has changed, but not local copy.
- */
- public static final int CHANGES_INCOMING = 2;
-
- /**
- * Constant indicating both local and server copy have changed.
- */
- public static final int CHANGES_CONFLICT = 3;
-
- /**
- * Get the last modified time on the server. Calling this when connected will
- * query it from the server, but calling it in disconnected mode will
- * query it from disk.
- * @return the last modified time on the server
- */
- public long lastRemoteModified();
-
- /**
- * Get the last modified time on the client.
- * @return the last modified time on the client
- */
- public long lastLocalModified();
-
- /**
- * Get the last time of download or synchronization.
- * @return the time of the last download or synchronization
- */
- public long lastSuccessfulSynch();
-
- /**
- * Returns whether the local and remote copies are synchronized.
- * @return <code>true</code> if the local and remote copies are synchronized,
- * <code>false</code> otherwise.
- */
- public boolean isSynchronized();
-
- /**
- * Get the state of the cache.
- * @return CHANGES_NONE if both local and remote copies are in sync,
- * CHANGES_OUTGOING if the local copy has changed but not the server copy,
- * CHANGES_INCOMING if the server copy has changed but not the local copy,
- * CHANGES_CONFLICT if both the local copy and server copy have changed.
- */
- public int getState();
-
- /**
- * Dispose of the cache.
- */
- public void dispose();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java
deleted file mode 100644
index c31ae8366..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java
+++ /dev/null
@@ -1,108 +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) - [195285] mount path mapper changes
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-
-/**
- * This interface is used to provide a common way of mapping mounted resources to the temp files project.
- * Since local (or remote) mounts can change or be removed (i.e. disconnected) this provides a way for a vendor to
- * remap a particular resource if the vendor software is able to determine the new mount location.
- *
- * There are a number of use cases where a customized workspace mapping would be desirable:
- * <ul>
- * <li>Two connections to the same host using different user IDs for each connection. In that case, it may make
- * sense to store the temp files differently for each connection (for example, qualified by user ID).
- * <li>If port-forwarding is used then a port could be used to qualify the temp file path.
- * <li>If the remote path contains invalid characters for the local file system, then the temp file mapping could
- * be made such that invalid characters ( e.g. :<>?* on Windows) translate to a sequence of valid characters on the client.
- * </ul>
- *
- *
- * Implementors of this interface should register their mappers via the mountPathMappers extension point.
- */
-public interface ISystemMountPathMapper
-{
-
-
- /**
- * Returns the qualified workspace path for a replica of this mounted file. Since the
- * system path is not unique for mounted files, this allows a vendor to make sure it is unique.
- * The workspace mapping should always be the remote path on the originating host.
- *
- * @param hostname the remote host
- * @param remotePath the remote path as seen by the file subsystem
- * @param subsystem the remote file subsystem. User the subsystem to customize how the temp file is located. If null
- * is specified, then the subsystem is not used in determining the mapping
- * @return the corresponding workspace replica mapping
- * @since 3.0
- */
- public String getWorkspaceMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem);
-
-
-
- /**
- * Returns the corresponding hostname for the specified path on the specified host. If a file is mounted
- * then the actual host containing the file will not be local. If there is no mapping, then
- * the hostname will be the same as the argument. If the file is remote (i.e. not locally mounted) then
- * this will return the same as the hostname argument.
- *
- * @param hostname the system host
- * @param remotePath the path on the system host
- * @return the actual host that contains the specified remote path
- */
- public String getActualHostFor(String hostname, String remotePath);
-
- /**
- * Returns the system path that can be used for copying the replica back to remote. When null
- * is returned RSE the file is treated as no longer available and thus remote uploads do not occur. Vendors
- * who would like to disable uploads for some period can implement this to return null during that period.
- *
- * @param hostname the remote host
- * @param remotePath the remote path as seen by the local file subsystem
- * @return the local system path that represents the mounted file
- */
- public String getMountedMappingFor(String hostname, String remotePath);
-
- /**
- * Indicates whether this mapper handles remapping of the specified resource. If more than one mount
- * path mapper returns true for this, then the getPriority() method will be used to determine precedence.
- * @param hostname the remote host
- * @param remotePath the remote path as seen by the file subsystem
- * @param subsystem the remote file subsystem
- * @return whether this mapper handles remapping of the specified remote resource
- * @since 3.0
- */
- public boolean handlesMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem);
-
-
- /**
- *
- * Returns the priority of this mount path mapper. This is used to determine which mount
- * path mapper to use when more than one are applicable. The lower the return value, the
- * higher priority.
- *
- * @param hostname the host name for the file system
- * @param remotePath the path on the remote file system
- * @param subsystem the subsystem used to retrieve files
- *
- * @return the priority, where the lower in value, the higher the priority.
- * @since 3.0
- */
- int getPriority(String hostname, String remotePath, IRemoteFileSubSystem subsystem);
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResource.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResource.java
deleted file mode 100644
index 19da1268c..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResource.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-import org.eclipse.core.resources.IFile;
-
-/**
- * This interface defines some common functionality required from all remote
- * resources for edit, irrespective of whether the remote system is an
- * OS/400, Windows, Linux or Unix operating system.
- */
-public interface ISystemRemoteEditResource extends ISystemRemoteResource {
-
-
-
- /**
- * Returns the local resource. The local resource does not exist if the method
- * returns null, or if calling exists() on the returned resource returs false.
- * @return the local resource.
- */
- public IFile getLocalResource();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResourceManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResourceManager.java
deleted file mode 100644
index 64a10f867..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteEditResourceManager.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.files.ui.resources;
-
-/**
- * This manager class manages remote resources.
- */
-public interface ISystemRemoteEditResourceManager extends ISystemRemoteManager {
-
-
-
- /**
- * Store a remote edit object with the given remote path as the key.
- * The idea is that each unique remote object can have an associated
- * edit object associated with it, and this object will take care
- * of remote editing of that object. Using the remote path as a key ensures
- * that a resource with a unique path will have a unique remote object.
- * @param key remote path to use as a key
- * @param editObj editbable object
- * @return the previously stored edit object, or null if none
- */
- public Object putEditObject(ISystemRemotePath key, Object editObj);
-
- /**
- * Get a remote edit object given the remote path as a key.
- * @param key remote path as a key
- * @return the stored edit object
- */
- public Object getEditObject(ISystemRemotePath key);
-
- /**
- * Save the edit object information to disk.
- * Clients must not call this method.
- */
- public void save();
-
- /**
- * Restore the edit object information from disk.
- * Clients must not call this method.
- */
- public void restore();
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteManager.java
deleted file mode 100644
index 783e597e4..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteManager.java
+++ /dev/null
@@ -1,43 +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.files.ui.resources;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * This interface should be implemented by all remote resource related
- * managers
- */
-public interface ISystemRemoteManager {
-
-
-
- /**
- * This method is called during plugin startup.
- * @param monitor progress monitor for long running operations, or null
- * if none is desired.
- */
- public void startup(IProgressMonitor monitor);
-
- /**
- * This method is called during plugin shutdown.
- * @param monitor progress monitor for long running operations, or null
- * if none is desired.
- */
- public void shutdown(IProgressMonitor monitor);
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarker.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarker.java
deleted file mode 100644
index b0e02d0c7..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarker.java
+++ /dev/null
@@ -1,221 +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.files.ui.resources;
-
-import java.util.Map;
-
-
-/**
- * This interface defines a remote marker. It can be used to tag information
- * to a any remote resource.
- * Clients must not implement this interface.
- */
-public interface ISystemRemoteMarker {
-
-
-
- /**
- * Remote markers extension point id.
- */
- public static final String EXTENSION_POINT_ID = "remoteMarkers"; //$NON-NLS-1$
-
- /**
- * Deletes this marker from its associated resource. This method has no
- * effect if this marker does not exist.
- */
- public void delete();
-
- /**
- * Tests this marker for equality with the given object.
- * Two markers are equal if and only if their id and resource info are both equal.
- * @param object the other object
- * @return <code>true</code> if objects are equal, <code>false</code> otherwise
- */
- public boolean equals(Object object);
-
- /**
- * Returns whether this marker exists. A marker
- * exists if its resource info exists and has a marker with the marker's id.
- *
- * @return <code>true</code> if this marker exists, otherwise
- * <code>false</code>
- */
- public boolean exists();
-
- /**
- * Returns the attribute with the given name. The result is an instance of one
- * of the following classes: <code>String</code>, <code>Integer</code>,
- * or <code>Boolean</code>.
- * Returns <code>null</code> if the attribute is undefined.
- *
- * @param attributeName the name of the attribute
- * @return the value, or <code>null</code> if the attribute is undefined.
- */
- public Object getAttribute(String attributeName);
-
- /**
- * Returns the integer-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined.
- * or the marker does not exist or is not an integer value.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- */
- public int getAttribute(String attributeName, int defaultValue);
-
- /**
- * Returns the string-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined
- * or the marker does not exist or is not a string value.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- */
- public String getAttribute(String attributeName, String defaultValue);
-
- /**
- * Returns the boolean-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined
- * or the marker does not exist or is not a boolean value.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- */
- public boolean getAttribute(String attributeName, boolean defaultValue);
-
- /**
- * Returns a map with all the attributes for the marker.
- * If the marker has no attributes then <code>null</code> is returned.
- *
- * @return a map of attribute keys and values (key type : <code>String</code>
- * value type : <code>String</code>, <code>Integer</code>, or
- * <code>Boolean</code>) or <code>null</code>.
- */
-
- public Map getAttributes();
-
- /**
- * Returns the attributes with the given names. The result is an an array
- * whose elements correspond to the elements of the given attribute name
- * array. Each element is <code>null</code> or an instance of one
- * of the following classes: <code>String</code>, <code>Integer</code>,
- * or <code>Boolean</code>.
- *
- * @param attributeNames the names of the attributes
- * @return the values of the given attributes.
- */
- public Object[] getAttributes(String[] attributeNames);
-
- /**
- * Returns the time at which this marker was created.
- *
- * @return the difference, measured in milliseconds, between the time at which
- * this marker was created and midnight, January 1, 1970 UTC.
- */
- public long getCreationTime();
-
- /**
- * Returns the id of the marker. The id of a marker is unique
- * relative to the resource with which the marker is associated.
- * Marker ids are not globally unique.
- *
- * @return the id of the marker
- * @see ISystemRemoteResource#findMarker
- */
- public long getId();
-
- /**
- * Returns the resource with which this marker is associated.
- *
- * @return the remote resource with which this marker is associated
- */
- public ISystemRemoteResource getResource();
-
- /**
- * Returns the type of this marker.
- *
- * @return the type of this marker
- */
- public String getType();
-
- /**
- * Returns whether the type of this marker is considered to be a subtype of
- * the given marker type.
- *
- * @return boolean <code>true</code>if the marker's type
- * is the same as (or a subtype of) the given type.
- */
- public boolean isSubtypeOf(String superType);
-
- /**
- * Sets the integer-valued attribute with the given name.
- *
- * @param attributeName the name of the attribute
- * @param value the value
- */
- public void setAttribute(String attributeName, int value);
-
- /**
- * Sets the attribute with the given name. The value must be <code>null</code> or
- * an instance of one of the following classes:
- * <code>String</code>, <code>Integer</code>, or <code>Boolean</code>.
- * If the value is <code>null</code>, the attribute is considered to be undefined.
- *
- * @param attributeName the name of the attribute
- * @param value the value, or <code>null</code> if the attribute is to be undefined
- */
- public void setAttribute(String attributeName, Object value);
-
- /**
- * Sets the boolean-valued attribute with the given name.
- *
- * @param attributeName the name of the attribute
- * @param value the value
- */
- public void setAttribute(String attributeName, boolean value);
-
- /**
- * Sets the given attribute key-value pairs on this marker.
- * The values must be <code>null</code> or an instance of
- * one of the following classes: <code>String</code>,
- * <code>Integer</code>, or <code>Boolean</code>.
- * If a value is <code>null</code>, the new value of the
- * attribute is considered to be undefined.
- *
- * @param attributeNames an array of attribute names
- * @param values an array of attribute values
- */
- public void setAttributes(String[] attributeNames, Object[] values);
-
- /**
- * Sets the attributes for this marker to be the ones contained in the
- * given table. The values must be an instance of one of the following classes:
- * <code>String</code>, <code>Integer</code>, or <code>Boolean</code>.
- * Attributes previously set on the marker but not included in the given map
- * are considered to be removals. Setting the given map to be <code>null</code>
- * is equivalent to removing all marker attributes.
- *
- * @param attributes a map of attribute names to attribute values
- * (key type : <code>String</code> value type : <code>String</code>,
- * <code>Integer</code>, or <code>Boolean</code>) or <code>null</code>
- */
- public void setAttributes(Map attributes);
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarkerSetElement.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarkerSetElement.java
deleted file mode 100644
index f4e8177d1..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteMarkerSetElement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-/**
- * An interface for all marker set elements.
- */
-public interface ISystemRemoteMarkerSetElement {
-
-
-
- /**
- * Get the id.
- * @return the id
- */
- public long getId();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemotePath.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemotePath.java
deleted file mode 100644
index c9ed5b489..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemotePath.java
+++ /dev/null
@@ -1,57 +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) - [261486][api][cleanup] Mark @noimplement interfaces as @noextend
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-/**
- * This interface defines a remote path.
- *
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- */
-public interface ISystemRemotePath {
-
- /**
- * Get the profile name.
- * @return the profile name
- */
- public String getProfileName();
-
- /**
- * Get the connection name.
- * @return the connection name
- */
- public String getConnectionName();
-
- /**
- * Get the path of the resource on the server.
- * @return the path of the resource on the server
- */
- public String getPath();
-
- /**
- * Returns the complete string representation of the remote path.
- * @return complete string representation of the remote path
- */
- public String toString();
-
- /**
- * Returns whether this path equals the given object.
- * This is system dependent.
- */
- public boolean equals(Object obj);
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteResource.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteResource.java
deleted file mode 100644
index 377a8bc21..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemRemoteResource.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * This interface defines some common functionality required from all remote
- * resources, irrespective of whether the remote system is an OS/400, Windows, Linux
- * or Unix operating system. In particular, it allows users to create markers on remote
- * resources, and to create both session and persistent properties for them. A session
- * property is one that is stored only during the current workbench session, while a
- * persistent property is one that is kept between sessions.
- * Clients must not implement this interface.
- *
- * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile
- */
-public interface ISystemRemoteResource {
-
-
-
- /**
- * Creates and returns the marker of the specified type on this resource.
- * @param type the marker type
- * @return the created marker
- */
- public ISystemRemoteMarker createMarker(String type);
-
- /**
- * Deletes all markers on this resource of the given type, and optionally deletes
- * such markers from its children. Deletion of markers with subtypes is also possible.
- * @param type the marker type, or <code>null</code> to indicate all types.
- * @param includeSubtypes whether or not to consider the subtypes of the given type
- */
- public void deleteMarkers(String type, boolean includeSubtypes);
-
- /**
- * Returns the marker with the specified id on this resource, or null if there
- * is no such marker.
- * @param id the id of the marker to find
- * @return a marker if found, or <code>null</code>
- */
- public ISystemRemoteMarker findMarker(long id);
-
- /**
- * Returns all markers of the specified type on this resource, and
- * optionally, on its children. Markers with subtypes of the given type
- * can also be found optionally. Returns an empty array if there are
- * no matching markers.
- * @param type the marker type, or <code>null</code> to indicate all types.
- * @param includeSubtypes whether or not to consider the subtypes of the given type
- * @return an array of markers, or an empty array if no markers are found
- */
- public ISystemRemoteMarker[] findMarkers(String type, boolean includeSubtypes);
-
- /**
- * Gets the marker with the given id. The marker is not guaranteed to exist.
- * @param id the marker id.
- */
- public ISystemRemoteMarker getMarker(long id);
-
- /**
- * Sets the value of the session property of this resource identified
- * by the given key. If the supplied value is <code>null</code>,
- * the session property is removed from this resource.
- * <p>
- * Sessions properties are intended to be used as a caching mechanism
- * by ISV plug-ins. They allow key-object associations to be stored with
- * existing resources in the workspace. These key-value associations are
- * maintained in memory (at all times), and the information is lost when a
- * resource is deleted from the workspace, when the parent project
- * is closed, or when the workspace is closed.
- * </p>
- * <p>
- * The qualifier part of the property name must be the unique identifier
- * of the declaring plug-in (e.g. <code>"com.example.plugin"</code>).
- * </p>
- *
- * @param key the qualified name of the property
- * @param value the value of the session property,
- * or <code>null</code> if the property is to be removed
- * @see #getSessionProperty
- */
- public void setSessionProperty(QualifiedName key, Object value);
-
- /**
- * Returns the value of the session property of this resource identified
- * by the given key, or <code>null</code> if this resource has no such property.
- *
- * @param key the qualified name of the property
- * @return the string value of the session property,
- * or <code>null</code> if this resource has no such property
- * @see #setSessionProperty
- */
- public Object getSessionProperty(QualifiedName key);
-
- /**
- * Sets the value of the persistent property of this resource identified
- * by the given key. If the supplied value is <code>null</code>,
- * the persistent property is removed from this resource. The change
- * is made immediately on disk.
- * <p>
- * Persistent properties are intended to be used by plug-ins to store
- * resource-specific information that should be persisted across platform sessions.
- * The value of a persistent property is a string which should be
- * short (i.e., under 2KB). Unlike session properties, persistent properties are
- * stored on disk and maintained across workspace shutdown and restart.
- * </p>
- * <p>
- * The qualifier part of the property name must be the unique identifier
- * of the declaring plug-in (e.g. <code>"com.example.plugin"</code>).
- * </p>
- *
- * @param key the qualified name of the property
- * @param value the string value of the property,
- * or <code>null</code> if the property is to be removed
- * @see #getPersistentProperty
- */
- public void setPersistentProperty(QualifiedName key, String value);
-
- /**
- * Returns the value of the persistent property of this resource identified
- * by the given key, or <code>null</code> if this resource has no such property.
- *
- * @param key the qualified name of the property
- * @return the string value of the property,
- * or <code>null</code> if this resource has no such property
- * @see #setPersistentProperty
- */
- public String getPersistentProperty(QualifiedName key);
-
- /**
- * Returns whether this resource exists on the remote server.
- * @return <code>true</code> if the resource exists, <code>false</code> otherwise
- */
- public boolean exists();
-
- /**
- * Returns whether a local copy of the file exists.
- */
- public boolean isExistsLocally();
-
- /**
- * Returns the last modified time on the server.
- * @return the last modified time on the server
- */
- public boolean getRemoteLastModifiedTime();
-
- /**
- * Returns the last modified time on the client.
- * @return the last modified time on the client.
- */
- public boolean getLocalLastModifiedTime();
-
- /**
- * Returns whether the local copy, if there is one, is in sync with the
- * remote copy.
- * @return true if the local copy is in sync, false otherwise, or if the
- * local copy does not exist.
- */
- public boolean isSynchronized();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemTextEditor.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemTextEditor.java
deleted file mode 100644
index 838cca7b1..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemTextEditor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-import org.eclipse.ui.IEditorInput;
-
-public interface ISystemTextEditor {
-
-
- public void setReadOnly(boolean readOnly);
-
- public void updateDirtyIndicator();
- public void refresh();
- public void setInput(IEditorInput input);
- public void gotoLine(int line);
- public void selectText(int charStart, int charEnd);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java
deleted file mode 100644
index ad2e1b9df..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java
+++ /dev/null
@@ -1,2052 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2011 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) - [177523] Unify singleton getter methods
- * 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) - [189130] Move SystemIFileProperties from UI to Core
- * David McKnight (IBM) - [187130] New Folder/File, Move and Rename should be available for read-only folders
- * Kevin Doyle (IBM) - [197976] Changing a file to read-only when it is open doesn't update local copy
- * David McKnight (IBM) - [186363] get rid of obsolete calls to ISubSystem.connect()
- * David McKnight (IBM) - [209660] check for changed encoding before using cached file
- * David McKnight (IBM) - [210812] for text transfer, need to tell editor to use local encoding
- * Xuan Chen (IBM) - [210816] Archive testcases throw ResourceException if they are run in batch
- * 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) - [222406] Need to be able to override local encoding
- * David McKnight (IBM) - [224377] "open with" menu does not have "other" option
- * Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check
- * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
- * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
- * David McKnight (IBM) - [235221] Files truncated on exit of Eclipse
- * David McKnight (IBM) - [247189] SystemEditableRemoteFile.openEditor() not updating the default editor properly
- * David McKnight (IBM) - [249544] Save conflict dialog appears when saving files in the editor
- * David McKnight (IBM) - [267247] Wrong encoding
- * David McKnight (IBM) - [272772] Exception handling in SystemEditableRemoteFile
- * David McKnight (IBM) - [284420] nullprogressmonitor is needed
- * David McKnight (IBM) - [310215] SystemEditableRemoteFile.open does not behave as expected
- * David McKnight (IBM) - [324519] SystemEditableRemoteFile throws NPE when used in headless mode
- * David McKnight (IBM) - [334839] File Content Conflict is not handled properly
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourceAttributes;
-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.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.IRSESystemType;
-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.actions.SystemDownloadConflictAction;
-import org.eclipse.rse.internal.files.ui.resources.SystemFileNameHelper;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
-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.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.files.core.subsystems.IVirtualRemoteFile;
-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.program.Program;
-import org.eclipse.swt.widgets.Display;
-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.IEditorRegistry;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IPartListener, IResourceChangeListener, IResourceDeltaVisitor
-{
- private IRemoteFile remoteFile;
- private String remotePath;
- private IRemoteFileSubSystem subsystem;
- private String root;
- private String localPath;
- private IEditorPart editor;
- private IFile localFile;
- private IWorkbenchPage page;
-
- /**
- * Internal class for downloading file
- */
- private class InternalDownloadFileRunnable extends Job
- //extends WorkspaceModifyOperation
- {
-
- private Exception e;
- private boolean completed = false;
- private boolean failed = false;
-
- /**
- * Constructor for InternalDownloadFileRunnable
- */
- private InternalDownloadFileRunnable()
- {
- super("Download"); // TODO - need to externalize //$NON-NLS-1$
- }
-
- /**
- *
- */
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException
- {
-
- try
- {
- failed = !SystemEditableRemoteFile.this.download(monitor);
- completed = true;
- monitor.done();
- }
- catch (CoreException e)
- {
- throw e;
- }
- catch (InvocationTargetException e)
- {
- throw e;
- }
- catch (InterruptedException e)
- {
- // cancel was pressed by user
- monitor.setCanceled(true);
- throw e;
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError("File can not be downloaded", e); //$NON-NLS-1$
- this.e = e;
- }
- }
-
- public boolean didComplete()
- {
- return completed;
- }
-
- public boolean didFail()
- {
- return failed;
- }
-
- /**
- * Get the exception that may have been thrown
- */
- private void throwException() throws Exception
- {
-
- if (e != null)
- {
- throw e;
- }
- }
-
- public IStatus run(IProgressMonitor monitor) {
- try
- {
- execute(monitor);
- }
- catch (Exception e)
- {
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- }
-
- private IEditorDescriptor _editorDescriptor = null;
- private boolean _isRemoteFileMounted = false;
- private String _actualRemoteHost = null;
- private String _actualRemotePath = null;
-
- /**
- * Constructor for SystemEditableRemoteFile
- *
- * @since 3.0 changed String editorId into IEditorDescriptor
- */
- public SystemEditableRemoteFile(IWorkbenchPage page, IRemoteFile remoteFile, IEditorDescriptor editorDescriptor)
- {
- super();
- this.page = page;
- this.remoteFile = remoteFile;
- this.remotePath = remoteFile.getAbsolutePath();
- this.subsystem = remoteFile.getParentRemoteFileSubSystem();
- SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance();
-
- // if remote edit project doesn't exist, create it
- if (!mgr.doesRemoteEditProjectExist())
- mgr.getRemoteEditProject();
-
- this.root = mgr.getRemoteEditProjectLocation().makeAbsolute().toOSString();
- this.localPath = getDownloadPath();
- this._editorDescriptor = editorDescriptor;
- }
-
- /**
- * Constructor for SystemEditableRemoteFile
- *
- * @since 3.0 changed String editorId into IEditorDescriptor
- */
- public SystemEditableRemoteFile(IRemoteFile remoteFile, IEditorDescriptor editorDescriptor)
- {
- this(null, remoteFile, editorDescriptor);
- }
-
- /**
- * Constructor for SystemEditableRemoteFile
- */
- public SystemEditableRemoteFile(IRemoteFile remoteFile)
- {
- super();
- this.remoteFile = remoteFile;
- this.remotePath = remoteFile.getAbsolutePath();
- this.subsystem = remoteFile.getParentRemoteFileSubSystem();
- this.root = SystemRemoteEditManager.getInstance().getRemoteEditProjectLocation().makeAbsolute().toOSString();
- this.localPath = getDownloadPath();
-
- // dkm - use registered
- String fileName = remoteFile.getName();
-
- IEditorRegistry registry = getEditorRegistry();
-
- if (registry != null){
- IEditorDescriptor descriptor = registry.getDefaultEditor(fileName);
- if (descriptor == null)
- {
- descriptor = getDefaultTextEditor();
- }
-
- this._editorDescriptor = descriptor;
- }
- }
-
- protected IEditorRegistry getEditorRegistry()
- {
- if (PlatformUI.isWorkbenchRunning())
- {
- return PlatformUI.getWorkbench().getEditorRegistry();
- }
- return null;
- }
-
- protected IEditorDescriptor getDefaultTextEditor()
- {
- IEditorRegistry registry = getEditorRegistry();
- return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
-
-
- /**
- * Returns an instance of this class given a local copy of a remote file.
- * @param file the local file to create it from.
- */
- public static SystemEditableRemoteFile getInstance(IFile file) {
-
- // first determine associated remote file
- IPath path = file.getFullPath();
- int numSegments = path.segmentCount();
-
- // first we need to find the right RemoteFileSubSystem for the remote file
- SystemIFileProperties properties = new SystemIFileProperties(file);
-
- ISubSystem fs = null;
-
- // get the subsystem ID property from the temporary file
- String subsystemId = properties.getRemoteFileSubSystem();
-
- // the subsystem ID may not exist if the temporary file existed before this feature
- // to handle migration of this smoothly, we can use another method to determine the subsystem
- if (subsystemId != null)
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- fs = registry.getSubSystem(subsystemId);
- }
-
- if (fs != null)
- {
- // use the remote file path property of the temp file to determine the path of the remote file
- // on the remote system
- String remotePath = properties.getRemoteFilePath();
-
- // the uploadPath property may not exist if the temporary file existed before this feature
- // to handle migration of this smoothly, we can use another method to determine the remote file path
- if (remotePath == null)
- {
- // derive the path from the temporary file path
- IRSESystemType systemType = fs.getHost().getSystemType();
-
- // on windows systems, we need to take into account drives and different separators
- boolean isWindows = systemType.isWindows();
-
- char fileSeparator = isWindows ? '\\' : '/';
- StringBuffer tempRemotePath = new StringBuffer(""); //$NON-NLS-1$
- for (int i = 3; i < numSegments; i++)
- {
- if (i == 3)
- {
- if (!isWindows)
- {
- tempRemotePath.append(fileSeparator);
- }
- }
- if (i > 3)
- {
- if (i == 4)
- {
- if (isWindows)
- {
- tempRemotePath.append(":"); //$NON-NLS-1$
- }
- }
-
- tempRemotePath.append(fileSeparator);
- }
-
- String seg = path.segment(i);
- tempRemotePath.append(seg);
- }
-
- remotePath = tempRemotePath.toString();
- }
-
- try {
- if (remotePath != null && fs instanceof IRemoteFileSubSystem) {
- IRemoteFile remoteFile = ((IRemoteFileSubSystem)fs).getRemoteFileObject(remotePath, new NullProgressMonitor());
-
- if (remoteFile != null) {
- return new SystemEditableRemoteFile(remoteFile);
- }
- else {
- return null;
- }
- }
- else {
- return null;
- }
- }
- catch (SystemMessageException e) {
- SystemBasePlugin.logError("Error getting remote file object " + remotePath, e); //$NON-NLS-1$
- }
- }
-
- return null;
- }
-
- /**
- * Set the remote file
- */
- public void setRemoteFile(IRemoteFile remoteFile)
- {
- this.remoteFile = remoteFile;
- this.remotePath = remoteFile.getAbsolutePath();
- this.subsystem = remoteFile.getParentRemoteFileSubSystem();
- this.localPath = getDownloadPath();
- this.localFile = null;
- }
-
- /**
- * Get the remote file
- */
- public IRemoteFile getRemoteFile()
- {
- return remoteFile;
- }
-
- /**
- * Set the local path
- */
- public void setLocalPath(String localPath)
- {
- this.localPath = localPath;
- }
-
- /**
- * Get the local path
- */
- public String getLocalPath()
- {
- return localPath;
- }
-
- /**
- * Set the editor
- */
- public void setEditor(IEditorPart editor)
- {
- this.editor = editor;
- }
-
- /**
- * Get the editor
- */
- public IEditorPart getEditor()
- {
- return editor;
- }
-
- /**
- * Check if user has write authority to the file.
- * @return true if the file is read-only
- */
- public boolean isReadOnly()
- {
-
- if (!subsystem.isConnected())
- {
- try
- {
- if (Display.getCurrent() == null) {
- subsystem.connect(new NullProgressMonitor(), false);
- } else {
- subsystem.connect(false, null);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- return !remoteFile.canWrite();
- }
-
- /**
- * Indicate whether the file can be edited
- */
- public void setReadOnly(boolean isReadOnly)
- {
- if (isReadOnly)
- {
- setEditorAsReadOnly();
- setFileAsReadOnly(); // added since setEditorAsReadOnly() no longer sets the file properties
- }
- else
- {
- if (editor instanceof ISystemTextEditor) {
- ((ISystemTextEditor) editor).setReadOnly(false);
- }
- IFile file = getLocalResource();
- setReadOnly(file, false);
- SystemIFileProperties properties = new SystemIFileProperties(file);
- properties.setReadOnly(false);
- }
- }
-
- /**
- * Download the file.
- * @param shell if the shell is null, no progress monitor will be shown
- * @return true if successful, false if cancelled
- */
- public boolean download(Shell shell) throws Exception
- {
-
- if (shell != null)
- {
-
-
- InternalDownloadFileRunnable downloadFileRunnable = new InternalDownloadFileRunnable();
- //ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
- IFile localFile = getLocalResource();
- SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
- listener.addIgnoreFile(localFile);
-
- //pmd.run(false, true, downloadFileRunnable);
- downloadFileRunnable.setRule(getRemoteFile());
- downloadFileRunnable.schedule();
- Display display = Display.getDefault();
- try {
- while (!downloadFileRunnable.didComplete())
- {
- while (display!=null && display.readAndDispatch()) {
- //Process everything on event queue
- }
- if (!downloadFileRunnable.didComplete()) Thread.sleep(200);
- }
- } catch(InterruptedException e) {
- /*stop waiting*/
- }
-
- listener.removeIgnoreFile(localFile);
- downloadFileRunnable.throwException();
- return !downloadFileRunnable.didFail();
- }
- else
- {
- return download(new NullProgressMonitor());
- }
- }
-
- protected void setReadOnly(IFile file, boolean flag)
- {
- ResourceAttributes attrs = file.getResourceAttributes();
- attrs.setReadOnly(flag);
- try
- {
- file.setResourceAttributes(attrs);
- }
- catch (CoreException e)
- {
- }
- }
-
- /**
- * Download the file.
- * @param monitor the progress monitor
- * @return true if the operation was successful. false if the user cancels.
- */
- public boolean download(IProgressMonitor monitor) throws Exception
- {
-
- // DY: check if the file exists and is read-only (because it was previously opened
- // in the system editor)
- IFile file = getLocalResource();
- SystemIFileProperties properties = new SystemIFileProperties(file);
- boolean newFile = !file.exists();
- if (file.isReadOnly())
- {
- setReadOnly(file, false);
- }
- properties.setReadOnly(false);
-
- // 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);
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
-
- // get the remote modified stamp
- long remoteModifiedStamp = remoteFile.getLastModified();
-
- // get dirty flag
- boolean dirty = properties.getDirty();
-
- boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp);
- if (dirty)
- {
- // we have a dirty file with pending changes
- // user may want to replace this with the remote file
- // here we prompt user **** Prompt Dialog 2 or 3
- // 1) replace pending changes with remote file
- // 2) open editor with our pending changes
- SystemDownloadConflictAction conflictAction = new SystemDownloadConflictAction(file, remoteNewer);
- Display.getDefault().syncExec(conflictAction);
-
- switch (conflictAction.getState())
- {
- case SystemDownloadConflictAction.CANCELLED :
- return false;
- case SystemDownloadConflictAction.OPEN_WITH_LOCAL :
- return true;
- case SystemDownloadConflictAction.REPLACE_WITH_REMOTE :
- default :
- return doDownload(properties, monitor);
- }
- }
- else
- {
- if (remoteNewer)
- {
- return doDownload(properties, monitor);
- }
- else
- {
- String encoding = properties.getEncoding();
- if (properties.getUsedBinaryTransfer() == remoteFile.isBinary() &&
- encoding != null && encoding.equals(remoteFile.getEncoding()) // changed encodings matter too
- )
- {
- // we already have same file, use the current file
- refresh();
- }
- else
- {
- // we transferred a different way last time, so we need to transfer again
- return doDownload(properties, monitor);
- }
- }
- }
- }
-
- else
- {
- return doDownload(properties, monitor);
- }
-
- return true;
- }
-
- private boolean doDownload(SystemIFileProperties properties, IProgressMonitor monitor) throws Exception
- {
- // file hasn't been downloaded before, so do the download now
- /* SystemMessage copyMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYTHINGGENERIC_PROGRESS);
- copyMessage.makeSubstitution(remoteFile.getName());
- monitor.beginTask(copyMessage.getLevelOneText(), (int)remoteFile.getLength());
- */
- if (!subsystem.isConnected())
- {
- // don't try to download file if not connected
- return false;
- }
-
- try
- {
- subsystem.download(remoteFile, localPath, remoteFile.getEncoding(), monitor);
- }
- catch (SystemMessageException e)
- {
- SystemMessageDialog.displayMessage(e);
- return false;
- }
- if (monitor.isCanceled())
- {
- return false;
- }
-
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
-
- refresh();
-
- // get fresh file object
- IFile file = getLocalResource();
- properties.setRemoteFileTimeStamp(remoteFile.getLastModified());
- properties.setDownloadFileTimeStamp(file.getLocalTimeStamp());
- properties.setDirty(false);
- properties.setUsedBinaryTransfer(remoteFile.isBinary());
-
- boolean readOnly = !remoteFile.canWrite();
- properties.setReadOnly(readOnly);
-
- // 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.
- properties.setDownloadFileTimeStamp(file.getLocation().toFile().lastModified());
-
- return true;
- }
-
- /**
- * Saves the local file and uploads it to the host immediately, rather than, in response to a resource change
- * event.
- */
- public boolean doImmediateSaveAndUpload()
- {
- if (editor != null)
- {
- editor.doSave(null);
- }
-
- SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
- listener.setEnabled(false);
-
- IRemoteFile remoteFile = getRemoteFile();
- IFile tempFile = getLocalResource();
- IRemoteFileSubSystem fs = remoteFile.getParentRemoteFileSubSystem();
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- // reget the remote file so that we have the right timestamps
- try
- {
- remoteFile.markStale(true); // as per bug 249544, we should mark stale to ensure we get a fresh copy
- remoteFile = fs.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
- return false;
- }
- listener.upload(fs, remoteFile, tempFile, properties, properties.getRemoteFileTimeStamp(), this, null);
-
- listener.setEnabled(true);
-
- return !properties.getDirty();
- //return true;
- }
-
- /**
- * Upload the file
- */
- private void upload(IProgressMonitor monitor) throws Exception
- {
-
- if (!subsystem.isConnected())
- {
- if (Display.getCurrent() == null) {
- subsystem.connect(new NullProgressMonitor(), false);
- } else {
- subsystem.connect(false, null);
- }
- }
-
- IFile file = getLocalResource();
- String srcEncoding = RemoteFileUtility.getSourceEncoding(file);
-
- subsystem.upload(localPath, remoteFile, srcEncoding, monitor);
-
- // update timestamp
- SystemIFileProperties properties = new SystemIFileProperties(file);
-
- //DKM- saveAS fix
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
- properties.setRemoteFileTimeStamp(remoteFile.getLastModified());
- }
-
- /**
- * Get the local resource
- */
- public IFile getLocalResource()
- {
- /* DKM - don't use this because workspace can't always handle case-sensitivity
- System.out.println("getting file for " + localPath);
- File file = new File(localPath);
- System.out.println("file= " + file);
- try
- {
- String path = file.getCanonicalPath();
- return RSEUIPlugin.getWorkspaceRoot().getFileForLocation(new Path(path));
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- */
- if (localFile == null || !localFile.exists())
- {
- IPath path = getLocalPathObject();
- localFile = SystemBasePlugin.getWorkspaceRoot().getFileForLocation(path);
- }
-
- return localFile;
- }
-
- private IPath getLocalPathObject()
- {
- IPath actualPath = null;
- IPath expectedPath = new Path(localPath);
-
- IPath rootPath = new Path(root);
- IContainer container = SystemBasePlugin.getWorkspaceRoot().getContainerForLocation(rootPath);
-
- if (container != null && container.exists())
- {
- IResource lastMatch = null;
- for (int i = rootPath.segmentCount(); i < expectedPath.segmentCount(); i++)
- {
- String expectedFolderOrFile = expectedPath.segment(i).toLowerCase();
- IResource match = null;
-
- try
- {
- IResource[] resources = container.members();
-
- for (int r = 0; r < resources.length && match == null; r++)
- {
- IResource resource = resources[r];
-
- if (resource instanceof IContainer)
- {
- String resName = resource.getName().toLowerCase();
- if (expectedFolderOrFile.equals(resName))
- {
- match = resource;
- lastMatch = match;
- }
- }
- // file match - i.e. last file
- else if (i == expectedPath.segmentCount() - 1)
- {
- String resName = resource.getName().toLowerCase();
- if (expectedFolderOrFile.equals(resName))
- {
- //match = resource;
- //lastMatch = match;
- // we found the resource - need to continue
- return resource.getLocation();
- }
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- if (match != null)
- {
- container = (IContainer) match;
- }
- else if (lastMatch != null)
- {
- IPath newPath = lastMatch.getLocation();
- while (i < expectedPath.segmentCount())
- {
- newPath = newPath.append(expectedPath.segment(i));
- i++;
- }
-
- return newPath;
- }
- else
- {
- return expectedPath;
- }
- }
-
- String fileName = expectedPath.segment(expectedPath.segmentCount() - 1);
- actualPath = container.getLocation().append(fileName);
- return actualPath;
- }
-
- return expectedPath;
- }
-
- /**
- * Delete the local resource
- */
- public void delete()
- {
-
- IPath rootPath = (new Path(root)).removeTrailingSeparator();
-
- String rootLocation = rootPath.makeAbsolute().toOSString();
-
- String resourceLocation = getLocalResource().getLocation().makeAbsolute().toOSString();
-
- File tempFile = new File(resourceLocation);
-
- boolean deleteResult = tempFile.delete();
-
- if (!deleteResult)
- {
- return;
- }
-
- while (resourceLocation.startsWith(rootLocation))
- {
-
- tempFile = tempFile.getParentFile();
- resourceLocation = tempFile.getAbsolutePath();
-
- if (resourceLocation.equals(rootLocation))
- { // do not delete the root folder itself
- break;
- }
-
- deleteResult = tempFile.delete();
-
- if (!deleteResult)
- {
- break;
- }
- }
-
- // refresh after delete
- refresh();
- }
-
- /**
- * Get the download path
- */
- private String getDownloadPath()
- {
-
- IPath path = new Path(root);
-
- _actualRemoteHost = getActualHostFor(remotePath);
-
- // DKM - now we're using only the hostname to prefix the remote path. Thus multiple connections to the same place will
- // yield the temp files
- //path = path.append("/" + subsystem.getSystemProfileName() + "/" + subsystem.getSystemConnectionName() + "/");
- path = path.append("/" + _actualRemoteHost + "/"); //$NON-NLS-1$ //$NON-NLS-2$
-
- String absolutePath = getWorkspaceRemotePath(remotePath);
-
- 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).toLowerCase() + absolutePath.substring(colonIndex + 1);
- }
- }
-
- String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- if (!os.startsWith("win")) //$NON-NLS-1$
- absolutePath = absolutePath.replace('\\', '/');
-
- // DY: We should only be escaping the remote portion of the path
- IPath remote = new Path(absolutePath);
- absolutePath = SystemFileNameHelper.getEscapedPath(remote.toOSString());
- _actualRemotePath = absolutePath;
-
- //path = path.append(absolutePath);
- //return SystemFileNameHelper.getEscapedPath(path.makeAbsolute().toOSString());
-
- return path.makeAbsolute().toOSString() + absolutePath;
- }
-
- /**
- * Gets the path to use in the workspace for saving the local replica remote file. In most cases
- * this path will be the same thing as the remote path however, this mechanism exists so that 3rd parties
- * can customize where temp files are saved.
- *
- * @param remotePath the absolute path to the resource on the host
- * @return the workspace mapping of the remote path
- */
- public String getWorkspaceRemotePath(String remotePath)
- {
- if (subsystem != null)
- {
- return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath, subsystem);
- }
- return remotePath;
- }
-
- public String getActualHostFor(String remotePath)
- {
- String hostname = subsystem.getHost().getHostName();
- if (subsystem != null
- //DKM && subsystem.getHost().getSystemType().isLocal()
- )
- {
- String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath, subsystem);
- if (!result.equals(hostname))
- {
- _isRemoteFileMounted = true;
- }
- return result;
- }
- return hostname;
- }
-
-
- /**
- * Returns the open IEditorPart for this remote object if there is one.
- */
- public IEditorPart getEditorPart()
- {
- return editor;
- }
-
- /**
- * Returns the remote object that is editable
- */
- public IAdaptable getRemoteObject()
- {
- return (IAdaptable) remoteFile;
- }
-
- /**
- * Is the local file open in an editor
- */
- public int checkOpenInEditor()
- {
- // first we check if it's open in the active page
- IWorkbenchPage activePage = this.page;
- IWorkbench wb = PlatformUI.getWorkbench();
- if (activePage == null)
- {
- IWorkbenchWindow activeWindow = wb.getActiveWorkbenchWindow();
- if (activeWindow != null)
- {
- activePage = activeWindow.getActivePage();
- }
- else
- {
- IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
- if (windows != null && windows.length > 0)
- {
- activePage = windows[0].getActivePage();
- }
- }
- }
-
- if (activePage == null){
- return NOT_OPEN;
- }
-
- IEditorReference[] activeReferences = activePage.getEditorReferences();
-
- IEditorPart part;
- java.io.File lFile = new java.io.File(localPath);
-
- for (int k = 0; k < activeReferences.length; k++)
- {
-
- // Need to think about whether to restore the editor here,
- // i.e. whether the argument to the getEditor() should be true
- part = activeReferences[k].getEditor(false);
-
- //DKM***if (part instanceof SystemTextEditor)
- if (part != null)
- {
-
- IEditorInput editorInput = part.getEditorInput();
-
- if (editorInput instanceof IFileEditorInput)
- {
- IPath path = ((IFileEditorInput) editorInput).getFile().getLocation();
- if (path!=null && lFile.compareTo(new java.io.File(path.toOSString()))==0) {
- //if (path.makeAbsolute().toOSString().equalsIgnoreCase(localPath))
- return OPEN_IN_SAME_PERSPECTIVE;
- }
- }
- }
- }
-
- IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
-
- for (int i = 0; i < windows.length; i++)
- {
-
- IWorkbenchPage[] pages = windows[i].getPages();
-
- for (int j = 0; j < pages.length; j++)
- {
-
- IEditorReference[] references = pages[j].getEditorReferences();
-
- if (pages[j] == activePage)
- {
- continue;
- }
-
- IEditorPart temp;
-
- for (int k = 0; k < references.length; k++)
- {
-
- // Need to think about whether to restore the editor here,
- // i.e. whether the argument to the getEditor() should be true
- temp = references[k].getEditor(false);
-
- IEditorInput editorInput = temp.getEditorInput();
-
- if (editorInput instanceof IFileEditorInput)
- {
- IPath path = ((IFileEditorInput) editorInput).getFile().getLocation();
-
- if (path!=null && path.makeAbsolute().toOSString().equalsIgnoreCase(localPath))
- {
- return OPEN_IN_DIFFERENT_PERSPECTIVE;
- }
- }
-
- }
- }
- }
-
- return NOT_OPEN;
- }
-
- /**
- * Open in editor
- */
- public void open(Shell shell)
- {
- open(shell, false);
- }
-
- /**
- * Open in editor
- */
- public void open(Shell shell, boolean readOnly)
- {
-
- try
- {
-
-
- // first check if file is already open in an editor
- int result = checkOpenInEditor();
- // ensure the file is stale
- remoteFile.markStale(true, false);
- {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
-
- if (!remoteFile.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND, remotePath, subsystem.getHost().getHostName());
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
-
- SystemMessageDialog dialog = new SystemMessageDialog(shell, message);
- dialog.open();
- return;
- }
-
- if (result == NOT_OPEN)
- {
- if (readOnly)
- {
- if (download(shell))
- {
- setLocalResourceProperties();
- setFileAsReadOnly();
- openEditor(remoteFile, readOnly);
- setEditorAsReadOnly();
- }
- }
- else if (!isReadOnly())
- { // we have write access
- if (download(shell))
- {
- addAsListener();
- setLocalResourceProperties();
- openEditor(remoteFile, readOnly);
- }
- }
- else
- { // we do not have write access
-
- IRemoteFile fakeRemoteFile = subsystem.getRemoteFileObject(remotePath, new NullProgressMonitor());
- if (!fakeRemoteFile.exists())
- { // this could be because file doesn't exist
- download(shell);
- }
-
- String msgTxt = NLS.bind(FileResources.MSG_DOWNLOAD_NO_WRITE, remotePath, subsystem.getHost().getHostName());
- String msgDetails = NLS.bind(FileResources.MSG_DOWNLOAD_NO_WRITE_DETAILS, remotePath, subsystem.getHost().getHostName());
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_DOWNLOAD_NO_WRITE,
- IStatus.WARNING, msgTxt, msgDetails);
- SystemMessageDialog dialog = new SystemMessageDialog(shell, message);
-
- boolean answer = dialog.openQuestion();
-
- if (answer)
- {
- if (download(shell))
- {
- setLocalResourceProperties();
- setFileAsReadOnly();
- openEditor(remoteFile, readOnly);
- setEditorAsReadOnly();
- }
- }
- }
- }
- else if (result == OPEN_IN_SAME_PERSPECTIVE)
- {
- openEditor(remoteFile, readOnly);
- }
- else if (result == OPEN_IN_DIFFERENT_PERSPECTIVE)
- {
- String msgTxt = NLS.bind(FileResources.MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR, remotePath, subsystem.getHost().getHostName());
- String msgDetails = NLS.bind(FileResources.MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR_DETAILS, remotePath, subsystem.getHost().getHostName());
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR,
- IStatus.WARNING, msgTxt, msgDetails);
-
- SystemMessageDialog dialog = new SystemMessageDialog(shell, message);
-
- boolean answer = dialog.openQuestion();
-
- if (answer)
- {
- setFileAsReadOnly();
- openEditor(remoteFile, readOnly);
- setEditorAsReadOnly(); // put editor in read only mode, but not file
- }
- }
- }
- catch (Exception e)
- {
-
- if (e instanceof InterruptedException)
- {
- // do nothing since user pressed cancel
- }
- else if (e instanceof SystemMessageException)
- {
- SystemMessageDialog dialog = new SystemMessageDialog(shell, ((SystemMessageException) e).getSystemMessage());
- dialog.open();
- }
- else
- {
- RemoteFileIOException exc = new RemoteFileIOException(e);
- SystemMessageDialog dialog = new SystemMessageDialog(shell, exc.getSystemMessage());
- dialog.open();
- }
- }
- }
-
-
- /**
- * Open in editor
- */
- public void open(IProgressMonitor monitor)
- {
- open(false, monitor);
- }
-
- /**
- * Open in editor
- */
- public void open(boolean readOnly, IProgressMonitor monitor)
- {
-
- try
- {
-
- // ensure the file is stale
- remoteFile.markStale(true, false);
- {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
- }
-
- if (!remoteFile.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND, remotePath, subsystem.getHost().getHostName());
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
-
- DisplayMessageDialog dd = new DisplayMessageDialog(message);
- Display.getDefault().syncExec(dd);
- return;
- }
-
- // assumption is that editor is not open
-
- if (readOnly)
- {
- if (download(monitor))
- {
- setLocalResourceProperties();
- setFileAsReadOnly();
- openEditor(remoteFile, readOnly);
- setEditorAsReadOnly();
- }
- }
- else if (!isReadOnly())
- { // we have write access
- if (download(monitor))
- {
- addAsListener();
- setLocalResourceProperties();
- openEditor(remoteFile, readOnly);
- }
- }
- else
- { // we do not have write access
-
- IRemoteFile fakeRemoteFile = subsystem.getRemoteFileObject(remotePath, monitor);
- if (!fakeRemoteFile.exists())
- { // this could be because file doesn't exist
- download(monitor);
- }
-
- String msgTxt = NLS.bind(FileResources.MSG_DOWNLOAD_NO_WRITE, remotePath, subsystem.getHost().getHostName());
- String msgDetails = NLS.bind(FileResources.MSG_DOWNLOAD_NO_WRITE_DETAILS, remotePath, subsystem.getHost().getHostName());
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_DOWNLOAD_NO_WRITE,
- IStatus.WARNING, msgTxt, msgDetails);
-
- DisplayQuestionDialog dd = new DisplayQuestionDialog(message);
- Display.getDefault().syncExec(dd);
- boolean answer = dd.getResponse();
-
-
- if (answer)
- {
- if (download(monitor))
- {
- setLocalResourceProperties();
- setFileAsReadOnly();
- openEditor(remoteFile, readOnly);
- setEditorAsReadOnly();
- }
- }
- }
-
- }
- catch (Exception e)
- {
-
- if (e instanceof InterruptedException)
- {
- // do nothing since user pressed cancel
- }
- else if (e instanceof SystemMessageException)
- {
- DisplayMessageDialog dd = new DisplayMessageDialog(((SystemMessageException)e).getSystemMessage());
- Display.getDefault().syncExec(dd);
- }
- else
- {
- RemoteFileIOException exc = new RemoteFileIOException(e);
- DisplayMessageDialog dd = new DisplayMessageDialog(exc.getSystemMessage());
- Display.getDefault().syncExec(dd);
- }
- }
- }
-
-
- public class DisplayMessageDialog implements Runnable
- {
- protected SystemMessage _msg;
- public DisplayMessageDialog(SystemMessage msg)
- {
- _msg = msg;
- }
-
- public void run()
- {
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), _msg);
- dialog.open();
- }
- }
-
- public class DisplayQuestionDialog implements Runnable
- {
- protected SystemMessage _msg;
- public boolean _responce = false;
- public DisplayQuestionDialog(SystemMessage msg)
- {
- _msg = msg;
- }
-
- public boolean getResponse()
- {
- return _responce;
- }
-
- public void run()
- {
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), _msg);
- try
- {
- _responce = dialog.openQuestion();
- }
- catch (Exception e)
- {
-
- }
- }
- }
-
- /**
- * Open in system editor
- */
- public void openInSystemEditor(Shell shell)
- {
-
- try
- {
- if (remoteFile.getHost().getSystemType().isLocal())
- {
- // Open local files "in-place", i.e. don't copy them to the
- // RemoteSystemsTempFiles project first
- if (remoteFile instanceof IVirtualRemoteFile)
- {
- Program.launch(remoteFile.getAbsolutePath());
- }
- else
- {
- Program.launch(remotePath);
- }
-
- }
- else
- {
- download(shell);
- IFile file = getLocalResource();
- // DY: set resource as read only when launching in external editor
- // because we do not get notified of save events (unless the user selects
- // "Refresh from local" on the project) and therefore cannot
- // push changes back to the server.
- setReadOnly(file, true);
- openSystemEditor();
- }
- }
- catch (Exception e)
- {
-
- if (e instanceof SystemMessageException)
- {
- SystemMessageDialog dialog = new SystemMessageDialog(shell, ((SystemMessageException) e).getSystemMessage());
- dialog.open();
- }
- else
- {
- RemoteFileIOException exc = new RemoteFileIOException(e);
- SystemMessageDialog dialog = new SystemMessageDialog(shell, exc.getSystemMessage());
- dialog.open();
- }
- }
- }
-
- /**
- * Open in in place editor
- */
- public void openInInPlaceEditor(Shell shell)
- {
-
- try
- {
- download(shell);
- IFile file = getLocalResource();
- // DY: set resource as read only when launching in external editor
- // because we do not get notified of save events (unless the user selects
- // "Refresh from local" on the project) and therefore cannot
- // push changes back to the server.
- setReadOnly(file, true);
- openInPlaceEditor();
-
- }
- catch (Exception e)
- {
-
- if (e instanceof SystemMessageException)
- {
- SystemMessageDialog dialog = new SystemMessageDialog(shell, ((SystemMessageException) e).getSystemMessage());
- dialog.open();
- }
- else
- {
- RemoteFileIOException exc = new RemoteFileIOException(e);
- SystemMessageDialog dialog = new SystemMessageDialog(shell, exc.getSystemMessage());
- dialog.open();
- }
- }
- }
-
-
- /**
- * Set local resource properties
- */
- public void setLocalResourceProperties() throws CoreException
- {
- IFile file = getLocalResource();
-
- SystemIFileProperties properties = new SystemIFileProperties(file);
-
- String profileID = subsystem.getParentRemoteFileSubSystemConfiguration().getEditorProfileID();
- properties.setEditorProfileType(profileID);
-
- // need this to get a reference back to the object
- properties.setRemoteFileObject(this);
-
- // set remote properties
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- String subSystemId = registry.getAbsoluteNameForSubSystem(subsystem);
- properties.setRemoteFileSubSystem(subSystemId);
- properties.setRemoteFilePath(remoteFile.getAbsolutePath());
-
- properties.setRemoteFileMounted(_isRemoteFileMounted);
- if (_isRemoteFileMounted)
- {
- properties.setResolvedMountedRemoteFileHost(_actualRemoteHost);
- properties.setResolvedMountedRemoteFilePath(_actualRemotePath);
- }
-
- // if we have an xml file, find the local encoding of the file
- SystemEncodingUtil util = SystemEncodingUtil.getInstance();
- String encoding = remoteFile.getEncoding();
- properties.setEncoding(encoding);
-
- String tempPath = file.getLocation().toOSString();
-
- if (util.isXML(tempPath)) {
-
- try {
- encoding = util.getXMLFileEncoding(tempPath);
- }
- catch (IOException e) {
- IStatus s = new Status(IStatus.ERROR, RSEUIPlugin.PLUGIN_ID, IStatus.ERROR, e.getLocalizedMessage(), e);
- throw new CoreException(s);
- }
- }
-
-
- try
- {
- if (encoding != null)
- {
- if (remoteFile.isBinary()){
- if (!file.isSynchronized(IResource.DEPTH_ZERO))
- {
- file.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
- }
- if (!file.getCharset().equals(encoding))
- {
- file.setCharset(encoding, null);
- }
- }
- else {
- // using text mode so the char set needs to be local
- if (properties.getLocalEncoding() != null){
- String localEncoding = properties.getLocalEncoding();
- file.setCharset(localEncoding, null);
- }
-
- // otherwise, the default charset is inherited so no need to set
- }
- }
- }
- catch (Exception e)
- {
- }
- }
-
- /**
- * Register as listener for various events
- */
- public void addAsListener()
- {
- try
- {
- if (!isReadOnly())
- {
- if (SystemBasePlugin.getActiveWorkbenchWindow() != null)
- {
- if (SystemBasePlugin.getActiveWorkbenchWindow().getActivePage() != null)
- {
- SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().addPartListener(this);
- }
- }
- SystemUniversalTempFileListener.getListener().registerEditedFile(this);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- /**
- * Open the editor
- */
- public void openEditor() throws PartInitException
- {
- // get fresh remote file object
- remoteFile.markStale(true); // make sure we get the latest remote file (with proper permissions and all)
- if (!remoteFile.getParentRemoteFileSubSystem().isOffline()){
- try
- {
- remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e)
- {
- SystemMessageDialog.displayExceptionMessage(SystemMessageDialog.getDefaultShell(), e);
- return;
- }
- }
- boolean readOnly = !remoteFile.canWrite();
- openEditor(remoteFile, readOnly);
- }
-
-
- /**
- * Method to open the editor given an IRemoteFile and a specified readOnly property.
- */
- private void openEditor(IRemoteFile remoteFile, boolean readOnly) throws PartInitException
- {
- IWorkbenchPage activePage = this.page;
- IWorkbench wb = PlatformUI.getWorkbench();
- if (activePage == null)
- {
- activePage = wb.getActiveWorkbenchWindow().getActivePage();
- }
- IFile file = getLocalResource();
- 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 = null;
- if (_editorDescriptor != null)
- editorId = _editorDescriptor.getId();
-
- IDE.setDefaultEditor(file, editorId);
-
- FileEditorInput finput = new FileEditorInput(file);
-
- // check for files already open
-
- // DKM - when _editorId is not lpex, this causes problem
- // DY - changed editor from SystemTextEditor to IEditorPart
- //editor = (SystemTextEditor)activePage.openEditor(file, _editorId);
- if (_editorDescriptor != null && _editorDescriptor.isOpenExternal()){
- editor = ((WorkbenchPage)activePage).openEditorFromDescriptor(new FileEditorInput(file), _editorDescriptor, true, null);
- }
- else {
- editor = activePage.openEditor(finput, _editorDescriptor.getId());
- }
-
-
- SystemIFileProperties properties = new SystemIFileProperties(file);
- properties.setRemoteFileObject(this);
- if (properties.getDirty()){
- updateDirtyIndicator();
- }
- }
-
- /**
- * Open the system editor
- */
- public void openSystemEditor() throws PartInitException
- {
- IWorkbenchPage activePage = this.page;
- if (activePage == null)
- {
- activePage = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
- }
- IFile file = getLocalResource();
-
- // set editor as preferred editor for this file
- String editorId = null;
- if (_editorDescriptor != null)
- editorId = _editorDescriptor.getId();
- IDE.setDefaultEditor(file, editorId);
-
- FileEditorInput fileInput = new FileEditorInput(file);
- activePage.openEditor(fileInput, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
-
- SystemIFileProperties properties = new SystemIFileProperties(file);
- properties.setRemoteFileObject(this);
- }
-
- /**
- * Open the in place editor
- */
- private void openInPlaceEditor() throws PartInitException
- {
- IWorkbenchPage activePage = this.page;
- if (activePage == null)
- {
- activePage = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
- }
- IFile file = getLocalResource();
- FileEditorInput fileInput = new FileEditorInput(file);
- activePage.openEditor(fileInput, IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
-
- }
-
- /**
- * Set editor to read only
- */
- private void setEditorAsReadOnly()
- {
- if (editor instanceof ISystemTextEditor)
- {
- ((ISystemTextEditor) editor).setReadOnly(true);
- }
- }
-
- private void setFileAsReadOnly()
- {
- IFile file = getLocalResource();
- setReadOnly(file, true);
-
- SystemIFileProperties properties = new SystemIFileProperties(file);
- properties.setReadOnly(true);
- }
-
- /**
- * Refresh
- */
- private void refresh()
- {
-
- SystemRemoteEditManager.getInstance().refreshRemoteEditContainer(localFile.getParent());
- }
-
- /**
- * @see IPartListener#partActivated(IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part)
- {
- }
-
- /**
- * @see IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part)
- {
- }
-
- /**
- * @see IPartListener#partClosed(IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part)
- {
- /*
- if (editor == part)
- {
- delete();
- }
- */
- SystemUniversalTempFileListener.getListener().unregisterEditedFile(this);
-
- IWorkbenchPage page = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
-
- if (page != null)
- {
- page.removePartListener(this);
- }
- }
-
- /**
- * @see IPartListener#partDeactivated(IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part)
- {
- }
-
- /**
- * @see IPartListener#partOpened(IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part)
- {
- }
-
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event)
- {
- /*
- if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
-
- IResourceDelta delta = event.getDelta();
-
- try {
- delta.accept(this);
- }
- catch (CoreException e) {
- RSEUIPlugin.logError("Error accepting delta", e);
- RemoteFileIOException exc = new RemoteFileIOException(e);
- SystemMessageDialog dialog = new SystemMessageDialog(RSEUIPlugin.getActiveWorkbenchShell(), exc.getSystemMessage());
- dialog.open();
- }
- }
- */
- }
-
- /**
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) throws CoreException
- {
-
- if (delta.getKind() == IResourceDelta.CHANGED)
- process(delta);
-
- return true;
- }
-
- /**
- * Process the resource delta
- */
- private void process(IResourceDelta delta)
- {
-
- IResource resource = delta.getResource();
-
- try
- {
-
- if (resource.getLocation().equals(getLocalResource().getLocation()))
- {
- upload(new NullProgressMonitor());
- }
- }
- catch (Exception e)
- {
-
- SystemBasePlugin.logError("Error uploading file", e); //$NON-NLS-1$
-
- if (e instanceof SystemMessageException)
- {
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), ((SystemMessageException) e).getSystemMessage());
- dialog.open();
- }
- else
- {
- RemoteFileIOException exc = new RemoteFileIOException(e);
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), exc.getSystemMessage());
- dialog.open();
- }
- }
- }
-
- /**
- * Save as to a remote location
- */
- public boolean saveAs(IRemoteFile newRemoteFile, IProgressMonitor progressMonitor)
- {
- if (editor == null)
- {
- try
- {
- openEditor();
- }
- catch (Exception e)
- {
- }
- }
-
- final IDocumentProvider documentProvider = ((ITextEditor) editor).getDocumentProvider();
-
- SystemEditableRemoteFile tempFile = new SystemEditableRemoteFile(newRemoteFile);
-
- IFile newFile = tempFile.getLocalResource();
-
- if (newFile.getLocation().equals(getLocalResource().getLocation()))
- {
-
- if (editor != null)
- {
- editor.doSave(progressMonitor);
- return true;
- }
- else
- {
- return true;
- }
- }
-
- final IFileEditorInput newInput = new FileEditorInput(newFile);
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation()
- {
-
- public void execute(final IProgressMonitor monitor) throws CoreException
- {
- documentProvider.saveDocument(monitor, newInput, documentProvider.getDocument(editor.getEditorInput()), true);
- }
- };
-
- boolean success = false;
-
- if (editor instanceof ISystemTextEditor)
- {
- documentProvider.aboutToChange(newInput);
- ISystemTextEditor systemEditor = (ISystemTextEditor) editor;
- systemEditor.refresh();
- try
- {
- new ProgressMonitorDialog(SystemBasePlugin.getActiveWorkbenchShell()).run(false, true, op);
- success = true;
- }
- catch (InterruptedException e)
- {
- }
- catch (InvocationTargetException e)
- {
- SystemBasePlugin.logError("Error in performSaveAs", e); //$NON-NLS-1$
- String msgTxt = CommonMessages.MSG_ERROR_UNEXPECTED;
-
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_ERROR_UNEXPECTED,
- IStatus.ERROR, msgTxt);
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), message);
- dialog.open();
-
- return true;
- }
- finally
- {
- documentProvider.changed(newInput);
-
- if (success)
- {
- systemEditor.setInput(newInput);
-
- // Delete the local resource associated with this object
- this.delete();
-
- // change properties of this object to the new file now
- this.setRemoteFile(newRemoteFile);
-
- try
- {
- this.setLocalResourceProperties();
- this.upload(progressMonitor);
- } catch (SystemMessageException e) {
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), e.getSystemMessage());
- dialog.open();
- return true;
- } catch (Exception e)
- {
- SystemBasePlugin.logError("Error in performSaveAs", e); //$NON-NLS-1$
- String msgTxt = CommonMessages.MSG_ERROR_UNEXPECTED;
-
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_ERROR_UNEXPECTED,
- IStatus.ERROR, msgTxt);
- SystemMessageDialog dialog = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), message);
- dialog.open();
-
- return true;
- }
- }
- }
- }
-
- if (progressMonitor != null)
- {
- progressMonitor.setCanceled(!success);
- }
-
- return true;
- }
-
- private void markEditorDirty(){
- ITextEditor textEditor = (ITextEditor)editor;
- IDocumentProvider provider = textEditor.getDocumentProvider();
- if (provider != null){
- IDocument doc = provider.getDocument(textEditor.getEditorInput());
- String content = doc.get();
- try {
- doc.replace(0, content.length(), content);
- } catch (BadLocationException e) {
- }
- }
- }
-
- public void updateDirtyIndicator()
- {
- // for lpex dirty indicator
- if (editor != null)
- {
- if (editor instanceof ISystemTextEditor)
- {
- ((ISystemTextEditor) editor).updateDirtyIndicator();
- }
- else if (editor instanceof ITextEditor){ // mark dirty by updating editor contents
- // only do this if we need to mark it as dirty
- SystemIFileProperties properties = new SystemIFileProperties(localFile);
- if (properties.getDirty()){
- if (Display.getCurrent() == null){ // if we're not on a UI thread
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- markEditorDirty();
- }
- });
- }
- else {
- markEditorDirty();
- }
- }
- }
- }
- }
-
-
- public boolean isDirty()
- {
- if (editor != null)
- return editor.isDirty();
- return false;
- }
-
-
- public String getAbsolutePath() {
- return remotePath;
- }
-
- public ISubSystem getSubSystem() {
- return subsystem;
- }
-
- public boolean exists()
- {
- return remoteFile.exists();
- }
-
- public boolean isStale()
- {
- return remoteFile.isStale();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemSafeFileOutputStream.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemSafeFileOutputStream.java
deleted file mode 100644
index dcf18ca2c..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemSafeFileOutputStream.java
+++ /dev/null
@@ -1,221 +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.files.ui.resources;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * This class should be used when there's a file already in the
- * destination and we don't want to lose its contents if a
- * failure writing this stream happens.
- * Basically, the new contents are written to a temporary location.
- * If everything goes OK, it is moved to the right place.
- * The user has the option to define the temporary location or
- * it will be created in the default-temporary directory
- */
-public class SystemSafeFileOutputStream extends OutputStream {
-
-
-
- protected File destination = null;
- protected File temp = null;
- protected OutputStream output = null;
- protected boolean failed = false;
- protected static final String BACKUP_EXTENSION = ".bak"; //$NON-NLS-1$
-
- /**
- * Constructor for SystemSafeFileOutputStream.
- * @param file the destination file.
- */
- public SystemSafeFileOutputStream(File file) throws IOException {
- this(file.getAbsolutePath(), null);
- }
-
- /**
- * Constructor for SystemSafeFileOutputStream.
- * @param destinationName the destination file name
- */
- public SystemSafeFileOutputStream(String destinationName) throws IOException {
- this(destinationName, null);
- }
-
- /**
- * Constructor for SystemSafeFileOutputStream.
- * @param destinationPath the destination file name
- * @param tempPath the temporary file name
- */
- public SystemSafeFileOutputStream(String destinationPath, String tempPath) throws IOException {
- destination = new File(destinationPath);
- createTempFile(tempPath);
-
- if (!destination.exists()) {
-
- if (!temp.exists()) {
- output = new BufferedOutputStream(new FileOutputStream(destination));
- return;
- }
-
- // If we do not have a file at destination location, but we do have at temp location,
- // it probably means something wrong happened the last time we tried to write it.
- // So, try to recover the backup file. And, if successful, write the new one.
- copy(temp, destination);
- }
-
- output = new BufferedOutputStream(new FileOutputStream(temp));
- }
-
- /**
- * Close the stream.
- */
- public void close() throws IOException {
-
- try {
- output.close();
- }
- catch (IOException e) {
- failed = true;
- throw e;
- }
-
- if (failed) {
- temp.delete();
- }
- else {
- commit();
- }
- }
-
- /**
- * Commit the temporary file to the destination.
- */
- protected void commit() throws IOException {
-
- if (!temp.exists()) {
- return;
- }
-
- destination.delete();
- copy(temp, destination);
- temp.delete();
- }
-
- /**
- * Copy contents of one file to another.
- * @param sourceFile the source file
- * @param destinationFile the destination file
- */
- protected void copy(File sourceFile, File destinationFile) throws IOException {
-
- if (!sourceFile.exists()) {
- return;
- }
-
- FileInputStream source = new FileInputStream(sourceFile);
- FileOutputStream destination = new FileOutputStream(destinationFile);
- transferData(source, destination);
- }
-
- /**
- * Create the temporary file at the given path.
- * @param tempPath the path of the temporary file to be created
- */
- protected void createTempFile(String tempPath) throws IOException {
-
- if (tempPath == null) {
- tempPath = destination.getAbsolutePath() + BACKUP_EXTENSION;
- }
-
- temp = new File(tempPath);
- }
-
- /**
- * Flush the stream.
- */
- public void flush() throws IOException {
- try {
- output.flush();
- } catch (IOException e) {
- failed = true;
- throw e; // rethrow
- }
- }
-
- /**
- * Get the temporary file path.
- * @return the path of the temporary file
- */
- public String getTempFilePath() {
- return temp.getAbsolutePath();
- }
-
- /**
- * Transfers data from one stream to another.
- * @param source stream
- * @param destination stream
- */
- protected void transferData(InputStream source, OutputStream destination) throws IOException {
-
- try {
- byte[] buffer = new byte[8192];
-
- while (true) {
- int bytesRead = source.read(buffer);
-
- if (bytesRead == -1) {
- break;
- }
-
- destination.write(buffer, 0, bytesRead);
- }
- }
- finally {
- try {
- source.close();
- }
- catch (IOException e) {
- }
-
- try {
- destination.close();
- }
- catch (IOException e) {
- }
- }
- }
-
- /**
- * Write an integer.
- * @param b the integer to write
- */
- public void write(int b) throws IOException {
-
- try {
- output.write(b);
- }
- catch (IOException e) {
- failed = true;
- throw e;
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java
deleted file mode 100644
index caecc53ec..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java
+++ /dev/null
@@ -1,800 +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) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * Martin Oberhuber (Wind River) - [199573] Fix potential threading issues in SystemTempFileListener
- * David McKnight (IBM) - [205297] Editor upload should not be on main 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) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
- * David McKnight (IBM) - [235221] Files truncated on exit of Eclipse
- * David McKnight (IBM) - [251631] NullPointerException in SystemTempFileListener
- * David McKnight (IBM) - [256048] Saving a member open in Remote LPEX editor while Working Offline doesn't set the dirty property
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ISaveContext;
-import org.eclipse.core.resources.ISaveParticipant;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-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.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.rse.core.IRSESystemType;
-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.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-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.files.core.subsystems.RemoteFileSubSystem;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * This class manages listening for resource changes within our temp file project
- * It is used for listening to saves made in the editor so that we can upload
- * changes to the remote files. */
-public abstract class SystemTempFileListener implements IResourceChangeListener
-{
- private class TempFileSaveParticipant implements ISaveParticipant
- {
- private SystemTempFileListener _listener;
-
- public TempFileSaveParticipant(SystemTempFileListener listener){
- _listener = listener;
- }
-
- public void doneSaving(ISaveContext context) {
- }
-
- public void prepareToSave(ISaveContext context) throws CoreException {
- }
-
- public void rollback(ISaveContext context) {
- }
-
- public void saving(ISaveContext context) throws CoreException {
-
- // wait for completion of synch
- while (isSynching()){
- try {
- Thread.sleep(1000);
- }
- catch (Exception e){
-
- }
- }
- }
-
- private boolean isSynching()
- {
- return _isSynching || _changedResources.size() > 0;
- }
-
- }
-
- private ArrayList _changedResources;
- private ArrayList _ignoredFiles = new ArrayList();
- private volatile boolean _isSynching;
- private boolean _isEnabled;
-
- public SystemTempFileListener()
- {
- _changedResources = new ArrayList();
- _isSynching = false;
- _isEnabled = true;
-
- ISaveParticipant saveParticipant = new TempFileSaveParticipant(this);
- try {
- ResourcesPlugin.getWorkspace().addSaveParticipant(Activator.getDefault(), saveParticipant);
- }
- catch (CoreException e){
- SystemBasePlugin.logError("Exception adding save participant", e); //$NON-NLS-1$
- }
- }
-
- public void setEnabled(boolean flag)
- {
- _isEnabled = flag;
- }
-
- public void addIgnoreFile(IFile toIgnore)
- {
- _ignoredFiles.add(toIgnore);
- }
-
- public void removeIgnoreFile(IFile toNotIgnore)
- {
- _ignoredFiles.remove(toNotIgnore);
- }
-
- public boolean isIgnorable(IFile file)
- {
- if (_ignoredFiles.contains(file))
- {
- return true;
- }
- else
- {
- IPath location = file.getLocation();
-
- if (location == null){
- // linked into remote file system -- ignore in tempfile listener
- return true;
- }
- else {
- String path = location.toString().toLowerCase();
-
- for (int i = 0; i < _ignoredFiles.size(); i++)
- {
- IFile cfile = (IFile)_ignoredFiles.get(i);
- String cpath = cfile.getLocation().toString().toLowerCase();
- if (path.equals(cpath))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
-
-
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event)
- {
- if (_isEnabled)
- {
- IResourceDelta delta = event.getDelta();
- if (delta != null)
- {
- if (preScanForTempFiles(delta))
- {
- // a temp file has changed
- // synchronize temp file with remote file
- processDelta(delta);
-
- if (_changedResources.size() > 0 && !_isSynching)
- {
- // indicating synching here instead of in SynchResourcesJob because
- // otherwise two calls can get into here creating two jobs
- _isSynching = true;
- synchRemoteResourcesOnThread();
- }
- }
- else
- {
- if (!RSECorePlugin.getThePersistenceManager().isBusy())
- {
- List changes = new ArrayList();
- checkLocalChanges(delta, changes);
- refreshRemoteResourcesOnMainThread(changes);
- }
- }
- }
- }
- }
-
- public class RefreshResourcesJob extends UIJob
- {
- private List _resources;
- public RefreshResourcesJob(List resources)
- {
- super(FileResources.RSEOperation_message);
- _resources = resources;
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor)
- {
- monitor.beginTask(FileResources.MSG_SYNCHRONIZE_PROGRESS, _resources.size());
- for (int i = 0; i < _resources.size(); i++)
- {
- Object resource = _resources.get(i);
- refreshRemoteResource(resource);
- monitor.worked(1);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- }
-
- /***
- * @deprecated don't use this class, it's only here because to remove it would be
- * an API change, and we can't do that until 3.0. Instead of using this,
- * SynchResourcesJob should be used.
- */
- public class RefreshResourcesUIJob extends WorkbenchJob
- {
- public RefreshResourcesUIJob()
- {
- super(FileResources.RSEOperation_message);
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor)
- {
- _isSynching = true;
- try {
- IFile[] filesToSync;
- synchronized(_changedResources) {
- filesToSync = (IFile[])_changedResources.toArray(new IFile[_changedResources.size()]);
- _changedResources.clear();
- }
- monitor.beginTask(FileResources.MSG_SYNCHRONIZE_PROGRESS, IProgressMonitor.UNKNOWN);
- setName(FileResources.MSG_SYNCHRONIZE_PROGRESS);
- for (int i = 0; i < filesToSync.length; i++)
- {
- synchronizeTempWithRemote(filesToSync[i], monitor);
- }
- } finally {
- _isSynching = false;
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- }
-
-
-
- /**
- * Used for doing the upload from a job
- * @author dmcknigh
- *
- */
- private class SynchResourcesJob extends Job
- {
- public SynchResourcesJob()
- {
- super(FileResources.RSEOperation_message);
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- try {
- // using while loop because changed resources could get added after the original batch
- while (!_changedResources.isEmpty()){
- IFile[] filesToSync;
- synchronized(_changedResources) {
- filesToSync = (IFile[])_changedResources.toArray(new IFile[_changedResources.size()]);
- _changedResources.clear();
- }
-
- monitor.beginTask(FileResources.MSG_SYNCHRONIZE_PROGRESS, IProgressMonitor.UNKNOWN);
- setName(FileResources.MSG_SYNCHRONIZE_PROGRESS);
- for (int i = 0; i < filesToSync.length; i++)
- {
- synchronizeTempWithRemote(filesToSync[i], monitor);
- }
- }
- }
- catch (Exception e){
- e.printStackTrace();
- }
- finally {
- _isSynching = false;
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- }
-
- private void refreshRemoteResourcesOnMainThread(List resources)
- {
- RefreshResourcesJob job = new RefreshResourcesJob(resources);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- }
-
- private void synchRemoteResourcesOnThread()
- {
- SynchResourcesJob job = new SynchResourcesJob();
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- }
-
- protected void checkLocalChanges(IResourceDelta delta, List changes)
- {
- IResourceDelta[] children = delta.getAffectedChildren();
- for (int i = 0; i < children.length; i++)
- {
- IResourceDelta child = children[i];
-
- // DKM - case where local resource changes that local subsystem happens to be looking at
- int kind = child.getKind();
- boolean noChange = (kind == IResourceDelta.NO_CHANGE);
- if (noChange)
- return;
-
- boolean isChanged = (kind == IResourceDelta.CHANGED);
- boolean isDeleted = (kind == IResourceDelta.REMOVED);
- boolean isAdded = (kind == IResourceDelta.ADDED);
- boolean isMovedTo = (kind == IResourceDelta.MOVED_TO);
- boolean isMovedFrom = (kind == IResourceDelta.MOVED_FROM);
-
- IResource resource = child.getResource();
-
- String pathOfChild = null;
- String pathOfParent = null;
-
- IPath location = resource.getLocation();
- if (location == null)
- {
- // deleted resource
- String projectPath = child.getFullPath().toOSString();
- String workspacePath = SystemBasePlugin.getWorkspaceRoot().getLocation().toOSString();
-
- pathOfChild = workspacePath + projectPath;
- pathOfParent = (new File(pathOfChild)).getParent();
- }
- else
- {
- pathOfChild = resource.getLocation().toOSString();
- pathOfParent = resource.getParent().getLocation().toOSString();
- }
-
-
-
- if (isChanged)
- {
- checkLocalChanges(child, changes);
- }
- else
- {
- RemoteFileSubSystem fs = (RemoteFileSubSystem)getLocalFileSubSystem();
- if (fs == null) return; // MJB: Defect 45678
-
- IRemoteFile remoteFile = fs.getCachedRemoteFile(pathOfChild);
- if (remoteFile != null)
- {
- remoteFile.markStale(true);
- }
-
- IRemoteFile cachedParent = fs.getCachedRemoteFile(pathOfParent);
- if (cachedParent == null)
- return;
-
- cachedParent.markStale(true);
- if (!changes.contains(cachedParent))
- {
- changes.add(cachedParent);
- }
- if (isDeleted)
- {
- //System.out.println("deleted="+isDeleted);
- }
- else if (isAdded)
- {
- //System.out.println("added="+isAdded);
- }
- else if (isMovedTo)
- {
- //System.out.println("movedto="+isMovedTo);
- }
- else if (isMovedFrom)
- {
- //System.out.println("movedfrom="+isMovedFrom);
- }
- }
-
- }
- }
-
- 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.isDisposed() && winShell.isVisible())
- {
- shell = winShell;
- return win;
- }
- else
- {
- win = null;
- }
- }
-
- return new ProgressMonitorDialog(shell);
- }
- }
- /**
- * Check the delta for changed temporary files. If
- * any are found, synchronize the temporary files with
- * the corresponding remote files.
- *
- * @param delta the delta to compare
- */
- protected void processDelta(IResourceDelta delta)
- {
- IResourceDelta[] children = delta.getAffectedChildren();
- for (int i = 0; i < children.length; i++)
- {
- IResourceDelta child = children[i];
-
- IResource resource = child.getResource();
-
- if (resource instanceof IFile)
- {
-
- // see if this temp file has been changed
- int ckind = child.getKind();
- boolean isChanged = ckind == IResourceDelta.CHANGED;
- int flags = child.getFlags();
- boolean contentChanged = (isChanged && (flags & IResourceDelta.CONTENT) != 0);
-
- if (contentChanged)
- {
- //TODO PROBLEM!! - Eclipse threading means the file may not be ignorable when this event comes in
- // - we need to know if this is via edit or not!
- if (!_changedResources.contains(resource) && !isIgnorable((IFile)resource))
- {
- SystemIFileProperties properties = new SystemIFileProperties(resource);
- long t1 = properties.getDownloadFileTimeStamp();
-
- // 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.
- long t2 = resource.getLocation().toFile().lastModified();
-
- if (t1 != t2)
- {
- String ssStr = properties.getRemoteFileSubSystem();
- if (ssStr != null)
- {
- ISubSystem ss = RSECorePlugin.getTheSystemRegistry().getSubSystem(ssStr);
- if (doesHandle(ss))
- {
- synchronized(_changedResources) {
- //avoid ConcurrentModificationException
- _changedResources.add(resource);
- }
- }
- }
- }
- }
-
- // KM - commenting out everything below to avoid doing checks as to whether
- // the file is opened in an editor. The check means that for cases
- // where the remote file was opened using an external editor, there
- // won't be a save back to the host, even when the user refreshes the temp project
- // or the file.
-
- /* DKM - can't remember why I did this, but it might be obsolete now
- * need to be able to save remotely regardless whether it's being edited that way or not
- */
- ///*
- // check if this file is being edited
- /*IWorkbenchWindow window = RSEUIPlugin.getActiveWorkbenchWindow();
- if (window == null)
- {
- // DKM:
- //no window, so forget about editors...just save
- // whenever refresh() is done (regardless of changes we hit this
- // we should only do something here when on main thread
- //_changedResources.add(resource);
- }
- else
- {
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- {
- IEditorReference[] references = page.getEditorReferences();
- for (int e = 0; e < references.length; e++)
- {
- IEditorReference ref = references[e];
- IEditorPart editorPart = ref.getEditor(false);
- if (editorPart != null)
- {
- IEditorInput input = editorPart.getEditorInput();
- if (input != null && input instanceof FileEditorInput)
- {
- FileEditorInput finput = (FileEditorInput) input;
- IFile eFile = finput.getFile();
- String eLoc = eFile.getLocation().toString();
-
- if (eLoc.equals(loc))
- {
- // add to list of pending resource changes
- if (!_changedResources.contains(resource))
- {
- _changedResources.add(resource);
- }
- /// DKM - shouldn't return
- //return;
- }
- }
- else if (input != null && input instanceof SystemCompareInput)
- {
- SystemCompareInput compareInput = (SystemCompareInput) input;
- IResource lFile = compareInput.getLeftResource();
- IResource rFile = compareInput.getRightResource();
-
- String lLoc = lFile.getLocation().toString();
- if (lLoc.equals(loc))
- {
- // add to list of pending resource changes
- if (!_changedResources.contains(resource))
- {
- _changedResources.add(resource);
- }
- }
-
- String rLoc = rFile.getLocation().toString();
- if (rLoc.equals(loc))
- {
- // add to list of pending resource changes
- if (!_changedResources.contains(resource))
- {
- _changedResources.add(resource);
- }
- }
- }
- }
- }
- }
- }*/
-
- // DKM - shouldn't return
- //return;
- }
- }
- else
- {
- // recursively check the subdelta of this delta
- processDelta(child);
- }
- }
- }
-
- /**
- * Synchronize a temporary file with it's corresponding remote file.
- * First we need to determine what the corresponding remote file is.
- * Then we need to compare timestamps to determine how to synchronize.
- *
- * @param file the temporary file to synchronize
- */
- protected void synchronizeTempWithRemote(IFile file, IProgressMonitor monitor)
- {
- // first determine associated remote file
- IPath path = file.getFullPath();
- int numSegments = path.segmentCount();
-
- // first we need to find the right RemoteFileSubSystem for the remote file
- SystemIFileProperties properties = new SystemIFileProperties(file);
-
- // before doing anything, check that the stored time stamp is not empty
- if (properties.getRemoteFileTimeStamp() == 0)
- {
- // we just downloaded this and that's why we hit an event
- return;
- }
-
- ISubSystem fs = null;
-
- // get the subsystem ID property from the temporary file
- String subsystemId = properties.getRemoteFileSubSystem();
-
- // the subsystem ID may not exist if the temporary file existed before this feature
- // to handle migration of this smoothly, we can use another method to determine the subsystem
- if (subsystemId != null)
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- fs = registry.getSubSystem(subsystemId);
- }
-
- if (fs != null)
- {
- // use the remote file path property of the temp file to determine the path of the remote file
- // on the remote system
- String uploadPath = properties.getRemoteFilePath();
-
- // the uploadPath property may not exist if the temporary file existed before this feature
- // to handle migration of this smoothly, we can use another method to determine the remote file path
- if (uploadPath == null)
- {
- // derive the path from the temporary file path
- IRSESystemType systemType = fs.getHost().getSystemType();
-
- // on windows systems, we need to take into account drives and different separators
- boolean isWindows = systemType.isWindows();
-
- char fileSeparator = isWindows ? '\\' : '/';
- StringBuffer remotePath = new StringBuffer(""); //$NON-NLS-1$
- for (int i = 3; i < numSegments; i++)
- {
- if (i == 3)
- {
- if (!isWindows)
- {
- remotePath.append(fileSeparator);
- }
- }
- if (i > 3)
- {
- if (i == 4)
- {
- if (isWindows)
- {
- remotePath.append(":"); //$NON-NLS-1$
- }
- }
-
- remotePath.append(fileSeparator);
- }
-
- String seg = path.segment(i);
- remotePath.append(seg);
- }
-
- uploadPath = remotePath.toString();
- }
-
- // attempt the remote file synchronization
- if (doesHandle(fs))
- {
- if (!fs.isOffline()){
- // see if we're connected
- try
- {
- // check that the remote file system is connected
- // if not, attempt to connect to it
- if (!fs.isConnected())
- {
- // make sure we connect synchronously from here
- fs.connect(monitor, false);
- }
- }
- catch (Exception e)
- {
- // unable to connect to the remote server
- // do not attempt synchronization
- // instead, defer synchronization to later but allow user to edit
- // set the dirty flag to indicate that this file needs resynchronization
- properties.setDirty(true);
-
- // as per bug 256048 - comment#6 if we're not connected follow through to
- // doResourceSynchronization so we have the change to mark the SystemTextEditor dirty
- }
- }
- doResourceSynchronization(fs, file, uploadPath, monitor);
- }
- }
- }
-
- protected void refreshRemoteResource(Object parent)
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- // refresh
- if (parent != null)
- {
- registry.fireEvent(new SystemResourceChangeEvent(parent, ISystemResourceChangeEvents.EVENT_REFRESH, null));
-
-
- List filterReferences = registry.findFilterReferencesFor(parent, getLocalFileSubSystem());
- for (int i = 0; i < filterReferences.size(); i++)
- {
- ISystemFilterReference filterRef = (ISystemFilterReference)filterReferences.get(i);
- filterRef.markStale(true);
- registry.fireEvent(new SystemResourceChangeEvent(filterRef, ISystemResourceChangeEvents.EVENT_REFRESH, null));
- }
- }
- }
-
-
- /**
- * Synchronize the specified remote file with the temporary local file using the
- * specified remote file subsystem.
- *
- * @param subsystem the remote file subsystem of the remote file
- * @param tempFile the temporary file
- * @param resourceId the remote file
- * @param monitor the progress monitor
- */
- protected abstract void doResourceSynchronization(ISubSystem subsystem, IFile tempFile, String resourceId, IProgressMonitor monitor);
-
- /**
- * Indicate whether this tempfile listener handles the specified
- * @param subsystem the subsystem to check
- * @return whether it handles this or not
- */
- protected abstract boolean doesHandle(ISubSystem subsystem);
-
- private IRemoteFileSubSystem getLocalFileSubSystem()
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- IHost con = registry.getLocalHost();
- if (con != null)
- {
- return RemoteFileUtility.getFileSubSystem(con);
- }
- return null;
- }
-
-
- /**
- * Prescan for changes that correspond the temp files project
- */
- protected boolean preScanForTempFiles(IResourceDelta delta)
- {
- if (delta == null)
- {
- return true; // not sure when we'd get this
- }
-
- // does temp files exist
- if (!SystemRemoteEditManager.getInstance().doesRemoteEditProjectExist())
- return false;
-
- IResourceDelta[] subdeltas = delta.getAffectedChildren();
- if (subdeltas.length > 0)
- {
- IResource resource = subdeltas[0].getResource();
- if ((resource != null) && (resource.getType() == IResource.PROJECT))
- {
- if (resource.getName().equals(SystemRemoteEditManager.REMOTE_EDIT_PROJECT_NAME))
- {
- return true;
- }
- }
- }
- return false;
- }
-
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java
deleted file mode 100644
index 26baafc15..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2011 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) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * David McKnight (IBM) - [205297] Editor upload should not be on main thread
- * David McKnight (IBM) - [195285] mount path mapper changes
- * Kevin Doyle (IBM) - [197976] Synch up Read-Only attribute when performing save based on local copy
- * Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file
- * Kevin Doyle (IBM) - [210389] Display error dialog when setting file not read-only fails when saving
- * David McKnight (IBM) - [235221] Files truncated on exit of Eclipse
- * David McKnight (IBM) - [249544] Save conflict dialog appears when saving files in the editor
- * David McKnight (IBM) - [256048] Saving a member open in Remote LPEX editor while Working Offline doesn't set the dirty property
- * David McKnight (IBM) - [191284] Confusing behaviour when editing a Readonly file.
- * David McKnight (IBM) - [334839] File Content Conflict is not handled properly
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-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.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.files.ui.actions.SystemUploadConflictAction;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-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.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.DisplaySystemMessageAction;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.WorkbenchActivityHelper;
-
-/**
- * This class manages listening for resource changes within our temp file project
- * It is used for listening to saves made in the editor so that we can upload
- * changes to the remote files. This class specifically handles universal files
- * and doesn't do anything for iSeries. For iSeries members we need to subclass this.
- */
-public class SystemUniversalTempFileListener extends SystemTempFileListener
-{
- private static SystemUniversalTempFileListener _instance = null;
-
- private ArrayList _editedFiles = new ArrayList();
-
- /**
- * Return singleton
- */
- public static SystemUniversalTempFileListener getListener()
- {
- if (_instance == null)
- {
- _instance = new SystemUniversalTempFileListener();
- }
- return _instance;
- }
-
- public void registerEditedFile(SystemEditableRemoteFile editMember)
- {
- _editedFiles.add(editMember);
- }
-
- public void unregisterEditedFile(SystemEditableRemoteFile editMember)
- {
- _editedFiles.remove(editMember);
- }
-
- public SystemEditableRemoteFile getEditedFile(IRemoteFile file)
- {
- for (int i = 0; i < _editedFiles.size(); i++)
- {
- SystemEditableRemoteFile efile = (SystemEditableRemoteFile) _editedFiles.get(i);
- if (efile != null)
- {
- IRemoteFile editedFile = efile.getRemoteFile();
- if (editedFile.getAbsolutePathPlusConnection().equals(file.getAbsolutePathPlusConnection()))
- {
- return efile;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Indicate whether this tempfile listener handles the specified
- * @param subsystem the subsystem to check
- * @return whether it handles this or not
- */
- protected boolean doesHandle(ISubSystem subsystem)
- {
- if (subsystem instanceof IRemoteFileSubSystem)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Synchronize the specified remote file with the temporary local file using the
- * specified remote file subsystem.
- *
- * @param subsystem the remote file subsystem of the remote file
- * @param tempFile the temporary file
- * @param resourceId the remote file
- * @param monitor progress monitor
- */
- protected void doResourceSynchronization(ISubSystem subsystem, IFile tempFile, String resourceId, IProgressMonitor monitor)
- {
- if (subsystem instanceof IRemoteFileSubSystem)
- {
- IRemoteFileSubSystem fs = (IRemoteFileSubSystem) subsystem;
-
- // first we need to get the stored timestamp property and the actual remote timestamp
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- // make sure we're working online
- // also as per bug 256048 - comment#6 if we're not connected we still need to do the same thing
- if (fs.isOffline() || !fs.isConnected())
- {
- // offline mode - make sure the file stays dirty
- properties.setDirty(true);
-
- // try to reset the dirty indicator for the editor if it's open
- // will only work for lpex right now
- SystemEditableRemoteFile editable = null;
- if (properties.getRemoteFileObject() instanceof SystemEditableRemoteFile){
- editable = (SystemEditableRemoteFile)properties.getRemoteFileObject();
- editable.updateDirtyIndicator();
- }
-
- return;
- }
- else
- {
- // for mounting...
- //if (fs.getHost().getSystemType().isLocal())
- {
- boolean isMounted = properties.getRemoteFileMounted();
- if (isMounted)
- {
- String mappedHostPath = properties.getResolvedMountedRemoteFilePath();
- String mappedHostName = properties.getResolvedMountedRemoteFileHost();
- String systemRemotePath = SystemRemoteEditManager.getInstance().getMountPathFor(mappedHostName, mappedHostPath, (IRemoteFileSubSystem)subsystem);
-
- if (systemRemotePath == null)
- {
- // mount no longer exists - just return for now
- return;
- }
- if (!systemRemotePath.equals(resourceId))
- {
- // remote path
- resourceId = systemRemotePath;
- properties.setRemoteFilePath(systemRemotePath);
- }
- }
- }
- }
-
- try
- {
- IRemoteFile remoteFile = fs.getRemoteFileObject(resourceId, monitor);
-
- if (remoteFile != null)
- {
-
- // make sure we have uptodate file
- remoteFile.markStale(true);
- remoteFile = fs.getRemoteFileObject(resourceId, monitor);
-
- // get modification stamp and dirty state
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
-
- // If remote file is read-only make it writable as the local
- // copy has changed to be writable
- if (remoteFile.exists() && !remoteFile.canWrite() && !tempFile.isReadOnly()) {
- IRemoteFileSubSystem ss = remoteFile.getParentRemoteFileSubSystem();
- ss.setReadOnly(remoteFile, false, monitor);
-
- // the remote file is still marked read-only, we need to requery the file (i.e. for SSH and FTP)
- if (!remoteFile.canWrite()){
- remoteFile.markStale(true);
- remoteFile = ss.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
- }
- }
-
- boolean openEditorAfterUpload = false;
-
- // get associated editable
- SystemEditableRemoteFile editable = getEditedFile(remoteFile);
- if (editable != null && storedModifiedStamp == 0)
- {
- return;
-
- }
- else if (editable == null)
- {
- Object remoteObject = properties.getRemoteFileObject();
- if (remoteObject != null && remoteObject instanceof SystemEditableRemoteFile)
- {
- editable = (SystemEditableRemoteFile) remoteObject;
- }
- else
- {
- editable = new SystemEditableRemoteFile(remoteFile);
- }
-
- openEditorAfterUpload = true;
- editable.setLocalResourceProperties();
- }
-
- upload(fs, remoteFile, tempFile, properties, storedModifiedStamp, editable, monitor);
-
- if (openEditorAfterUpload){
- // moving this to after the upload because otherwise it queries the remote file and that messes up the timestamps needed by upload
- final SystemEditableRemoteFile fEditable = editable;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
-
- // defect - we get a save event when saving during a close
- // in that case, we shouldn't reopen the editor
- // I think this was originally here so that, if a save is done on
- // a file that hasn't yet been wrapped with an editable, we can
- // set the editor member
- // now call check method before
- if (fEditable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN)
- {
- try {
- fEditable.openEditor(); // open e
- }
- catch (PartInitException e) {
- }
- }
-
- fEditable.addAsListener();
- }
- });
- }
- }
- }
- catch (SystemMessageException e) {
- DisplaySystemMessageAction msgAction = new DisplaySystemMessageAction(e.getSystemMessage());
- Display.getDefault().syncExec(msgAction);
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage());
- }
- }
-
- }
-
- /**
- * This method attempts to upload a temporary file in the workspace to a corresponding remote file location. It
- * checks whether the timestamp of the remote file has changed since the temporary file was last known to
- * be in synch with the remote file. If the timestamp has not changed, then it is assumed that the remote
- * file has not changed and therefore it is safe to do an upload. If the timestamp has changed, then the remote
- * file must have changed independently and there is a conflict and the upload conflict action is invoked.
- *
- * <p>
- * <b>Warning</b> It is important to make sure that the remoteFile that gets passed in is up-to-date AND is the
- * current cached version. If the remoteFile is not up-to-date then the timestamp of the actual remote file may
- * be wrong and lead to the following problems:
- *
- * <ul>
- * <li> If the detected remote timestamp is not the actual remote timestamp but it is the same as the storedModifiedStamp, an
- * upload without detecting a conflict will cause lost data on the remote side!
- * <li> If the detected remote timestamp is not the actual remote timestamp and the actual timestamp is the same as the
- * storedModifiedStamp, a conflict will be indicated that doesn't actually exist
- * </ul>
- *
- * If the remoteFile is not the current cached version then the following problem occurs. After the upload, the remote file is
- * marked stale so that the up-to-date remote file can be retrieved with the updated actual timestamp. Because the remoteFile
- * that was passed into this method is not the cached version, marking it stale will not mark the cached version stale and
- * thus, when a re-query of the file is done after the upload, the original cached version gets returned as opposed to a fresh
- * version with the correct timestamp.
- *
- * <p>
- * Because of these problems, it is recommended that, before calling upload(), the remoteFile is retrieved from the cache and is
- * marked stale like the following example:
- *
- * <code>
- * ...
- * // get the remote file from the cache
- * IRemoteFile remoteFile = fs.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
- *
- * // mark it stale
- * remoteFile.markStale(true);
- *
- * // re-query the remote file to make sure you have the latest
- * remoteFile = fs.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
- *
- * // call upload
- * upload(fs, remoteFile, ...);
- * ....
- * </code>
- *
- *
- * @param fs the file subsystem that corresponds with the file to upload
- * @param remoteFile the remote file location to upload to
- * @param tempFile the source temp file to upload
- * @param properties the remote file properties of the file to upload
- * @param storedModifiedStamp the last timestamp of the remote file for which a temp file was in synch with the remote file
- * @param editable the wrapper that associates the remote file, temp file and editor together
- * @param monitor the progress monitor
- */
- public void upload(IRemoteFileSubSystem fs, IRemoteFile remoteFile, IFile tempFile, SystemIFileProperties properties,
- long storedModifiedStamp, SystemEditableRemoteFile editable, IProgressMonitor monitor)
- {
- try
- {
- // get the remote modified timestamp
- long remoteModifiedStamp = remoteFile.getLastModified();
-
-
- boolean remoteFileDeleted = !remoteFile.exists();
- // compare timestamps
- if (remoteFileDeleted || (storedModifiedStamp == remoteModifiedStamp))
- {
- // timestamps are the same, so the remote file hasn't changed since our last download
- try
- {
- // upload our pending changes to the remote file
- String srcEncoding = tempFile.getCharset(true);
-
- if (srcEncoding == null) {
- srcEncoding = remoteFile.getEncoding();
- }
-
- fs.upload(tempFile.getLocation().makeAbsolute().toOSString(), remoteFile, srcEncoding, monitor);
- }
-
- catch (RemoteFileSecurityException e)
- {
- DisplaySystemMessageAction msgAction = new DisplaySystemMessageAction(e.getSystemMessage());
- Display.getDefault().syncExec(msgAction);
- }
- catch (RemoteFileIOException e)
- {
- DisplaySystemMessageAction msgAction = new DisplaySystemMessageAction(e.getSystemMessage());
- Display.getDefault().syncExec(msgAction);
- }
- catch (Exception e)
- {
- RemoteFileIOException exc = new RemoteFileIOException(e);
- DisplaySystemMessageAction msgAction = new DisplaySystemMessageAction(exc.getSystemMessage());
- Display.getDefault().syncExec(msgAction);
- }
-
- // requery the file so get the new timestamp
- remoteFile.markStale(true);
- remoteFile =fs.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor);
-
- IRemoteFile parent = remoteFile.getParentRemoteFile();
-
-
- long ts = remoteFile.getLastModified();
-
- // set the stored timestamp to be the same as the remote timestamp
- properties.setRemoteFileTimeStamp(ts);
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- // refresh
- if (parent != null)
- {
- registry.fireEvent(new SystemResourceChangeEvent(parent, ISystemResourceChangeEvents.EVENT_REFRESH, null));
- }
-
- registry.fireEvent(new SystemResourceChangeEvent(remoteFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, remoteFile));
-
-
- // indicate that the temp file is no longer dirty
- properties.setDirty(false);
- if (editable.isDirty())
- editable.updateDirtyIndicator();
- }
- else if (storedModifiedStamp == -1)
- {
- // hack because Eclipse send out event after replacing local file with remote
- // we don't want to save this!
- // set the stored timestamp to be the same as the remote timestamp
- properties.setRemoteFileTimeStamp(remoteFile.getLastModified());
- }
- else
- {
- // conflict
- // determine which file has a newer timestamp
- final boolean remoteNewer = remoteModifiedStamp > storedModifiedStamp;
-
- // case 1: the remote file has changed since our last download
- // it's new timestamp is newer than our stored timestamp (file got
- // updated)
-
- // case 2: the remote file has changed since our last download
- // it's new timestamp is older than our stored timestamp (file got
- // replaced with an older version)
-
- // prompt user with dialog **** Prompt Dialog 1
- // 1) Overwrite local
- // 2) Overwrite remote
- // 3) Save as...
- // 4) Cancel
-
- final SystemEditableRemoteFile remoteEdit = editable;
- final IFile tFile = tempFile;
- final IRemoteFile rFile = remoteFile;
- final SystemIFileProperties fProperties = properties;
-
- // upload is run in a job, so the conflict action/dialog needs to run in UI thread
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run()
- {
- boolean closing = PlatformUI.getWorkbench().isClosing();
- Shell shell = null;
- if (closing){
- shell = Display.getDefault().getActiveShell();
- }
- else {
- shell = RSEUIPlugin.getTheSystemRegistryUI().getShell();
- }
- SystemUploadConflictAction conflictAction = new SystemUploadConflictAction(shell, tFile, rFile, remoteNewer);
- conflictAction.run();
- if (fProperties.getDirty()){
- remoteEdit.updateDirtyIndicator();
- }
- }
- });
-
-
-
-
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java
deleted file mode 100644
index 4cd702b2c..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java
+++ /dev/null
@@ -1,3185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 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:
- * Michael Scharf (Wind River) - Fix 163844: InvalidThreadAccess in checkForCollision
- * 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) - [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) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * Xuan Chen (IBM) - [187548] Editor shows incorrect file name after renaming file on Linux dstore
- * David McKnight (IBM) - [191472] should not use super transfer with SSH/FTP Folder Copy and Paste
- * Xuan Chen (IBM) - [191367] with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work
- * Xuan Chen (IBM) - [201790] [dnd] Copy and Paste across connections to a Drive doesn't work
- * Xuan Chen (IBM) - [202668] [supertransfer] Subfolders not copied when doing first copy from dstore to Local
- * Xuan Chen (IBM) - [202670] [supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted"
- * Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
- * David McKnight (IBM) - [205819] Need to use input stream copy when EFS files are the src
- * David McKnight (IBM) - [195285] mount path mapper changes
- * Kevin Doyle (IBM) - [203014] Copy/Paste Across Connections doesn't display Overwrite dialog when folder already exists
- * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
- * David McKnight (IBM) - [209375] new API copyRemoteResourcesToWorkspaceMultiple to optimize downloads
- * 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, passed through check collision as well through overloading.
- * Xuan Chen (IBM) - [160775] [api] [breaking] [nl] rename (at least within a zip) blocks UI thread
- * David McKnight (IBM) - [203114] don't treat XML files specially (no hidden prefs for bin vs text)
- * David McKnight (IBM) - [209552] get rid of copy APIs to be clearer with download and upload
- * David McKnight (IBM) - [143503] encoding and isBinary needs to be stored in the IFile properties
- * Xuan Chen (IBM) - [191370] [dstore] supertransfer zip not deleted when canceling copy
- * Xuan Chen (IBM) - [210816] Archive testcases throw ResourceException if they are run in batch
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * Rupen Mardirossian (IBM) - [210682] Collisions when doing a copy operation across systems will us the SystemCopyDialog
- * Xuan Chen (IBM) - [229093] set charset of the temp file of the text remote file to its remote encoding
- * Rupen Mardirossian (IBM) - [198728] downloadResourcesToWorkspace now creates empty folders for copying across connections via createEmptyFolders method
- * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
- * Kevin Doyle (IBM) - [227391] Saving file in Eclipse does not update remote file
- * David McKnight (IBM) - [234924] [ftp][dnd][Refresh] Copy/Paste file from Package Explorer doesn't refresh folder
- * David McKnight (IBM) - [236723] UniversalFileTransferUtility..uploadResourcesFromWorkspace should query remote folder encoding
- * Radoslav Gerganov (ProSyst) - [231428] [files] NPE on canceling copy operation from remote host
- * David McKnight (IBM) - [262092] Special characters are missing when pasting a file on a different connection
- * David McKnight (IBM) - [271831] Set the readonly file attribute when download the file
- * David McKnight (IBM) - [251136] Error copying local file to remote system when temp file is readonly
- * 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) - [281712] [dstore] Warning message is needed when disk is full
- * David McKnight (IBM) - [234258] [dnd] Drag&Drop a folder silently ignores elements without permissions
- * David McKnight (IBM) - [299140] Local Readonly file can't be copied/pasted twice
- * David McKnight (IBM) - [298440] jar files in a directory can't be pasted to another system properly
- * David McKnight (IBM) - [311218] Content conflict dialog pops up when it should not
- *******************************************************************************/
-
-package org.eclipse.rse.files.ui.resources;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.internal.resources.Resource;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourceAttributes;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.osgi.util.NLS;
-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.model.SystemRemoteResourceSet;
-import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
-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.SystemFileNameHelper;
-import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
-import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
-import org.eclipse.rse.internal.ui.dialogs.CopyRunnable;
-import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
-import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
-import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
-import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
-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.clientserver.messages.SystemOperationCancelledException;
-import org.eclipse.rse.services.clientserver.messages.SystemUnsupportedOperationException;
-import org.eclipse.rse.services.files.IFileService;
-import org.eclipse.rse.services.files.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.services.files.RemoteFolderNotEmptyException;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-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.IVirtualRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Utility class for doing file transfers on universal systems.
- *
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- */
-public class UniversalFileTransferUtility {
- static final boolean doCompressedTransfer = true;//false;
-
- static final String _rootPath = SystemRemoteEditManager.getInstance().getRemoteEditProjectLocation().makeAbsolute().toOSString();
-
- public static class RenameStatus extends Status {
-
- private static final int CANCEL_ALL = 16;
-
- /**
- * Creates a new RenameStatus object. The created status has no
- * children.
- *
- * @param severity the severity; one of <code>OK</code>,
- * <code>ERROR</code>, <code>INFO</code>,
- * <code>WARNING</code>, or <code>CANCEL</code>
- * @param pluginId the unique identifier of the relevant plug-in
- * @param code the plug-in-specific status code, or <code>OK</code>
- * @param message a human-readable message, localized to the current
- * locale
- * @param exception a low-level exception, or <code>null</code> if not
- * applicable
- */
- public RenameStatus(int severity, String pluginId, int code, String message, Throwable exception) {
- super(severity, pluginId, code, message, exception);
- }
- }
-
- /**
- * Indicates whether super transfer should be used for a particular file transfer. This will return true if both
- * the preference for super transfer is turned on and the subsystem configuration supports archives
- * @param subsystem the subsystem used to transfer files and folders
- * @return true if super transfer should be used
- */
- private static boolean doSuperTransfer(IRemoteFileSubSystem subsystem)
- {
- boolean doSuperTransferProperty = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER) &&
- subsystem.getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
- return doSuperTransferProperty;
- }
-
- /**
- * Transfer a remote file or folder from one remote location to another.
- * @param srcFileOrFolder the file or folder to copy
- * @param tgtFolder the folder to copy to
- * @param monitor the progress monitor
- */
- public static void transferRemoteResource(IRemoteFile srcFileOrFolder, IRemoteFile tgtFolder, IProgressMonitor monitor)
- {
- Object tempSrc = downloadResourceToWorkspace(srcFileOrFolder, monitor);
- if (tempSrc instanceof IResource)
- {
- uploadResourceFromWorkspace((IResource) tempSrc, tgtFolder, monitor);
- }
- }
-
- private static boolean tempFileAvailable(IFile tempFile, IRemoteFile remoteFile) throws RemoteFileIOException
- {
- // before we make the transfer to the temp file check whether a temp file already exists
- if (tempFile.exists() && ((Resource)tempFile).getPropertyManager() != null)
- {
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- String replicaRemoteFilePath = properties.getRemoteFilePath();
- String remoteFilePath = remoteFile.getAbsolutePath();
-
- if (!remoteFilePath.equals(replicaRemoteFilePath)){
- // this temp file is for a file of different case
- Exception e = new Exception(FileResources.FILEMSG_CREATE_FILE_FAILED_EXIST);
- throw new RemoteFileIOException(e);
- }
-
-
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
-
- // compare timestamps
- if (storedModifiedStamp > 0)
- {
- // ;if they're the same, just use temp file
- long remoteModifiedStamp = remoteFile.getLastModified();
-
- boolean usedBin = properties.getUsedBinaryTransfer();
- boolean shouldUseBin = remoteFile.isBinary();
-
- // changed encodings matter too
- String remoteEncoding = remoteFile.getEncoding();
- String lastEncoding = properties.getEncoding();
-
-
- boolean usedReadOnly = properties.getReadOnly();
- boolean isReadOnly = !remoteFile.canWrite();
-
- if (storedModifiedStamp == remoteModifiedStamp &&
- usedBin == shouldUseBin &&
- remoteEncoding.equals(lastEncoding) &&
- usedReadOnly == isReadOnly
- ){
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * replicates a remote file to the temp files project in the workspace
- *
- * @param srcFileOrFolder the file to copy
- * @param monitor the progress monitor
- * @return the resulting local replica, or <code>null</code> if the
- * operation was cancelled before the download was complete
- * @since 3.0
- */
- protected static IFile downloadFileToWorkspace(IRemoteFile srcFileOrFolder, IProgressMonitor monitor)
- {
- IRemoteFileSubSystem srcFS = srcFileOrFolder.getParentRemoteFileSubSystem();
- IResource tempResource = getTempFileFor(srcFileOrFolder);
-
- IFile tempFile = (IFile) tempResource;
-
- boolean available = true;
- try {
- available = tempFileAvailable(tempFile, srcFileOrFolder);
- }
- catch (RemoteFileIOException e){
- // this is the case where a temp file exists for a file of a different case
- // bug 276534
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- Object obj = properties.getRemoteFileObject();
- if (obj != null && obj instanceof SystemEditableRemoteFile)
- {
- SystemEditableRemoteFile editable = (SystemEditableRemoteFile) obj;
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN){
- // editor open for this file
- // for now, best we may be able to do is just keep this one and warn
- String remotePath = editable.getAbsolutePath();
- String msgTxt = NLS.bind(FileResources.FILEMSG_COPY_FILE_FAILED, remotePath);
- String msgDetails = FileResources.FILEMSG_COPY_FILE_FAILED_DETAILS;
-
- final SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR,
- IStatus.WARNING, msgTxt, msgDetails);
-
- runInDisplayThread(new Runnable() {
- public void run() {
- SystemMessageDialog dlg = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), message);
- dlg.open();
- }});
- return null;
- }
- else {
- // get rid of the current temp file
- try {
- tempFile.delete(true, monitor);
- }
- catch (CoreException ex){}
- tempResource = getTempFileFor(srcFileOrFolder);
- tempFile = (IFile) tempResource;
-
- available = false;
- }
- }
- else {
- // file not being edited, so overwrite it
- available = false;
- }
- }
- if (available){
- return tempFile;
- }
-
- try
- {
- // copy remote file to workspace
- SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
- listener.addIgnoreFile(tempFile);
- String remoteEncoding = srcFileOrFolder.getEncoding();
- srcFS.download(srcFileOrFolder, tempFile.getLocation().makeAbsolute().toOSString(), remoteEncoding, monitor);
-
- if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
- {
- // eclipse doesn't like this if the resource appears to be from another project
- try
- {
- //tempFile.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
- tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
- }
- catch (Exception e)
- {
-
- }
- }
- if (tempFile.exists())
- {
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- // set the appropriate readonly flag
- boolean readOnly = !srcFileOrFolder.canWrite();
- setReadOnly(tempFile, readOnly);
-
- // set file properties
- properties.setRemoteFileTimeStamp(srcFileOrFolder.getLastModified());
- properties.setDownloadFileTimeStamp(tempFile.getLocation().toFile().lastModified());
- properties.setReadOnly(readOnly);
- properties.setDirty(false);
-
- if (remoteEncoding != null)
- {
- if (srcFileOrFolder.isBinary())
- {
- if (!tempFile.isSynchronized(IResource.DEPTH_ZERO))
- {
- tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
- }
- if (!tempFile.getCharset().equals(remoteEncoding))
- {
- tempFile.setCharset(remoteEncoding, null);
- }
- }
- else
- {
- // using text mode so the char set needs to be local
- if (properties.getLocalEncoding() != null){
- String localEncoding = properties.getLocalEncoding();
- tempFile.setCharset(localEncoding, null);
- }
- // otherwise, the default charset is inherited so no need to set
- }
- }
- }
- listener.removeIgnoreFile(tempFile);
- }
- catch (SystemOperationCancelledException soce) {
- return null;
- }
- catch (final SystemMessageException e)
- {
- runInDisplayThread(new Runnable() {
- public void run() {
- SystemMessageDialog dlg = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), e.getSystemMessage());
- dlg.open();
- }});
- return null;
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
-
- return (IFile) tempResource;
- }
-
- protected static void setIFileProperties(IFile tempFile, IRemoteFile remoteFile, IRemoteFileSubSystem subSystem)
- {
- // set it's properties for use later
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- // set remote properties
- properties.setRemoteFileTimeStamp(remoteFile.getLastModified());
- properties.setDirty(false);
-
- String remotePath = remoteFile.getAbsolutePath();
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
- properties.setRemoteFileSubSystem(subSystemId);
- properties.setRemoteFilePath(remotePath);
-
-
- properties.setEncoding(remoteFile.getEncoding());
- properties.setUsedBinaryTransfer(remoteFile.isBinary());
-
- // 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.
- properties.setDownloadFileTimeStamp(tempFile.getLocation().toFile().lastModified());
-
- boolean isMounted = isRemoteFileMounted(subSystem, remotePath);
- properties.setRemoteFileMounted(isMounted);
- if (isMounted)
- {
- String actualRemoteHost = getActualHostFor(subSystem, remotePath);
- String actualRemotePath = getWorkspaceRemotePath(subSystem, remotePath);
- properties.setResolvedMountedRemoteFileHost(actualRemoteHost);
- properties.setResolvedMountedRemoteFilePath(actualRemotePath);
- }
- }
-
- /**
- * Used for local files - special case!
- * @param tempFile
- * @param remoteFile
- * @param hostname
- * @param userId
- * @since 3.0
- */
- protected static void setIFileProperties(IFile tempFile, File remoteFile, String hostname, String userId)
- {
- // set it's properties for use later
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- // set remote properties
- properties.setRemoteFileTimeStamp(remoteFile.lastModified());
- properties.setDirty(false);
-
- String remotePath = remoteFile.getAbsolutePath();
- properties.setRemoteFilePath(remotePath);
- try
- {
- properties.setEncoding(tempFile.getCharset());
- }
- catch (CoreException e){
- }
-
-
- // 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.
- properties.setDownloadFileTimeStamp(tempFile.getLocation().toFile().lastModified());
-
- boolean isMounted = isRemoteFileMounted(hostname, remotePath, null); // no subsystem
- properties.setRemoteFileMounted(isMounted);
- if (isMounted)
- {
- String actualRemoteHost = getActualHostFor(hostname, remotePath, null); // no subsystem
- String actualRemotePath = getWorkspaceRemotePath(hostname, remotePath, null); // no subsystem
- properties.setResolvedMountedRemoteFileHost(actualRemoteHost);
- properties.setResolvedMountedRemoteFilePath(actualRemotePath);
- }
- }
-
- /**
- * This method downloads a set of remote resources to the workspace. It uses
- * the downloadMultiple() API of the remote file subsystem and service
- * layers so for some service implementations, this is a big optimization
- *
- * @param remoteSet the set of resources to download
- * @param monitor the progress monitor
- * @return the set of temporary files created as a result of the download.
- * This may contain fewer files than requested in case the operation
- * was cancelled.
- * @since 3.0
- */
- public static SystemWorkspaceResourceSet downloadResourcesToWorkspaceMultiple(SystemRemoteResourceSet remoteSet, IProgressMonitor monitor)
- {
- IContainer broadestContainer = null;
- SystemWorkspaceResourceSet resultSet = new SystemWorkspaceResourceSet();
- List set = remoteSet.getResourceSet();
- IRemoteFileSubSystem srcFS = (IRemoteFileSubSystem)remoteSet.getSubSystem();
-
- SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
-
-
- List remoteFilesForDownload = new ArrayList();
- List tempFilesForDownload = new ArrayList();
- List remoteEncodingsForDownload = new ArrayList();
- List emptyFolders = new ArrayList();
-
- // step 1: pre-download processing
- for (int i = 0; i < set.size() && !resultSet.hasMessage(); i++){
-
- if (monitor != null && monitor.isCanceled())
- {
- return resultSet;
- }
-
- IRemoteFile srcFileOrFolder = (IRemoteFile)set.get(i);
- // first check for existence
- if (!srcFileOrFolder.exists()){
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND, srcFileOrFolder.getAbsolutePath(), srcFS.getHostAliasName());
-
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- resultSet.setMessage(errorMessage);
-
- }
- else
- {
- if (srcFileOrFolder.isFile()) // file transfer only
- {
- IResource tempResource = getTempFileFor(srcFileOrFolder);
-
- IFile tempFile = (IFile) tempResource;
-
- boolean problem = false;
- boolean available = true;
- try {
- available = tempFileAvailable(tempFile, srcFileOrFolder);
- }
- catch (RemoteFileIOException e){
- // this is the case where a temp file exists for a file of a different case
- // bug 276534
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- Object obj = properties.getRemoteFileObject();
- if (obj != null && obj instanceof SystemEditableRemoteFile)
- {
- SystemEditableRemoteFile editable = (SystemEditableRemoteFile) obj;
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN){
- // editor open for this file
- // for now, best we may be able to do is just keep this one and warn
- String remotePath = srcFileOrFolder.getAbsolutePath();
- String msgTxt = NLS.bind(FileResources.FILEMSG_COPY_FILE_FAILED, remotePath);
- String msgDetails = FileResources.FILEMSG_COPY_FILE_FAILED_DETAILS;
- SystemMessage message = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR,
- IStatus.WARNING, msgTxt, msgDetails);
-
- resultSet.setMessage(message);
- problem = true;
- }
- else {
- // get rid of the current temp file
- try {
- tempFile.delete(true, monitor);
- }
- catch (CoreException ex){}
- tempResource = getTempFileFor(srcFileOrFolder);
- tempFile = (IFile) tempResource;
- }
- available = false;
- }
- else {
- // file not being edited, so overwrite it
- available = false;
- }
- }
-
- if (available){
- resultSet.addResource(tempFile);
- }
- else if (!problem){
- listener.addIgnoreFile(tempFile);
-
- remoteFilesForDownload.add(srcFileOrFolder);
- tempFilesForDownload.add(tempFile);
- remoteEncodingsForDownload.add(srcFileOrFolder.getEncoding());
-
- IContainer parent = tempFile.getParent();
- if (broadestContainer == null || parent.contains(broadestContainer)){
- broadestContainer = parent;
- }
- else {
- if (!broadestContainer.contains(parent)) { // siblings?
- broadestContainer = broadestContainer.getParent();
- }
- }
- }
- }
- else if (srcFileOrFolder.isDirectory()) // recurse for empty folders and add to our consolidated resource set
- {
- IResource tempFolder = getTempFileFor(srcFileOrFolder);
- try
- {
- //get contents of folder
- IRemoteFile[] children = srcFS.list(srcFileOrFolder,IFileService.FILE_TYPE_FILES_AND_FOLDERS,monitor);
- //check for empty folder and add to set
- if(children==null || children.length==0)
- {
- emptyFolders.add(tempFolder);
- }
- //get all subfolders
- children=srcFS.list(srcFileOrFolder, IFileService.FILE_TYPE_FOLDERS, monitor);
-
- if(!(children==null) && !(children.length==0))
- {
- // make sure children are not archives!
- ArrayList fcs = new ArrayList();
- for (int c = 0; c < children.length; c++){
- IRemoteFile child = children[c];
- if (!child.isArchive()){
- fcs.add(child);
- }
- }
- if (fcs.size() > 0){
-
- SystemRemoteResourceSet childSet = new SystemRemoteResourceSet(srcFS, fcs);
-
- //recurse with subfolders to check for empty folders
- SystemWorkspaceResourceSet childResults = downloadResourcesToWorkspaceMultiple(childSet, monitor);
- if (childResults.hasMessage())
- {
- resultSet.setMessage(childResults.getMessage());
- }
- resultSet.addResource(tempFolder);
- }
- }
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError(e.getMessage(), e);
- SystemMessageDialog.displayMessage(e);
- }
- }
- }
- }
-
- // step 2: downloading
- IRemoteFile[] sources = (IRemoteFile[])remoteFilesForDownload.toArray(new IRemoteFile[remoteFilesForDownload.size()]);
-
- String[] encodings = (String[])remoteEncodingsForDownload.toArray(new String[remoteEncodingsForDownload.size()]);
-
- // destinations
- String[] destinations = new String[remoteFilesForDownload.size()];
- for (int t = 0; t < tempFilesForDownload.size(); t++){
- IFile destFile = (IFile)tempFilesForDownload.get(t);
-
- // make sure the file isn't read-only during the download
- if (destFile.isReadOnly()){
- setReadOnly(destFile, false);
- }
-
- destinations[t] = destFile.getLocation().toOSString();
- }
-
- if (sources.length > 0){
- try {
- srcFS.downloadMultiple(sources, destinations, encodings, monitor);
- }
- catch (SystemMessageException e){
- resultSet.setMessage(e.getSystemMessage());
- }
- }
-
- // step 2.1: refresh the broadest container (keep it down to 1 big refresh)
- try
- {
- if (broadestContainer != null && !broadestContainer.isSynchronized(IResource.DEPTH_INFINITE)){
- broadestContainer.refreshLocal(IResource.DEPTH_INFINITE, null);//monitor);
- }
- }
- catch (Exception e)
- {
-
- }
- //Create empty folders
- try
- {
- createEmptyFolders(monitor, emptyFolders);
- }
- catch(CoreException e)
- {
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_FILE_FAILED,
- IStatus.ERROR, FileResources.FILEMSG_CREATE_FILE_FAILED, e);
- resultSet.setMessage(errorMessage);
- }
-
- // step 3: post download processing
- if (!resultSet.hasMessage())
- {
-
- for (int p = 0; p < remoteFilesForDownload.size(); p++) {
-
- IRemoteFile srcFileOrFolder = (IRemoteFile)remoteFilesForDownload.get(p);
- IFile tempFile = (IFile)tempFilesForDownload.get(p);
- resultSet.addResource(tempFile);
- String remoteEncoding = (String)remoteEncodingsForDownload.get(p);
- listener.removeIgnoreFile(tempFile);
-
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
- long storedTime = properties.getRemoteFileTimeStamp();
- long currentTime = srcFileOrFolder.getLastModified();
- String storedEncoding = properties.getEncoding();
- String currentEncoding = srcFileOrFolder.getEncoding();
-
- if (storedTime != currentTime || (storedEncoding == null || !storedEncoding.equals(currentEncoding)))
- {
- if (tempFile.exists())
- {
- // deal with encoding properties
- if (storedEncoding == null || !storedEncoding.equals(currentEncoding)){
- // set the appropriate readonly flag
- boolean readOnly = !srcFileOrFolder.canWrite();
- setReadOnly(tempFile, readOnly);
-
- try
- {
- if (remoteEncoding != null)
- {
- if (srcFileOrFolder.isBinary())
- {
- if (!tempFile.isSynchronized(IResource.DEPTH_ZERO))
- {
- tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
- }
- if (!tempFile.getCharset().equals(remoteEncoding))
- {
- tempFile.setCharset(remoteEncoding, null);
- }
- }
- else
- {
- // using text mode so the char set needs to be local
- if (properties.getLocalEncoding() != null){
- String localEncoding = properties.getLocalEncoding();
- tempFile.setCharset(localEncoding, null);
- }
- // otherwise, the default charset is inherited so no need to set
- }
- }
- }
- catch (Exception e)
- {
- SimpleSystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_OPERATION_FAILED,
- IStatus.ERROR, "", e); //$NON-NLS-1$
- resultSet.setMessage(errorMessage);
- return null;
- }
- }
-
- try
- {
- // set all properties
- setIFileProperties(tempFile, srcFileOrFolder, srcFS);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- }
- return resultSet;
- }
-
- private static void createEmptyFolders(IProgressMonitor monitor, List emptyFolders) throws CoreException
- {
- IContainer empty;
- IFolder emptyFolder;
- List emptyParent;
- boolean go=false;
- for(int i=0; i<emptyFolders.size();i++)
- {
- emptyParent = new ArrayList();
- empty = (IContainer) emptyFolders.get(i);
- go=true;
- //check to see which parent folders need to be created
- while(go)
- {
- empty = empty.getParent();
- if(!empty.exists() && empty instanceof IFolder)
- {
- emptyParent.add(empty);
- }
- else
- {
- go=false;
- }
- }
- //create empty parent folders
- for(int j=emptyParent.size()-1;j>=0;j--)
- {
- emptyFolder = (IFolder) emptyParent.get(j);
- if(!emptyFolder.exists())
- {
- emptyFolder.create(true, true, monitor);
- }
- }
- //create empty folders
- emptyFolder = (IFolder) emptyFolders.get(i);
- if(!emptyFolder.exists())
- {
- emptyFolder.create(true, true, monitor);
- }
- }
- }
-
-
- /**
- * Replicates a set of remote files or folders to the workspace
- * @param remoteSet the objects which are being copied
- * @param monitor a progress monitor
- * @return the temporary objects that was created after the download
- * @since 3.0
- */
- public static SystemWorkspaceResourceSet downloadResourcesToWorkspace(SystemRemoteResourceSet remoteSet, IProgressMonitor monitor)
- {
- boolean ok = true;
- SystemWorkspaceResourceSet resultSet = new SystemWorkspaceResourceSet();
- IRemoteFileSubSystem srcFS = (IRemoteFileSubSystem)remoteSet.getSubSystem();
-
- if (!srcFS.isConnected())
- {
- return null;
- }
-
- boolean doSuperTransferProperty = doSuperTransfer(srcFS);
-
- List set = remoteSet.getResourceSet();
- List emptyFolders = new ArrayList();
-
- for (int i = 0; i < set.size() && !resultSet.hasMessage(); i++)
- {
- if (monitor != null && monitor.isCanceled())
- {
- return resultSet;
- }
-
-
- IRemoteFile srcFileOrFolder = (IRemoteFile)set.get(i);
- if (!srcFileOrFolder.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND, srcFileOrFolder.getAbsolutePath(), srcFS.getHostAliasName());
-
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- resultSet.setMessage(errorMessage);
-
- }
- else
- {
- if (srcFileOrFolder.isFile()) // file transfer
- {
-
- IFile tempFile = downloadFileToWorkspace(srcFileOrFolder, monitor);
- if (monitor != null && monitor.isCanceled())
- {
- return resultSet;
- }
- resultSet.addResource(tempFile);
- }
- else // folder transfer
- {
- IResource tempFolder = null;
-
- if (doCompressedTransfer && doSuperTransferProperty && !srcFileOrFolder.isRoot()
- && !(srcFileOrFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal()))
- {
- try
- {
- tempFolder = compressedDownloadToWorkspace(srcFileOrFolder, monitor);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- ok = false;
- }
- ok = tempFolder != null;
- if (ok)
- {
- resultSet.addResource(tempFolder);
- }
- }
- else
- {
- tempFolder = getTempFileFor(srcFileOrFolder);
- try
- {
- IRemoteFile[] children = srcFS.list(srcFileOrFolder,monitor);
- //check for empty folder and add to set
- if(children==null || children.length==0)
- {
- emptyFolders.add(tempFolder);
- }
-
- SystemRemoteResourceSet childSet = new SystemRemoteResourceSet(srcFS, children);
- SystemWorkspaceResourceSet childResults = downloadResourcesToWorkspace(childSet, monitor);
- if (childResults.hasMessage())
- {
- resultSet.setMessage(childResults.getMessage());
- }
- resultSet.addResource(tempFolder);
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError(e.getMessage(), e);
- SystemMessageDialog.displayMessage(e);
- }
- }
- }
- }
- }
-
- //Create empty folders
- try
- {
- createEmptyFolders(monitor, emptyFolders);
- }
- catch(CoreException e)
- {
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_CREATE_FILE_FAILED,
- IStatus.ERROR, FileResources.FILEMSG_CREATE_FILE_FAILED, e);
- resultSet.setMessage(errorMessage);
- }
-
- // refresh and set IFile properties
- for (int r = 0; r < resultSet.size(); r++)
- {
- IResource tempResource = (IResource)resultSet.get(r);
- IRemoteFile rmtFile = (IRemoteFile)remoteSet.get(r);
-
- if (tempResource != null && !tempResource.exists()) // need to check for null resource
- // because it's possible to be null when the download fails
- {
- // refresh temp file in project
- try
- {
- tempResource.refreshLocal(IResource.DEPTH_ONE, null /*monitor*/);
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- }
- if (tempResource instanceof IFile)
- {
- try
- {
- setIFileProperties((IFile)tempResource, rmtFile, srcFS);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- /*
- else
- {
- // refresh temp file in project
- try
- {
- tempResource.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- }
- */
- }
-
-
- return resultSet;
- }
-
- public static void discardReplicasOfDeletedFiles(IRemoteFileSubSystem ss, IContainer folder)
- {
- try
- {
- IResource[] members = folder.members();
- for (int i = members.length -1; i >= 0; i--)
- {
- IResource member = members[i];
- if (member instanceof IFile)
- {
- // is this a valid replica?
- SystemIFileProperties properties = new SystemIFileProperties(member);
- String path = properties.getRemoteFilePath();
- if (path != null)
- {
- IRemoteFile remoteFile = null;
- if (ss instanceof RemoteFileSubSystem)
- {
- // mark any cached remote file stale so we know for sure
- remoteFile = ((RemoteFileSubSystem)ss).getCachedRemoteFile(path);
- if (remoteFile != null)
- {
- remoteFile.markStale(true);
- }
- }
- remoteFile = ss.getRemoteFileObject(path, new NullProgressMonitor());
- if (remoteFile != null && !remoteFile.exists())
- {
- // this must be old so we should delete this
- member.delete(true, new NullProgressMonitor());
- }
- }
- }
- else if (member instanceof IContainer)
- {
- discardReplicasOfDeletedFiles(ss, (IContainer)member);
- }
- }
- }
- catch (Exception e)
- {
- }
- }
-
- /**
- * @since 3.0
- */
- public static Object downloadResourceToWorkspace(File srcFileOrFolder, IProgressMonitor monitor) {
-
- if (!srcFileOrFolder.exists()) {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND, srcFileOrFolder.getAbsolutePath(), "LOCALHOST"); //$NON-NLS-1$
-
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- return errorMessage;
- }
-
- if (srcFileOrFolder.isFile()) {
- IFile tempFile = downloadFileToWorkspace(srcFileOrFolder, monitor);
-
- if (!tempFile.exists())
- {
- // refresh temp file in project
- try
- {
- if (PlatformUI.isWorkbenchRunning())
- {
- if (!tempFile.isSynchronized(IResource.DEPTH_ZERO))
- tempFile.refreshLocal(IResource.DEPTH_ZERO, monitor);
- }
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- tempFile = (IFile) getTempFileFor(srcFileOrFolder);
- if (tempFile.exists())
- {
- try
- {
- setIFileProperties(tempFile, srcFileOrFolder, "LOCALHOST", System.getProperty("user.name")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- return tempFile;
- }
- else {
- return null;
- }
- }
-
- /**
- * Replicates a local file to the temporary files project in the workspace.
- * @param srcFileOrFolder the file to copy.
- * @param monitor the progress monitor.
- * @return the resulting local replica.
- * @since 3.0
- */
- protected static IFile downloadFileToWorkspace(File srcFileOrFolder, IProgressMonitor monitor)
- {
- IResource tempResource = getTempFileFor(srcFileOrFolder);
-
- IFile tempFile = (IFile) tempResource;
-
- // before we make the transfer to the temp file check whether a temp file already exists
- if (tempFile.exists())
- {
- SystemIFileProperties properties = new SystemIFileProperties(tempFile);
-
- long storedModifiedStamp = properties.getRemoteFileTimeStamp();
-
- // compare timestamps
- if (storedModifiedStamp > 0)
- {
- // if they're the same, just use temp file
- long remoteModifiedStamp = srcFileOrFolder.lastModified();
-
- boolean usedBin = properties.getUsedBinaryTransfer();
- boolean shouldUseBin = RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(srcFileOrFolder);
- if (storedModifiedStamp == remoteModifiedStamp && (usedBin == shouldUseBin))
- {
- // set the appropriate readonly flag
- boolean readOnly = !srcFileOrFolder.canWrite();
- setReadOnly(tempFile, readOnly);
-
- return tempFile;
- }
- }
- }
-
- try
- {
- // copy remote file to workspace
- SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
- listener.addIgnoreFile(tempFile);
- String encoding = tempFile.getParent().getDefaultCharset();
-
- download(srcFileOrFolder, tempFile, encoding, monitor);
- listener.removeIgnoreFile(tempFile);
- if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
- {
- // eclipse doesn't like this if the resource appears to be from another project
- try
- {
- tempFile.refreshLocal(IResource.DEPTH_ZERO, null);
- }
- catch (Exception e)
- {
-
- }
- }
- if (tempFile.exists())
- {
- // set the appropriate readonly flag
- boolean readOnly = !srcFileOrFolder.canWrite();
- setReadOnly(tempFile, readOnly);
-
- if (RemoteFileUtility.getSystemFileTransferModeRegistry().isText(srcFileOrFolder))
- {
- try
- {
- if (!tempFile.isSynchronized(IResource.DEPTH_ZERO))
- {
- tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
- }
- String cset = tempFile.getCharset();
- if (!cset.equals(encoding))
- {
- tempFile.setCharset(encoding, monitor);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError("An exception occured " + e.getMessage(), e); //$NON-NLS-1$
- return null;
- }
-
- return (IFile)tempResource;
- }
-
- protected static boolean download(File file, IFile tempFile, String hostEncoding, IProgressMonitor monitor) {
-
- FileInputStream inputStream = null;
- BufferedInputStream bufInputStream = null;
- FileOutputStream outputStream = null;
- BufferedOutputStream bufOutputStream = null;
- OutputStreamWriter outputWriter = null;
- BufferedWriter bufWriter = null;
- boolean isCancelled = false;
-
- File destinationFile = tempFile.getLocation().toFile();
-
- try
- {
-
- if (!destinationFile.exists())
- {
- File parentDir = destinationFile.getParentFile();
- parentDir.mkdirs();
- }
- else {
- // make sure the temp file can be written to
- if (tempFile.isReadOnly()){
- setReadOnly(tempFile, false);
- }
- }
-
- // encoding conversion required if it a text file but not an xml file
- boolean isBinary = RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(file);
- boolean isEncodingConversionRequired = !isBinary;
-
- inputStream = new FileInputStream(file);
- bufInputStream = new BufferedInputStream(inputStream);
- outputStream = new FileOutputStream(destinationFile);
-
- if (isEncodingConversionRequired)
- {
- outputWriter = new OutputStreamWriter(outputStream, hostEncoding);
- bufWriter = new BufferedWriter(outputWriter);
- }
- else
- {
- bufOutputStream = new BufferedOutputStream(outputStream);
- }
-
-
- byte[] buffer = new byte[512000];
- long totalSize = file.length();
- int totalRead = 0;
-
- while (totalRead < totalSize && !isCancelled)
- {
-
- int available = bufInputStream.available();
- available = (available < 512000) ? available : 512000;
-
- int bytesRead = bufInputStream.read(buffer, 0, available);
-
- if (bytesRead == -1) {
- break;
- }
-
- // need to convert encoding, i.e. text file, but not xml
- // ensure we read in file using the encoding for the file system
- // which can be specified by user as text file encoding in preferences
- if (isEncodingConversionRequired)
- {
- String s = new String(buffer, 0, bytesRead, hostEncoding);
- if (bufWriter != null)
- bufWriter.write(s);
- }
- else
- {
- if (bufOutputStream != null)
- bufOutputStream.write(buffer, 0, bytesRead);
- }
-
- totalRead += bytesRead;
-
- if (monitor != null)
- {
- monitor.worked(bytesRead);
- isCancelled = monitor.isCanceled();
- }
- }
- }
- catch (FileNotFoundException e)
- {
- return false;
- }
- catch (UnsupportedEncodingException e)
- {
- return false;
- }
- catch (IOException e)
- {
- return false;
- }
- finally
- {
-
- try
- {
- if (bufWriter != null)
- bufWriter.close();
-
- if (bufInputStream != null)
- bufInputStream.close();
-
- if (bufOutputStream != null)
- bufOutputStream.close();
-
- if (isCancelled)
- {
- return false;
- }
- else if (destinationFile != null && file.exists()) {
- destinationFile.setLastModified(file.lastModified());
-
- if (destinationFile.length() != file.length()) {
- return false;
- }
- }
- }
- catch (IOException e)
- {
- }
- }
-
- return true;
- }
-
- /**
- * Replicates a remote file or folder to the workspace
- *
- * @param srcFileOrFolder the object which is being copied
- * @param monitor a progress monitor
- * @return the temporary object that was created after the download
- * @since 3.0
- */
- public static Object downloadResourceToWorkspace(IRemoteFile srcFileOrFolder, IProgressMonitor monitor)
- {
-
- boolean ok = true;
-
- IRemoteFileSubSystem srcFS = srcFileOrFolder.getParentRemoteFileSubSystem();
-
- if (!srcFS.isConnected())
- {
- return null;
- }
- if (!srcFileOrFolder.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_FILE_NOTFOUND, srcFileOrFolder.getAbsolutePath(), srcFS.getHostAliasName());
-
- SystemMessage errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_ERROR_FILE_NOTFOUND,
- IStatus.ERROR, msgTxt);
- return errorMessage;
- }
-
- if (srcFileOrFolder.isFile())
- {
- IFile tempFile = downloadFileToWorkspace(srcFileOrFolder, monitor);
-
- if (!tempFile.exists())
- {
- // refresh temp file in project
- try
- {
- if (PlatformUI.isWorkbenchRunning())
- {
- if (!tempFile.isSynchronized(IResource.DEPTH_ZERO))
- tempFile.refreshLocal(IResource.DEPTH_ZERO, monitor);
- }
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- tempFile = (IFile) getTempFileFor(srcFileOrFolder);
- if (tempFile.exists() && ((Resource)tempFile).getPropertyManager() != null)
- {
- try
- {
- setIFileProperties(tempFile, srcFileOrFolder, srcFS);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- return tempFile;
- }
- else
- {
- IResource tempFolder = null;
-
- boolean doSuperTransferProperty = doSuperTransfer(srcFileOrFolder.getParentRemoteFileSubSystem());
-
- if (doCompressedTransfer && doSuperTransferProperty && !srcFileOrFolder.isRoot()
- && !(srcFileOrFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal()))
- {
- try
- {
- tempFolder = compressedDownloadToWorkspace(srcFileOrFolder, monitor);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- ok = false;
- }
- ok = tempFolder != null;
- if (ok)
- {
- return tempFolder;
- }
- }
- else
- {
- tempFolder = getTempFileFor(srcFileOrFolder);
- IRemoteFile[] children = null;
- try
- {
- children = srcFS.list(srcFileOrFolder, monitor);
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError(e.getMessage(), e);
- SystemMessageDialog.displayMessage(e);
- }
- IResource[] childResources = null;
-
- if (children != null)
- {
- childResources = new IResource[children.length];
- if (children.length == 0)
- {
- File tempFolderFile = tempFolder.getLocation().toFile();
- tempFolderFile.mkdirs();
- }
-
- for (int i = 0; i < children.length && ok; i++)
- {
- IRemoteFile child = children[i];
- IResource childResource = null;
- if (child.isFile())
- {
- childResource = downloadFileToWorkspace(child, monitor);
- }
- else
- {
- childResource = (IResource) downloadResourceToWorkspace(child, monitor);
- }
- if (childResource == null)
- {
- ok = false;
- }
- if (monitor != null && monitor.isCanceled())
- {
- ok = false;
- }
- childResources[i] = childResource;
- }
- }
-
- if (ok)
- {
- refreshResourceInWorkspace(tempFolder);
-
- // set properties of files
- if (tempFolder.exists() && children != null && childResources != null)
- {
- for (int i = 0; i < childResources.length; i++)
- {
- IResource tempFile = childResources[i];
-
- if (tempFile.exists() && tempFile instanceof IFile)
- {
- IRemoteFile child = children[i];
- setIFileProperties((IFile)tempFile, child, srcFS);
- }
- }
- }
-
- return tempFolder;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Helper method to get the local file subsystem.
- * @return the local file subsystem
- */
- private static 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.getHost().getSystemType().isLocal())
- {
- return anFS;
- }
- }
-
- return null;
- }
-
-
- /**
- * Perform a copy via drag and drop.
- * @param srcFileOrFolder 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 targetFolder the object to be copied to.
- * @param monitor the progress monitor
- * @return the resulting remote object
- * @since 3.0
- */
- public static Object uploadResourceFromWorkspace(IResource srcFileOrFolder, IRemoteFile targetFolder, IProgressMonitor monitor)
- {
- return uploadResourceFromWorkspace(srcFileOrFolder, targetFolder, monitor, true);
- }
-
- /**
- * Perform a copy via drag and drop.
- * @param workspaceSet the objects to be copied. If the target and sources are not on the same system, then this is a
- * temporary object produced by the doDrag.
- * @param targetFolder the object to be copied to.
- * @param monitor the progress monitor
- * @param checkForCollisions indicates whether to check for colllisions or not
- * @return the resulting remote objects
- * @since 3.0
- */
- public static SystemRemoteResourceSet uploadResourcesFromWorkspace(SystemWorkspaceResourceSet workspaceSet, IRemoteFile targetFolder, IProgressMonitor monitor, boolean checkForCollisions)
- {
-
-
- IRemoteFileSubSystem targetFS = targetFolder.getParentRemoteFileSubSystem();
-
- boolean doSuperTransferPreference = doSuperTransfer(targetFS);
- SystemRemoteResourceSet resultSet = new SystemRemoteResourceSet(targetFS);
-
- if (targetFolder.isStale())
- {
- try
- {
- 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;
- }
- boolean isTargetArchive = targetFolder.isArchive();
- boolean isTargetVirtual = ArchiveHandlerManager.isVirtual(targetFolder.getAbsolutePath());
- if (isTargetArchive && !targetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) return null;
- StringBuffer newPathBuf = new StringBuffer(targetFolder.getAbsolutePath());
- if (isTargetArchive)
- {
- newPathBuf.append(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
- }
- else if (isTargetVirtual)
- {
- //if the target is a virtual folder, we need to append ArchiveHandlerManager.VIRTUAL_FOLDER_SEPARATOR
- //instead of the file separator of the file subsystem.
- newPathBuf.append(ArchiveHandlerManager.VIRTUAL_FOLDER_SEPARATOR);
- }
- else
- {
- int newPathBufLenth = newPathBuf.length();
- if (newPathBufLenth > 0 && !((newPathBuf.charAt(newPathBufLenth - 1) == targetFolder.getSeparatorChar())))
- {
- newPathBuf.append(targetFolder.getSeparatorChar());
- }
- }
-
- List resources = workspaceSet.getResourceSet();
- List newFilePathList = new ArrayList();
-
-
- // query what we're going to create
- for (int n = 0; n < resources.size(); n++)
- {
- IResource srcFileOrFolder = (IResource)resources.get(n);
- newFilePathList.add(newPathBuf.toString() + srcFileOrFolder.getName());
- }
- // one big query
- SystemRemoteResourceSet existingFiles = null;
- try
- {
- String[] folderAndFilePaths = (String[])newFilePathList.toArray(new String[newFilePathList.size()]);
- IRemoteFile[] results = targetFS.getRemoteFileObjects(folderAndFilePaths, monitor);
- existingFiles = new SystemRemoteResourceSet(targetFS, results);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
-
- // clear the list so that next time we use renamed names
- newFilePathList.clear();
- //List toCopyNames = new ArrayList(); //was used for rename operation (no longer needed)
- List copyFilesOrFolders = new ArrayList();
- List existingFilesOrFolders = new ArrayList();
-
- for (int i = 0; i < resources.size() && !resultSet.hasMessage(); i++)
- {
- if (monitor != null && monitor.isCanceled())
- {
- try
- {
- IRemoteFile[] results = targetFS.getRemoteFileObjects((String[])newFilePathList.toArray(new String[newFilePathList.size()]), monitor);
- resultSet = new SystemRemoteResourceSet(targetFS, results);
- if (workspaceSet.hasMessage())
- {
- resultSet.setMessage(workspaceSet.getMessage());
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return resultSet;
- }
-
-
- IResource srcFileOrFolder = (IResource)resources.get(i);
- String name = srcFileOrFolder.getName();
-
- if (srcFileOrFolder instanceof IFile)
- {
- String oldPath = newPathBuf.toString() + name;
- if (checkForCollisions)
- {
- if(existingFiles!=null)
- {
- if(checkForCollision(existingFiles, targetFolder, oldPath))
- {
- existingFilesOrFolders.add(existingFiles.get(oldPath));
- }
- }
- //below code is used for renaming operation, which is no longer needed
- /*int severity = status.getSeverity();
-
- if (severity == IStatus.OK) {
- name = status.getMessage();
- toCopyNames.add(name);
- }
- else if (severity == IStatus.CANCEL) {
-
- int code = status.getCode();
-
- if (code == IStatus.CANCEL) {
- continue;
- }
- else if (code == RenameStatus.CANCEL_ALL) {
- break;
- }
- }*/
- }
- copyFilesOrFolders.add(srcFileOrFolder);
- }
-
- else if (srcFileOrFolder instanceof IContainer)
- {
- String oldPath = newPathBuf.toString() + name;
- if (checkForCollisions)
- {
- if(existingFiles!=null)
- {
- if(checkForCollision(existingFiles, targetFolder, oldPath))
- {
- existingFilesOrFolders.add(existingFiles.get(oldPath));
- }
- }
- //below code is used for renaming operation, which is no longer needed
- /*
- RenameStatus status = checkForCollision(existingFiles, targetFolder, name, oldPath, toCopyNames);
- int severity = status.getSeverity();
-
- if (severity == IStatus.OK) {
- name = status.getMessage();
- toCopyNames.add(name);
- }
- else if (severity == IStatus.CANCEL) {
-
- int code = status.getCode();
-
- if (code == IStatus.CANCEL) {
- continue;
- }
- else if (code == RenameStatus.CANCEL_ALL) {
- break;
- }
- }
- */
-
- }
- copyFilesOrFolders.add(srcFileOrFolder);
- }
- }
- boolean overwrite=false;
- if(existingFilesOrFolders.size()>0)
- {
- CopyRunnable cr = new CopyRunnable(existingFilesOrFolders);
- Display.getDefault().syncExec(cr);
- overwrite = cr.getOk();
- }
- if(existingFilesOrFolders.size()==0 || overwrite)
- {
- for (int i = 0; i < copyFilesOrFolders.size() && !resultSet.hasMessage(); i++)
- {
-
- IResource srcFileOrFolder = (IResource)copyFilesOrFolders.get(i);
- String name = srcFileOrFolder.getName();
-
- String newPath = newPathBuf.toString() + name;
-
- if (srcFileOrFolder instanceof IFile)
- {
- try
- {
- String srcCharSet = RemoteFileUtility.getSourceEncoding((IFile)srcFileOrFolder);
-
- String srcFileLocation = srcFileOrFolder.getLocation().toOSString();
-
- // for bug 236723, getting remote encoding for target instead of default for target fs
- String remoteEncoding = targetFolder.getEncoding();
- String systemEncoding = targetFS.getRemoteEncoding();
-
- targetFS.upload(srcFileLocation, srcCharSet, newPath, remoteEncoding,monitor);
- newFilePathList.add(newPath);
-
- // should check preference first
- if (RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS))
- {
- SystemIFileProperties properties = new SystemIFileProperties(srcFileOrFolder);
- try {
- IRemoteFile newFile = targetFS.getRemoteFileObject(newPath, monitor);
- targetFS.setLastModified(newFile, properties.getRemoteFileTimeStamp(), monitor);
- }
- catch (SystemUnsupportedOperationException e){
- // service doesn't support setLastModified
- SystemBasePlugin.logError("Unable to set last modified", e); //$NON-NLS-1$
- }
- }
- }
-
- catch (RemoteFileIOException e)
- {
- resultSet.setMessage(e.getSystemMessage());
- }
- catch (SystemMessageException e)
- {
- resultSet.setMessage(e.getSystemMessage());
- }
-
- if (resultSet.hasMessage())
- {
- return resultSet;
- }
- }
- if(srcFileOrFolder instanceof IContainer)
- {
- IContainer directory = (IContainer) srcFileOrFolder;
- if (!directory.exists())
- {
- try
- {
- directory.refreshLocal(IResource.DEPTH_ONE, monitor);
- }
- catch (Exception e)
- {
-
- }
- }
- try
- {
- if (existingFiles != null)
- {
- IRemoteFile newTargetFolder = (IRemoteFile)existingFiles.get(newPath);
- // newTargetFolder will be null if user chose to do a rename
- if (newTargetFolder == null) {
- newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
- }
- if (newTargetFolder != null && !newTargetFolder.exists())
- {
- newTargetFolder = targetFS.createFolder(newTargetFolder, monitor);
- }
-
- boolean isTargetLocal = newTargetFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal();
- boolean destInArchive = (newTargetFolder instanceof IVirtualRemoteFile) || newTargetFolder.isArchive();
-
- if (doCompressedTransfer && doSuperTransferPreference && !destInArchive && !isTargetLocal)
- {
- compressedUploadFromWorkspace(directory, newTargetFolder, monitor);
- }
- else
- {
- //sometimes, IContainer#members does not return the right members under
- //this folder. We need to call refreshLocal() first to overcome this problem
- directory.refreshLocal(IResource.DEPTH_ONE, monitor);
- IResource[] children = directory.members();
- SystemWorkspaceResourceSet childSet = new SystemWorkspaceResourceSet(children);
- SystemRemoteResourceSet childResults = uploadResourcesFromWorkspace(childSet, newTargetFolder, monitor, false);
- if (childResults == null)
- {
- return null;
- }
- if (childResults.hasMessage())
- {
- resultSet.setMessage(childResults.getMessage());
- }
- }
-
- newFilePathList.add(newPath);
- }
- }
- catch (SystemMessageException e)
- {
- workspaceSet.setMessage(e.getSystemMessage());
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
-
- try
- {
- IRemoteFile[] results = targetFS.getRemoteFileObjects((String[])newFilePathList.toArray(new String[newFilePathList.size()]), monitor);
- resultSet = new SystemRemoteResourceSet(targetFS, results);
- if (workspaceSet.hasMessage())
- {
- resultSet.setMessage(workspaceSet.getMessage());
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return resultSet;
- }
-
- /**
- * Perform a copy via drag and drop.
- * @param srcFileOrFolder 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 targetFolder the object to be copied to.
- * @param monitor the progress monitor
- * @param checkForCollisions indicates whether to check for colllisions or not
- * @return the result remote object
- * @since 3.0
- */
- public static Object uploadResourceFromWorkspace(IResource srcFileOrFolder, IRemoteFile targetFolder, IProgressMonitor monitor, boolean checkForCollisions)
- {
- Object result = null;
-
- IRemoteFileSubSystem targetFS = targetFolder.getParentRemoteFileSubSystem();
-
- if (targetFolder.isStale())
- {
- try
- {
- 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);
- return errorMsg;
- }
-
- if (!targetFS.isConnected())
- {
- return null;
- }
-
- /*
- SystemMessage copyMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPY_PROGRESS);
- copyMessage.makeSubstitution(srcFileOrFolder.getName(), targetFolder.getAbsolutePath());
- */
-
- String name = srcFileOrFolder.getName();
-
- if (srcFileOrFolder instanceof IFile)
- {
- if (checkForCollisions)
- {
- name = checkForCollision(targetFolder, name);
- if (name == null)
- {
- return null;
- }
- }
-
- boolean isTargetArchive = targetFolder.isArchive();
- if (isTargetArchive && !targetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) return null;
- 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();
-
- try
- {
-
- String srcCharSet = null;
-
- boolean isText = RemoteFileUtility.getSystemFileTransferModeRegistry().isText(newPath);
- if (isText)
- {
- srcCharSet = RemoteFileUtility.getSourceEncoding((IFile)srcFileOrFolder);
- }
- IPath location = srcFileOrFolder.getLocation();
- IRemoteFile copiedFile = null;
- if (location == null) // remote EFS file?
- {
- if (srcFileOrFolder instanceof IFile)
- {
- // copy using input stream
- try
- {
- InputStream inStream = ((IFile)srcFileOrFolder).getContents();
-
- if (targetFS instanceof FileServiceSubSystem)
- {
- /*
- OutputStream outStream = targetFS.getOutputStream(targetFolder.getAbsolutePath(), name, IFileService.NONE, monitor);
-
- byte[] buffer = new byte[1024];
- int readCount;
- while( (readCount = inStream.read(buffer)) > 0)
- {
- outStream.write(buffer, 0, readCount);
- }
- outStream.close();
- */
- IFileService fileService = ((FileServiceSubSystem)targetFS).getFileService();
-
- // for bug 236723, getting remote encoding for target instead of default for target fs
- String remoteEncoding = targetFolder.getEncoding();
- fileService.upload(inStream, targetFolder.getAbsolutePath(), name, !isText, remoteEncoding, monitor);
- }
- }
- catch (Exception e)
- {
- }
-
- }
- }
- else
- {
- // just copy using local location
- String srcFileLocation = location.toOSString();
-
- // for bug 236723, getting remote encoding for target instead of default for target fs
- String remoteEncoding = targetFolder.getEncoding();
- targetFS.upload(srcFileLocation, srcCharSet, newPath, remoteEncoding, monitor);
- }
-
- copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor);
-
- // should check preference first
-
- if (RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS))
- {
- SystemIFileProperties properties = new SystemIFileProperties(srcFileOrFolder);
- long timestamp = properties.getRemoteFileTimeStamp();
-
- // srcFileOrFolder may not be a file from the RemoteSystemTempFiles folder in which
- // case there will be no stored property for the remote timestamp.
- if (timestamp == 0)
- timestamp = srcFileOrFolder.getLocalTimeStamp();
-
- try {
- targetFS.setLastModified(copiedFile, timestamp, monitor);
- }
- catch (SystemUnsupportedOperationException e){
- // service doesn't support setLastModified
- SystemBasePlugin.logError("Unable to set last modified", e); //$NON-NLS-1$
- }
- }
-
- return copiedFile;
- }
-
- catch (RemoteFileIOException e)
- {
- SystemMessageDialog.displayMessage(e);
- return e.getSystemMessage();
- }
- catch (SystemMessageException e)
- {
- SystemMessageDialog.displayMessage(e);
- return e.getSystemMessage();
- }
- }
- else if (srcFileOrFolder instanceof IContainer)
- {
- if (checkForCollisions)
- {
- name = checkForCollision(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();
-
- IContainer directory = (IContainer) srcFileOrFolder;
-
- // this is a directory
- // recursively copy
- try
- {
- IRemoteFile newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
- if (!newTargetFolder.exists())
- {
- targetFS.createFolder(newTargetFolder, monitor);
- newTargetFolder.markStale(true);
- newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
- }
-
-
- if (!directory.isSynchronized(IResource.DEPTH_ONE))
- {
- try
- {
- directory.refreshLocal(IResource.DEPTH_ONE, monitor);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
-
- boolean isTargetLocal = newTargetFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal();
- boolean destInArchive = (newTargetFolder instanceof IVirtualRemoteFile) || newTargetFolder.isArchive();
- boolean doSuperTransferPreference = doSuperTransfer(targetFS);
- if (doCompressedTransfer && doSuperTransferPreference && !destInArchive && !isTargetLocal)
- {
- compressedUploadFromWorkspace(directory, newTargetFolder, monitor);
- }
- else
- {
- IResource[] children = directory.members();
- for (int i = 0; i < children.length; i++)
- {
- if (monitor.isCanceled())
- {
- return null;
- }
- else
- {
- IResource child = children[i];
- if (uploadResourceFromWorkspace(child, newTargetFolder, monitor, false) == null)
- {
- return null;
- }
- }
- }
- }
- return newTargetFolder;
-
- }
- catch (SystemMessageException e)
- {
- SystemMessageDialog.displayMessage(e);
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- return null;
- }
-
- return result;
- }
-
- /**
- * @since 3.0
- */
- public static void compressedUploadFromWorkspace(IContainer directory, IRemoteFile newTargetFolder, IProgressMonitor monitor) throws Exception
- {
- if (!newTargetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) return;
- if (ArchiveHandlerManager.isVirtual(newTargetFolder.getAbsolutePath()))
- {
- return;
- }
- IRemoteFile destinationArchive = null;
- String newPath = null;
- IRemoteFileSubSystem targetFS = null;
- IRemoteFile remoteArchive = null;
-
- try
- {
- monitor.beginTask(FileResources.RESID_SUPERTRANSFER_PROGMON_MAIN,IProgressMonitor.UNKNOWN);
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_CREATE);
- destinationArchive = getLocalFileSubSystem().getRemoteFileObject(File.createTempFile("supertransfer", getArchiveExtensionFromProperties()).getAbsolutePath(), monitor); //$NON-NLS-1$
- FileServiceSubSystem localSS = (FileServiceSubSystem)getLocalFileSubSystem();
- try
- {
- localSS.delete(destinationArchive, monitor);
- }
- catch (Exception e)
- {
-
- }
- localSS.createFile(destinationArchive, monitor);
-
- if (destinationArchive == null)
- {
- return;
- }
- if (!destinationArchive.isArchive())
- {
- return;
- }
- IRemoteFile newTargetParent = newTargetFolder.getParentRemoteFile();
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_POPULATE);
- IRemoteFile sourceDir = localSS.getRemoteFileObject(directory.getLocation().toOSString(), monitor);
- targetFS = newTargetFolder.getParentRemoteFileSubSystem();
-
-
- // FIXME
- //localSS.copyToArchiveWithEncoding(sourceDir, destinationArchive, sourceDir.getName(), targetFS.getRemoteEncoding(), monitor);
- localSS.copy(sourceDir, destinationArchive, sourceDir.getName(), monitor);
-
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_TRANSFER);
- newPath = newTargetParent.getAbsolutePath() + targetFS.getSeparator() + destinationArchive.getName();
-
- // copy local zip to remote
- targetFS.upload(destinationArchive.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$
- remoteArchive = targetFS.getRemoteFileObject(newPath, monitor);
-
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_EXTRACT);
- String compressedFolderPath = newPath + ArchiveHandlerManager.VIRTUAL_SEPARATOR + directory.getName();
- IRemoteFile compressedFolder = targetFS.getRemoteFileObject(compressedFolderPath, monitor);
-
- // extract the compressed folder from the temp archive on remote
- targetFS.copy(compressedFolder, newTargetParent, newTargetFolder.getName(), monitor);
-
- }
- catch (SystemMessageException e)
- {
- if (monitor.isCanceled())
- {
- //If this operation if cancelled, and if the destination has already been created (partially)
- //in the host, we need to delete it.
- if (newTargetFolder.exists())
- {
- targetFS.delete(newTargetFolder, null);
- }
- }
- throw e;
- //SystemMessageDialog.displayMessage(e);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw e;
- }
- finally {
- if (newPath == null) cleanup(destinationArchive, null);
- else cleanup(destinationArchive, new File(newPath));
-
- // delete the temp remote archive
- // now, DStoreFileService#getFile() (which is invoked by getRemoteFileObject() call)
- // has been updated to also put the query object into the dstore file map,
- // we don't need to do the query on the remoteArchive object before the
- // delete.
- if (remoteArchive != null && remoteArchive.exists())
- {
- targetFS.delete(remoteArchive, null);
- }
- monitor.done();
- }
- }
-
- protected static void setReadOnly(IFile file, boolean flag)
- {
- ResourceAttributes attrs = file.getResourceAttributes();
- attrs.setReadOnly(flag);
- try
- {
- file.setResourceAttributes(attrs);
- }
- catch (CoreException e)
- {
- }
- }
- public static void transferProperties(IResource source, IRemoteFile target, IProgressMonitor monitor) throws CoreException, RemoteFileSecurityException, RemoteFileIOException, SystemMessageException
- {
- if (monitor.isCanceled()) return;
- if (source instanceof IFile)
- {
- SystemIFileProperties properties = new SystemIFileProperties(source);
- try {
- target.getParentRemoteFileSubSystem().setLastModified(target, properties.getRemoteFileTimeStamp(), monitor);
- }
- catch (SystemUnsupportedOperationException e){
- // service doesn't support setLastModified
- SystemBasePlugin.logError("Unable to set last modified", e); //$NON-NLS-1$
- }
- }
- else if (source instanceof IContainer)
- {
- source.refreshLocal(IResource.DEPTH_ONE, null);
- IResource[] children = ((IContainer)source).members();
- for (int i = 0; i < children.length; i++)
- {
- if (monitor.isCanceled())
- {
- return;
- }
- else
- {
- IResource child = children[i];
- IRemoteFile newtarget = target.getParentRemoteFileSubSystem().getRemoteFileObject(target, child.getName(), monitor);
- if (!newtarget.exists()) return;
- transferProperties(child, newtarget, monitor);
- }
- }
- }
- }
-
- protected static String getArchiveExtensionFromProperties()
- {
-
- IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
- String archiveType = store.getString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
- if (archiveType == null || !ArchiveHandlerManager.getInstance().isRegisteredArchive("test." + archiveType)) //$NON-NLS-1$
- {
- archiveType = ".zip"; //$NON-NLS-1$
- }
- else
- {
- archiveType = "." + archiveType; //$NON-NLS-1$
- }
- //String archiveType = ".zip";
- return archiveType;
- }
-
- /**
- * @since 3.0
- */
- public static IResource compressedDownloadToWorkspace(IRemoteFile directory, IProgressMonitor monitor) throws Exception
- {
- if (!directory.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) return null;
- IRemoteFile destinationArchive = null;
- IRemoteFile cpdest = null;
- File dest = null;
- IResource targetResource = null;
- FileServiceSubSystem localSS = (FileServiceSubSystem)getLocalFileSubSystem();
- try
- {
- monitor.beginTask(FileResources.RESID_SUPERTRANSFER_PROGMON_MAIN,IProgressMonitor.UNKNOWN);
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_CREATE);
- File file = File.createTempFile("supertransfer", getArchiveExtensionFromProperties()); //$NON-NLS-1$
- file.delete();
- String separator = ""; //$NON-NLS-1$
- IRemoteFile destinationParent = directory.getParentRemoteFile();
- if (!destinationParent.getAbsolutePath().endsWith(directory.getSeparator()))
- separator = directory.getSeparator();
-
-
- if (destinationParent.canWrite())
- {
- try
- {
- String destArchPath = destinationParent.getAbsolutePath() + separator + file.getName();
- destinationArchive = directory.getParentRemoteFileSubSystem().getRemoteFileObject(destArchPath, monitor);
- if (destinationArchive.exists())
- {
- directory.getParentRemoteFileSubSystem().delete(destinationArchive, monitor);
- }
- directory.getParentRemoteFileSubSystem().createFile(destinationArchive, monitor);
- }
- catch (RemoteFileSecurityException e)
- {
- // can't write to this directory
- }
- }
- if (destinationArchive == null)
- {
- String homeFolder = directory.getParentRemoteFileSubSystem().getRemoteFileObject("./", monitor).getAbsolutePath(); //$NON-NLS-1$
- String destArchPath = homeFolder + separator + file.getName();
- destinationArchive = directory.getParentRemoteFileSubSystem().getRemoteFileObject(destArchPath, monitor);
- if (destinationArchive.exists()) directory.getParentRemoteFileSubSystem().delete(destinationArchive,monitor);
- destinationArchive = directory.getParentRemoteFileSubSystem().createFile(destinationArchive, monitor);
- }
-
- targetResource = getTempFileFor(directory);
-
- if (destinationArchive == null)
- {
- return null;
- }
- if (!destinationArchive.isArchive())
- {
- return null;
- }
-
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_POPULATE);
- IRemoteFileSubSystem sourceFS = directory.getParentRemoteFileSubSystem();
- IRemoteFile sourceDir = sourceFS.getRemoteFileObject(directory.getAbsolutePath(), monitor);
-
- // DKM - copy src dir to remote temp archive
- try
- {
- sourceFS.copy(sourceDir, destinationArchive, sourceDir.getName(), monitor);
- }
- catch (SystemMessageException e)
- {
- if (monitor.isCanceled())
- {
- cleanup(destinationArchive, null);
- return targetResource;
- }
- }
- destinationArchive.markStale(true);
-
- // reget it so that it's properties (namely "size") are correct
- cpdest = destinationArchive = destinationArchive.getParentRemoteFileSubSystem().getRemoteFileObject(destinationArchive.getAbsolutePath(), monitor);
-
- monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_TRANSFER);
- String name = destinationArchive.getName();
-
- // DKM - use parent folder as dest
- dest = new File(targetResource.getParent().getLocation().toOSString() + File.separator + name);
- sourceFS.download(cpdest, dest.getAbsolutePath(), System.getProperty("file.encoding"), monitor); //$NON-NLS-1$
-
-
- ISystemArchiveHandler handler = ArchiveHandlerManager.getInstance().getRegisteredHandler(dest);
-
- VirtualChild[] arcContents = handler.getVirtualChildrenList(null);
- monitor.beginTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_EXTRACT, arcContents.length);
-
- for (int i = 0; i < arcContents.length; i++)
- {
- if (arcContents[i].isDirectory && handler.getVirtualChildren(arcContents[i].fullName, null) == null) continue;
- String currentTargetPath = targetResource.getParent().getLocation().toOSString() + localSS.getSeparator() + useLocalSeparator(arcContents[i].fullName);
- IRemoteFile currentTarget = localSS.getRemoteFileObject(currentTargetPath, monitor);
- boolean replace = false;
-
- if (currentTarget != null && currentTarget.exists())
- {
- IResource currentTargetResource = SystemBasePlugin.getWorkspaceRoot().getContainerForLocation(new Path(currentTarget.getAbsolutePath()));
- SystemIFileProperties properties = new SystemIFileProperties(currentTargetResource);
-
- if (properties.getRemoteFileTimeStamp() != arcContents[i].getTimeStamp())
- {
- replace = true;
- }
- }
- else
- {
- replace = true;
- }
-
- if (replace)
- {
-
- if (!monitor.isCanceled())
- {
- String currentSourcePath = dest.getAbsolutePath() + ArchiveHandlerManager.VIRTUAL_SEPARATOR + arcContents[i].fullName;
- IRemoteFile currentSource = localSS.getRemoteFileObject(currentSourcePath, monitor);
- boolean shouldExtract = currentSource.isFile();
-
- if (!shouldExtract)
- {
- // check for empty dir
- IRemoteFile[] children = localSS.list(currentSource, monitor);
-
- if (children == null || children.length == 0)
- {
- shouldExtract = true;
- }
- }
-
- if (shouldExtract)
- {
- String msgTxt = NLS.bind(FileResources.MSG_EXTRACT_PROGRESS, currentSource.getName());
- monitor.subTask(msgTxt);
-
-
- boolean canWrite = true;
- if (currentTarget != null)
- {
- IResource currentTargetResource = SystemBasePlugin.getWorkspaceRoot().getContainerForLocation(new Path(currentTarget.getAbsolutePath()));
- if (currentTargetResource != null && currentTargetResource.exists())
- {
- try
- {
- currentTargetResource.delete(false, monitor);
- }
- catch (Exception e)
- {
- // don't extract this one
- canWrite = false;
- }
- }
-
- if (canWrite)
- {
- localSS.copy(currentSource, currentTarget.getParentRemoteFile(), currentSource.getName(), monitor);
- // FIXME localSS.copyFromArchiveWithEncoding(currentSource, currentTarget.getParentRemoteFile(), currentSource.getName(), sourceEncoding, isText, monitor);
-
- SystemIFileProperties properties = new SystemIFileProperties(currentTargetResource);
- properties.setRemoteFileTimeStamp(arcContents[i].getTimeStamp());
- monitor.worked(1);
- }
- }
- }
- }
- else
- {
- //return null;
- }
-
- }
- }
- }
- catch (SystemMessageException e)
- {
- SystemMessageDialog.displayMessage(e);
- cleanup(cpdest, dest);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- cleanup(cpdest, dest);
- throw e;
- }
-
- cleanup(cpdest, dest);
- monitor.done();
- return targetResource;
- }
-
- protected static void cleanup(IRemoteFile arc1, File arc2) throws RemoteFileIOException, RemoteFileSecurityException, RemoteFolderNotEmptyException
- {
- if (arc1 != null)
- {
- try
- {
- arc1.getParentRemoteFileSubSystem().delete(arc1, null);
- }
- catch (SystemMessageException e)
- {
- SystemMessageDialog.displayMessage(e);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- if (arc2 != null && arc2.exists())
- arc2.delete();
- }
- /**
- *
- */
- protected static String useLocalSeparator(String virtualPath)
- {
- return virtualPath.replace('/', getLocalFileSubSystem().getSeparatorChar());
- }
-
- /**
- * Returns the corresponding temp file location for a remote file or folder
- * @param srcFileOrFolder the remote file or folder
- * @return the local replica location
- */
- public static IResource getTempFileFor(IRemoteFile srcFileOrFolder)
- {
- SystemRemoteEditManager editMgr = SystemRemoteEditManager.getInstance();
- if (!editMgr.doesRemoteEditProjectExist())
- {
- editMgr.getRemoteEditProject();
- }
-
- //char separator = IFileConstants.PATH_SEPARATOR_CHAR_WINDOWS;
- char separator = '/';
- StringBuffer path = new StringBuffer(editMgr.getRemoteEditProjectLocation().makeAbsolute().toOSString());
-
- String actualHost = getActualHostFor(srcFileOrFolder.getParentRemoteFileSubSystem(), srcFileOrFolder.getAbsolutePath());
- path = path.append(separator + actualHost + separator);
-
- String absolutePath = srcFileOrFolder.getAbsolutePath();
-
- if (srcFileOrFolder.getHost().getSystemType().isLocal())
- {
- absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath(), srcFileOrFolder.getParentRemoteFileSubSystem());
- }
-
- IPath remote = new Path(absolutePath);
- absolutePath = SystemFileNameHelper.getEscapedPath(remote.toOSString());
-
- 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).toLowerCase() + absolutePath.substring(colonIndex + 1);
- }
- }
-
- path = path.append(absolutePath);
- String pathstr = normalizePath(path.toString(), srcFileOrFolder.getParentRemoteFileSubSystem().getSeparatorChar());
-
- IPath workspacePath = getLocalPathObject(pathstr);
-
- IResource result = null;
- if (srcFileOrFolder.isDirectory())
- {
- result = SystemBasePlugin.getWorkspaceRoot().getContainerForLocation(workspacePath);
- }
- else
- {
- result = SystemBasePlugin.getWorkspaceRoot().getFileForLocation(workspacePath);
- }
-
- return result;
- }
-
- protected static String normalizePath(String localpath, char rmtSeparator)
- {
- char localSeparator = File.separatorChar;
- if (localSeparator != rmtSeparator)
- {
- return localpath.replace(rmtSeparator, localSeparator);
- }
- return localpath;
- }
-
- /**
- * Returns the corresponding temp file location for a local file or folder.
- * @param srcFileOrFolder the local file or folder.
- * @return the local replica location.
- */
- public static IResource getTempFileFor(File srcFileOrFolder)
- {
- SystemRemoteEditManager editMgr = SystemRemoteEditManager.getInstance();
- if (!editMgr.doesRemoteEditProjectExist())
- {
- editMgr.getRemoteEditProject();
- }
-
- //char separator = IFileConstants.PATH_SEPARATOR_CHAR_WINDOWS;
- char separator = '/';
- StringBuffer path = new StringBuffer(editMgr.getRemoteEditProjectLocation().makeAbsolute().toOSString());
-
- String actualHost = "LOCALHOST"; //$NON-NLS-1$
- path = path.append(separator + actualHost + separator);
-
- // this is only for local, so no remote name required
- String absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath(), null); // no subsystem
-
- 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).toLowerCase() + absolutePath.substring(colonIndex + 1);
- }
- }
-
- path = path.append(absolutePath);
- IPath workspacePath = getLocalPathObject(path.toString());
-
- IResource result = null;
- if (srcFileOrFolder.isDirectory())
- {
- result = SystemBasePlugin.getWorkspaceRoot().getContainerForLocation(workspacePath);
- }
- else
- {
- result = SystemBasePlugin.getWorkspaceRoot().getFileForLocation(workspacePath);
- }
-
- return result;
- }
-
-
- private static IPath getLocalPathObject(String localPath)
- {
- IPath actualPath = null;
- IPath expectedPath = new Path(localPath);
-
- IPath rootPath = new Path(_rootPath);
- IContainer container = SystemBasePlugin.getWorkspaceRoot().getContainerForLocation(rootPath);
-
- if (container != null && container.exists())
- {
- IResource lastMatch = null;
- for (int i = rootPath.segmentCount(); i < expectedPath.segmentCount() - 1; i++)
- {
- String expectedFolder = expectedPath.segment(i).toLowerCase();
- IResource match = null;
-
- try
- {
- IResource[] resources = container.members();
-
- for (int r = 0; r < resources.length && match == null; r++)
- {
- IResource resource = resources[r];
- if (resource instanceof IContainer)
- {
- String resName = resource.getName().toLowerCase();
- if (expectedFolder.equals(resName))
- {
- match = resource;
- lastMatch = match;
- }
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- if (match != null)
- {
- container = (IContainer) match;
- }
- else if (lastMatch != null)
- {
- IPath newPath = lastMatch.getLocation();
- while (i < expectedPath.segmentCount())
- {
- newPath = newPath.append(expectedPath.segment(i));
- i++;
- }
-
- return newPath;
- }
- else
- {
- return expectedPath;
- }
- }
-
- String fileName = expectedPath.segment(expectedPath.segmentCount() - 1);
- try {
- IResource[] resources = container.members();
- boolean found = false;
- for (int r = 0; r < resources.length && !found; r++){
- IResource resource = resources[r];
- if (resource instanceof IFile){
- String resourceName = resource.getName();
- if (resourceName.toLowerCase().equals(fileName.toLowerCase())){
- found = true;
- fileName = resourceName;
- }
- }
- }
- }
- catch (CoreException e){}
-
- actualPath = container.getLocation().append(fileName);
- return actualPath;
- }
-
- return expectedPath;
- }
-
-
- /**
- * @since 3.0
- */
- public static String getActualHostFor(IRemoteFileSubSystem subsystem, String remotePath)
- {
- String hostname = subsystem.getHost().getHostName();
- if (subsystem.getHost().getSystemType().isLocal())
- {
- String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath, subsystem);
- return result;
- }
- return hostname;
- }
-
- /**
- * @since 3.0
- */
- public static String getActualHostFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- return SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath, subsystem);
- }
-
- private static void refreshResourceInWorkspace(IResource parent)
- {
- if (!parent.exists())
- {
- refreshResourceInWorkspace(parent.getParent());
- }
- else
- {
- try
- {
- parent.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- catch (Exception e)
- {
- }
- }
- }
-
- protected static boolean isRemoteFileMounted(ISubSystem subsystem, String remotePath)
- {
- String hostname = subsystem.getHost().getHostName();
- if (subsystem.getHost().getSystemType().isLocal())
- {
- String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath, (IRemoteFileSubSystem)subsystem);
- if (!result.equals(hostname))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @since 3.0
- */
- protected static boolean isRemoteFileMounted(String hostname, String remotePath, IRemoteFileSubSystem subsystem)
- {
- String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath, subsystem);
-
- if (!result.equals(hostname)) {
- return true;
- }
-
- return false;
- }
-
- /**
- * @since 3.0
- */
- protected static String getWorkspaceRemotePath(IRemoteFileSubSystem subsystem, String remotePath) {
-
- if (subsystem != null) {
- return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath, subsystem);
- }
-
- return remotePath;
- }
-
- /**
- * @since 3.0
- */
- protected static String getWorkspaceRemotePath(String hostname, String remotePath, IRemoteFileSubSystem subsystem) {
- return SystemRemoteEditManager.getInstance().getWorkspacePathFor(hostname, remotePath, subsystem);
- }
-
- protected static RenameStatus checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath)
- {
- return checkForCollision(existingFiles, targetFolder, oldName, oldPath, null);
- }
- /**
- * @since 3.0
- */
- protected static RenameStatus checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath, List NamesInUse)
- {
- String newName = oldName;
-
- IRemoteFile targetFileOrFolder = (IRemoteFile) existingFiles.get(oldPath);
-
- RenameStatus status = new RenameStatus(IStatus.OK, Activator.getDefault().getBundle().getSymbolicName(), IStatus.OK, newName, null);
-
- if (targetFileOrFolder != null && targetFileOrFolder.exists()) {
- RenameRunnable rr = new RenameRunnable(targetFileOrFolder, NamesInUse);
- Display.getDefault().syncExec(rr);
- newName = rr.getNewName();
-
- if (newName == null) {
-
- int state = rr.getCancelStatus();
-
- if (state == RenameRunnable.RENAME_DIALOG_CANCELLED_ALL) {
- status = new RenameStatus(IStatus.CANCEL, Activator.getDefault().getBundle().getSymbolicName(), RenameStatus.CANCEL_ALL, "", null); //$NON-NLS-1$
- }
- else if (state == RenameRunnable.RENAME_DIALOG_CANCELLED) {
- status = new RenameStatus(IStatus.CANCEL, Activator.getDefault().getBundle().getSymbolicName(), IStatus.CANCEL, "", null); //$NON-NLS-1$
- }
- }
- else {
- status = new RenameStatus(IStatus.OK, Activator.getDefault().getBundle().getSymbolicName(), IStatus.OK, newName, null);
- }
- }
-
-
- return status;
- }
-
- /**
- * @since 3.0
- */
- protected static boolean checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldPath)
- {
-
- IRemoteFile targetFileOrFolder = (IRemoteFile) existingFiles.get(oldPath);
-
-
- if (targetFileOrFolder != null && targetFileOrFolder.exists())
- return true;
- else
- return false;
- }
-
- /**
- * @since 3.0
- */
- public static class RenameRunnable implements Runnable
- {
- private IRemoteFile _targetFileOrFolder;
- private String _newName;
- private List _namesInUse = new ArrayList();
- private int cancelStatus;
-
- /**
- * @since 3.0
- */
- public static int RENAME_DIALOG_NOT_CANCELLED = -1;
- /**
- * @since 3.0
- */
- public static int RENAME_DIALOG_CANCELLED = 0;
- /**
- * @since 3.0
- */
- public static int RENAME_DIALOG_CANCELLED_ALL = 1;
-
- public RenameRunnable(IRemoteFile targetFileOrFolder)
- {
- _targetFileOrFolder = targetFileOrFolder;
- cancelStatus = RENAME_DIALOG_NOT_CANCELLED;
- }
-
- /**
- * @since 3.0
- */
- public RenameRunnable(IRemoteFile targetFileOrFolder, List namesInUse)
- {
- _targetFileOrFolder = targetFileOrFolder;
- cancelStatus = RENAME_DIALOG_NOT_CANCELLED;
- _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.setShowCancelAllButton(true);
-
- dlg.open();
- if (!dlg.wasCancelled() && !dlg.wasCancelledAll())
- _newName = dlg.getNewName();
- else {
- _newName = null;
-
- if (dlg.wasCancelledAll()) {
- cancelStatus = RENAME_DIALOG_CANCELLED_ALL;
- }
- else {
- cancelStatus = RENAME_DIALOG_CANCELLED;
- }
- }
- }
-
- public String getNewName()
- {
- return _newName;
- }
-
- public int getCancelStatus() {
- return cancelStatus;
- }
- }
-
- protected static String checkForCollision(final IRemoteFile targetFolder, String oldName)
- {
- final String[] newName = new String[]{oldName};
-
- try
- {
-
- IRemoteFileSubSystem ss = targetFolder.getParentRemoteFileSubSystem();
- final 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())
- {
- //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
- runInDisplayThread(new Runnable() {
- public void run() {
- ValidatorFileUniqueName validator = null; // new ValidatorFileUniqueName(shell, targetFolder, srcFileOrFolder.isDirectory());
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(SystemBasePlugin.getActiveWorkbenchShell(), true, targetFileOrFolder, validator); // true => copy-collision-mode
-
- dlg.open();
- if (!dlg.wasCancelled())
- newName[0] = dlg.getNewName();
- else
- newName[0] = null;
- }
- });
- }
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError("SystemCopyRemoteFileAction.checkForCollision()", e); //$NON-NLS-1$
- }
-
- return newName[0];
- }
-
- private static void runInDisplayThread(Runnable runnable) {
- Display display = Display.getCurrent();
- if (display == null)
- display = Display.getDefault();
- if(Thread.currentThread()==display.getThread()) {
- // if we are in the display thread we can call the method directly
- runnable.run();
- } else {
- // we execute it in the Display Thread but we wait for the result...
- display.syncExec(runnable);
- }
- }
-
-
-
-
- /**
- * replicates a remote file to the temp files project in the workspace
- *
- * @param srcFileOrFolder the file to copy
- * @param monitor the progress monitor
- * @return the resulting local replica
- *
- * @deprecated use downloadFileToWorkspace
- */
- protected static IFile copyRemoteFileToWorkspace(IRemoteFile srcFileOrFolder, IProgressMonitor monitor)
- {
- return downloadFileToWorkspace(srcFileOrFolder, monitor);
- }
-
-
-
-
- /**
- * This method downloads a set of remote resources to the workspace. It uses
- * the downloadMultiple() API of the remote file subsystem and service layers so
- * for some service implementations, this is a big optimization
- *
- * @param remoteSet the set of resources to download
- * @param monitor the progress monitor
- * @return the set of temp files created as a result of the download.
- *
- * @deprecated use downloadResourcesToWorkspaceMultiple
- * @since 3.0
- */
- public static SystemWorkspaceResourceSet copyRemoteResourcesToWorkspaceMultiple(SystemRemoteResourceSet remoteSet, IProgressMonitor monitor)
- {
- return downloadResourcesToWorkspaceMultiple(remoteSet, monitor);
- }
-
-
- /**
- * Replicates a set of remote files or folders to the workspace
- * @param remoteSet the objects which are being copied
- * @param monitor a progress monitor
- * @return the temporary objects that was created after the download
- *
- * @deprecated use downloadResourcesToWorkspace
- */
- public static SystemWorkspaceResourceSet copyRemoteResourcesToWorkspace(SystemRemoteResourceSet remoteSet, IProgressMonitor monitor)
- {
- return downloadResourcesToWorkspace(remoteSet, monitor);
- }
-
- /**
- *
- * @deprecated use downloadResourceToWorkspace
- */
- public static Object copyRemoteResourceToWorkspace(File srcFileOrFolder, IProgressMonitor monitor) {
- return downloadResourceToWorkspace(srcFileOrFolder, monitor);
- }
-
- /**
- * Replicates a local file to the temp files project in the workspace.
- * @param srcFileOrFolder the file to copy.
- * @param monitor the progress monitor.
- * @return the resulting local replica.
- *
- * @deprecated use downloadFileToWorkspace
- */
- protected static IFile copyRemoteFileToWorkspace(File srcFileOrFolder, IProgressMonitor monitor)
- {
- return downloadFileToWorkspace(srcFileOrFolder, monitor);
- }
-
-
-
- /**
- * Replicates a remote file or folder to the workspace
- * @param srcFileOrFolder the object which is being copied
- * @param monitor a progress monitor
- * @return the temporary object that was created after the download
- *
- * @deprecated use downloadResourceToWorkspace
- */
- public static Object copyRemoteResourceToWorkspace(IRemoteFile srcFileOrFolder, IProgressMonitor monitor)
- {
- return downloadResourceToWorkspace(srcFileOrFolder, monitor);
- }
- /**
- * Perform a copy via drag and drop.
- * @param srcFileOrFolder 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 targetFolder the object to be copied to.
- * @param monitor the progress monitor
- * @return the resulting remote object
- *
- * @deprecated use uploadResourceFromWorkspace
- */
- public static Object copyWorkspaceResourceToRemote(IResource srcFileOrFolder, IRemoteFile targetFolder, IProgressMonitor monitor)
- {
- return uploadResourceFromWorkspace(srcFileOrFolder, targetFolder, monitor);
- }
-
- /**
- * Perform a copy via drag and drop.
- * @param workspaceSet the objects to be copied. If the target and sources are not on the same system, then this is a
- * temporary object produced by the doDrag.
- * @param targetFolder the object to be copied to.
- * @param monitor the progress monitor
- * @param checkForCollisions indicates whether to check for collisions or not
- * @return the resulting remote objects
- *
- * @deprecated use uploadResourcesFromWorkspace
- */
- public static SystemRemoteResourceSet copyWorkspaceResourcesToRemote(SystemWorkspaceResourceSet workspaceSet, IRemoteFile targetFolder, IProgressMonitor monitor, boolean checkForCollisions)
- {
- return uploadResourcesFromWorkspace(workspaceSet, targetFolder, monitor, checkForCollisions);
- }
-
- /**
- * Perform a copy via drag and drop.
- * @param srcFileOrFolder 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 targetFolder the object to be copied to.
- * @param monitor the progress monitor
- * @param checkForCollisions indicates whether to check for collisions or not
- * @return the result remote object
- *
- * @deprecated use uploadResourceFromWorkspace
- */
- public static Object copyWorkspaceResourceToRemote(IResource srcFileOrFolder, IRemoteFile targetFolder, IProgressMonitor monitor, boolean checkForCollisions)
- {
- return uploadResourceFromWorkspace(srcFileOrFolder, targetFolder, monitor, checkForCollisions);
- }
-
- /**
- * @param directory
- * @param newTargetFolder
- * @param monitor
- * @throws Exception
- *
- * @deprecated use compressedUploadFromWorkspace
- */
- public static void compressedCopyWorkspaceResourceToRemote(IContainer directory, IRemoteFile newTargetFolder, IProgressMonitor monitor) throws Exception
- {
- compressedUploadFromWorkspace(directory, newTargetFolder, monitor);
- }
-
- /**
- *
- * @param directory
- * @param monitor
- * @return
- * @throws Exception
- *
- * @deprecated use compressedDownloadToWorkspace
- */
- public static IResource compressedCopyRemoteResourceToWorkspace(IRemoteFile directory, IProgressMonitor monitor) throws Exception
- {
- return compressedDownloadToWorkspace(directory, monitor);
- }
-
-}
-
-
-
-
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/ISystemRemoteFolderBrowseCompleteListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/ISystemRemoteFolderBrowseCompleteListener.java
deleted file mode 100644
index 5170cf635..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/ISystemRemoteFolderBrowseCompleteListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-
-/**
- * Interface for listeners interested in being notified whenever
- * the browse button in <code>SystemRemoteFolderCombo</code> is run.
- */
-public interface ISystemRemoteFolderBrowseCompleteListener {
-
- /**
- * Notifies that the given file was selected from the browse dialog. Note that the file will
- * be null if the user cancelled from the browse dialog.
- * @param remoteFile the remote file that was selected, or <code>null</code> if the user cancelled
- * from the browse dialog.
- */
- public void fileSelected(IRemoteFile remoteFile);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SaveAsForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SaveAsForm.java
deleted file mode 100644
index 20ecd4dda..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SaveAsForm.java
+++ /dev/null
@@ -1,244 +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) - [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
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.osgi.util.NLS;
-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.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.ValidatorFileName;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class SaveAsForm extends SystemSelectRemoteFileOrFolderForm {
- protected Text fileNameText;
- protected String fileName, initialFileName;
- protected ValidatorFileName validator;
-
- /**
- * Constructor for SaveAsForm
- */
- public SaveAsForm(ISystemMessageLine msgLine, Object caller, boolean fileMode)
- {
- super(msgLine, caller, fileMode);
-
- validator = new ValidatorFileName();
- }
-
- /**
- * In this method, we populate the given SWT container with widgets and return the container
- * to the caller.
- * @param parent The parent composite
- */
- public Control createContents(Shell shell, Composite parent)
- {
- Control control = super.createContents(shell, parent);
-
- Composite composite = SystemWidgetHelpers.createComposite(parent, 2);
-// SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_NEWFILE_NAME_ROOT_LABEL);
-// fileNameText = SystemWidgetHelpers.createTextField(composite, null);
-
- fileNameText = SystemWidgetHelpers.createLabeledTextField(
- composite, null, FileResources.RESID_NEWFILE_NAME_LABEL, FileResources.RESID_NEWFILE_NAME_TOOLTIP);
-
-
- fileNameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- fileName = fileNameText.getText();
- setPageComplete();
- }
- });
-
- if (fileName != null)
- {
- fileNameText.setText(fileName);
- }
-
- return control;
- }
-
- /**
- * Completes processing of the dialog.
- * Intercept of parent method.
- *
- * @return true if no errors
- */
- public boolean verify()
- {
- // This method added by Phil to issue warning msg for existing member
- //System.out.println("Inside verify");
- boolean ok = super.verify();
- if (ok)
- {
- IRemoteFile file = (IRemoteFile) getSelectedObject();
- IRemoteFile saveasFile = null;
- try
- {
- saveasFile = file.getParentRemoteFileSubSystem().getRemoteFileObject(file, fileName, new NullProgressMonitor());
- }
- catch (Exception e)
- {
- }
-
- //System.out.println("...saveasMbr null? "+ (saveasMbr==null));
- if (saveasFile != null && saveasFile.exists())
- {
- String msgTxt = NLS.bind(FileResources.MSG_UPLOAD_FILE_EXISTS, fileName);
-
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_UPLOAD_FILE_EXISTS,
- IStatus.WARNING, msgTxt);
- SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
- ok = dlg.openQuestionNoException();
-
- }
- }
- return ok;
- }
-
- public boolean isPageComplete()
- {
- SystemMessage errMsg = validator.validate(fileName);
-
- if (errMsg != null)
- {
- setErrorMessage(errMsg);
- return false;
- }
- else
- {
- clearErrorMessage();
- }
-
- return fileNameText !=null && fileNameText.getText().length() > 0 && super.isPageComplete();
- }
-
- public String getFileName()
- {
- return fileName;
- }
-
- public void setPreSelection(IRemoteFile selection)
- {
- if (selection.isDirectory())
- {
- super.setPreSelection(selection);
- }
- else if (selection.isFile())
- {
- IRemoteFile parentFile = selection.getParentRemoteFile();
-
- if (parentFile.isDirectory())
- {
- super.setPreSelection(parentFile);
- }
-
- fileName = selection.getName();//parentFile.getName();
- initialFileName=fileName;
- }
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- /**
- * User selected something in the tree.
- * This is an intercept of the parent's method so we can process a member selection, and
- * copy the selected member's name to the entry field.
- */
- public void selectionChanged(SelectionChangedEvent e)
- {
- super.selectionChanged(e);
- Object selectedObject = getFirstSelection(e.getSelection());
- if (selectedObject != null && selectedObject instanceof IRemoteFile)
- {
- IRemoteFile remoteFile = (IRemoteFile)selectedObject;
-
- ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject);
- if ((remoteAdapter != null))
- {
-
- if (fileNameText != null)
- {
- // simulate the parent file being selected...
- Object parentFile = getSelectedParent();
-
- if (remoteFile.isFile())
- {
- fileName = remoteAdapter.getName(selectedObject);
- fileNameText.setText(fileName);
- }
- else
- {
- fileName =initialFileName;
- if (fileName != null)
- {
- fileNameText.setText(fileName);
- }
- parentFile = remoteFile;
- }
-
-
- remoteAdapter = getRemoteAdapter(parentFile);
- if (remoteAdapter != null)
- {
- String fullPath = remoteAdapter.getAbsoluteName(parentFile);
- setNameText(fullPath);
- outputObjects = new Object[] {parentFile};
- setPageComplete();
- }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java
deleted file mode 100644
index eee6fab25..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java
+++ /dev/null
@@ -1,886 +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) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * 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 Dykstal (IBM) - [148977] New Filter dialog should propose a default filter name on the 2nd page
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-
-import java.util.Arrays;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-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.SystemSelectFileTypesAction;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.internal.ui.actions.SystemTestFilterStringAction;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
-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.RemoteFileSubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.util.ValidatorFileFilterString;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorPathName;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.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;
-
-
-/**
- * The edit pane for page 1 of the New File Filter wizard.
- * Prompts for the details of a single file filter string.
- */
-public class SystemFileFilterStringEditPane
- extends SystemFilterStringEditPane
-{
- // GUI widgets
- protected Button filesOnlyCheckBox;
- protected Button subsetByFileNameRadioButton;
- protected Button subsetByFileTypesRadioButton;
- protected Button selectTypesButton;
- protected Label labelFile;
- protected Label labelTypes;
- protected Text textFile;
- protected Text textTypes;
- protected SystemRemoteFolderCombo folderCombo;
- // limits
- protected int filterFileLength = 256;
- protected int filterPathLength = 256;
- // validators
- protected ISystemValidator pathValidator = new ValidatorPathName();
- protected ISystemValidator fileValidator;
- // inputs
- protected boolean caseSensitive = false;
- //protected boolean showTestButton = true;
- protected String[] inputFilterStrings;
- // state
- protected boolean noValidation = false;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
- protected boolean skipUniquenessChecking;
- protected boolean calledFromVerify;
- protected boolean dontStealFocus;
- protected RemoteFileSubSystemConfiguration inputSubsystemConfiguration = null;
-
- // actions
- private SystemTestFilterStringAction testAction = null;
- private SystemSelectFileTypesAction typesAction = null;
-
-
- /**
- * Constructor for SystemFileFilterStringEditPane.
- * @param shell
- */
- public SystemFileFilterStringEditPane(Shell shell)
- {
- super(shell);
- }
-
- // ------------------------------
- // INPUT/CONFIGURATION METHODS...
- // ------------------------------
- /**
- * Set the contextual system filter pool reference manager provider. Will be non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider (eg subsystem).
- * <p>
- * Intercept of parent so we can extract the isCaseSensitive() value.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- super.setSystemFilterPoolReferenceManagerProvider(provider);
- if (provider != null)
- caseSensitive = ((ISubSystem)provider).getSubSystemConfiguration().isCaseSensitive();
- }
- /**
- * Set the contextual system filter pool manager provider. Will be non-null if the
- * current selection is a filter pool or filter or reference to either, or a manager
- * provider itself (eg, subsystem factory).
- * <p>
- * Intercept of parent so we can extract the isCaseSensitive() value.
- */
- public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- super.setSystemFilterPoolManagerProvider(provider);
- if (provider != null)
- caseSensitive = ((ISubSystemConfiguration)provider).isCaseSensitive();
- }
-
- /**
- * Call this to override the text limit for the filter name, from the default of 40.
- */
- public void setFilterFileLength(int max)
- {
- filterFileLength = max;
- if (textFile != null)
- textFile.setTextLimit(max);
- }
- /**
- * Call this to override the text limit for the filter name, from the default of 40.
- */
- public void setFilterPathLength(int max)
- {
- filterPathLength = max;
- if (folderCombo != null)
- folderCombo.setTextLimit(max);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#setEditable(boolean)
- */
- public void setEditable(boolean editable) {
- super.setEditable(editable);
- enable(filesOnlyCheckBox, editable);
- enable(subsetByFileNameRadioButton, editable);
- enable(selectTypesButton, editable);
- enable(labelFile, editable);
- enable(textFile, editable);
- enable(folderCombo, editable);
- enable(subsetByFileTypesRadioButton, editable);
- enable(labelTypes, editable);
- enable(textTypes, editable);
- }
-
- /**
- * Existing strings are used to aid in uniqueness validation.
- */
- public void setExistingStrings(String[] existingStrings, boolean caseSensitive)
- {
- this.inputFilterStrings = existingStrings;
- this.caseSensitive = caseSensitive;
- }
-
- // ------------------------------
- // LIFECYCLE METHODS...
- // ------------------------------
-
- /**
- * Populate the pane with the GUI widgets
- * @param parent
- * @return Control
- */
- public Control createContents(Composite parent)
- {
- int gridColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);
-
- // directory prompt
- String historyKey = null;
- if (refProvider != null)
- historyKey = ((ISubSystem)refProvider).getSubSystemConfiguration().getId()+".filterStringDialog"; // unique to us //$NON-NLS-1$
- else
- historyKey = "files.filterStringDialog"; // unique to us //$NON-NLS-1$
-
- boolean readonly = false;
- folderCombo = SystemFileWidgetHelpers.createFolderCombo(composite_prompts, null, gridColumns, historyKey, readonly);
- folderCombo.setShowNewConnectionPrompt(false);
- SystemWidgetHelpers.setHelp(folderCombo, RSEUIPlugin.HELPPREFIX+"ffsd0001"); //$NON-NLS-1$
- SystemWidgetHelpers.createLabel(composite_prompts," ",gridColumns); // FILLER //$NON-NLS-1$
-
- // parent folder prompt
- //textFolder = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, rb, RESID_FILEFILTERSTRING_FOLDER_ROOT);
-
- // "Subset by file name filter" radiobutton
- subsetByFileNameRadioButton = SystemWidgetHelpers.createRadioButton(composite_prompts, null, SystemFileResources.RESID_FILEFILTERSTRING_BYFILENAME_LABEL, SystemFileResources.RESID_FILEFILTERSTRING_BYFILENAME_TOOLTIP);
- //SystemWidgetHelpers.setHelp(subsetByFileNameRadioButton, RSEUIPlugin.HELPPREFIX+"ffsd0002", RSEUIPlugin.HELPPREFIX+"ffsd0003");
- SystemWidgetHelpers.setHelp(subsetByFileNameRadioButton, RSEUIPlugin.HELPPREFIX+"ffsd0002"); //$NON-NLS-1$
- updateGridData(subsetByFileNameRadioButton, gridColumns);
-
- // File name prompt
- //textFile = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, rb, RESID_FILEFILTERSTRING_FILE_ROOT);
- String indent = " "; //$NON-NLS-1$
- String temp = SystemWidgetHelpers.appendColon(SystemFileResources.RESID_FILEFILTERSTRING_FILE_LABEL);
- labelFile = SystemWidgetHelpers.createLabel(composite_prompts, indent+temp);
- labelFile.setToolTipText(SystemFileResources.RESID_FILEFILTERSTRING_FILE_TOOLTIP);
- textFile = SystemWidgetHelpers.createTextField(composite_prompts, null);
- textFile.setToolTipText(SystemFileResources.RESID_FILEFILTERSTRING_FILE_TOOLTIP);
- //SystemWidgetHelpers.setHelp(textFile, RSEUIPlugin.HELPPREFIX+"ffsd0003",RSEUIPlugin.HELPPREFIX+"ffsd0002");
- SystemWidgetHelpers.setHelp(textFile, RSEUIPlugin.HELPPREFIX+"ffsd0003"); //$NON-NLS-1$
- updateGridData(textFile, gridColumns-1);
- textFile.setText("*"); //$NON-NLS-1$
-
-
- // "Subset by file types filter" radiobutton
- subsetByFileTypesRadioButton = SystemWidgetHelpers.createRadioButton(composite_prompts, null, SystemFileResources.RESID_FILEFILTERSTRING_BYFILETYPES_LABEL, SystemFileResources.RESID_FILEFILTERSTRING_BYFILETYPES_TOOLTIP);
- //SystemWidgetHelpers.setHelp(subsetByFileTypesRadioButton, RSEUIPlugin.HELPPREFIX+"ffsd0004", RSEUIPlugin.HELPPREFIX+"ffsd0005");
- SystemWidgetHelpers.setHelp(subsetByFileTypesRadioButton, RSEUIPlugin.HELPPREFIX+"ffsd0004"); //$NON-NLS-1$
- updateGridData(subsetByFileTypesRadioButton, gridColumns);
-
- // File types prompt
- Composite typesGroup = SystemWidgetHelpers.createComposite(composite_prompts, 3);
- //SystemWidgetHelpers.setHelp(typesGroup, RSEUIPlugin.HELPPREFIX+"ffsd0005",RSEUIPlugin.HELPPREFIX+"ffsd0004");
- SystemWidgetHelpers.setHelp(typesGroup, RSEUIPlugin.HELPPREFIX+"ffsd0005"); //$NON-NLS-1$
- GridLayout layout = (GridLayout)typesGroup.getLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- updateGridData(typesGroup, gridColumns);
- temp = SystemWidgetHelpers.appendColon(SystemFileResources.RESID_FILEFILTERSTRING_TYPES_LABEL);
- labelTypes = SystemWidgetHelpers.createLabel(typesGroup, indent+temp);
- labelTypes.setToolTipText(SystemFileResources.RESID_FILEFILTERSTRING_TYPES_TOOLTIP);
- textTypes = SystemWidgetHelpers.createReadonlyTextField(typesGroup);
- textTypes.setToolTipText(SystemFileResources.RESID_FILEFILTERSTRING_TYPES_TOOLTIP);
- updateGridData(textTypes, 1);
- selectTypesButton = SystemWidgetHelpers.createPushButton(typesGroup, null, SystemFileResources.RESID_FILEFILTERSTRING_SELECTTYPES_LABEL, SystemFileResources.RESID_FILEFILTERSTRING_SELECTTYPES_TOOLTIP);
- GridData data = (GridData)selectTypesButton.getLayoutData();
- data.grabExcessHorizontalSpace = false;
- data.horizontalAlignment = GridData.FILL;
-
-
- /*
- // Include Folders check box
- subdirCheckBox = SystemWidgetHelpers.createCheckBox(composite_prompts, gridColumns, null,
- rb, RESID_FILEFILTERSTRING_INCFOLDERS_ROOT);
- subdirCheckBox.addSelectionListener(this);
-
- // Include Files check box
- fileCheckBox = SystemWidgetHelpers.createCheckBox(composite_prompts, gridColumns, null,
- rb, RESID_FILEFILTERSTRING_INCFILES_ROOT);
- fileCheckBox.addSelectionListener(this);
- */
-
- // Show Files Only check box
- SystemWidgetHelpers.createLabel(composite_prompts," ",gridColumns); // FILLER //$NON-NLS-1$
- filesOnlyCheckBox = SystemWidgetHelpers.createCheckBox(composite_prompts, gridColumns, null,
- SystemFileResources.RESID_FILEFILTERSTRING_INCFILESONLY_LABEL, SystemFileResources.RESID_FILEFILTERSTRING_INCFILESONLY_TOOLTIP);
- SystemWidgetHelpers.setHelp(filesOnlyCheckBox, RSEUIPlugin.HELPPREFIX+"ffsd0006"); //$NON-NLS-1$
-
- // Test button
- /*
- if (showTestButton)
- {
- SystemWidgetHelpers.createLabel(composite_prompts," ",gridColumns); // FILLER
- SystemWidgetHelpers.createLabel(composite_prompts," ",gridColumns); // FILLER
- createTestButton(composite_prompts, RESID_FILEFILTERSTRING_TEST_ROOT);
- SystemWidgetHelpers.setHelp(testButton, RSEUIPlugin.HELPPREFIX+"ffsd0007");
- updateGridData(testButton, gridColumns);
- }
- */
-
- folderCombo.setFocus();
-
- if (refProvider != null)
- inputSubsystemConfiguration = (RemoteFileSubSystemConfiguration)((ISubSystem)refProvider).getSubSystemConfiguration();
- else if (provider != null)
- inputSubsystemConfiguration = (RemoteFileSubSystemConfiguration)provider;
- pathValidator = inputSubsystemConfiguration.getPathValidator();
- fileValidator = inputSubsystemConfiguration.getFileFilterStringValidator();
- if (refProvider != null)
- folderCombo.setSystemConnection(((ISubSystem)refProvider).getHost());
- else if (inputSubsystemConfiguration != null)
- folderCombo.setSystemTypes(inputSubsystemConfiguration.getSystemTypes());
- folderCombo.setSubSystem((IRemoteFileSubSystem)refProvider);
- folderCombo.setTextLimit(filterPathLength);
- textFile.setTextLimit(filterFileLength);
-
- resetFields();
- doInitializeFields();
-
- folderCombo.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateFolderInput();
- }
- }
- );
- textFile.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateFileInput();
- }
- }
- );
-
- subsetByFileNameRadioButton.addSelectionListener(this);
- subsetByFileTypesRadioButton.addSelectionListener(this);
- selectTypesButton.addSelectionListener(this);
- filesOnlyCheckBox.addSelectionListener(this);
-
- setEditable(editable);
- return composite_prompts;
- }
- private void updateGridData(Control widget, int gridColumns)
- {
- GridData data = (GridData)widget.getLayoutData();
- data.horizontalSpan = gridColumns;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- }
-
- /**
- * Return the control to recieve initial focus. Should be overridden if you override createContents
- */
- public Control getInitialFocusControl()
- {
- return folderCombo.getCombo();
- }
-
- /**
- * Override of parent.
- * Called after reset fields, at first create time or when input is reset to a non-null value.
- */
- protected void doInitializeFields()
- {
- if (folderCombo == null)
- return;
- //if (refProvider == null)
- //RSEUIPlugin.logError("Programming Error: input subsystem is not set for SystemFileFilterStringEditPane",null);
-
- if (inputFilterString != null)
- {
- RemoteFileFilterString rffs = new RemoteFileFilterString(inputSubsystemConfiguration, inputFilterString);
- String defaultPath = rffs.getPath();
- folderCombo.setText((defaultPath==null) ? "" : defaultPath); //$NON-NLS-1$
- String defaultFile = rffs.getFile();
- textFile.setText((defaultFile==null) ? "" : defaultFile); //$NON-NLS-1$
- String defaultTypes = rffs.getTypesAsString();
- textTypes.setText((defaultTypes==null) ? "" : defaultTypes); //$NON-NLS-1$
- boolean defaultIncludeFilesOnly = rffs.getShowFiles() && !rffs.getShowSubDirs();
- boolean defaultSubsetByFileName = !rffs.getFilterByTypes();
- // set appropriate radio button for subset type
- subsetByFileNameRadioButton.setSelection(defaultSubsetByFileName);
- subsetByFileTypesRadioButton.setSelection(!defaultSubsetByFileName);
- filesOnlyCheckBox.setSelection(defaultIncludeFilesOnly);
- enableFields(defaultSubsetByFileName);
- }
- }
- /**
- * This is called in the change filter dialog when the user selects "new", or selects another string.
- * You must override this if you override createContents. Be sure to test if the contents have even been created yet!
- */
- protected void resetFields()
- {
- if (folderCombo == null)
- return;
- folderCombo.setText(""); //$NON-NLS-1$
- textFile.setText("*"); //$NON-NLS-1$
- textTypes.setText(""); //$NON-NLS-1$
- subsetByFileNameRadioButton.setSelection(true);
- subsetByFileTypesRadioButton.setSelection(false);
- filesOnlyCheckBox.setSelection(false);
- enableFields(true);
- }
-
- /**
- * Must be overridden if createContents is overridden.
- * <p>
- * This is called by the isComplete, to decide if the default information
- * is complete enough to enable finish. It doesn't do validation, that will be done when
- * finish is pressed.
- */
- protected boolean areFieldsComplete()
- {
- if (folderCombo == null)
- return false;
- else
- {
- boolean filterGiven = false;
- boolean subsetByFileName = false;
- String fileNameText = null;
-
- if (subsetByFileNameRadioButton.getSelection()) {
- fileNameText = textFile.getText().trim();
- filterGiven = fileNameText.length() > 0;
- subsetByFileName = true;
- }
- else {
- filterGiven = textTypes.getText().trim().length() > 0;
- subsetByFileName = false;
- }
-
- String folderText = folderCombo.getText().trim();
-
- if (inputSubsystemConfiguration != null) {
-
- // KM: defect 53009.
- // if input subsystem factory is Unix, then we can not allow empty path
- if (inputSubsystemConfiguration.isUnixStyle()) {
- return folderText.length() > 0 && filterGiven;
- }
- // otherwise, if it is Windows
- else {
-
- // check if folder path is empty
- if (folderText.length() == 0) {
-
- // KM: defect 53210
- // if folder path empty, only valid filter is subset by file name and it
- // must be wild card
- if (subsetByFileName && fileNameText != null) {
- return fileNameText.equals("*"); //$NON-NLS-1$
- }
- // if we are not subsetting by file name, it is not valid
- else {
- return false;
- }
- }
- // if folder path is not empty, we just make sure a subset is given
- else {
- return filterGiven;
- }
- }
- }
- // otherwise don't care about folder path
- else {
- return filterGiven;
- }
- }
- }
- /**
- * Enable/disable fields dependent on radiobuttons
- */
- private void enableFields(boolean byFileName)
- {
- labelTypes.setEnabled(!byFileName);
- //textTypes.setEnabled(!byFileName);
- selectTypesButton.setEnabled(!byFileName);
- labelFile.setEnabled(byFileName);
- textFile.setEnabled(byFileName);
- }
-
- /**
- * Get the action to run when "Select Types..." is pressed by the user
- */
- private SystemSelectFileTypesAction getSelectTypesAction()
- {
- if (typesAction == null)
- typesAction = new SystemSelectFileTypesAction(selectTypesButton.getShell());
- return typesAction;
- }
-
-
- /**
- * Completes processing of the wizard page or dialog. If this
- * method returns true, the wizard/dialog will close;
- * otherwise, it will stay active.
- *
- * @return error, if there is one
- */
- public SystemMessage verify()
- {
- errorMessage = null;
- Control controlInError = null;
- calledFromVerify = true;
- skipEventFiring = true;
-
- errorMessage = validateFolderInput();
- if (errorMessage != null)
- {
- controlInError = folderCombo;
- }
- else
- {
- if (subsetByFileNameRadioButton.getSelection()) {
- errorMessage = validateFileInput();
- }
- else
- {
- if (textTypes.getText().trim().length() == 0)
- {
- errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_ERROR_NOFILETYPES,
- IStatus.ERROR, FileResources.FILEMSG_ERROR_NOFILETYPES, FileResources.FILEMSG_ERROR_NOFILETYPES_DETAILS);
- }
- }
- controlInError = textFile;
- }
- if ((errorMessage == null) && (inputFilterStrings!=null) && !skipUniquenessChecking)
- {
- boolean notUnique = false;
- String currFilterString = getFilterString();
- if (containsFilterString(currFilterString))
- notUnique = true;
- if (notUnique)
- {
- String msgTxt = NLS.bind(FileResources.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE, currFilterString);
- errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.FILEMSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE,
- IStatus.ERROR, msgTxt);
- }
- controlInError = textFile;
- }
-
- if (errorMessage != null)
- {
- if (!dontStealFocus)
- controlInError.setFocus();
- }
- else
- folderCombo.updateHistory(true);
-
- calledFromVerify = false;
- skipEventFiring = false;
- fireChangeEvent(errorMessage);
- return errorMessage;
- }
-
- /*
- *
- */
- private boolean containsFilterString(String newString)
- {
- if (inputFilterStrings == null)
- return false;
- else
- {
- for (int idx=0; idx<inputFilterStrings.length; idx++)
- {
- if (caseSensitive)
- {
- if (inputFilterStrings[idx].equals(newString))
- return true;
- }
- else
- {
- if (inputFilterStrings[idx].equalsIgnoreCase(newString))
- return true;
- }
- }
- }
- return false;
- }
-
- // ---------------------------------------------
- // METHODS FOR VERIFYING INPUT PER KEYSTROKE ...
- // ---------------------------------------------
- /**
- * 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 validateFileInput()
- {
- if (noValidation || ignoreChanges)
- return null;
-
- errorMessage = null;
-
- // first validate file name
- if (fileValidator != null)
- {
- if (fileValidator instanceof ValidatorFileFilterString)
- {
- ValidatorFileFilterString fv = (ValidatorFileFilterString)fileValidator;
- fv.setIsFileName(true);
- }
-
- errorMessage = fileValidator.validate(textFile.getText().trim());
- }
-
- // if there is no error message, then validate that folder name is correct
- // this fires a change event
- if (errorMessage == null) {
- errorMessage = validateFolderInput();
- }
- // otherwise, simply fire change event
- // Bug 142185: fire an event with null to erase any previously shown and saved error message
- else {
- fireChangeEvent(null);
- fireChangeEvent(errorMessage);
- }
-
- return errorMessage;
- }
- /**
- * 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 validateFolderInput()
- {
- if (noValidation || ignoreChanges)
- return null;
- errorMessage= null;
-
- String folderComboText = folderCombo.getText().trim();
-
- // first check if folder path is empty
- if (folderComboText.length() == 0) {
-
- // KM: defect 53009.
- // If the input subsystem factory is Unix, we do not allow empty folder path.
- // Note that for Windows, it is perfectly valid to have an empty folder path,
- // which indicates that the filter will resolve to show all the drives
- if (inputSubsystemConfiguration != null) {
-
- if (inputSubsystemConfiguration.isUnixStyle()) {
-
- // let error message come from path validator
- if (pathValidator != null) {
- errorMessage = pathValidator.validate(folderComboText);
- }
- // no path validator, so just use default path empty message
- else {
- errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_VALIDATE_PATH_EMPTY,
- IStatus.ERROR, FileResources.MSG_VALIDATE_PATH_EMPTY, FileResources.MSG_VALIDATE_PATH_EMPTY_DETAILS);
- }
- }
- // KM: defect 53210
- // for Windows, check that subset by file name is selected
- // and that it is wild card character
- else {
-
- if (!subsetByFileNameRadioButton.getSelection() || !textFile.getText().trim().equals("*")) { //$NON-NLS-1$
-
- // let error message come from path validator
- if (pathValidator != null) {
- errorMessage = pathValidator.validate(folderComboText);
- }
- // no path validator, so just use default path empty message
- else {
- errorMessage = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ISystemFileConstants.MSG_VALIDATE_PATH_EMPTY,
- IStatus.ERROR, FileResources.MSG_VALIDATE_PATH_EMPTY, FileResources.MSG_VALIDATE_PATH_EMPTY_DETAILS);
- }
- }
- }
- }
- }
- // otherwise go through path validator
- else if (pathValidator != null) {
- errorMessage = pathValidator.validate(folderComboText);
- }
-
- fireChangeEvent(errorMessage);
- return errorMessage;
- }
-
- // ------------------------------
- // DATA EXTRACTION METHODS
- // ------------------------------
-
- /**
- * Get the filter string in its current form.
- * This should be overridden if createContents is overridden.
- */
- public String getFilterString()
- {
- if (folderCombo == null)
- return inputFilterString;
- String folder = folderCombo.getText().trim();
- boolean subsetByFileName = subsetByFileNameRadioButton.getSelection();
- String file = null;
- if (subsetByFileName)
- file = textFile.getText().trim();
- else
- file = textTypes.getText().trim();
- boolean showFilesOnly = filesOnlyCheckBox.getSelection();
- boolean showSubDirs = !showFilesOnly; //subdirCheckBox.getSelection();
- boolean showFiles = true; //fileCheckBox.getSelection();
- RemoteFileFilterString rffs = new RemoteFileFilterString(inputSubsystemConfiguration, folder, file);
- rffs.setShowSubDirs(showSubDirs);
- rffs.setShowFiles(showFiles);
- //System.out.println("internalGetFilterString: showSubDirs = " + showSubDirs + ", showFiles = " + showFiles);
- //System.out.println("... resulting string: " + rffs.toString());
- return rffs.toString();
- }
-
- // ------------------
- // EVENT LISTENERS...
- // ------------------
-
- /**
- * User has selected something
- */
- public void widgetSelected(SelectionEvent event)
- {
- Object src = event.getSource();
- dontStealFocus = true;
- /*
- else if (src == subdirCheckBox)
- validateFileInput();
- else if (src == fileCheckBox)
- validateFileInput();
- */
- if (src == filesOnlyCheckBox)
- {
- verify();
- }
- else if (src == subsetByFileNameRadioButton)
- {
- verify();
- enableFields(true);
- textFile.setFocus();
- }
- else if (src == subsetByFileTypesRadioButton)
- {
- verify();
- enableFields(false);
- selectTypesButton.setFocus();
- }
- else if (src == selectTypesButton)
- {
- SystemSelectFileTypesAction typesAction = getSelectTypesAction();
- String typesString = textTypes.getText().trim();
- typesAction.setTypes(typesString);
- typesAction.run();
- if (!typesAction.wasCancelled())
- {
- typesString = typesAction.getTypesString();
- textTypes.setText(typesString);
- dontStealFocus = false;
- verify();
- }
- }
- dontStealFocus = false;
- }
-
- /**
- * Called by us or by owning dialog when common Test button is pressed
- */
- public void processTest(Shell shell)
- {
- if (refProvider == null)
- {
- SystemBasePlugin.logWarning("Programming Error: input subsystem is not set"); //$NON-NLS-1$
- return;
- }
- skipUniquenessChecking = true;
- if (verify() == null)
- {
- SystemTestFilterStringAction testAction = new SystemTestFilterStringAction(getShell());
- testAction.setSubSystem((ISubSystem)refProvider);
- testAction.setFilterString(getFilterString());
- try
- {
- testAction.run();
- }
- catch (Exception exc)
- {
-
- SystemMessage msg = SystemMessageDialog.getExceptionMessage(getShell(), exc);
- fireChangeEvent(msg);
- }
- }
- skipUniquenessChecking = false;
- }
-
- // ------------------------
- // STATIC HELPER METHODS...
- // ------------------------
-
- /**
- * Reusable method to return a name validator for creating/update a file system filter string
- * @param filter The system filter to which we are adding/updating a filter string.
- * @param filterString The current filter object on updates. Can be null for new string. Used
- * to remove from the existing string list the current filter string.
- */
- public static ValidatorFileFilterString getFileFilterStringValidator(ISystemFilter filter, String filterString)
- {
- String[] strings = filter.getFilterStrings();
- Vector v = new Vector(strings.length);
- v.addAll(Arrays.asList(strings));
- if (filterString != null)
- v.removeElement(filterString);
- IRemoteFileSubSystemConfiguration ssFactory = (IRemoteFileSubSystemConfiguration)filter.getProvider();
- ValidatorFileFilterString validator = new ValidatorFileFilterString(ssFactory,v);
- return validator;
- }
-
- /**
- * Reusable method to return a name validator for creating/update a file system filter string.
- * No unique checking.
- */
- public static ValidatorFileFilterString getFileFilterStringValidator(IRemoteFileSubSystemConfiguration ssFactory)
- {
- return new ValidatorFileFilterString(ssFactory);
- }
-
- /**
- * If the file filter string is in new mode, and we have a non-Unix system, then if
- * the folder name is empty and other fields are at default, we do not allow an implicit
- * save through changing of filter string or pressing Ok button in the change filter pane.
- * If in new mode for non-Unix system, and the user hasn't changed the other fields,
- * we force user to use the Create button to create the filter string explicitly.
- * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#canSaveImplicitly()
- */
- public boolean canSaveImplicitly() {
-
- // KM: defect 53009.
- // check if subsystem factory is non Unix and we're in new mode
- if (newMode && inputSubsystemConfiguration != null && !inputSubsystemConfiguration.isUnixStyle()) {
-
- // check that folder combo is empty
- String folderComboText = folderCombo.getText().trim();
-
- // if so, return false if other fields haven't changed
- // So a user is not able to save with an empty folder path without
- // explicitly pressing Create.
- // Note that if we're changing an existing filter string, a user can save
- // implicitly (i.e. without pressing Apply), by changing the filter
- // string selection in the filter string list in SystemChangeFilterPane
- // or by pressing Ok with pending changes. Same goes for a new filter
- // string for which the user has changed the subset by file name
- // or subset by file type fields. KM: defect 53210
- if (folderComboText.length() == 0 &&
- subsetByFileNameRadioButton.getSelection() &&
- textFile.getText().trim().equals("*")) { //$NON-NLS-1$
- return false;
- }
- else {
- return super.canSaveImplicitly();
- }
- }
- else {
- return super.canSaveImplicitly();
- }
- }
-
- public String getDefaultFilterName()
- {
- String defaultFilterName = ""; //$NON-NLS-1$
- if (folderCombo != null) {
- String folderName = folderCombo.getText().trim();
- if (folderName.length() > 0) {
- String separator = inputSubsystemConfiguration.getSeparator();
- if (folderName.endsWith(separator)) {
- folderName = folderName.substring(0, folderName.length() - separator.length());
- }
- int p = folderName.lastIndexOf(separator);
- p += separator.length();
- if (p < folderName.length()) {
- defaultFilterName = folderName.substring(p);
- }
- }
- }
- return defaultFilterName;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileWidgetHelpers.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileWidgetHelpers.java
deleted file mode 100644
index ba301d222..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileWidgetHelpers.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Static methods that can be used when writing SWT GUI code.
- * They simply make it more productive.
- */
-public class SystemFileWidgetHelpers extends SystemWidgetHelpers
-{
-
-
- /**
- * Creates a new remote system folder combobox instance and sets the default
- * layout data, with tooltip text.
- * <p>
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * A remote system folder combobox is one that mimics the local folder selection combobox, but
- * works with remote file systems instead. It has a label, a historical dropdown, and a browse button.
- * <p>
- * @param parent composite to put the combo into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param historyKey The key with which to remember/restore the history for this combo. Pass null to use the overall default.
- * @param horizontalSpan number of columns this should span
- * @param readOnly true if the combo is to be readonly
- */
- public static SystemRemoteFolderCombo createFolderCombo(Composite parent, SelectionListener listener, int horizontalSpan, String historyKey, boolean readOnly) {
- if (historyKey == null)
- historyKey = ISystemPreferencesConstants.HISTORY_FOLDER;
- SystemRemoteFolderCombo combo = new SystemRemoteFolderCombo(parent, SWT.NULL, historyKey, readOnly);
- if (listener != null)
- combo.addSelectionListener(listener);
- boolean hasGridData = (combo.getLayoutData() != null) && (combo.getLayoutData() instanceof GridData);
- //System.out.println("history directory griddata non-null? " + hasGridData);
- int minwidth = 250;
- if (!hasGridData) {
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = minwidth;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.horizontalSpan = horizontalSpan;
- combo.setLayoutData(data);
- } else {
- ((GridData) combo.getLayoutData()).horizontalSpan = horizontalSpan;
- ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL;
- ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData) combo.getLayoutData()).widthHint = minwidth;
- }
- return combo;
- }
-
- /**
- * Creates a new remote system directory combobox instance and sets the default
- * layout data, with tooltip text. Each remote directory is qualified by its connection name.
- * These combos are always readonly.
- * <p>
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * A remote system qualified-directory combobox is one that mimics the local directory selection combobox, but
- * works with remote file systems instead. It has a label, a historical dropdown, and a browse button.
- * <p>
- * @param parent composite to put the combo into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param historyKey The key with which to remember/restore the history for this combo. Pass null to use the overall default.
- * @param horizontalSpan number of columns this should span
- */
- public static SystemQualifiedRemoteFolderCombo createQualifiedDirectoryCombo(Composite parent, SelectionListener listener, int horizontalSpan, String historyKey) {
- if (historyKey == null)
- historyKey = ISystemPreferencesConstants.HISTORY_QUALIFIED_FOLDER;
- SystemQualifiedRemoteFolderCombo combo = new SystemQualifiedRemoteFolderCombo(parent, SWT.NULL, historyKey);
- if (listener != null)
- combo.addSelectionListener(listener);
- boolean hasGridData = (combo.getLayoutData() != null) && (combo.getLayoutData() instanceof GridData);
- //System.out.println("history directory griddata non-null? " + hasGridData);
- int minwidth = 250;
- if (!hasGridData) {
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = minwidth;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.horizontalSpan = horizontalSpan;
- combo.setLayoutData(data);
- } else {
- ((GridData) combo.getLayoutData()).horizontalSpan = horizontalSpan;
- ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL;
- ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData) combo.getLayoutData()).widthHint = minwidth;
- }
- return combo;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java
deleted file mode 100644
index 9a4f8edba..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java
+++ /dev/null
@@ -1,789 +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 Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * David McKnight (IBM) - [186363] get rid of obsolete calls to ISubSystem.connect()
- * 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) - [225089][ssh][shells][api] Canceling connection leads to exception
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-import java.util.Hashtable;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.osgi.util.NLS;
-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.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.services.clientserver.messages.CommonMessages;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-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.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.widgets.ISystemCombo;
-import org.eclipse.rse.ui.widgets.SystemHistoryCombo;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This re-usable widget is for selecting a new or previously specified
- * folder path within a given connection.
- * <p>
- * The dropdown is historical and contains a folder path qualified by a connection name.
- * It is readonly ... the user must use the browse button.
- * <p>
- * The composite is layed as follows:
- * <code>
- * Folder: conn\dir1_____v Browse...
- * </code>
- * <p>
- * The browse button lists only connections that are of the specified subsystem factory.
- * It also by default has a New Connection... prompting object for creating new connections, but this can be
- * turned off.
- * <p>
- * To get the current folder object selected, use getFolder().
- * <p>
- * To listen for changes, use addSelectionListener().
- */
-public class SystemQualifiedRemoteFolderCombo extends Composite
- implements ISystemCombo
-{
- public static final char CONNECTION_DELIMITER = IRemoteFile.CONNECTION_DELIMITER;
- private Label folderLabel = null;
- private SystemHistoryCombo folderCombo = null;
- private Button browseButton = null;
- //private RemoteFileSubSystem subsystem = null;
- //private RemoteFileSubSystemConfiguration subsystemConfiguration = null;
- //private String subsystemConfigurationID = null;
- //private IRemoteFile[] folders = null;
- private Hashtable resolvedFolders = new Hashtable();
- //private String[] folderStrings = null;
- private IRSESystemType[] systemTypes;
- private boolean readOnly = true;
- private boolean showNewPrompt = true;
- private SystemSelectRemoteFolderAction browseAction = null;
- //private static final int DEFAULT_COMBO_WIDTH = 300;
- //private static final int DEFAULT_BUTTON_WIDTH = 80;
-
- /**
- * Constructor.
- * Requires a history key used to store/restore the dropdown history for this. Pass null to use
- * the overall default (ISystemPreferencesConstants.HISTORY_FOLDER).
- * By default, this allows users to select with any connection that has subsystems that implement
- * RemoteFileSubSystem. To restrict it to connections of a particular system type, say, call
- * setSystemType.
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget
- * @param historyKey A string identifying the key into the user preferences where this combo's history will be stored.
- * @see #setSystemType(IRSESystemType)
- */
- public SystemQualifiedRemoteFolderCombo(Composite parent, int style, String historyKey)
- {
- super(parent, style);
- prepareComposite(3);
- folderLabel = SystemWidgetHelpers.createLabel(this,SystemFileResources.WIDGET_FOLDER_LABEL, SystemFileResources.WIDGET_FOLDER_TOOLTIP);
- if (historyKey == null)
- historyKey = ISystemPreferencesConstants.HISTORY_QUALIFIED_FOLDER;
- folderCombo = SystemWidgetHelpers.createHistoryCombo(this,null,historyKey,readOnly,SystemFileResources.WIDGET_FOLDER_TOOLTIP);
- Object folderData = folderCombo.getLayoutData();
- if (folderData instanceof GridData)
- ((GridData)folderData).widthHint = 200;
- browseButton = createPushButton(this,SystemFileResources.WIDGET_BROWSE_LABEL);
- browseButton.setToolTipText(SystemFileResources.WIDGET_BROWSE_TOOLTIP);
- addOurButtonSelectionListener();
- //scrubHistory(); this is too intensive as it starts all kinds of servers and stuff unnecessarily.
- }
-
- /**
- * Set auto-uppercase. When enabled, all non-quoted values are uppercases when appropriate.
- * This has no effect in readonly mode, which this combo is, so in fact this is ineffective!
- * We include it in case we allow editing in the future, and because it is in the ISystemCombo
- * interface we implement.
- */
- public void setAutoUpperCase(boolean enable)
- {
- folderCombo.setAutoUpperCase(enable);
- }
-
- /**
- * 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});
- //System.out.println("SYSTEM TYPES SET TO "+systemType+" IN SYSQUALRMTFLDRCMBO");
- }
-
- /**
- * Specify if the "New Connection..." object for creating connections should be shown when the user selects
- * the Browse... button to select a remote folder. The default is true.
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- this.showNewPrompt = show;
- if (browseAction != null)
- browseAction.setShowNewConnectionPrompt(show);
- }
-
- /**
- * Return the combo box history widget
- */
- public SystemHistoryCombo getFolderCombo()
- {
- return folderCombo;
- }
- /**
- * Return the combo box widget
- */
- public SystemHistoryCombo getHistoryCombo()
- {
- return folderCombo;
- }
- /**
- * Return the raw combo box widget
- */
- public Combo getCombo()
- {
- return folderCombo.getCombo();
- }
-
- /**
- * Set the width hint for this whole composite
- * Default is computed from the child widgets
- */
- public void setWidthHint(int widthHint)
- {
- // after much research it was decided that it was the wrong thing to do to
- // explicitly set the widthHint of a child widget without our composite, as
- // that could end up being a bigger number than the composites widthHint itself
- // if the caller set its it directly.
- // Rather, we just set the overall composite width and specify the combo child
- // widget is to grab all the space within that which the little button does not use.
- ((GridData)getLayoutData()).widthHint = widthHint;
- }
-
- /**
- * Return the browse button widget
- */
- public Button getBrowseButton()
- {
- return browseButton;
- }
-
- /**
- * Set the folders in the combo field.
- * History is updated.
- * @param folders Array of IRemoteFile objects ... each is a remote folder
- */
- public void setFolders(IRemoteFile[] folders)
- {
- if (folders == null)
- {
- //folderStrings = null;
- folderCombo.setItems(null);
- return;
- }
- String[] folderStrings = new String[folders.length];
- for (int idx=0; idx<folders.length; idx++)
- folderStrings[idx] = folders[idx].getAbsolutePathPlusConnection();
- folderCombo.setItems(folderStrings);
- folderCombo.select(0);
- updateHistory();
- }
- /**
- * Append a folder to the list. It is not selected so call {@link #setFolder(IRemoteFile)}
- * or {@link #setSelectionIndex(int)} to select it if desired.
- * History is updated.
- * @param folder The folder to add. Caller's responsibility to precheck for existence
- * by calling {@link #getFolderIndex(IRemoteFile)}.
- * @return int zero-based index position of new entry in list.
- */
- public int addFolder(IRemoteFile folder)
- {
- int pos = -1;
- String[] folderStrings = folderCombo.getItems();
- if (folderStrings == null)
- {
- folderStrings = new String[1];
- folderStrings[0] = folder.getAbsolutePathPlusConnection();
- pos = 0;
- }
- else
- {
- String[] newFolderStrings = new String[folderStrings.length+1];
- for (int idx=0; idx<folderStrings.length; idx++)
- newFolderStrings[idx] = folderStrings[idx];
- pos = newFolderStrings.length-1;
- newFolderStrings[pos] = folder.getAbsolutePathPlusConnection();
- folderStrings = newFolderStrings;
- }
- folderCombo.setItems(folderStrings);
- //folderCombo.select(pos);
- folderCombo.setHistory(folderStrings);
- return pos;
- }
- /**
- * Remove a folder from the list. History is updated
- * @param folder The folder to remove.
- */
- public void removeFolder(IRemoteFile folder)
- {
- int idx = getFolderIndex(folder);
- if (idx > -1)
- {
- folderCombo.getCombo().remove(idx);
- updateHistory();
- }
- }
-
- /**
- * Get the items in the combo field as an array of strings.
- * @return Array of String objects
- */
- public String[] getItems()
- {
- return folderCombo.getItems();
- }
-
- /**
- * Get the index of a given folder in the current list for this combo.
- * Returns -1 if it is not in the list.
- */
- public int getFolderIndex(IRemoteFile folder)
- {
- int match = -1;
- String[] folderStrings = folderCombo.getItems();
- if ( (folderStrings == null) || (folderStrings.length==0) )
- return match;
- String fulldir = folder.getAbsolutePathPlusConnection();
- for (int idx=0; (idx<folderStrings.length) && (match==-1); idx++)
- {
- if (folderStrings[idx].equals(fulldir))
- match = idx;
- }
- return match;
- }
-
- /**
- * Set the folder combo field's current contents given an IRemoteFile object.
- * If this folder is in the list, it is selected.
- * If it is not in the list, it is added and selected.
- */
- public void setFolder(IRemoteFile folder)
- {
- int idx = getFolderIndex(folder);
- if (idx == -1)
- idx = addFolder(folder);
- select(idx);
- }
- /**
- * Set the value by selecting the item in the list at the given position.
- * Same as {@link #select(int)}
- */
- public void setSelectionIndex(int selIdx)
- {
- select(selIdx);
- }
- /**
- * Select the combo dropdown list entry at the given index
- * Same as {@link #setSelectionIndex(int)}
- */
- public void select(int selIdx)
- {
- folderCombo.clearSelection();
- folderCombo.select(selIdx);
- }
-
- /**
- * Clear the selection of the text in the entry field part of the combo, and the list selection
- */
- public void clearSelection()
- {
- folderCombo.clearSelection();
- }
- /**
- * Clear the selection of the text in the entry field part of the combo
- */
- public void clearTextSelection()
- {
- folderCombo.clearTextSelection();
- }
-
- /**
- * Get the index number of the currently selected item.
- */
- public int getSelectionIndex()
- {
- return folderCombo.getSelectionIndex();
- }
-
- /**
- * Query the folder combo field's current contents
- */
- public String getText()
- {
- return folderCombo.getText();
- }
- /**
- * Query the folder combo field's current contents as an IRemoteFile object.
- * It is at this time that the currently selected string is converted into an
- * IRemoteFile object. This can be a bit computationally intensive, as it requires
- * accessing the remote system, and prompting for a connection if the user is not
- * not yet connected to that system.
- * <p>
- * Since it is possible the selected item is no longer valid, this will throw an
- * exception if the profile or connection does not exist or the user cancels the
- * connecting action. The message in the exception is translated and displayable.
- */
- public IRemoteFile getFolder()
- throws Exception
- {
- String fileString = folderCombo.getText().trim();
- //System.out.println("selected idx = " + idx);
- if (fileString.length() == 0)
- return null;
- else
- {
- IRemoteFile fileObj = (IRemoteFile)resolvedFolders.get(fileString);
- if (fileObj == null)
- {
- fileObj = convertToRemoteFile(fileString);
- if (fileObj != null)
- resolvedFolders.put(fileString, fileObj);
- }
- return fileObj;
- }
- }
- /**
- * Query the folder combo field's current contents and return the connection part of
- * it as a SystemConnection object.
- * <p>
- * Will return null if either there is no contents currently or there is no such system!
- */
- public IHost getSystemConnection()
- {
- String fileString = folderCombo.getText().trim();
- if (fileString.length() == 0)
- return null;
- String profileName = extractProfileName(fileString);
- String connName = extractConnectionName(fileString);
- if ((profileName == null) || (connName == null))
- return null;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = sr.getSystemProfile(profileName);
- if (profile == null)
- return null;
- IHost conn = RSECorePlugin.getTheSystemRegistry().getHost(profile,connName);
- return conn;
- }
-
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- folderCombo.setEnabled(enabled);
- browseButton.setEnabled(enabled);
- }
- /**
- * Set the tooltip text for the folder combo field
- */
- public void setToolTipText(String tip)
- {
- folderLabel.setToolTipText(tip);
- folderCombo.setToolTipText(tip);
- }
- /**
- * Set the tooltip text for the browse button
- */
- public void setBrowseButtonToolTipText(String tip)
- {
- browseButton.setToolTipText(tip);
- }
- /**
- * Same as {@link #setBrowseButtonToolTipText(String)}
- */
- public void setButtonToolTipText(String tip)
- {
- setBrowseButtonToolTipText(tip);
- }
-
- /**
- * Set the folder combo field's text limit
- */
- public void setTextLimit(int limit)
- {
- folderCombo.setTextLimit(limit);
- }
- /**
- * Set the focus to the folder combo field
- */
- public boolean setFocus()
- {
- return folderCombo.setFocus();
- }
- /**
- * Set the focus to the browse button
- */
- public void setBrowseButtonFocus()
- {
- browseButton.setFocus();
- }
-
- /**
- * Register a listener interested in an item is selected in the combo box
- * @see #removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener)
- {
- folderCombo.addSelectionListener(listener);
- }
- /**
- * Remove a previously set combo box selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener)
- {
- folderCombo.removeSelectionListener(listener);
- }
- /**
- * Register a listener interested in when the browse button is selected
- * @see #removeBrowseButtonSelectionListener(SelectionListener)
- */
- public void addBrowseButtonSelectionListener(SelectionListener listener)
- {
- browseButton.addSelectionListener(listener);
- }
- /**
- * Remove a previously set browse button selection listener.
- * @see #addBrowseButtonSelectionListener(SelectionListener)
- */
- public void removeBrowseButtonSelectionListener(SelectionListener listener)
- {
- browseButton.removeSelectionListener(listener);
- }
-
- /**
- * Register a listener interested in entry field modify events
- * @see #removeModifyListener(ModifyListener)
- */
- public void addModifyListener(ModifyListener listener)
- {
- folderCombo.addModifyListener(listener);
- }
- /**
- * Remove a previously set entry field listener.
- * @see #addModifyListener(ModifyListener)
- */
- public void removeModifyListener(ModifyListener listener)
- {
- folderCombo.removeModifyListener(listener);
- }
-
- /**
- * Return the current history for the folder combo box
- */
- public static String[] getHistory()
- {
- return SystemPreferencesManager.getFolderHistory();
- }
-
- /**
- * Update the history with current entry field setting.
- * <p>
- * This is called automatically for you whenever this list is changed.
- */
- public void updateHistory()
- {
- folderCombo.updateHistory();
- }
-
- // ---------------------------------------------------------
- // METHODS TO CONVERT FROM STRINGS TO IREMOTEFILE OBJECTS...
- // ---------------------------------------------------------
- /**
- * Given a qualified folder name, return an IRemoteFile object representing it.
- * Will return null if there is no connection of the given name, or that connection
- * does not have a subsystem that implements RemoteFileSubSystem.
- * <p>
- * Note that if the connection contains multiple subsystems that implement RemoteFileSubSystem,
- * or that come from a subsystem factory of the given subsystem factory ID,
- * the first such subsystem is chosen.
- */
- public IRemoteFile convertToRemoteFile(String qualifiedFolder)
- throws Exception
- {
- SystemMessage msg = null;
- // parse string in constituent profile, connection and folder parts...
- String profileName = extractProfileName(qualifiedFolder);
- String connName = extractConnectionName(qualifiedFolder);
- String dirName = extractFolder(qualifiedFolder);
- if ((profileName == null) || (connName == null) || (dirName == null))
- return null;
-
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- // turn profile name into profile object...
- ISystemProfile profile = sr.getSystemProfile(profileName);
- if (profile == null)
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_PROFILE_NOTFOUND, profileName);
- throw new Exception(msgTxt);
- }
-
- // turn connection name into connection object...
- IHost conn = RSECorePlugin.getTheSystemRegistry().getHost(profile,connName);
- if (conn == null)
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_CONNECTION_NOTFOUND, connName);
- throw new Exception(msgTxt);
- }
-
- // turn folder name into folder object...
- IRemoteFile remoteFolder = null;
- ISubSystem[] filesubsystems = null;
- //if (subsystemConfigurationID == null)
- filesubsystems = RemoteFileUtility.getFileSubSystems(conn);
- //else
- // filesubsystems = sr.getSubSystems(subsystemConfigurationID, conn);
-
- if (filesubsystems.length == 0)
- {
- String msgTxt = NLS.bind(FileResources.MSG_ERROR_CONNECTION_NOTFOUND, connName);
- throw new Exception(msgTxt);
- }
- IRemoteFileSubSystem ss = (IRemoteFileSubSystem)filesubsystems[0]; // what else to do?
- if (!ss.isConnected())
- {
- try
- {
- if (Display.getCurrent() == null) {
- ss.connect(new NullProgressMonitor(), false);
- } else {
- ss.connect(false, null);
- }
- } catch (OperationCanceledException exc)
- {
- String msgTxt = NLS.bind(CommonMessages.MSG_CONNECT_CANCELLED, conn.getHostName());
- throw new Exception(msgTxt);
- } catch (Exception exc)
- {
- String msgTxt = NLS.bind(CommonMessages.MSG_CONNECT_FAILED, conn.getHostName());
- throw new Exception(msgTxt);
- }
- }
- if (ss.isConnected())
- remoteFolder = ss.getRemoteFileObject(dirName, new NullProgressMonitor());
- return remoteFolder;
- }
-
- /**
- * Get the profile.connection name part of a qualified folder string.
- */
- public static String extractQualifiedConnectionName(String qualifiedFolder)
- {
- int idx = qualifiedFolder.indexOf(CONNECTION_DELIMITER);
- if (idx == -1)
- return null;
- else
- return qualifiedFolder.substring(0,idx);
- }
- /**
- * Get the profile name part of a profile.connection string
- */
- public static String extractProfileName(String qualifiedConnectionName)
- {
- int idx = qualifiedConnectionName.indexOf('.');
- if (idx == -1)
- return null;
- else
- return qualifiedConnectionName.substring(0,idx);
- }
- /**
- * Get the connection name part of a profile.connection string.
- * Will work if given profile.connection or profile.connection\folder
- */
- public static String extractConnectionName(String qualifiedConnectionName)
- {
- int idx = qualifiedConnectionName.indexOf('.');
- if (idx == -1)
- return null;
- else
- {
- String nonProfile = qualifiedConnectionName.substring(idx+1);
- idx = nonProfile.indexOf(CONNECTION_DELIMITER);
- if (idx == -1)
- return nonProfile;
- else
- return nonProfile.substring(0,idx);
- }
- }
-
- /**
- * Get the folder name part of a qualified folder string.
- */
- public static String extractFolder(String qualifiedFolder)
- {
- int idx = qualifiedFolder.indexOf(CONNECTION_DELIMITER);
- if (idx == -1)
- return null;
- else
- return qualifiedFolder.substring(idx+1);
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
-
- /**
- * Prepares this composite control and sets the default layout data.
- * @param numColumns Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns)
- {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = false;
- //data.widthHint = 300;
- composite.setLayoutData(data);
- return composite;
- }
-
- protected void addOurButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- IHost defaultConnection = null;
- IRemoteFile currFolder = null;
- try
- {
- currFolder = getFolder();
- } catch (Exception exc) {}
- if (currFolder != null)
- defaultConnection = currFolder.getHost();
-
- if (browseAction == null)
- {
- browseAction = getBrowseAction(getShell(), defaultConnection);
- }
- browseAction.setShowNewConnectionPrompt(showNewPrompt);
- //if (defaultConnection != null)
- browseAction.setHost(defaultConnection);
- //if (systemTypes != null)
- browseAction.setSystemTypes(systemTypes);
- //if (systemTypes != null)
- // System.out.println("browseAction systemsTypes set to "+systemTypes[0]);
-
-
- browseAction.run();
- IRemoteFile folder = browseAction.getSelectedFolder();
- if (folder != null)
- setFolder(folder);
- }
- };
- browseButton.addSelectionListener(selectionListener);
- }
- /**
- * Returns action to be called when Browse... pressed.
- */
- protected SystemSelectRemoteFolderAction getBrowseAction(Shell shell, IHost defaultConnection)
- {
- SystemSelectRemoteFolderAction action = new SystemSelectRemoteFolderAction(shell);
- return action;
- }
-
-
- public static Button createPushButton(Composite group, String label)
- {
- Button button = new Button(group, SWT.PUSH);
- button.setText(label);
- //button.setText("THIS IS A VERY LONG LABEL. I MEAN, IT IS JUST HUGE");
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = false;
- button.setLayoutData(data);
- return button;
- }
- protected static Button createPushButton(Composite group, ResourceBundle bundle, String key)
- {
- String label = bundle.getString(key+"label"); //$NON-NLS-1$
- Button button = createPushButton(group,label);
- button.setToolTipText(bundle.getString(key+"tooltip")); //$NON-NLS-1$
- return button;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java
deleted file mode 100644
index 030b8243e..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-import java.util.Iterator;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-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.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.widgets.ISystemCombo;
-import org.eclipse.rse.ui.widgets.SystemHistoryCombo;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This re-usable widget is for selecting a new or previously specified
- * folder path within a given connection.
- * <p>
- * Unlike SystemQualifiedRemoteFolderCombo, this widget does not combine the
- * connection name with the folder name. That means if you want to restrict
- * this to a particular connection, you must call setSystemConnection. If
- * you want to restrict to any connections of a particular system type, call
- * setSystemType.
- * <p>
- * Because this combo only deals with strings, versus IRemoteFile, it is
- * left to the caller to interpret that string as desired.
- * <p>
- * The composite is layed as follows:
- * <pre><code>
- * Folder: ______________v Browse...
- * </code></pre>
- */
-public class SystemRemoteFolderCombo extends Composite implements ISystemCombo
-{
- private Label folderLabel = null;
- private SystemHistoryCombo folderCombo = null;
- private Button browseButton = null;
- //private RemoteFileSubSystem subsystem = null;
- //private RemoteFileSubSystemConfiguration subsystemConfiguration = null;
- private IRSESystemType[] systemTypes = null;
- private IHost connection = null;
- private boolean showNewConnectionPrompt = true;
- //private static final int DEFAULT_COMBO_WIDTH = 300;
- //private static final int DEFAULT_BUTTON_WIDTH = 80;
- private SystemSelectRemoteFolderAction browseAction = null;
- private IRemoteFileSubSystem fileSubSystem = null;
-
- // list of listeners that are notified when the browse action is run and completed
- // note that the listener
- private Vector listeners;
-
- /**
- * Constructor for SystemFileFolderCombo. Requires a history key used to store/restore the
- * dropdown history for this. Pass null to use the overall default (ISystemPreferencesConstants.HISTORY_FOLDER)
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget
- * @param historyKey A string identifying the key into the user preferences where this combo's history will be stored.
- * @param readOnly True if the combo box is not to allow user editing.
- * @see #setSystemConnection(IHost)
- */
- public SystemRemoteFolderCombo(Composite parent, int style, String historyKey, boolean readOnly)
- {
- super(parent, style);
- prepareComposite(3);
- folderLabel = SystemWidgetHelpers.createLabel(this,SystemFileResources.WIDGET_FOLDER_LABEL, SystemFileResources.WIDGET_FOLDER_TOOLTIP);
- if (historyKey == null)
- historyKey = ISystemPreferencesConstants.HISTORY_FOLDER;
- folderCombo = SystemWidgetHelpers.createHistoryCombo(this,null,historyKey,readOnly,SystemFileResources.WIDGET_FOLDER_TOOLTIP);
- Object folderData = folderCombo.getLayoutData();
- if (folderData instanceof GridData)
- ((GridData)folderData).widthHint = 160;
- browseButton = createPushButton(this,SystemFileResources.WIDGET_BROWSE_LABEL);
- addOurButtonSelectionListener();
-
- listeners = new Vector();
- }
-
- /**
- * Set auto-uppercase. When enabled, all non-quoted values are uppercases when appropriate.
- * This has no effect in readonly mode!
- */
- public void setAutoUpperCase(boolean enable)
- {
- folderCombo.setAutoUpperCase(enable);
- }
-
- /**
- * 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 the input system connection to restrict the browse button to this connection only.
- * Either call this or setSubSystemConfigurationId.
- */
- public void setSystemConnection(IHost connection)
- {
- this.connection = connection;
- }
- /**
- * Get the system connection as specified in setSystemConnection.
- */
- public IHost getSystemConnection()
- {
- return connection;
- }
-
- /**
- * Set the input remote file subsystem. If set, this will allow the browse button to better
- * pre-fill the selection dialog when browse is pressed.
- */
- public void setSubSystem(IRemoteFileSubSystem subsystem)
- {
- this.fileSubSystem = subsystem;
- }
-
- /**
- * Set whether to allow users to create new connections when Browse is pressed
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- this.showNewConnectionPrompt = show;
- }
-
- /**
- * Return the combo box widget as a System
- * Same as {@link #getCombo()}
- */
- public Combo getFolderCombo()
- {
- return folderCombo.getCombo();
- }
-
- /**
- * Get folder label.
- * @return the folder label.
- */
- public Label getFolderLabel() {
- return folderLabel;
- }
-
- /**
- * Return the combo box historical widget
- * Same as {@link #getCombo()} but returns the combo reference as a SystemHistoryCombo reference
- */
- public SystemHistoryCombo getHistoryCombo()
- {
- return folderCombo;
- }
- /**
- * Return the embedded combo box widget
- * Same as {@link #getFolderCombo()}
- */
- public Combo getCombo()
- {
- return folderCombo.getCombo();
- }
-
- /**
- * Set the width hint for this whole composite
- * Default is computed from children.
- */
- public void setWidthHint(int widthHint)
- {
- // after much research it was decided that it was the wrong thing to do to
- // explicitly set the widthHint of a child widget without our composite, as
- // that could end up being a bigger number than the composites widthHint itself
- // if the caller set its it directly.
- // Rather, we just set the overall composite width and specify the combo child
- // widget is to grab all the space within that which the little button does not use.
- ((GridData)getLayoutData()).widthHint = widthHint;
- }
-
- /**
- * Return the browse button widget
- */
- public Button getBrowseButton()
- {
- return browseButton;
- }
-
- /**
- * Set the items in the combo field
- */
- public void setItems(String[] items)
- {
- folderCombo.setItems(items);
- }
- /**
- * Get the items in the combo field
- */
- public String[] getItems()
- {
- return folderCombo.getItems();
- }
-
-
- /**
- * Set the folder combo field's current contents
- */
- public void setText(String text)
- {
- folderCombo.setText(text);
- }
-
- /**
- * Query the folder combo field's current contents
- */
- public String getText()
- {
- return folderCombo.getText();
- }
-
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- folderLabel.setEnabled(enabled);
- folderCombo.setEnabled(enabled);
- browseButton.setEnabled(enabled);
- }
- /**
- * Set the tooltip text for the folder combo field
- */
- public void setToolTipText(String tip)
- {
- folderLabel.setToolTipText(tip);
- folderCombo.setToolTipText(tip);
- }
- /**
- * Set the tooltip text for the browse button
- */
- public void setBrowseButtonToolTipText(String tip)
- {
- browseButton.setToolTipText(tip);
- }
- /**
- * Set the tooltip text for the browse button.
- * Same as {@link #setBrowseButtonToolTipText(String)}
- */
- public void setButtonToolTipText(String tip)
- {
- browseButton.setToolTipText(tip);
- }
-
- /**
- * Set the folder combo field's text limit
- */
- public void setTextLimit(int limit)
- {
- folderCombo.setTextLimit(limit);
- }
- /**
- * Set the focus to the folder combo field
- */
- public boolean setFocus()
- {
- return folderCombo.setFocus();
- }
- /**
- * Set the focus to the browse button
- */
- public void setBrowseButtonFocus()
- {
- browseButton.setFocus();
- }
- /**
- * Select the combo dropdown list entry at the given index
- */
- public void select(int selIdx)
- {
- folderCombo.select(selIdx);
- }
- /**
- * Same as {@link #select(int)}
- */
- public void setSelectionIndex(int selIdx)
- {
- select(selIdx);
- }
- /**
- * Get the index number of the currently selected item.
- */
- public int getSelectionIndex()
- {
- return folderCombo.getSelectionIndex();
- }
-
- /**
- * Clear the selection of the text in the entry field part of the combo
- */
- public void clearSelection()
- {
- folderCombo.clearSelection();
- }
- /**
- * Clear the entered/selected contents of the combo box. Clears only the text selection, not the list selection
- */
- public void clearTextSelection()
- {
- folderCombo.clearTextSelection();
- }
- /**
- * Register a listener interested in an item is selected in the combo box
- * @see #removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener)
- {
- folderCombo.addSelectionListener(listener);
- }
- /**
- * Remove a previously set combo box selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener)
- {
- folderCombo.removeSelectionListener(listener);
- }
- /**
- * Register a listener interested in when the browse button is selected
- * @see #removeBrowseButtonSelectionListener(SelectionListener)
- */
- public void addBrowseButtonSelectionListener(SelectionListener listener)
- {
- browseButton.addSelectionListener(listener);
- }
- /**
- * Remove a previously set browse button selection listener.
- * @see #addBrowseButtonSelectionListener(SelectionListener)
- */
- public void removeBrowseButtonSelectionListener(SelectionListener listener)
- {
- browseButton.removeSelectionListener(listener);
- }
-
- /**
- * Register a listener interested in entry field modify events
- * @see #removeModifyListener(ModifyListener)
- */
- public void addModifyListener(ModifyListener listener)
- {
- folderCombo.addModifyListener(listener);
- }
- /**
- * Remove a previously set entry field listener.
- * @see #addModifyListener(ModifyListener)
- */
- public void removeModifyListener(ModifyListener listener)
- {
- folderCombo.removeModifyListener(listener);
- }
-
- /**
- * Adds a listener which will be notified each time after the browse action is run.
- * @param listener the listener to be notified.
- */
- public void addBrowseActionCompleteListener(ISystemRemoteFolderBrowseCompleteListener listener) {
-
- if (!listeners.contains(listener)) {
- listeners.add(listener);
- }
- }
-
- /**
- * Removes the given listener. Has no effect if the listener was not added before.
- * @param listener the listener to be removed.
- */
- public void removeBrowseActionCompleteListener(ISystemRemoteFolderBrowseCompleteListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Notifies all registered listeners.
- * @param remoteFile the remote file to use for the notification.
- */
- protected void notifyBrowseActionCompleteListeners(IRemoteFile remoteFile) {
-
- Iterator iter = listeners.iterator();
-
- if (iter.hasNext()) {
- ISystemRemoteFolderBrowseCompleteListener listener = (ISystemRemoteFolderBrowseCompleteListener)(iter.next());
- listener.fileSelected(remoteFile);
- }
- }
-
- /**
- * Return the current history for the folder combo box
- */
- public static String[] getHistory()
- {
- return SystemPreferencesManager.getFolderHistory();
- }
-
- /**
- * Update the history with current entry field setting.
- * <p>
- * This is called automatically for you when setText is called. However, for non-readonly
- * versions, you should still call this yourself when OK is successfully pressed on the
- * dialog box.
- */
- public void updateHistory()
- {
- folderCombo.updateHistory();
- }
-
- /**
- * Update the history with current entry field setting, and optionally refresh the list from the new history.
- */
- public void updateHistory(boolean refresh) {
- folderCombo.updateHistory(refresh);
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares this composite control and sets the default layout data.
- * @param numColumns Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns)
- {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = false;
- //data.widthHint = 180; //CAUSES TRUNCATION IF TRANSLATED BUTTON TEXT IS LONG
- composite.setLayoutData(data);
- return composite;
- }
-
- protected void addOurButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- if (browseAction == null)
- {
- browseAction = getBrowseAction(getShell());
- }
- //if (connection != null)
- browseAction.setFoldersOnly(true);
- browseAction.setHost(connection);
- //if (systemTypes != null)
- browseAction.setSystemTypes(systemTypes);
- browseAction.setShowNewConnectionPrompt(showNewConnectionPrompt);
- browseAction.setShowPropertySheet(true, false);
- String currentFolder = getText().trim();
- if ((currentFolder.length() > 0) && (fileSubSystem!=null))
- {
- IRemoteFile currentFolderObject = null;
- try {
- currentFolderObject = fileSubSystem.getRemoteFileObject(currentFolder, new NullProgressMonitor());
- } catch(SystemMessageException e) {
- SystemBasePlugin.logError("SystemRemoteFolderCombo.wdigetSelected", e); //$NON-NLS-1$
- }
- if (currentFolderObject != null)
- browseAction.setPreSelection(currentFolderObject);
- }
-
- browseAction.run();
- IRemoteFile folder = browseAction.getSelectedFolder();
- if (folder != null)
- setText(folder.getAbsolutePath());
-
- // notify listeners with the selected folder
- // we notify even if the suer cancelled and the folder is null so listeners
- // know that the brose dialog was cancelled
- notifyBrowseActionCompleteListeners(folder);
- }
- };
- browseButton.addSelectionListener(selectionListener);
- }
- /**
- * Returns action to be called when Browse... pressed.
- * Either connection or subsystemConfigurationId better be set!
- */
- protected SystemSelectRemoteFolderAction getBrowseAction(Shell shell)
- {
- SystemSelectRemoteFolderAction action = new SystemSelectRemoteFolderAction(shell);
- return action;
- }
-
-
- public static Button createPushButton(Composite group, String label)
- {
- Button button = new Button(group, SWT.PUSH);
- button.setText(label);
- //button.setText("THIS IS A VERY LONG LABEL. I MEAN IT IS JUST HUGE."); //to test mri
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = false;
- button.setLayoutData(data);
- return button;
- }
- protected static Button createPushButton(Composite group, ResourceBundle bundle, String key)
- {
- String label = bundle.getString(key+"label"); //$NON-NLS-1$
- Button button = createPushButton(group,label);
- button.setToolTipText(bundle.getString(key+"tooltip")); //$NON-NLS-1$
- return button;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java
deleted file mode 100644
index 203ad6a39..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java
+++ /dev/null
@@ -1,1078 +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
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [229752] [api][regression] SystemSelectRemoteFileOrFolderForm.getInputProvider() cannot be overriden
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemRemoteObjectMatcher;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.SystemFilterUtil;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.files.ui.ISystemAddFileListener;
-import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
-import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
-import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl;
-import org.eclipse.rse.internal.ui.view.SystemViewForm;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.util.SystemRemoteFileMatcher;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-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.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProvider;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-
-/**
- * A reusable form for prompting for a remote file system folder or file.
- * <p>
- * This form may be used to populate a dialog or a wizard page.
- * <p>
- * To configure the functionality, call these methods:
- * <ul>
- * <li>{@link #setShowNewConnectionPrompt(boolean)}
- * <li>{@link #setSystemConnection(IHost) or #setDefaultConnection(SystemConnection)}
- * <li>{@link #setSystemTypes(IRSESystemType[])}
- * <li>{@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)}
- * <li>{@link #setPreSelection(IRemoteFile)}
- * <li>{@link #setFileTypes(String[])} or {@link #setFileTypes(String)}
- * <li>{@link #setAutoExpandDepth(int)}
- * <li>{@link #setShowPropertySheet(boolean)}
- * <li>{@link #enableAddMode(org.eclipse.rse.files.ui.ISystemAddFileListener)}
- * <li>{@link #setMultipleSelectionMode(boolean)}
- * </ul>
- * <p>
- * To configure the text on the dialog, call these methods:
- * <ul>
- * <li>{@link #setMessage(String)}
- * <li>{@link #setSelectionTreeToolTipText(String)}
- * </ul>
- * <p>
- * After running, call these methods to get the output:
- * <ul>
- * <li>{@link #getSelectedObject()}
- * <li>{@link #getSelectedConnection()}
- * </ul>
- */
-public class SystemSelectRemoteFileOrFolderForm
- implements ISelectionChangedListener
-{
- protected static final int PROMPT_WIDTH = 400; // The maximum width of the dialog's prompt, in pixels.
-
- // GUI widgets
- protected Label verbiageLabel, spacer1, spacer2;
- protected Text nameEntryValue;
- private SystemViewForm tree;
- private SystemPropertySheetForm ps;
- protected ISystemMessageLine msgLine;
- protected Composite outerParent, ps_composite;
- // inputs
- protected ISystemRegistry sr = null;
- protected String verbiage = null;
- protected String treeTip = null;
- protected String locationPrompt = ""; //$NON-NLS-1$
- protected String fileTypes;
- protected boolean fileMode;
- protected boolean valid = true;
- protected boolean filesOnlyMode;
- protected boolean showRootFilter = true;
- protected boolean alwaysEnableOK = false;
- protected boolean multipleSelectionMode;
- protected boolean allowForMultipleParents = false;
- protected boolean showPropertySheet = false;
- protected boolean showLocationPrompt = false;
- protected boolean allowFolderSelection = true;
- protected SystemRemoteObjectMatcher objectMatcher = null;
- protected ISystemAddFileListener addButtonCallback = null;
- protected Vector listeners = new Vector();
- protected IValidatorRemoteSelection selectionValidator;
- // outputs
- protected Object[] outputObjects = null;
- protected IHost outputConnection = null;
- // state
- //protected ResourceBundle rb;
- protected ISystemSelectRemoteObjectAPIProvider inputProvider = null;
- protected ISystemFilter preSelectFilter;
- protected String preSelectFilterChild;
- protected boolean preSelectRoot;
- protected boolean initDone;
- protected boolean contentsCreated;
-
- //protected String errorMessage;
- protected Object caller;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
- protected int autoExpandDepth = 0;
-
- protected Object previousSelection = null;
- protected List viewerFilters = new ArrayList();
-
- /**
- * Constructor
- * @param msgLine A GUI widget capable of writing error messages to.
- * @param caller The wizardpage or dialog hosting this form.
- * @param fileMode true if in select-file mode, false if in select-folder mode
-
- * @see #setSystemConnection(IHost)
- * @see #setShowNewConnectionPrompt(boolean)
- * @see #setSystemTypes(IRSESystemType[])
- * @see #setSelectionTreeToolTipText(String)
- */
- public SystemSelectRemoteFileOrFolderForm(ISystemMessageLine msgLine, Object caller, boolean fileMode)
- {
- this.msgLine = msgLine;
- this.caller = caller;
- this.fileMode = fileMode;
- callerInstanceOfWizardPage = (caller instanceof WizardPage);
- callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
- sr = RSECorePlugin.getTheSystemRegistry();
-
- // set default GUI
- verbiage = fileMode ? SystemFileResources.RESID_SELECTFILE_VERBIAGE: SystemFileResources.RESID_SELECTDIRECTORY_VERBIAGE;
- treeTip = fileMode ? SystemFileResources.RESID_SELECTFILE_SELECT_TOOLTIP : SystemFileResources.RESID_SELECTDIRECTORY_SELECT_TOOLTIP;
-
- // create the input provider that drives the contents of the tree
- inputProvider = getInputProvider();
-
- String initialFilterString = "*"; // change to "*" for defect 43492 //$NON-NLS-1$
- inputProvider.setFilterString(fileMode ? initialFilterString : initialFilterString+" /nf"); //$NON-NLS-1$
-
- // create object matcher
- if (fileMode)
- objectMatcher = SystemRemoteFileMatcher.getFileOnlyMatcher();
- else
- objectMatcher = SystemRemoteFileMatcher.getFolderOnlyMatcher();
- }
-
- // ---------------------------------
- // INPUT OR CONFIGURATION METHODS...
- // ---------------------------------
- /**
- * Returns the input provider that drives the contents of the tree
- * Subclasses can override to provide custom tree contents
- *
- * @since 3.0 replaced SystemSelectRemoteObjectAPIProvider by
- * ISystemSelectRemoteObjectAPIProvider
- */
- protected ISystemSelectRemoteObjectAPIProvider getInputProvider()
- {
- if (inputProvider == null)
- {
- // create the input provider that drives the contents of the tree
- inputProvider = new SystemSelectRemoteObjectAPIProviderImpl(null, ISystemFileRemoteTypes.TYPECATEGORY,
- true, null); // show new connection prompt, no system type restrictions
-
- }
- return inputProvider;
- }
-
- /**
- * Indicate whether the form should allow selection of objects from different parents
- */
- public void setAllowForMultipleParents(boolean flag)
- {
- allowForMultipleParents = flag;
- }
-
- /**
- * Set the connection to restrict the user to seeing
- */
- public void setSystemConnection(IHost conn)
- {
- // Dave, you can't just change true to false. This causes the side effect of all selection dialogs
- // allowing users to see more then just their current connection, which makes no sense. It needs
- // to be selective based on the particular action. So, I added setDefaultConnection for those cases
- // where we want to see other connections. Phil
- //inputProvider.setSystemConnection(conn, /* DKM - now we support cross system copy true */ false); // true means only this connection
- inputProvider.setSystemConnection(conn,true); // true means only this connection
- }
- /**
- * Set the connection to default the selection to
- */
- public void setDefaultConnection(IHost conn)
- {
- inputProvider.setSystemConnection(conn, /* DKM - now we support cross system copy true */ false); // true means only this connection
- }
-
- /**
- * Set to true if a "New Connection..." special connection is to be shown for creating new connections
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- inputProvider.setShowNewConnectionPrompt(show);
- }
-
- /**
- * 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)
- {
- inputProvider.setSystemTypes(systemTypes);
- }
-
- /**
- * Set the message shown as the text at the top of the form. Eg, "Select a file"
- */
- public void setMessage(String message)
- {
- this.verbiage = message;
- if (verbiageLabel != null)
- verbiageLabel.setText(message);
- }
- /**
- * Set the tooltip text for the remote systems tree from which an item is selected.
- */
- public void setSelectionTreeToolTipText(String tip)
- {
- this.treeTip = tip;
- if (tree != null)
- tree.setToolTipText(tip);
- }
-
- /**
- * 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)
- {
- setSystemConnection(connection);
- setShowNewConnectionPrompt(false);
- setAutoExpandDepth(1);
- //ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(connection);
- IRemoteFileSubSystemConfiguration ssf = ss.getParentRemoteFileSubSystemConfiguration();
- RemoteFileFilterString rffs = new RemoteFileFilterString(ssf);
- rffs.setShowFiles(fileMode); // no files if in folders mode
- rffs.setShowSubDirs(!fileMode || !filesOnlyMode); // yes folders, always, for now
- if (fileTypes != null)
- rffs.setFile(fileTypes);
-
- // set the default filters we will show when the user expands a connection...
- String filterName = null;
- ISystemFilter filter = null;
- int filterCount = showRootFilter ? 2 : 1;
- if (preSelectRoot)
- filterCount = 1;
- ISystemFilter[] filters = new ISystemFilter[filterCount];
- int idx = 0;
-
- // filter one: "Root files"/"Root folders" or "Drives"
- if (showRootFilter)
- {
- if (ssf.isUnixStyle())
- {
- if (!preSelectRoot)
- {
- // "Root files" or "Folders"
- filterName = fileMode ? SystemFileResources.RESID_FILTER_ROOTFILES : SystemFileResources.RESID_FILTER_ROOTFOLDERS;
- //rffs.setPath(ssf.getSeparator()); // defect 43492. Show the root not the contents of the root
- }
- else
- {
- filterName = SystemFileResources.RESID_FILTER_ROOTS; // "Roots"
- }
- }
- else
- filterName = fileMode ? SystemFileResources.RESID_FILTER_DRIVES : SystemFileResources.RESID_FILTER_DRIVES;
- filter = SystemFilterUtil.makeSimpleFilter(filterName);
- filter.setSubSystem(ss);
- filter.setFilterStrings(new String[] {rffs.toString()});
- filters[idx++] = filter;
- //System.out.println("FILTER 1: " + filter.getFilterString());
- if (preSelectRoot)
- {
- preSelectFilter = filter;
- preSelectFilterChild = folderAbsolutePath;
- //RSEUIPlugin.logInfo("in setRootFolder. Given: " + folderAbsolutePath);
- }
- }
-
- if (!preSelectRoot)
- {
-
- // filter two: "\folder1\folder2"
- rffs.setPath(folderAbsolutePath);
-
- filter = SystemFilterUtil.makeSimpleFilter(rffs.toStringNoSwitches());
- filter.setSubSystem(ss);
- filter.setFilterStrings(new String[] {rffs.toString()});
- filters[idx] = filter;
-
- preSelectFilter = filter;
- //RSEUIPlugin.logInfo("FILTER 2: " + filter.getFilterString());
- }
- inputProvider.setFilterString(null); // undo what ctor did
- inputProvider.setQuickFilters(filters);
- }
- /**
- * 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.
- *
- * @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)
- {
- SystemBasePlugin.logInfo("given: '" + selection.getAbsolutePath()+"'"); //$NON-NLS-1$ //$NON-NLS-2$
- IRemoteFile parentFolder = selection.getParentRemoteFile();
- /**/
- if (parentFolder != null)
- SystemBasePlugin.logInfo("parent of given: '" + parentFolder.getAbsolutePath() + "'"); //$NON-NLS-1$ //$NON-NLS-2$
- else
- SystemBasePlugin.logInfo("parent of given is null"); //$NON-NLS-1$
- /**/
- // it might be a bug, bug when asking for the parent of '/', I get back '/'!!!
- if ((parentFolder != null) &&
- (selection.getAbsolutePath().equals("/") && //$NON-NLS-1$
- (parentFolder.getAbsolutePath()!=null) &&
- parentFolder.getAbsolutePath().equals("/"))) //$NON-NLS-1$
- parentFolder = null;
- if (parentFolder != null)
- {
- IRemoteFileSubSystemConfiguration ssf = selection.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration();
- boolean isUnix = ssf.isUnixStyle();
- if (isUnix)
- setRestrictFolders(parentFolder.isRoot());
- setRootFolder(parentFolder);
- preSelectFilterChild = selection.getName();
- //RSEUIPlugin.logInfo("Setting preSelectFilterChild to '"+preSelectFilterChild+"'");
- }
- else
- {
- SystemBasePlugin.logInfo("preSelectRoot is true"); //$NON-NLS-1$
- preSelectRoot = true;
- setRestrictFolders(false);
- setRootFolder(selection);
- }
- inputProvider.setPreSelectFilterChild(preSelectFilterChild);
- }
-
- /**
- * 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)
- {
- String fts = null;
- if (fileTypes != null)
- fts = RemoteFileFilterString.getTypesString(fileTypes);
- setFileTypes(fts);
- }
- /**
- * 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)
- {
- this.fileTypes = fileTypes;
- inputProvider.setFilterString("/"+ fileTypes); //$NON-NLS-1$
- }
- /**
- * 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.autoExpandDepth = depth+1;
- }
- /**
- * 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)
- {
- //this.filesOnlyMode = restrict;
- this.showRootFilter = !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;
- }
- /**
- * 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;
- }
-
- /**
- * 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;
- if (multiple)
- objectMatcher = null;
- }
-
- /**
- * Add a listener to selection change events in the tree
- */
- public void addSelectionChangedListener(ISelectionChangedListener l)
- {
- if (tree != null)
- tree.addSelectionChangedListener(l);
- else
- listeners.addElement(l);
- }
- /**
- * Remove a listener for selection change events
- */
- public void removeSelectionChangedListener(ISelectionChangedListener l)
- {
- if (tree != null)
- tree.removeSelectionChangedListener(l);
- else
- listeners.removeElement(l);
- }
-
- /**
- * 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...
- // ---------------------------------
- /**
- * Return first selected object
- */
- public Object getSelectedObject()
- {
- if ((outputObjects != null) && (outputObjects.length>=1))
- return outputObjects[0];
- else
- return null;
- }
- /**
- * Return all selected objects.
- * @see #setMultipleSelectionMode(boolean)
- */
- public Object[] getSelectedObjects()
- {
- return outputObjects;
- }
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
-
- /**
- * Return the multiple selection mode current setting
- */
- public boolean getMultipleSelectionMode()
- {
- return multipleSelectionMode;
- }
-
- // -----------------------------------------------------
- // SEMI-PRIVATE METHODS USED BY CALLING DIALOG/WIZARD...
- // -----------------------------------------------------
- /**
- * Often the message line is null at the time of instantiation, so we have to call this after
- * it is created.
- */
- public void setMessageLine(ISystemMessageLine msgLine)
- {
- this.msgLine = msgLine;
- }
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl()
- {
- return tree.getTreeControl();
- }
-
- /**
- * Show or hide the property sheet. This is called after the contents are created when the user
- * toggles the Details button.
- * @param shell Use getShell() in your dialog or wizard page
- * @param contents Use getContents() in your dialog or wizard page
- * @return new state -> true if showing, false if hiding
- */
- public boolean toggleShowPropertySheet(Shell shell, Control contents)
- {
- Point windowSize = shell.getSize();
- Point oldSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (showPropertySheet) // hiding?
- {
- ps.dispose();
- spacer1.dispose();
- spacer2.dispose();
- ps_composite.dispose();
- ps = null; spacer1 = spacer2 = null; ps_composite = null;
- ((GridLayout)outerParent.getLayout()).numColumns = 1;
- }
- else // showing?
- {
- //createPropertySheet((Composite)contents, shell);
- ((GridLayout)outerParent.getLayout()).numColumns = 2;
- createPropertySheet(outerParent, shell);
- }
-
- Point newSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- shell.setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y));
-
- if (ps != null)
- {
- ISelection s = tree.getSelection();
- if (s != null)
- ps.selectionChanged(s);
- }
-
- showPropertySheet = !showPropertySheet;
- return showPropertySheet;
- }
-
- /**
- * Create the property sheet viewer
- */
- private void createPropertySheet(Composite outerParent, Shell shell)
- {
- ps_composite = SystemWidgetHelpers.createFlushComposite(outerParent, 1);
- ((GridData)ps_composite.getLayoutData()).grabExcessVerticalSpace = true;
- ((GridData)ps_composite.getLayoutData()).verticalAlignment = GridData.FILL;
-
- // SPACER LINES
- spacer1 = SystemWidgetHelpers.createLabel(ps_composite, "", 1); //$NON-NLS-1$
- spacer2 = SystemWidgetHelpers.createLabel(ps_composite, "", 1); //$NON-NLS-1$
- // PROPERTY SHEET VIEWER
- ps = new SystemPropertySheetForm(shell, ps_composite, SWT.BORDER, msgLine);
- }
-
- public void dispose()
- {
- if (tree != null)
- {
- tree.removeSelectionChangedListener(this);
- for (int i = 0; i < listeners.size(); i++)
- {
- tree.removeSelectionChangedListener((ISelectionChangedListener)listeners.get(i));
- }
- }
- }
- /**
- * In this method, we populate the given SWT container with widgets and return the container
- * to the caller.
- * @param parent The parent composite
- */
- public Control createContents(Shell shell, Composite parent)
- {
- contentsCreated = true;
-
- outerParent = parent;
- // OUTER COMPOSITE
- //if (showPropertySheet)
- {
- outerParent = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);
- }
-
- // INNER COMPOSITE
- int gridColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(outerParent, gridColumns);
-
- // PROPERTY SHEET COMPOSITE
- if (showPropertySheet)
- {
- createPropertySheet(outerParent, shell);
- }
- else
- {
- //((GridLayout)composite_prompts.getLayout()).margin...
- }
-
- // MESSAGE/VERBIAGE TEXT AT TOP
- verbiageLabel = SystemWidgetHelpers.createVerbiage(composite_prompts, verbiage, gridColumns, false, PROMPT_WIDTH);
- //verbiageLabel = SystemWidgetHelpers.createLabel(composite_prompts, verbiage, gridColumns);
-
- // SPACER LINE
- SystemWidgetHelpers.createLabel(composite_prompts, "", gridColumns); //$NON-NLS-1$
-
- // LOCATION PROMPT
- if (showLocationPrompt)
- {
- SystemWidgetHelpers.createLabel(composite_prompts, locationPrompt, gridColumns);
- }
-
- // SELECT OBJECT READONLY TEXT FIELD
- Composite nameComposite = composite_prompts;
- int nameSpan = gridColumns;
- nameEntryValue = SystemWidgetHelpers.createReadonlyTextField(nameComposite);
- ((GridData)nameEntryValue.getLayoutData()).horizontalSpan = nameSpan;
-
- // create an array of viewer filters from our list of viewer filters
- ViewerFilter[] initViewerFilters = null;
-
- // if we don't have a viewer filter list, then create an empty array
- if (viewerFilters == null) {
- initViewerFilters = new ViewerFilter[0];
- }
- // otherwise copy from list to array
- else {
- initViewerFilters = new ViewerFilter[viewerFilters.size()];
-
- Iterator iter = viewerFilters.iterator();
-
- int idx = 0;
-
- // copy from list to array
- while (iter.hasNext()) {
- ViewerFilter filter = (ViewerFilter)(iter.next());
- initViewerFilters[idx] = filter;
- idx++;
- }
- }
-
- // TREE
- tree = new SystemViewForm(shell, composite_prompts, SWT.NULL, inputProvider, !multipleSelectionMode, msgLine, gridColumns, 1, initViewerFilters);
-
- if (treeTip != null)
- //tree.setToolTipText(treeTip); //EXTREMELY ANNOYING!
- if (autoExpandDepth != 0)
- {
- tree.getSystemTree().setAutoExpandLevel(autoExpandDepth);
- tree.reset(inputProvider);
- }
-
- // initialize fields
- if (!initDone)
- doInitializeFields();
-
- // add selection listeners
- tree.addSelectionChangedListener(this);
- if (listeners.size() > 0)
- for (int idx=0; idx<listeners.size(); idx++)
- tree.addSelectionChangedListener((ISelectionChangedListener)listeners.elementAt(idx));
-
- // pre-select default root folder filter...
- if (preSelectFilter != null)
- {
- tree.select(preSelectFilter, true);
- Object preSelectFilterChildObject = inputProvider.getPreSelectFilterChildObject();
- if (preSelectFilterChildObject != null)
- tree.select(preSelectFilterChildObject, false);
- }
-
- return composite_prompts;
- }
-
- /**
- * Completes processing of the wizard page or dialog. If this
- * method returns true, the wizard/dialog will close;
- * otherwise, it will stay active.
- *
- * @return true if no errors
- */
- public boolean verify()
- {
- msgLine.clearErrorMessage();
- outputConnection = internalGetConnection();
- return true;
- }
-
-
- // -----------------------------------------------------
- // PRIVATE METHODS USED BY US...
- // -----------------------------------------------------
-
- /**
- * Return the current connection
- */
- protected IHost internalGetConnection()
- {
- Object parent = tree.getSystemTree().getRootParent();
- if (parent instanceof IHost)
- {
- return (IHost)parent;
- }
- return null;
- }
-
- protected void setNameText(String text)
- {
- nameEntryValue.setText(text);
- }
- private String getNameText()
- {
- return nameEntryValue.getText();
- }
- private void doInitializeFields()
- {
- setPageComplete();
- initDone = true;
- return;
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- private ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- // ---------------------------------------------------
- // METHODS FOR SELECTION CHANGED LISTENER INTERFACE...
- // ---------------------------------------------------
- /**
- * User selected something in the tree.
- */
- public void selectionChanged(SelectionChangedEvent e)
- {
- valid = true;
- ISelection selection = e.getSelection();
-
- if (ps != null)
- ps.selectionChanged(selection);
-
- outputObjects = null;
- int selectionSize = ((IStructuredSelection)selection).size();
- if ((selectionSize > 1) && !tree.sameParent() && !allowForMultipleParents)
- {
- clearErrorMessage();
- setNameText(""); //$NON-NLS-1$
- setPageComplete();
- return; // don't enable OK/Add if selections from different parents
- }
-
- Object errMsg = null;
- Object selectedObject = getFirstSelection(selection);
- if (selectedObject == previousSelection && selectionSize == 1)
- {
- // DKM we null set this before, so we need to reset it
- outputObjects = getSelections(selection);
- return;
- }
- clearErrorMessage();
- setNameText(""); //$NON-NLS-1$
- setPageComplete();
- previousSelection = selectedObject;
- if (selectedObject != null)
- {
-
- ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject);
- if (remoteAdapter != null)
- {
- setNameTextFromSelection(selection, selectedObject, remoteAdapter);
-
- outputConnection = internalGetConnection();
- if ((addButtonCallback != null) && (selectedObject instanceof IRemoteFile))
- {
- errMsg = addButtonCallback.okToEnableAddButton(outputConnection, (IRemoteFile[])getSelections(selection));
-
- if (errMsg != null)
- {
- if (errMsg instanceof String)
- setErrorMessage((String)errMsg);
- else
- setErrorMessage((SystemMessage)errMsg);
- }
- }
- else if ((objectMatcher == null) || objectMatcher.appliesTo(remoteAdapter, selectedObject))
- {
- SystemMessage selectionMsg = null;
- if (selectionValidator != null)
- selectionMsg = selectionValidator.isValid(outputConnection, getSelections(selection), getRemoteAdapters(selection));
-
- if (selectionMsg != null)
- {
- valid = false;
- setErrorMessage(selectionMsg);
- setPageComplete();
- }
- }
- // if we're in file mode and folder selection is not allowed, then mark as invlaid selection
- else if (fileMode && !allowFolderSelection) {
-
- if (remoteAdapter.getRemoteType(selectedObject).equals(ISystemFileRemoteTypes.TYPE_FOLDER)) {
- valid = false;
- setPageComplete();
- }
- }
- }
- }
- }
-
- protected ISystemRemoteElementAdapter[] getRemoteAdapters(ISelection selection)
- {
- Object[] selectedObjects = getSelections(selection);
- ISystemRemoteElementAdapter[] adapters = new ISystemRemoteElementAdapter[selectedObjects.length];
- for (int idx=0; idx<adapters.length; idx++)
- {
- adapters[idx] = getRemoteAdapter(selectedObjects[idx]);
- }
- return adapters;
- }
-
-
- private void setNameTextFromSelection(ISelection selection, Object selectedObject,ISystemRemoteElementAdapter remoteAdapter)
- {
- setNameText(remoteAdapter.getAbsoluteName(selectedObject));
- outputObjects = getSelections(selection);
- setPageComplete();
- }
-
- /**
- * Return first item currently selected.
- */
- protected Object getFirstSelection(ISelection selection)
- {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- if (sSelection != null)
- {
- Iterator selectionIterator = sSelection.iterator();
- if (selectionIterator.hasNext())
- return selectionIterator.next();
- else
- return null;
- }
- return null;
- }
- /**
- * Return all items currently selected.
- */
- protected Object[] getSelections(ISelection selection)
- {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- if (sSelection != null)
- {
- Object[] selectedObjects = new Object[sSelection.size()];
- Iterator selectionIterator = sSelection.iterator();
- int idx = 0;
- while (selectionIterator.hasNext())
- selectedObjects[idx++] = selectionIterator.next();
- return selectedObjects;
- }
- return null;
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- return ( (getNameText().length() > 0) ) && valid;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- if (callerInstanceOfWizardPage)
- {
- ((WizardPage)caller).setPageComplete(isPageComplete());
- }
- else if (callerInstanceOfSystemPromptDialog)
- {
- ((SystemPromptDialog)caller).setPageComplete(isPageComplete());
- }
- }
-
-
- protected void clearErrorMessage()
- {
- if (msgLine != null)
- msgLine.clearErrorMessage();
- }
- protected void setErrorMessage(String msg)
- {
- if (msgLine != null)
- if (msg != null)
- msgLine.setErrorMessage(msg);
- else
- msgLine.clearErrorMessage();
- }
- protected void setErrorMessage(SystemMessage msg)
- {
- if (msgLine != null)
- if (msg != null)
- msgLine.setErrorMessage(msg);
- else
- msgLine.clearErrorMessage();
- }
-
- /**
- * Return shell of parent dialog or wizard
- */
- protected Shell getShell()
- {
- if (callerInstanceOfWizardPage)
- return ((WizardPage)caller).getShell();
- else if (callerInstanceOfSystemPromptDialog)
- return ((SystemPromptDialog)caller).getShell();
- else
- return null;
- }
-
- public void setShowLocationPrompt(boolean show)
- {
- showLocationPrompt = show;
- }
-
- public void setLocationPrompt(String prompt)
- {
- locationPrompt = prompt;
- }
-
- /**
- * Add viewer filter.
- * @param filter a viewer filter.
- */
- public void addViewerFilter(ViewerFilter filter) {
- viewerFilters.add(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 form is in file selection mode.
- * @param allow <code>true</code> to allow folder selection, <code>false</code> otherwise.
- */
- public void setAllowFolderSelection(boolean allow) {
- allowFolderSelection = allow;
- }
-
- /**
- * Returns the system tree
- *
- * @return the system tree
- * @since 3.0 replacing the previous getSystemViewForm method
- */
- public ISystemTree getSystemTree()
- {
- return tree.getSystemTree();
- }
-
- /**
- * @since 3.0
- */
- public Object getSelectedParent()
- {
- return tree.getSelectedParent();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java
deleted file mode 100644
index 075925c5b..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java
+++ /dev/null
@@ -1,623 +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) - [184095] Replace systemTypeName by IRSESystemType
- * 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
- ********************************************************************************/
-
-package org.eclipse.rse.files.ui.widgets;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.internal.files.ui.Activator;
-import org.eclipse.rse.internal.files.ui.actions.SystemSelectFileTypesAction;
-import org.eclipse.rse.internal.files.ui.widgets.SystemFileTreeAndListGroup;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewLabelAndContentProvider;
-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.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileRoot;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.SWT;
-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.Composite;
-
-
-/**
- * This re-usable composite widget is for prompting the user to select
- * multiple files from a remote system.
- * <p>
- * The composite is layed as follows:
- * <code>
- * Folder: ______________V Browse...
- *
- * .________________. ____________.
- * | + folder | | file1 |
- * | + subfolder | | file2 |
- * | + subfolder | | file3 |
- * .---------------. .-----------.
- * </code>
- * The tree and list boxes are checkbox widgets, standard in Eclipse.
- * <p>
- * You can also optionally decide to show the standard buttons at the
- * button of the checkbox boxes:
- * <code>
- * .-----------------. .------------. .--------------.
- * | Select Types... | | Select All | | Deselect All |
- * .-----------------. .------------. .--------------.
- * </code>
- *
- * <p>
- * To allow error messages to be issued on a message line versus in message dialogs,
- * pass in an ISystemMessageLine reference. This usually represents the message line
- * of a dialog or wizard. If supplied, messages are written to it.
- * To specify it, call {@link #setMessageLine(ISystemMessageLine)}.
- */
-public class SystemSelectRemoteFilesForm extends Composite
-{
- // widgets
- private SystemQualifiedRemoteFolderCombo dirCombo = null;
- private SystemFileTreeAndListGroup fileSelector = null;
- //private RemoteFileEmptyImpl emptyFileSelectorRoot = null;
- private RemoteFileRoot rootElement = null;
- private Button selectTypesButton, selectAllButton, deselectAllButton;
- // state
- private String historyKey = null;
- private boolean showSelectTypesButton, showSelectAllButtons = false;
- private ISystemMessageLine msgLine = null;
- private java.util.List selectedTypes = new ArrayList();
- private String filterString = null;
- private SystemSelectFileTypesAction typesAction = null;
- private SystemViewLabelAndContentProvider folderProvider, fileProvider;
- // constants
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 400;
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 150;
- /**
- * Constructor when you want to specify your own history key for the qualified folder
- * nested widget.
- *
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
- * @param showSelectTypesButton Specify if you want to have Select Types button
- * @param showSelectAllButtons Specify if you want to have Select All and Deselect All buttons
- * @param key The unique string used as a preferences key to persist the qualified-folder history
- */
- public SystemSelectRemoteFilesForm(Composite parent, int style,
- boolean showSelectTypesButton, boolean showSelectAllButtons,
- String key)
- {
- super(parent, style);
- this.showSelectTypesButton = showSelectTypesButton;
- this.showSelectAllButtons = showSelectAllButtons;
- historyKey = key;
- prepareComposite(1);
- createFolderPrompt(this);
- createFilesSelectorGroup(this);
- if (showSelectTypesButton || showSelectAllButtons)
- createButtons(this, showSelectTypesButton, showSelectAllButtons);
- addOurQualifiedFolderSelectionListener();
- }
- /**
- * Constructor when you want to use the default history key, meaning you share the
- * qualified-folder history with other dialogs/wizards that use the same widget.
- *
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
- * @param showSelectTypesButton Specify if you want to have Select Types button
- * @param showSelectAllButtons Specify if you want to have Select All and Deselect All buttons
- */
- public SystemSelectRemoteFilesForm(Composite parent, int style,
- boolean showSelectTypesButton, boolean showSelectAllButtons)
- {
- this(parent, style, showSelectTypesButton, showSelectAllButtons, null);
- }
- /**
- * Constructor when you want to use the default history key and want to show the standard buttons.
- *
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
- */
- public SystemSelectRemoteFilesForm(Composite parent, int style)
- {
- this(parent, style, true, true, null);
- }
-
- /**
- * Specify a message line so error messages are written to it versus in message dialogs.
- * @param msgLine An object implementing ISystemMessageLine. Typically pass "this" for
- * your dialog or wizard page, and implement the interface there.
- */
- public void setMessageLine(ISystemMessageLine msgLine)
- {
- this.msgLine = msgLine;
- }
- /**
- * Get the message line specified in setMessageLine.
- */
- public ISystemMessageLine getMessageLine()
- {
- return msgLine;
- }
-
- /**
- * 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)
- {
- dirCombo.setSystemTypes(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 a filter string to subset the list by. For example, "A*.java" or "java,class,"
- */
- public void setFilterString(String filterString)
- {
- fileProvider.setFilterString(filterString);
- folderProvider.setFilterString(filterString);
- refresh();
- }
- /**
- * 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 filterString;
- }
-
- /**
- * Return the nested qualified-folder combo widget
- */
- public SystemQualifiedRemoteFolderCombo getFolderCombo()
- {
- return dirCombo;
- }
-
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- dirCombo.setEnabled(enabled);
- fileSelector.getListTable().setEnabled(enabled);
- }
- /**
- * Set the focus to the combo field
- */
- public boolean setFocus()
- {
- return dirCombo.setFocus();
- }
-
- /**
- * Clear the contents of the file selector widgets
- */
- public void clearAll()
- {
- fileSelector.clearAll();
- enableButtonGroup(false);
- }
- /**
- * Set the root folder from which to populate the widgets
- * @param rootFolder The root folder from which to start the tree
- */
- public void setRootFolder(IRemoteFile rootFolder)
- {
- rootElement.setRootFile(rootFolder);
- fileSelector.setRoot(rootElement);
- enableButtonGroup(true);
- }
-
- /**
- * Refesh the contents of the folder and file-selection checkbox viewers
- */
- public void refresh()
- {
- folderProvider.flushCache();
- fileProvider.flushCache();
- fileSelector.refresh();
- }
-
- /**
- * Add a checkstate listener to be called whenever the checked state of
- * a remote file is changed.
- */
- public void addCheckStateListener(ICheckStateListener l)
- {
- fileSelector.addCheckStateListener(l);
- }
- /**
- * Remove a checkstate listener
- */
- public void removeCheckStateListener(ICheckStateListener l)
- {
- fileSelector.removeCheckStateListener(l);
- }
-
- /**
- * Get the list of selected IRemoteFile objects.
- * Will be length 0 if nothing selected
- */
- public IRemoteFile[] getSelectedFiles()
- {
- java.util.List list = fileSelector.getAllCheckedListItems();
- IRemoteFile[] files = new IRemoteFile[list.size()];
- Iterator i = list.iterator();
- int idx = 0;
- while (i.hasNext())
- {
- files[idx++] = (IRemoteFile)i.next();
- }
- return files;
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares this composite control and sets the default layout data.
- * @param numColumns Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns)
- {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = false;
- //data.widthHint = SIZING_SELECTION_WIDGET_WIDTH + 20;
- composite.setLayoutData(data);
- return composite;
- }
-
- /**
- * Create qualified-folder prompt
- */
- protected void createFolderPrompt(Composite parent)
- {
- // connection\folder prompt
- dirCombo = new SystemQualifiedRemoteFolderCombo(parent, SWT.NULL, historyKey);
- }
-
- /**
- * Create folder and files selection checkbox viewers
- */
- protected void createFilesSelectorGroup(Composite parent)
- {
- // file selector prompt (checkbox tree and checkbox list)
- folderProvider = new SystemViewLabelAndContentProvider(true,false);
- fileProvider = new SystemViewLabelAndContentProvider(false,true);
- rootElement = new RemoteFileRoot();
- fileSelector = new SystemFileTreeAndListGroup(parent,
- folderProvider, folderProvider, // tree content and label providers
- fileProvider, fileProvider, // list content and label providers
- SWT.NULL, SIZING_SELECTION_WIDGET_WIDTH,
- SIZING_SELECTION_WIDGET_HEIGHT);
- }
- /**
- * Create three buttons under checkbox viewers
- */
- protected void createButtons(Composite parent, boolean showSelectTypes, boolean showSelectAll)
- {
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- if (showSelectTypes && showSelectAll)
- layout.numColumns = 3;
- else if (showSelectTypes)
- layout.numColumns = 1;
- else
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- if (showSelectTypes)
- {
- selectTypesButton = createPushButton(buttonComposite, SystemResources.RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_LABEL, SystemResources.RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_TOOLTIP);
- addSelectTypesButtonSelectionListener();
- }
- if (showSelectAll)
- {
- selectAllButton = createPushButton(buttonComposite, SystemResources.RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL);
- deselectAllButton = createPushButton(buttonComposite, SystemResources.RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP);
- addSelectAllButtonSelectionListener();
- addDeselectAllButtonSelectionListener();
- }
-
- enableButtonGroup(false);
- }
- protected static Button createPushButton(Composite group, String label, String tooltip)
- {
- Button button = createPushButton(group,label);
- button.setToolTipText(tooltip);
- return button;
- }
- public static Button createPushButton(Composite group, String label)
- {
- Button button = new Button(group, SWT.PUSH);
- button.setText(label);
- //button.setText("THIS IS A LONG LABEL. I MEAN, IT IS JUST HUGE!");
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(data);
- return button;
- }
-
-
- protected void addOurQualifiedFolderSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- clearErrorMessage();
- //clearMessage();
- IRemoteFile selectedFolder = null;
- try
- {
- selectedFolder = dirCombo.getFolder();
- if (selectedFolder == null)
- {
- //displayErrorMessage("Nothing selected?");
- clearAll();
- }
- else
- {
- //displayMessage("Selected folder exist? " + selectedFolder.exists());
- setRootFolder(selectedFolder);
- }
- }
- catch (Exception exc)
- {
- String msg = exc.getMessage();
- if ((msg == null) || (msg.length()==0))
- {
- msg = "Exception: " + exc.getClass().getName(); //$NON-NLS-1$
- displayExceptionMessage(exc);
- }
- else
- displayErrorMessage(msg);
- clearAll();
- }
- }
- };
- dirCombo.addSelectionListener(selectionListener);
- }
-
- protected void addSelectTypesButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- handleTypesEditButtonPressed();
- }
- };
- selectTypesButton.addSelectionListener(selectionListener);
- }
- protected void addSelectAllButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- fileSelector.setAllSelections(true);
- }
- };
- selectAllButton.addSelectionListener(selectionListener);
- }
- protected void addDeselectAllButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- fileSelector.setAllSelections(false);
- }
- };
- deselectAllButton.addSelectionListener(selectionListener);
- }
-
- /**
- * Open a registered type selection dialog and note the selections
- * in the receivers types-to-export field
- */
- protected void handleTypesEditButtonPressed()
- {
- SystemSelectFileTypesAction typesAction = getSelectTypesAction();
- typesAction.setTypes(selectedTypes);
- typesAction.run();
- if (!typesAction.wasCancelled())
- {
- selectedTypes = typesAction.getTypes();
- setupSelectionsBasedOnSelectedTypes();
- }
- /*
- TypeFilteringDialog dialog =
- new TypeFilteringDialog(getShell(), selectedTypes);
- dialog.open();
- Object[] newSelectedTypes = dialog.getResult();
- if (newSelectedTypes != null) // ie.- did not press Cancel
- {
- this.selectedTypes = new ArrayList(newSelectedTypes.length);
- for (int i = 0; i < newSelectedTypes.length; i++)
- {
- //System.out.println(newSelectedTypes[i]);
- this.selectedTypes.add(newSelectedTypes[i]);
- }
- setupSelectionsBasedOnSelectedTypes();
- }
- */
- }
- /**
- * Get the action to run when "Select Types..." is pressed by the user
- */
- private SystemSelectFileTypesAction getSelectTypesAction()
- {
- if (typesAction == null)
- typesAction = new SystemSelectFileTypesAction(getShell());
- return typesAction;
- }
- /**
- * Update the tree to only select those elements that match the selected types
- */
- protected void setupSelectionsBasedOnSelectedTypes()
- {
- //BusyIndicator.showWhile(getShell().getDisplay(), new Runnable()
- //{
- //public void run()
- //{
- Map selectionMap = new Hashtable();
- IRemoteFile[] filesList = getSelectedFiles();
- for (int idx=0;idx<filesList.length; idx++)
- {
- IRemoteFile file = filesList[idx];
- String extension = file.getExtension();
- //System.out.println("File extension for " + file.getName() + ": " + extension);
- if (isExportableExtension(extension))
- {
- java.util.List elements = new ArrayList();
- IRemoteFile parent = file.getParentRemoteFile();
- if (selectionMap.containsKey(parent))
- elements = (java.util.List)selectionMap.get(parent);
- elements.add(file);
- selectionMap.put(parent, elements);
- }
- }
- fileSelector.updateSelections(selectionMap);
- //}
- //});
- }
- /**
- * Returns whether the extension provided is an extension that
- * has been specified for export by the user.
- *
- * @param extension the resource name
- * @return <code>true</code> if the resource name is suitable for export based
- * upon its extension
- */
- protected boolean isExportableExtension(String extension)
- {
- if (selectedTypes == null) // ie.- all extensions are acceptable
- return true;
- Iterator enumer = selectedTypes.iterator();
- while (enumer.hasNext())
- {
- if (extension.equalsIgnoreCase((String)enumer.next()))
- return true;
- }
- return false;
- }
-
-
- /**
- * Enable or disable the button group.
- */
- protected void enableButtonGroup(boolean enable)
- {
- if (!showSelectTypesButton && !showSelectAllButtons)
- return;
- if (selectTypesButton != null)
- selectTypesButton.setEnabled(enable);
- if (selectAllButton != null)
- selectAllButton.setEnabled(enable);
- if (deselectAllButton != null)
- deselectAllButton.setEnabled(enable);
- }
-
-
- protected void clearErrorMessage()
- {
- if (msgLine != null)
- msgLine.clearErrorMessage();
- }
-
- protected void displayErrorMessage(String msgText)
- {
- if (msgLine != null)
- msgLine.setErrorMessage(msgText);
- else
- SystemMessageDialog.displayErrorMessage(getShell(),msgText);
- }
- protected void displayErrorMessage(SystemMessage msg)
- {
- if (msgLine != null)
- msgLine.setErrorMessage(msg);
- else
- SystemMessageDialog.displayErrorMessage(getShell(),msg);
- }
- protected void displayExceptionMessage(Exception exc)
- {
- if (msgLine != null)
- {
- SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
- ICommonMessageIds.MSG_EXCEPTION_OCCURRED,
- IStatus.ERROR, CommonMessages.MSG_EXCEPTION_OCCURRED, exc);
- msgLine.setErrorMessage(msg);
- }
- else
- SystemMessageDialog.displayExceptionMessage(getShell(), exc);
- }
-
-} \ No newline at end of file
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 281e3b348..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, 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:
- * 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 04ae0affd..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, 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:
-# 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 ea853743d..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, 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:
- * {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 949f49bbf..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFileAction.java
+++ /dev/null
@@ -1,205 +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) - [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
- * David McKnight (IBM) - [309813] RSE permits opening of file after access removed
- * David McKnight (IBM) - [312362] Editing Unix file after it changes on host edits old data
- *******************************************************************************/
-
-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();
-
- boolean usedReadOnly = properties.getReadOnly();
- boolean isReadOnly = !remoteFile.canWrite();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- usedReadOnly == isReadOnly &&
- !encodingChanged);
- }
- return false;
- }
-
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- protected void process(IRemoteFile remoteFile) {
-
- // make sure we're using the latest version of remoteFile
- try {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){
- }
- 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
- {
- boolean isCached = isFileCached(editable, remoteFile);
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
- {
- if (isCached)
- {
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
- }
- else
- {
- if (isCached)
- {
- editable.setLocalResourceProperties();
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
- }
- }
- 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 c988382e9..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemEditFilesAction.java
+++ /dev/null
@@ -1,236 +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) - [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
- * David McKnight (IBM) - [309813] RSE permits opening of file after access removed
- * David McKnight (IBM) - [312362] Editing Unix file after it changes on host edits old data
- *******************************************************************************/
-
-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)
- {
- IRemoteFile remoteFile = (IRemoteFile)obj;
- process(remoteFile);
- }
- }
- }
-
- 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();
-
- boolean usedReadOnly = properties.getReadOnly();
- boolean isReadOnly = !remoteFile.canWrite();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- usedReadOnly == isReadOnly &&
- !encodingChanged);
- }
- return false;
- }
-
- /**
- * Process the object: download file, open in editor, etc.
- */
- protected void process(IRemoteFile remoteFile) {
-
- // make sure we're using the latest version of remoteFile
- try {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){
- }
- 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
- {
- boolean isCached = isFileCached(editable, remoteFile);
- if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
- {
- if (isCached)
- {
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
- }
- else
- {
- if (isCached)
- {
- editable.setLocalResourceProperties();
- editable.openEditor();
- }
- else
- {
- DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
- oJob.schedule();
- }
- }
- }
- 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 672f00c1d..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileOpenWithMenu.java
+++ /dev/null
@@ -1,576 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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) - [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
- * David McKnight (IBM) - [309755] SystemRemoteFileOpenWithMenu.getPreferredEditor(), the listed default editor is not always correct
- * David McKnight (IBM) - [312362] Editing Unix file after it changes on host edits old data
- *******************************************************************************/
-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) {
-
- // make sure we're using the latest version of remoteFile
- try {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){
- }
-
- 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(editable);
-}
-
-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();
-
- boolean usedReadOnly = properties.getReadOnly();
- boolean isReadOnly = !remoteFile.canWrite();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- usedReadOnly == isReadOnly &&
- !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 || !localFile.exists()){
- 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 8e36440eb..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemUploadConflictAction.java
+++ /dev/null
@@ -1,725 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2011 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
- * David McKnight (IBM) - [330804] Change the default selection of Save Conflict dialog
- * David McKnight (IBM) - [334839] File Content Conflict is not handled properly
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.actions;
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-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.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-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.PlatformUI;
-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);
- if (Display.getCurrent() != null){
- reopen.run();
- }
- else {
- 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);
-
- // need to refresh this otherwise the local resource will be out of sync
- _tempFile.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
- properties.setRemoteFileTimeStamp(_remoteFile.getLastModified());
- properties.setDirty(false);
- properties.setUsedBinaryTransfer(_remoteFile.isBinary());
-
- Display.getDefault().asyncExec(new Runnable(){
- public void run(){
- IEditorPart part = getEditorFor(_tempFile);
- part.setFocus();
- }
- });
- }
- 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();
- if (_saveas){
- if (_saveasLocation == null){
- try {
- _saveasLocation = _remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(_saveasFileEntry.getText(), new NullProgressMonitor());
- } catch (SystemMessageException e) {
- }
- if (_saveasLocation == null){
- 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);
- return;
- }
- }
- }
- 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);
-
-
- _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);
- _saveasButton.setSelection(true);
-
- 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(true);
- _saveasFileEntry.addKeyListener(new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- String loc = _saveasFileEntry.getText();
- if (loc != null && loc.length() > 0){
- _errorMessage = null;
- setErrorMessage(_errorMessage);
- enableOkButton(true);
- }
- else {
- enableOkButton(false);
- }
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
-
- GridData fileEntryData = new GridData(GridData.FILL_BOTH);
- fileEntryData.widthHint = 100;
- _saveasFileEntry.setLayoutData(fileEntryData);
- _saveasFileEntry.setEditable(true);
-
- _browseButton = new Button(s, SWT.PUSH);
- _browseButton.setText(SystemResources.BUTTON_BROWSE);
- _browseButton.addSelectionListener(this);
- _browseButton.setEnabled(true);
-
- // since saveas is the new default, need to prompt dialog with error message
- 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);
-
- 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;
- }
-
-
- 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();
- }
- }
- else {
- // editor closed, possibly due to shutdown
- // can't manipulate editors, but we can at least make the original temp file uptodate
- SystemIFileProperties properties = new SystemIFileProperties(_tempFile);
- SystemEditableRemoteFile edit = (SystemEditableRemoteFile)properties.getRemoteFileObject();
- if (edit != null){
- try {
- edit.download(getShell());
- edit.addAsListener();
- edit.setLocalResourceProperties();
- }
- catch (Exception e){
- }
- }
- }
- }
- }
-
- 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);
-
- if (PlatformUI.getWorkbench().isClosing()){
- sjob.run(new NullProgressMonitor());
- }
- else {
- sjob.schedule();
- }
- }
- }
- else
- {
- // cancelled dialog, so no remote synchronization
- // set dirty flag!
- properties.setDirty(true);
- }
- }
-
- 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;
- }
-
-}
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 63d9ae42f..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java
+++ /dev/null
@@ -1,909 +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
- * 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
- * David McKnight (IBM) - [325502] The default editor for a file is not updated when opened in RSE explorer
- *******************************************************************************/
-
-package org.eclipse.rse.internal.files.ui.resources;
-
-import java.io.File;
-import java.lang.reflect.Field;
-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 {
- if (descriptor != null){
- // using reflection to change descriptor since there's
- // no API right now but will have to put in something when we're able
- try {
- Class cls = editable.getClass();
- //throws NoSuchFieldException in case the field doesn't exist
- Field fld = cls.getDeclaredField("_editorDescriptor"); //$NON-NLS-1$
- fld.setAccessible(true);
- fld.set(editable, descriptor);
- }
- catch (Exception e){
- }
- }
- 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 a35b46c8f..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchPage.java
+++ /dev/null
@@ -1,1628 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2011 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
- * Kit Lo (IBM) - [312923] TVT36:TCT252: JPN: Extra spaces in front of the second Regular expression checkbox (edit)
- * David McKnight (IBM) - [340069] Change access modifier for SystemSearchPage methods to protected from private
- * David McKnight (IBM) - [340212] Change access modifier for a few more SystemSearchPage methods
- *******************************************************************************/
-
-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.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
- protected class RemoteSearchData {
-
- public String searchString;
- public boolean caseSensitive;
- public boolean stringRegex;
- public String fileNames;
- public boolean fileNameCaseSensitive;
- public boolean fileNameRegex;
- public String profileName;
- public String connectionName;
- public String folderName;
- public boolean includeArchives;
- public 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.
- */
- protected 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.
- */
- protected String getFileNames() {
- return fileNameEditor.getFileNamesText();
- }
-
- /**
- * Gets the profile name from the folder selection.
- * @return the profile name.
- */
- protected String getProfileName() {
- return folderNameEditor.getProfileName();
- }
-
- /**
- * Gets the connection name from the folder selection.
- * @return the connection name.
- */
- protected String getConnectionName() {
- return folderNameEditor.getConnectionName();
- }
-
- /**
- * Gets the folder name from the folder selection.
- * @return the folder name.
- */
- protected 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.
- */
- protected 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);
-
- // dummy label for alignment
- Label dummyLabel = new Label(comp, SWT.LEFT);
- dummyLabel.setText(""); //$NON-NLS-1$
-
- gd = new GridData(GridData.BEGINNING);
- gd.horizontalSpan = 2;
- dummyLabel.setLayoutData(gd);
-
- // 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);
-
-
- 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.
- */
- protected 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.
- */
- protected 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 515862113..000000000
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java
+++ /dev/null
@@ -1,3768 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2011 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
- * David McKnight (IBM) - [309813] RSE permits opening of file after access removed
- * David McKnight (IBM) - [308221] Bidi3.6: Improper display of date in Properties and Table Views
- * David McKnight (IBM) - [317541] Show blank as the last modified for a file with no last modified
- * David McKnight (IBM) - [323299] [files] remote file view adapter needs to use the latest version of IRemoteFile
- * David McKnight (IBM) - [324192] Cannot open a renamed file
- * David McKnight (IBM) - [341244] folder selection input to unlocked Remote Systems Details view sometimes fails
- *******************************************************************************/
-
-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.RemoteFileSubSystem;
-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;
-import com.ibm.icu.util.ULocale;
-
-
-/**
- * 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();
-
- // make sure we have the lastest cached version otherwise could be working with a bad file that never got marked as stale
- IRemoteFile originalFile = file;
- if (ss instanceof RemoteFileSubSystem){
- IRemoteFile cachedFile = ((RemoteFileSubSystem)ss).getCachedRemoteFile(file.getAbsolutePath());
- if (cachedFile != null){
- file = cachedFile;
- if (originalFile.isStale()){ // the original file was marked stale, so the cached one should be too
- file.markStale(true);
- }
- }
- }
-
-
- /*
- 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;
- }
- }
- }
-
- // taking out the synchronized block to avoid potential deadlock
- // TODO next release, find a risk-free way to avoid duplicate queries
- // synchronized (file)
-
- {
- 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;
-
- IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
-
- // make sure we have the lastest cached version otherwise could be working with a bad file that never got marked as stale
- IRemoteFile originalFile = file;
- if (ss instanceof RemoteFileSubSystem){
- IRemoteFile cachedFile = ((RemoteFileSubSystem)ss).getCachedRemoteFile(file.getAbsolutePath());
- if (cachedFile != null){
- file = cachedFile;
- if (originalFile.isStale()){ // the original file was marked stale, so the cached one should be too
- file.markStale(true);
- }
- }
- }
-
- 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)
- {
- long t = date.getTime();
-
- if (formatted)
- {
- if (t == 0){
- // no time available, we should leave this blank
- return ""; //$NON-NLS-1$
- }
- else {
- ULocale locale = ULocale.getDefault();
- DateFormat icufmt = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, locale);
- String formattedDate = icufmt.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;
-
- // change the remote file regardless of whether it's open in an editor or not
- // 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();
-
- boolean usedReadOnly = properties.getReadOnly();
- boolean isReadOnly = !remoteFile.canWrite();
-
- return (!dirty &&
- !remoteNewer &&
- usedBinary == isBinary &&
- usedReadOnly == isReadOnly &&
- !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