diff --git a/rse/plugins/org.eclipse.rse.files.ui/plugin.xml b/rse/plugins/org.eclipse.rse.files.ui/plugin.xml index b85054997e1..cce62093066 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/plugin.xml +++ b/rse/plugins/org.eclipse.rse.files.ui/plugin.xml @@ -1,6 +1,6 @@ @@ -448,14 +443,17 @@ Johnson Ma (Wind River) - [195402] Add tar.gz archive support objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile" id="org.eclipse.rse.files.ui.actions.synchronizeCache"> - - + + + + + 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 index f56256189a4..53873b0f9e3 100644 --- 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 @@ -24,6 +24,7 @@ * 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; @@ -130,6 +131,9 @@ implements IValidatorRemoteSelection Object selectedObject = e.next(); if (!(selectedObject instanceof IRemoteFile)) enable = false; + else { + enable = !((IRemoteFile)selectedObject).getParentRemoteFileSubSystem().isOffline(); + } } return enable; } @@ -588,4 +592,7 @@ implements IValidatorRemoteSelection { 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/SystemNewFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFileAction.java index cb8a8f41289..1066dac37d9 100644 --- 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 @@ -12,18 +12,21 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * 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; @@ -65,5 +68,21 @@ public class SystemNewFileAction extends SystemBaseWizardAction // 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/SystemNewFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemNewFolderAction.java index 078951ae59d..4a5f56600e7 100644 --- 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 @@ -12,19 +12,22 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * 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; @@ -65,4 +68,19 @@ public class SystemNewFolderAction extends SystemBaseWizardAction 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/SystemSearchAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemSearchAction.java index 695df145af6..d4acd833fc2 100644 --- 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 @@ -12,16 +12,20 @@ * * 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; @@ -41,4 +45,20 @@ public class SystemSearchAction extends SystemBaseAction { 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/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java index cfb66571846..dfc64d124d1 100644 --- 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 @@ -58,6 +58,7 @@ * 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 *******************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -317,7 +318,8 @@ public class SystemViewRemoteFileAdapter boolean canRead = true; boolean supportsSearch = true; boolean supportsArchiveManagement = false; - + boolean offline = false; + // perf improvement... phil Object firstSelection = selection.getFirstElement(); IRemoteFile firstFile = null; @@ -327,9 +329,13 @@ public class SystemViewRemoteFileAdapter elementType = firstFile.isDirectory() || firstFile.isRoot() ? 1 : 0; isArchive = firstFile.isArchive(); canRead = firstFile.canRead(); + + IRemoteFileSubSystem fileSubSystem = firstFile.getParentRemoteFileSubSystem(); + + offline = fileSubSystem.isOffline(); - supportsSearch = firstFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsSearch(); - supportsArchiveManagement = firstFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement(); + supportsSearch = fileSubSystem.getParentRemoteFileSubSystemConfiguration().supportsSearch(); + supportsArchiveManagement = fileSubSystem.getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement(); } else return; @@ -353,25 +359,24 @@ public class SystemViewRemoteFileAdapter if ((elementType == 1 || (isArchive && supportsArchiveManagement))) { - if (!foldersOnly && canRead) + if (!foldersOnly) { if (addNewFile == null) { - addNewFile = new SystemNewFileAction(shell); + addNewFile = new SystemNewFileAction(shell); } + addNewFile.setEnabled(canRead && !offline); menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFile); } if (!filesOnly) { - if (canRead) - { - if (addNewFolder == null) - { - addNewFolder = new SystemNewFolderAction(shell); - } - menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFolder); - } - + if (addNewFolder == null) + { + addNewFolder = new SystemNewFolderAction(shell); + } + addNewFolder.setEnabled(canRead && !offline); + menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFolder); + if (addNewFilter == null) { addNewFilter = new SystemNewFileFilterFromFolderAction(shell); @@ -382,33 +387,27 @@ public class SystemViewRemoteFileAdapter } } - else - { - if (canRead) - { - // 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); + 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 -> + // open with -> - MenuManager submenu = - new MenuManager(FileResources.ResourceNavigator_openWith, - ISystemContextMenuConstants.GROUP_OPENWITH); + 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 (openWithMenu == null) + { + openWithMenu = new SystemRemoteFileOpenWithMenu(); + } + openWithMenu.updateSelection(selection); + submenu.add(openWithMenu); + menu.getMenuManager().appendToGroup(ISystemContextMenuConstants.GROUP_OPENWITH, submenu); } @@ -444,35 +443,40 @@ public class SystemViewRemoteFileAdapter { replaceEditionAction = new SystemReplaceWithEditionAction(shell); } - if (canRead && supportsSearch) + if (supportsSearch) { //menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, addToArchiveAction); // add search action menu.add(ISystemContextMenuConstants.GROUP_SEARCH, searchAction); + searchAction.setEnabled(canRead && !offline); } - if (!firstFile.isRoot() && canRead) + 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)) { - if (canRead) - { - menu.add(menuGroup, pasteClipboardAction); - } + menu.add(menuGroup, pasteClipboardAction); + pasteClipboardAction.setEnabled(canRead && !offline); } - if (!firstFile.isRoot() && canRead) + if (!firstFile.isRoot()) { menu.add(menuGroup, moveAction); + moveAction.setEnabled(canRead && !offline); } } @@ -1491,7 +1495,9 @@ public class SystemViewRemoteFileAdapter { if (element instanceof IRemoteFile) { - return ((IRemoteFile)element).canRead(); + IRemoteFile file = (IRemoteFile)element; + boolean offline = file.getParentRemoteFileSubSystem().isOffline(); + return file.canRead() && !offline; } return true; } @@ -1506,8 +1512,9 @@ public class SystemViewRemoteFileAdapter if (element instanceof IRemoteFile) { IRemoteFile file = (IRemoteFile) element; + boolean offline = file.getParentRemoteFileSubSystem().isOffline(); boolean supportsArchiveManagement = file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement(); - return file.canRead() && file.canWrite() && (file.isDirectory() || file.isRoot() || (file.isArchive() && supportsArchiveManagement)); + return !offline && file.canRead() && file.canWrite() && (file.isDirectory() || file.isRoot() || (file.isArchive() && supportsArchiveManagement)); } return false; @@ -2727,8 +2734,8 @@ public class SystemViewRemoteFileAdapter public boolean canDelete(Object element) { IRemoteFile file = (IRemoteFile) element; - //System.out.println("INSIDE CANDELETE FOR ADAPTER: RETURNING " + !file.isRoot()); - return !file.isRoot() && file.canRead(); + boolean offline = file.getParentRemoteFileSubSystem().isOffline(); + return !file.isRoot() && file.canRead() && !offline; } @@ -2861,7 +2868,8 @@ public class SystemViewRemoteFileAdapter public boolean canRename(Object element) { IRemoteFile file = (IRemoteFile) element; - return !file.isRoot() && file.canRead(); + boolean offline = file.getParentRemoteFileSubSystem().isOffline(); + return !file.isRoot() && file.canRead() && !offline; } private void moveTempResource(IResource localResource, IPath newLocalPath, IRemoteFileSubSystem ss, String newRemotePath) @@ -3357,7 +3365,8 @@ public class SystemViewRemoteFileAdapter IRemoteFile remoteFile = (IRemoteFile) element; if (remoteFile.isFile()) { - return remoteFile.canRead(); + boolean offline = remoteFile.getParentRemoteFileSubSystem().isOffline(); + return remoteFile.canRead() && !offline; } return false; } diff --git a/rse/plugins/org.eclipse.rse.importexport/plugin.xml b/rse/plugins/org.eclipse.rse.importexport/plugin.xml index 93ffc78cda4..d3cb15f8c9c 100644 --- a/rse/plugins/org.eclipse.rse.importexport/plugin.xml +++ b/rse/plugins/org.eclipse.rse.importexport/plugin.xml @@ -1,4 +1,20 @@ + + @@ -100,19 +116,19 @@ point="org.eclipse.ui.popupMenus"> - - - + id="org.eclipse.rse.files.importexport.projectImportExport"> + + + + + + + +