Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-04-09 05:16:34 +0000
committerWilliam Chen2012-04-09 05:16:34 +0000
commitfa7318427bc45f249da163230ab3f04c8044cfb4 (patch)
tree80cb1319efe7cfbe70476b9990bc56a558ffb53e /target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui
parent269b0de82efcebe8a3bfe28fb3ee8b34377a3ba1 (diff)
downloadorg.eclipse.tcf-fa7318427bc45f249da163230ab3f04c8044cfb4.tar.gz
org.eclipse.tcf-fa7318427bc45f249da163230ab3f04c8044cfb4.tar.xz
org.eclipse.tcf-fa7318427bc45f249da163230ab3f04c8044cfb4.zip
Target Explorer: Rename the directory of
org.eclipse.tcf.te.tcf.filesystem.
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF54
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/build.properties7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/error.gifbin0 -> 354 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/folder.gifbin0 -> 216 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/hidden_file_filter.pngbin0 -> 438 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfile_wiz.gifbin0 -> 353 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfolder_wiz.gifbin0 -> 349 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/pending.gifbin0 -> 535 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/refresh.gifbin0 -> 327 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/root.gifbin0 -> 909 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdrive.gifbin0 -> 336 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdriveopen.gifbin0 -> 339 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/synch_synch.gifbin0 -> 353 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/system_file_filter.pngbin0 -> 243 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/banner.pngbin0 -> 2315 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/delete_readonly.pngbin0 -> 367 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/replace_confirm.pngbin0 -> 847 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_conflict.pngbin0 -> 98 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_modified.pngbin0 -> 97 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_outdated.pngbin0 -> 98 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml1955
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java242
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java156
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java196
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java133
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java240
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java26
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DeleteHandlerDelegate.java182
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerModelViewerInput.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/RefreshHandlerDelegate.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java137
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java109
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java83
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java87
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java275
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java256
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java482
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java306
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java419
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java158
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java99
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java224
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java360
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java115
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java98
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java63
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java115
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java420
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java138
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/IOpExecutor.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/JobExecutor.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java76
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java214
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java389
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java115
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java137
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java92
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java110
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java252
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java363
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetContentProvider.java97
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java296
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java354
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties279
138 files changed, 14349 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.classpath
new file mode 100644
index 000000000..8a8f1668c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.project b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.project
new file mode 100644
index 000000000..ab596bd29
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.project
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tcf.te.tcf.filesystem.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <filteredResources>
+ <filter>
+ <id>0</id>
+ <name></name>
+ <type>10</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-target</arguments>
+ </matcher>
+ </filter>
+ </filteredResources>
+</projectDescription>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..086868ad1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,362 @@
+#Fri Oct 07 16:14:06 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=4
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..5149950f5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Oct 07 16:14:06 CEST 2011
+eclipse.preferences.version=1
+formatter_profile=_Target Explorer Java STD
+formatter_settings_version=12
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..bde30a596
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,54 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.filesystem.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.ui.navigator;bundle-version="3.5.100",
+ org.eclipse.tcf.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.forms;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.swt;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.views;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.0.0",
+ org.eclipse.core.filesystem;bundle-version="1.3.100",
+ org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.eclipse.compare;bundle-version="3.5.200",
+ org.eclipse.text;bundle-version="3.5.100",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
+ org.eclipse.core.expressions;bundle-version="3.4.300",
+ org.eclipse.tcf.te.ui.controls;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.ui;bundle-version="1.0.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
+ org.eclipse.tcf.te.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.filesystem.ui.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.controls,
+ org.eclipse.tcf.te.tcf.filesystem.ui.dialogs,
+ org.eclipse.tcf.te.tcf.filesystem.ui.filters,
+ org.eclipse.tcf.te.tcf.filesystem.ui.help;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.interfaces,
+ org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.preferences,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.autosave;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.decorators;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.preferences;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.properties;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.ui.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/build.properties
new file mode 100644
index 000000000..d24082bdb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ icons/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/error.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/error.gif
new file mode 100644
index 000000000..85ec26bb8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/error.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/folder.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/folder.gif
new file mode 100644
index 000000000..5ae555a34
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/folder.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/hidden_file_filter.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/hidden_file_filter.png
new file mode 100644
index 000000000..7cb530b2a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/hidden_file_filter.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfile_wiz.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfile_wiz.gif
new file mode 100644
index 000000000..9d050885b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfile_wiz.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfolder_wiz.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfolder_wiz.gif
new file mode 100644
index 000000000..310eb18e3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/newfolder_wiz.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/pending.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/pending.gif
new file mode 100644
index 000000000..3bd4e3605
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/pending.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/refresh.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/refresh.gif
new file mode 100644
index 000000000..3ca04d06f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/refresh.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/root.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/root.gif
new file mode 100644
index 000000000..ba39f47f4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/root.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdrive.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdrive.gif
new file mode 100644
index 000000000..fd426343b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdrive.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdriveopen.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdriveopen.gif
new file mode 100644
index 000000000..2171f7c38
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/rootdriveopen.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/synch_synch.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/synch_synch.gif
new file mode 100644
index 000000000..ae7726345
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/synch_synch.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/system_file_filter.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/system_file_filter.png
new file mode 100644
index 000000000..24e66a8a0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj16/system_file_filter.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/banner.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/banner.png
new file mode 100644
index 000000000..aa7c955b7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/banner.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/delete_readonly.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/delete_readonly.png
new file mode 100644
index 000000000..4c8a7e3a8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/delete_readonly.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/replace_confirm.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/replace_confirm.png
new file mode 100644
index 000000000..455df2156
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/obj32/replace_confirm.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_conflict.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_conflict.png
new file mode 100644
index 000000000..eb22b4cce
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_conflict.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_modified.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_modified.png
new file mode 100644
index 000000000..66e3e4e24
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_modified.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_outdated.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_outdated.png
new file mode 100644
index 000000000..f662aac01
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/icons/ovr/ovr_outdated.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties
new file mode 100644
index 000000000..7ea30d154
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties
@@ -0,0 +1,112 @@
+##################################################################################
+# Copyright (c) 2011 Wind River Systems, Inc. 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:
+# Wind River Systems - initial API and implementation
+##################################################################################
+
+pluginName = Target Explorer, TCF File System Extensions
+providerName = Eclipse.org - TCF
+
+# ***** Navigator Content *****
+
+navigatorContent.name = File System
+
+# ***** Editor Pages *****
+
+FSExplorerEditorPage.name=File System
+
+# ***** Preference and Property Pages *****
+
+GeneralInformationPage.name=General
+
+preference.page.name = File System
+
+# ***** Wizards and Wizard Pages *****
+
+newfile.wizard.name = File
+newfile.wizard.description = Please specify the attributes of the file.
+newfolder.wizard.name = Folder
+newfolder.wizard.description = Please specify the attributes of the folder.
+
+# ***** Filter *****
+
+FSTreeViewerFilter.hiddenFiles=Hidden files and folders
+FSTreeViewerFilter.systemFiles=Protected operating system files
+
+# ***** Actions/Commands *****
+
+PropertiesAction.label=Properties
+PropertiesAction.tooltip=Show Properties of Selection
+
+fsmenu.open.label = Open
+fsmenu.refresh.label = Refresh
+fsmenu.update.label = Update
+fsmenu.commit.label = Commit
+fsmenu.merge.label = Merge
+fsmenu.revert.label = Revert
+
+temenu.open.label = Open
+temenu.refresh.label = Refresh
+temenu.update.label = Update
+temenu.commit.label = Commit
+temenu.merge.label = Merge
+temenu.revert.label = Revert
+
+command.refresh.name = Refresh File
+command.update.name = Update File
+command.commit.name = Commit File
+command.merge.name = Merge File
+command.revert.name = Revert File
+
+decorator.modified.label = Modified Cache
+decorator.outdated.label = Outdated Cache
+decorator.conflict.label = Conflicting Cache
+decorator.label.cut = Cut File
+decorator.hidden.label = Hidden File
+
+menu.label.openwith = Open With
+menu.new.label = &New
+
+command.label.cut = Cut
+command.label.copy = Copy
+command.label.paste = Paste
+command.label.delete = Delete
+command.label.rename = Rename
+command.label.move = Move
+command.label.cut.1 = Cut
+command.label.copy.1 = Copy
+command.label.paste.1 = Paste
+command.label.delete.1 = Delete
+command.label.rename.1 = Rename
+command.label.move.1 = Move
+
+command.newfile.label = &File
+command.newfolder.label = &Folder
+command.newfile.name = New File
+command.newfolder.name = New Folder
+
+column.name.name = Name
+column.name.size = Size
+column.name.modified = Date Modified
+
+filter.name.hidden = Hidden files and folders
+filter.name.system = Protected operating system files
+
+column.name.type = Type
+column.name.accessed = Date Accessed
+
+filter.description.hidden = Hide hidden files and folders.
+filter.description.system = Hide protected operating system files.
+
+command.refreshViewer.label = Refresh View
+command.refreshViewer.tooltip = Refresh View
+command.refreshViewer.name = Refresh Viewer
+
+propertyTab.general.label = General
+propertyTab.advanced.label = Advanced
+propertyTab.permission.label = Permissions
+command.refresh.tooltip = Refresh the selected node \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
new file mode 100644
index 000000000..e5325aa3d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
@@ -0,0 +1,1955 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Common navigator contributions -->
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding viewerId="org.eclipse.tcf.te.ui.views.View">
+ <includes>
+ <contentExtension
+ pattern="org.eclipse.tcf.te.tcf.filesystem.navigator.*"/>
+ </includes>
+ </viewerContentBinding>
+ <dragAssistant
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd.FSDragAdapterAssistant"
+ viewerId="org.eclipse.tcf.te.ui.views.View">
+ </dragAssistant>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ activeByDefault="false"
+ contentProvider="org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSNavigatorContentProvider"
+ icon="icons/obj16/rootdrive.gif"
+ id="org.eclipse.tcf.te.tcf.filesystem.navigator.content"
+ labelProvider="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider"
+ name="%navigatorContent.name"
+ priority="normal">
+ <triggerPoints>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.locator.hasRemoteService"
+ value="FileSystem">
+ </test>
+ </triggerPoints>
+ <possibleChildren>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </possibleChildren>
+ <commonSorter
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeViewerSorter"
+ id="org.eclipse.tcf.te.tcf.filesystem.navigator.sorter">
+ </commonSorter>
+ <dropAssistant
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd.FSDropAdapterAssistant"
+ id="org.eclipse.tcf.te.tcf.filesystem.dropAssistant">
+ <possibleDropTargets>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof></possibleDropTargets>
+ </dropAssistant>
+ <commonWizard
+ type="new"
+ wizardId="org.eclipse.tcf.te.tcf.filesystem.wizards.NewFileWizard">
+ <enablement>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test></enablement>
+ </commonWizard>
+ <commonWizard
+ type="new"
+ wizardId="org.eclipse.tcf.te.tcf.filesystem.wizards.NewFolderWizard">
+ <enablement>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test>
+ </enablement>
+ </commonWizard>
+ </navigatorContent>
+ <commonFilter
+ activeByDefault="true"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.filters.HiddenFilesViewerFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.navigator.filter.hiddenFiles"
+ name="%FSTreeViewerFilter.hiddenFiles"
+ visibleInUI="true">
+ </commonFilter>
+ <commonFilter
+ activeByDefault="true"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.filters.SystemFilesViewerFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.navigator.filter.systemFiles"
+ name="%FSTreeViewerFilter.systemFiles"
+ visibleInUI="true">
+ </commonFilter>
+ </extension>
+
+<!-- Editor page contributions -->
+ <extension point="org.eclipse.tcf.te.ui.views.editorPages">
+ <editorPage
+ class="org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage:org.eclipse.tcf.te.ui.controls.viewer.fs:File System Explorer"
+ name="%FSExplorerEditorPage.name"
+ id="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage">
+ </editorPage>
+ </extension>
+
+<!-- Editor page binding contributions -->
+ <extension point="org.eclipse.tcf.te.ui.views.editorPageBindings">
+ <editorPageBinding
+ id="org.eclipse.tcf.te.tcf.filesystem.binding.FSExplorerEditorPage"
+ pageId="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage">
+ <enablement>
+ <with variable="activeEditorInput">
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="FileSystem"/>
+ <test
+ property="org.eclipse.tcf.te.runtime.preference"
+ args="bundleId=org.eclipse.tcf.te.tcf.filesystem.ui,key=te.tcf.filesystem.core.feature.editor.content.enable"
+ value="true">
+ </test>
+ </and>
+ </with>
+ </enablement>
+ </editorPageBinding>
+ </extension>
+
+<!-- Menu contributions -->
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.controls.menu.fs?after=additions">
+ <separator
+ name="group.new">
+ </separator>
+ <menu
+ label="%menu.new.label">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.newFile"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_NewFile"
+ icon="icons/obj16/newfile_wiz.gif"
+ label="%command.newfile.label"
+ style="push">
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.newFolder"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_NewFolder"
+ icon="icons/obj16/newfolder_wiz.gif"
+ label="%command.newfolder.label"
+ style="push">
+ </command>
+ </menu>
+ <separator name="group.open" visible="true"/>
+ <command
+ commandId="org.eclipse.ui.navigator.Open"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Open"
+ id="open"
+ label="%fsmenu.open.label"
+ style="push">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile"/>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <menu
+ label="%menu.label.openwith">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ <dynamic
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.OpenWithContribution"
+ id="openWithMenu">
+ </dynamic>
+ </menu>
+ <separator
+ name="group.edit"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.cut"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Cut"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/cut_edit.gif"
+ id="cut"
+ label="%command.label.cut"
+ mnemonic="t"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.edit.copy"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Copy"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.gif"
+ id="copy"
+ label="%command.label.copy"
+ mnemonic="C"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.edit.paste"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Paste"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/paste_edit.gif"
+ id="paste"
+ label="%command.label.paste"
+ mnemonic="P"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.move"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.rename"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Rename"
+ id="rename"
+ label="%command.label.rename"
+ mnemonic="R"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.edit.move"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Move"
+ id="move"
+ label="%command.label.move"
+ mnemonic="M"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.delete"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.delete"
+ disabledIcon="platform:/plugin/org.eclipse.ui/icons/full/dtool16/delete.gif"
+ helpContextId="org.eclipse.tcf.te.ui.command_Delete"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/delete.gif"
+ id="org.eclipse.tcf.te.ui.commands.delete"
+ label="%command.label.delete"
+ mnemonic="D"
+ style="push"
+ tooltip="%command.delete.description">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test
+ property="org.eclipse.tcf.te.ui.views.isDeletableElement"
+ value="true">
+ </test>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.state"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ id="org.eclipse.tcf.te.ui.commands.refresh"
+ label="%fsmenu.refresh.label"
+ mnemonic="f"
+ style="push"
+ tooltip="%command.refresh.tooltip">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test
+ property="org.eclipse.tcf.te.ui.views.isRefreshableElement"
+ value="true">
+ </test>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.update"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Update"
+ id="update"
+ label="%fsmenu.update.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.commit"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Commit"
+ id="commit"
+ label="%fsmenu.commit.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.merge"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Merge"
+ id="merge"
+ label="%fsmenu.merge.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.revert"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Revert"
+ id="revert"
+ label="%fsmenu.revert.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <separator name="group.properties" visible="true"/>
+ <command
+ commandId="org.eclipse.ui.file.properties"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Properties"
+ id="properties"
+ label="%PropertiesAction.label"
+ tooltip="%PropertiesAction.tooltip">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <and>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot">
+ </test>
+ </not>
+ </and>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.properties">
+ <command
+ commandId="org.eclipse.ui.file.properties"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Properties"
+ id="properties"
+ label="%PropertiesAction.label"
+ tooltip="%PropertiesAction.tooltip">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <and>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot">
+ </test>
+ </not>
+ </and>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.open">
+ <command
+ commandId="org.eclipse.ui.navigator.Open"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Open"
+ id="open"
+ label="%temenu.open.label"
+ style="push">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile"/>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <menu
+ label="%menu.label.openwith">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ <dynamic
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.OpenWithContribution"
+ id="openWithMenu">
+ </dynamic>
+ </menu>
+ <separator
+ name="file.group.edit"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.cut"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Cut"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/cut_edit.gif"
+ id="cut"
+ label="%command.label.cut.1"
+ mnemonic="t"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.edit.copy"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Copy"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.gif"
+ id="copy"
+ label="%command.label.copy.1"
+ mnemonic="C"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.edit.paste"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Paste"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/paste_edit.gif"
+ id="paste"
+ label="%command.label.paste.1"
+ mnemonic="P"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.move"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.rename"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Rename"
+ id="rename"
+ label="%command.label.rename.1"
+ mnemonic="R"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.edit.move"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Move"
+ id="move"
+ label="%command.label.move.1"
+ mnemonic="M"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.state"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.update"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Update"
+ id="update"
+ label="%temenu.update.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.commit"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Commit"
+ id="commit"
+ label="%temenu.commit.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.merge"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Merge"
+ id="merge"
+ label="%temenu.merge.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.revert"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Revert"
+ id="revert"
+ label="%temenu.revert.label"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.tcf.te.ui.controls.menu.fs?after=additions">
+ <command
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.refreshViewer"
+ icon="icons/obj16/refresh.gif"
+ label="%command.refreshViewer.label"
+ style="push"
+ tooltip="%command.refreshViewer.tooltip">
+ </command>
+ </menuContribution>
+ </extension>
+
+<!-- Property page contributions -->
+ <extension point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.properties.GeneralInformationPage"
+ id="org.eclipse.tcf.te.tcf.filesystem.pages.basic"
+ name="%GeneralInformationPage.name">
+ <enabledWhen>
+ <and>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot">
+ </test>
+ </not>
+ </and>
+ </enabledWhen>
+ </page>
+ </extension>
+
+<!-- Property tester contributions -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers.CachePropertyTester"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache"
+ namespace="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache"
+ properties="isAutoSavingOn"
+ type="java.lang.Object">
+ </propertyTester>
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers.ClipboardPropertyTester"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytester.clipboard"
+ namespace="org.eclipse.tcf.te.tcf.filesystem.propertytester.clipboard"
+ properties="canPaste"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers.EditorActivationEventPropertyTester"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytester.event"
+ namespace="org.eclipse.tcf.te.tcf.filesystem.propertytester.event"
+ properties="isEditorActivation"
+ type="org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent">
+ </propertyTester>
+ </extension>
+
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.update"
+ name="%command.update.name">
+ </command>
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.commit"
+ name="%command.commit.name">
+ </command>
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.merge"
+ name="%command.merge.name">
+ </command>
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.revert"
+ name="%command.revert.name">
+ </command>
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.newFile"
+ name="%command.newfile.name">
+ </command>
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.newFolder"
+ name="%command.newfolder.name">
+ </command>
+ <command
+ id="org.eclipse.tcf.te.tcf.filesystem.commands.refreshViewer"
+ name="%command.refreshViewer.name">
+ </command>
+ </extension>
+
+<!-- Command handler contributions -->
+ <extension point="org.eclipse.ui.handlers">
+ <!-- This handler contribution is for the double click behaviour in the
+ Target Explore tree view -->
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.OpenFileHandler"
+ commandId="org.eclipse.ui.navigator.Open">
+ <activeWhen>
+ <and>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.UpdateHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.update">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="outdated">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.CommitHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.commit">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="modified">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MergeHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.merge">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="conflict">
+ </test>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.UpdateHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.revert">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <or>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="modified">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="conflict">
+ </test>
+ </or>
+ </iterate>
+ </with>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn">
+ </test>
+ </not>
+ </and>
+ </enabledWhen>
+ </handler>
+
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.CutFilesHandler"
+ commandId="org.eclipse.ui.edit.cut">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot">
+ </test>
+ </not>
+ <or>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows">
+ </test>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly">
+ </test>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows">
+ </test>
+ </not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.CopyFilesHandler"
+ commandId="org.eclipse.ui.edit.copy">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable">
+ </test>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.PasteFilesHandler"
+ commandId="org.eclipse.ui.edit.paste">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.clipboard.canPaste">
+ </test>
+ </with>
+ </and>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MoveFilesHandler"
+ commandId="org.eclipse.ui.edit.move">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot">
+ </test>
+ </not>
+ <or>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows">
+ </test>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly">
+ </test>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows">
+ </test>
+ </not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.RenameFilesHandler"
+ commandId="org.eclipse.ui.edit.rename">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <or>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot">
+ </test>
+ </not>
+ <or>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows">
+ </test>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly">
+ </test>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows">
+ </test>
+ </not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.NewFileHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.newFile">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <or>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test>
+ </and>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ args="isWritable"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent">
+ </test>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.NewFolderHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.newFolder">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.tcf.te.ui.views.Editor">
+ </equals>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ <or>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable">
+ </test>
+ </and>
+ <and>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile">
+ </test>
+ <test
+ args="isWritable"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent">
+ </test>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.RefreshViewerHandler"
+ commandId="org.eclipse.tcf.te.tcf.filesystem.commands.refreshViewer">
+ </handler>
+ </extension>
+
+<!-- Decorator contributions -->
+ <extension point="org.eclipse.ui.decorators">
+ <decorator
+ icon="icons/ovr/ovr_modified.png"
+ id="org.eclipse.tcf.te.tcf.filesystem.decorators.modified"
+ label="%decorator.modified.label"
+ lightweight="true"
+ location="TOP_RIGHT"
+ state="true">
+ <enablement>
+ <objectState
+ name="cache.state"
+ value="modified">
+ </objectState>
+ </enablement>
+ </decorator>
+ <decorator
+ icon="icons/ovr/ovr_outdated.png"
+ id="org.eclipse.tcf.te.tcf.filesystem.decorators.outdated"
+ label="%decorator.outdated.label"
+ lightweight="true"
+ location="TOP_RIGHT"
+ state="true">
+ <enablement>
+ <objectState
+ name="cache.state"
+ value="outdated">
+ </objectState>
+ </enablement>
+ </decorator>
+ <decorator
+ icon="icons/ovr/ovr_conflict.png"
+ id="org.eclipse.tcf.te.tcf.filesystem.decorators.conflict"
+ label="%decorator.conflict.label"
+ lightweight="true"
+ location="TOP_RIGHT"
+ state="true">
+ <enablement>
+ <objectState
+ name="cache.state"
+ value="conflict">
+ </objectState>
+ </enablement>
+ </decorator>
+ <decorator
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.decorators.PhantomDecorator"
+ id="org.eclipse.tcf.te.tcf.filesystem.decorators.cut"
+ label="%decorator.label.cut"
+ state="true">
+ <enablement>
+ <objectState
+ name="edit.cut"
+ value="true">
+ </objectState>
+ </enablement>
+ </decorator>
+ <decorator
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.decorators.PhantomDecorator"
+ id="org.eclipse.tcf.te.tcf.filesystem.decorators.hidden"
+ label="%decorator.hidden.label"
+ state="true">
+ <enablement>
+ <objectState
+ name="hidden"
+ value="true">
+ </objectState>
+ </enablement>
+ </decorator>
+ </extension>
+
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.preferences.PreferencesInitializer"/>
+ </extension>
+
+<!-- Preference page contributions -->
+ <extension point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.tcf.te.ui.preferences.general"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.preferences.PreferencePage"
+ id="org.eclipse.tcf.te.ui.preferences.tcf.filesystem"
+ name="%preference.page.name">
+ </page>
+ </extension>
+
+<!-- Adapter contributions -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.FSTreeNodeAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.IActionFilter">
+ </adapter>
+ <adapter
+ type="org.eclipse.jface.viewers.ILabelProvider">
+ </adapter>
+ <adapter
+ type="org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate">
+ </adapter>
+ <adapter
+ type="org.eclipse.tcf.te.ui.views.interfaces.handler.IDeleteHandlerDelegate">
+ </adapter>
+ </factory>
+ </extension>
+
+<!-- CellEditor factory contributions -->
+ <extension point="org.eclipse.tcf.te.ui.cellEditors">
+ <cellEditor
+ editorFactory="org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor.FSViewerCellEditorFactory">
+ <activation>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ <with
+ variable="event">
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.event.isEditorActivation">
+ </test>
+ </with>
+ </and>
+ </activation>
+ <contributeTo
+ viewerId="org.eclipse.tcf.te.ui.views.View">
+ </contributeTo>
+ <contributeTo
+ viewerId="org.eclipse.tcf.te.ui.controls.viewer.fs">
+ </contributeTo>
+ </cellEditor>
+ </extension>
+
+<!-- New wizard contributions -->
+ <extension point="org.eclipse.tcf.te.ui.newWizards">
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.tcf.te.tcf.ui.newWizards.category"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards.NewFileWizard"
+ hasPages="true"
+ icon="icons/obj16/newfile_wiz.gif"
+ id="org.eclipse.tcf.te.tcf.filesystem.wizards.NewFileWizard"
+ name="%newfile.wizard.name">
+ <description>
+ %newfile.wizard.description
+ </description>
+ </wizard>
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.tcf.te.tcf.ui.newWizards.category"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards.NewFolderWizard"
+ hasPages="true"
+ icon="icons/obj16/newfolder_wiz.gif"
+ id="org.eclipse.tcf.te.tcf.filesystem.wizards.NewFolderWizard"
+ name="%newfolder.wizard.name">
+ <description>
+ %newfolder.wizard.description
+ </description>
+ </wizard>
+ </extension>
+
+ <extension point="org.eclipse.tcf.te.ui.viewers">
+ <viewer
+ autoExpandLevel="0"
+ contentProvider="org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider"
+ doubleClickCommand="org.eclipse.ui.navigator.Open"
+ helpId="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"
+ id="org.eclipse.tcf.te.ui.controls.viewer.fs"
+ menuId="org.eclipse.tcf.te.ui.controls.menu.fs"
+ persistent="true">
+ <creation>
+ <style name="SWT.FULL_SELECTION" />
+ <style name="SWT.MULTI" />
+ </creation>
+ <dragSupport
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd.FSDragSourceListener">
+ <operations>
+ <operation name="DND.DROP_COPY" />
+ <operation name="DND.DROP_MOVE" />
+ <operation name="DND.DROP_LINK" />
+ </operations>
+ <transferTypes>
+ <transferType name ="LocalSelectionTransfer" />
+ </transferTypes>
+ </dragSupport>
+ <dropSupport
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd.FSDropTargetListener">
+ <operations>
+ <operation name="DND.DROP_COPY" />
+ <operation name="DND.DROP_MOVE" />
+ <operation name="DND.DROP_LINK" />
+ </operations>
+ <transferTypes>
+ <transferType name ="LocalSelectionTransfer" />
+ <transferType
+ name="FileTransfer">
+ </transferType>
+ </transferTypes>
+ </dropSupport>
+ </viewer>
+ <columnContribution viewerId="org.eclipse.tcf.te.ui.controls.viewer.fs">
+ <column
+ alignment="SWT.LEFT"
+ comparator="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementComparator"
+ id="name"
+ labelProvider="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider"
+ moveable="true"
+ name="%column.name.name"
+ resizable="true"
+ style="SWT.LEFT"
+ visible="true"
+ width="300">
+ </column>
+ <column
+ alignment="SWT.RIGHT"
+ comparator="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.SizeComparator"
+ id="size"
+ labelProvider="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.SizeLabelProvider"
+ moveable="true"
+ name="%column.name.size"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="true"
+ width="100">
+ </column>
+ <column
+ alignment="SWT.LEFT"
+ comparator="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FileTypeComparator"
+ id="type"
+ labelProvider="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FileTypeLabelProvider"
+ moveable="true"
+ name="%column.name.type"
+ resizable="true"
+ style="SWT.LEFT"
+ visible="false"
+ width="100">
+ </column>
+ <column
+ alignment="SWT.RIGHT"
+ comparator="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.ModificationTimeComparator"
+ id="modified"
+ labelProvider="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.ModificationTimeLabelProvider"
+ moveable="true"
+ name="%column.name.modified"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="true"
+ width="120">
+ </column>
+ <column
+ alignment="SWT.RIGHT"
+ comparator="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.AccessTimeComparator"
+ id="accessed"
+ labelProvider="org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.AccessTimeLabelProvider"
+ moveable="true"
+ name="%column.name.accessed"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="false"
+ width="120">
+ </column>
+ </columnContribution>
+
+ <filterContribution viewerId="org.eclipse.tcf.te.ui.controls.viewer.fs">
+ <filter
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.filters.HiddenFilesViewerFilter"
+ description="%filter.description.hidden"
+ enabled="true"
+ id="org.eclipse.tcf.te.tcf.filesystem.navigator.filter.hiddenFiles"
+ image="icons/obj16/hidden_file_filter.png"
+ name="%filter.name.hidden"
+ visibleInUI="true">
+ </filter>
+ <filter
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.filters.SystemFilesViewerFilter"
+ description="%filter.description.system"
+ enabled="true"
+ id="org.eclipse.tcf.te.tcf.filesystem.navigator.filter.systemFiles"
+ image="icons/obj16/system_file_filter.png"
+ name="%filter.name.system"
+ visibleInUI="true">
+ <activation>
+ <with variable="input">
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.peer.isWindows"/>
+ </with>
+ </activation>
+ </filter>
+ </filterContribution>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.ViewerInputAdapterFactory">
+ <adapter
+ type="org.eclipse.tcf.te.core.interfaces.IViewerInput">
+ </adapter>
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="org.eclipse.tcf.te.ui">
+ <propertyTab
+ category="org.eclipse.tcf.te"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytab.general"
+ label="%propertyTab.general.label">
+ </propertyTab>
+ <propertyTab
+ afterTab="org.eclipse.tcf.te.tcf.filesystem.propertytab.general"
+ category="org.eclipse.tcf.te"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytab.permissions"
+ label="%propertyTab.permission.label">
+ </propertyTab>
+ <propertyTab
+ afterTab="org.eclipse.tcf.te.tcf.filesystem.propertytab.general,org.eclipse.tcf.te.tcf.filesystem.propertytab.permissions"
+ category="org.eclipse.tcf.te"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytab.advanced"
+ label="%propertyTab.advanced.label">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="org.eclipse.tcf.te.ui">
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.BasicFolderSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.FolderFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.folder.basic"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.general">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.BasicFileSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.FileFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.file.basic"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.general">
+ </propertySection>
+ <propertySection
+ afterSection="org.eclipse.tcf.te.tcf.filesystem.propertysection.folder.basic,org.eclipse.tcf.te.tcf.filesystem.propertysection.file.basic"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsAttributesSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.windows.attributes"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.general">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.LinuxPermissionsSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.LinuxFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.linux.permissions"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.permissions">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsFolderAISection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsFolderFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.windows.folderAI"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.advanced">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsFileAISection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsFileFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.windows.fileAI"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.advanced">
+ </propertySection>
+ <propertySection
+ afterSection="org.eclipse.tcf.te.tcf.filesystem.propertysection.windows.folderAI,"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsAttributesCESection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed.WindowsFilter"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertysection.windows.attributesCE"
+ tab="org.eclipse.tcf.te.tcf.filesystem.propertytab.advanced">
+ </propertySection>
+ </propertySections>
+ </extension>
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/pom.xml
new file mode 100644
index 000000000..3f79bbe91
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.tcf</groupId>
+ <artifactId>tcf-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+ <version>1.0.0.qualifier</version>
+ <artifactId>org.eclipse.tcf.te.tcf.filesystem</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
new file mode 100644
index 000000000..ed0bb2315
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River) - [345387] Open the remote files with a proper editor
+ * William Chen (Wind River) - [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.activator;
+
+import java.net.URL;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.IExecutionListener;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.autosave.SaveAllListener;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.autosave.SaveListener;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.FsClipboard;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.preferences.PreferencePage;
+import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIPlugin extends AbstractUIPlugin {
+ // The shared instance of this plug-in.
+ private static UIPlugin plugin;
+ // The listener which listens to command "SAVE" and synchronize the local file with the target.
+ private IExecutionListener saveListener;
+ // The listener which listens to command "SAVE ALL" and synchronize the local file with the target.
+ private IExecutionListener saveAllListener;
+ // The shared instance of Clipboard
+ private FsClipboard clipboard;
+
+ /**
+ * The constructor
+ */
+ public UIPlugin() {
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() != null && getDefault().getBundle() != null) {
+ return getDefault().getBundle().getSymbolicName();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ clipboard = new FsClipboard();
+
+ // Add the two execution listeners to command "SAVE" and "SAVE ALL".
+ ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ if (commandService != null) {
+ saveListener = new SaveListener();
+ Command saveCmd = commandService.getCommand(IWorkbenchCommandConstants.FILE_SAVE);
+ saveCmd.addExecutionListener(saveListener);
+ saveAllListener = new SaveAllListener();
+ Command saveAllCmd = commandService.getCommand(IWorkbenchCommandConstants.FILE_SAVE_ALL);
+ saveAllCmd.addExecutionListener(saveAllListener);
+ }
+ }
+
+ /**
+ * Get the shared instance of clipboard
+ */
+ public static FsClipboard getClipboard() {
+ return plugin.clipboard;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ // Remove the two execution listeners.
+ ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ if (commandService != null) {
+ Command saveCmd = commandService.getCommand(IWorkbenchCommandConstants.FILE_SAVE);
+ saveCmd.removeExecutionListener(saveListener);
+ Command saveAllCmd = commandService.getCommand(IWorkbenchCommandConstants.FILE_SAVE_ALL);
+ saveAllCmd.removeExecutionListener(saveAllListener);
+ }
+ // Ignore SWTException here, the display might be disposed already.
+ if (clipboard != null) {
+ try {
+ clipboard.dispose();
+ }
+ catch (SWTException e) { /* ignored on purpose */
+ }
+ }
+ clipboard = null;
+ plugin = null;
+ super.stop(context);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
+ */
+ @Override
+ protected void initializeImageRegistry(ImageRegistry registry) {
+ URL url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "folder.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.FOLDER, ImageDescriptor.createFromURL(url));
+
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "root.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.ROOT, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "rootdrive.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.ROOT_DRIVE, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "rootdriveopen.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.ROOT_DRIVE_OPEN, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "synch_synch.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.COMPARE_EDITOR, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ32 + "replace_confirm.png"); //$NON-NLS-1$
+ registry.put(ImageConsts.REPLACE_FOLDER_CONFIRM, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ32 + "delete_readonly.png"); //$NON-NLS-1$
+ registry.put(ImageConsts.DELETE_READONLY_CONFIRM, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ32 + "banner.png"); //$NON-NLS-1$
+ registry.put(ImageConsts.BANNER_IMAGE, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "error.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.ERROR_IMAGE, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "pending.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.PENDING, ImageDescriptor.createFromURL(url));
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the <code>Image</code> object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The <code>Image</code> object instance or <code>null</code>.
+ */
+ public static Image getImage(String key) {
+ return getDefault().getImageRegistry().get(key);
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the <code>ImageDescriptor</code> object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The <code>ImageDescriptor</code> object instance or <code>null</code>.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getImageRegistry().getDescriptor(key);
+ }
+
+ /**
+ * Loads the image given by the specified image descriptor from the image
+ * registry. If the image has been loaded ones before already, the cached
+ * <code>Image</code> object instance is returned. Otherwise, the <code>
+ * Image</code> object instance will be created and cached before returned.
+ *
+ * @param descriptor The image descriptor.
+ * @return The corresponding <code>Image</code> object instance or <code>null</code>.
+ */
+ public static Image getSharedImage(AbstractImageDescriptor descriptor) {
+ ImageRegistry registry = getDefault().getImageRegistry();
+
+ String imageKey = descriptor.getDecriptorKey();
+ Image image = registry.get(imageKey);
+ if (image == null) {
+ registry.put(imageKey, descriptor);
+ image = registry.get(imageKey);
+ }
+
+ return image;
+ }
+
+ /**
+ * If the option of "autosaving" is set to on.
+ *
+ * @return true if it is auto saving or else false.
+ */
+ public static boolean isAutoSaving() {
+ IPreferenceStore preferenceStore = getDefault().getPreferenceStore();
+ boolean autoSaving = preferenceStore.getBoolean(PreferencePage.PREF_AUTOSAVING);
+ return autoSaving;
+ }
+
+ /**
+ * If the option of "in-place editor" is set to on.
+ *
+ * @return true if it uses in-place editor when renaming files/folders.
+ */
+ public static boolean isInPlaceEditor() {
+ IPreferenceStore preferenceStore = getDefault().getPreferenceStore();
+ boolean inPlaceEditor = preferenceStore.getBoolean(PreferencePage.PREF_RENAMING_IN_PLACE_EDITOR);
+ return inPlaceEditor;
+ }
+
+ /**
+ * If the option of "copy permissions" is set to on.
+ *
+ * @return true if it should copy source file permissions.
+ */
+ public static boolean isCopyPermission() {
+ IPreferenceStore preferenceStore = getDefault().getPreferenceStore();
+ boolean copyPermission = preferenceStore.getBoolean(PreferencePage.PREF_COPY_PERMISSION);
+ return copyPermission;
+ }
+
+ /**
+ * If the option of "copy ownership" is set to on.
+ *
+ * @return true if it should copy source file ownership.
+ */
+ public static boolean isCopyOwnership() {
+ IPreferenceStore preferenceStore = getDefault().getPreferenceStore();
+ boolean copyOwnership = preferenceStore.getBoolean(PreferencePage.PREF_COPY_OWNERSHIP);
+ return copyOwnership;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
new file mode 100644
index 000000000..f4954f236
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.controls;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.ui.trees.TreeContentProvider;
+
+
+/**
+ * File system content provider for the common navigator of Target Explorer.
+ */
+public class FSNavigatorContentProvider extends TreeContentProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return node.parent != null ? node.parent : node.peerNode;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ UIPlugin.getClipboard().addPropertyChangeListener(commonViewerListener);
+ UIPlugin plugin = UIPlugin.getDefault();
+ IPreferenceStore preferenceStore = plugin.getPreferenceStore();
+ preferenceStore.addPropertyChangeListener(commonViewerListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ UIPlugin.getClipboard().removePropertyChangeListener(commonViewerListener);
+ UIPlugin plugin = UIPlugin.getDefault();
+ IPreferenceStore preferenceStore = plugin.getPreferenceStore();
+ preferenceStore.removePropertyChangeListener(commonViewerListener);
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ super.getChildren(parentElement);
+
+ // For the file system, we need the peer node
+ if (parentElement instanceof IPeerModel) {
+ final IPeerModel peerNode = (IPeerModel)parentElement;
+ // Get the file system model root node, if already stored
+ FSModel model = FSModel.getFSModel(peerNode);
+
+ // If the file system model root node hasn't been created, create
+ // and initialize the root node now.
+ if (model.getRoot() == null) {
+ model.createRoot(peerNode);
+ }
+ if (isRootNodeVisible()) {
+ return new Object[] { model.getRoot() };
+ }
+ return getChildren(model.getRoot());
+ } else if (parentElement instanceof FSTreeNode) {
+ final FSTreeNode node = (FSTreeNode)parentElement;
+ if(node.isPendingNode() || node.isFile()) {
+ return NO_ELEMENTS;
+ }
+ if(!node.childrenQueried) {
+ if(!node.childrenQueryRunning) {
+ // Get the file system model root node, if already stored
+ FSModel model = FSModel.getFSModel(node.peerNode);
+ model.queryChildren(node);
+ }
+ if(node.unsafeGetChildren().isEmpty()) {
+ return new Object[] {FSTreeNode.PENDING_NODE};
+ }
+ }
+ return node.unsafeGetChildren().toArray();
+ }
+
+ return NO_ELEMENTS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(final Object element) {
+ Assert.isNotNull(element);
+
+ boolean hasChildren = false;
+
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode)element;
+ if(node.isPendingNode()) {
+ hasChildren = false;
+ } else if(node.isFile()) {
+ hasChildren = false;
+ } else if(node.isSystemRoot()) {
+ hasChildren = true;
+ } else if (node.isDirectory()) {
+ if(node.childrenQueryRunning) {
+ hasChildren = !super.hasChildren(element);
+ }
+ else {
+ hasChildren = !node.childrenQueried || super.hasChildren(element);
+ }
+ }
+ }
+ else if (element instanceof IPeerModel) {
+ // Get the root node for this peer model object.
+ // If null, true is returned as it means that the file system
+ // model hasn't been created yet and have to treat is as children
+ // not queried yet.
+ IPeerModel peerModel = (IPeerModel) element;
+ FSModel model = FSModel.getFSModel(peerModel);
+ FSTreeNode root = model.getRoot();
+ hasChildren = root != null ? hasChildren(root) : true;
+ }
+
+ return hasChildren;
+ }
+
+ /**
+ * If the root node of the tree is visible.
+ *
+ * @return true if it is visible.
+ */
+ protected boolean isRootNodeVisible() {
+ return true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java
new file mode 100644
index 000000000..9f4288ee3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.controls;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+
+
+
+/**
+ * File system tree content provider implementation.
+ */
+public class FSTreeContentProvider extends FSNavigatorContentProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode parent = ((FSTreeNode) element).parent;
+ return parent != null && !parent.isSystemRoot() ? parent : null;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.controls.FSNavigatorContentProvider#isRootNodeVisible()
+ */
+ @Override
+ protected boolean isRootNodeVisible() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java
new file mode 100644
index 000000000..b58011b40
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.controls;
+
+import org.eclipse.jface.viewers.TreePathViewerSorter;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementComparator;
+
+/**
+ * File system tree control viewer sorter implementation.
+ */
+public class FSTreeViewerSorter extends TreePathViewerSorter {
+ private final FSTreeElementComparator comparator;
+
+ /**
+ * Constructor.
+ */
+ public FSTreeViewerSorter() {
+ comparator = new FSTreeElementComparator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (e1 instanceof FSTreeNode && e2 instanceof FSTreeNode) {
+ return comparator.compare((FSTreeNode) e1, (FSTreeNode) e2);
+ }
+ return super.compare(viewer, e1, e2);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
new file mode 100644
index 000000000..ed9dd296f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.dialogs;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeViewerSorter;
+import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.IFSConstants;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MoveFilesHandler;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.trees.FilterDescriptor;
+import org.eclipse.tcf.te.ui.trees.ViewerStateManager;
+import org.eclipse.ui.IDecoratorManager;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+
+/**
+ * <p>
+ * The folder selection dialog for a remote file system. To populate the tree of the selection
+ * dialog with the file system, you should call <code>
+ * ElementTreeSelectionDialog.setInput</code> to specify the peer model of the remote target. In
+ * order to validate the destination folder, you should also specify the nodes to be moved. The file
+ * selection dialog is of single selection. You can get the selected result by calling
+ * <code>getFirstResult</code>. The type of selected folder is an instance of FSTreeNode.
+ * </p>
+ * <p>
+ * The following is a snippet of example code:
+ *
+ * <pre>
+ * FSFolderSelectionDialog dialog = new FSFolderSelectionDialog(shell);
+ * dialog.setInput(peer);
+ * dialog.setMovedNodes(nodes);
+ * if (dialog.open() == Window.OK) {
+ * Object obj = dialog.getFirstResult();
+ * Assert.isTrue(obj instanceof FSTreeNode);
+ * FSTreeNode folder = (FSTreeNode) obj;
+ * // Use folder ...
+ * }
+ * </pre>
+ *
+ * @see MoveFilesHandler
+ */
+public class FSFolderSelectionDialog extends ElementTreeSelectionDialog {
+ // The nodes that are being moved.
+ private List<FSTreeNode> movedNodes;
+
+ /**
+ * Create an FSFolderSelectionDialog using the specified shell as the parent.
+ *
+ * @param parentShell The parent shell.
+ */
+ public FSFolderSelectionDialog(Shell parentShell) {
+ this(parentShell, new FSTreeElementLabelProvider(), new FSTreeContentProvider());
+ }
+
+ /**
+ * Create an FSFolderSelectionDialog using the specified shell, an FSTreeLabelProvider, and a
+ * content provider that provides the tree nodes.
+ *
+ * @param parentShell The parent shell.
+ * @param labelProvider The label provider.
+ * @param contentProvider The content provider.
+ */
+ private FSFolderSelectionDialog(Shell parentShell, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+ super(parentShell, createDecoratingLabelProvider(labelProvider), contentProvider);
+ setTitle(Messages.FSFolderSelectionDialog_MoveDialogTitle);
+ setMessage(Messages.FSFolderSelectionDialog_MoveDialogMessage);
+ this.setAllowMultiple(false);
+ this.setComparator(new FSTreeViewerSorter());
+ this.addFilter(new DirectoryFilter());
+ this.setStatusLineAboveButtons(false);
+ this.setValidator(new ISelectionStatusValidator() {
+
+ @Override
+ public IStatus validate(Object[] selection) {
+ return isValidFolder(selection);
+ }
+ });
+ }
+
+ /**
+ * The viewer filter used to filter out files.
+ */
+ static class DirectoryFilter extends ViewerFilter {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return node.isDirectory() || node.isPendingNode();
+ }
+ return false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#setInput(java.lang.Object)
+ */
+ @Override
+ public void setInput(Object input) {
+ super.setInput(input);
+ FilterDescriptor[] filterDescriptors = ViewerStateManager.getInstance().getFilterDescriptors(IFSConstants.ID_TREE_VIEWER_FS, input);
+ if (filterDescriptors != null) {
+ for(FilterDescriptor descriptor : filterDescriptors) {
+ if(descriptor.isEnabled()) {
+ addFilter(descriptor.getFilter());
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a decorating label provider using the specified label provider.
+ *
+ * @param labelProvider The label provider that actually provides labels and images.
+ * @return The decorating label provider.
+ */
+ private static ILabelProvider createDecoratingLabelProvider(ILabelProvider labelProvider) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IDecoratorManager manager = workbench.getDecoratorManager();
+ ILabelDecorator decorator = manager.getLabelDecorator();
+ return new DecoratingLabelProvider(labelProvider,decorator);
+ }
+
+ /**
+ * Set the nodes that are about to be moved.
+ *
+ * @param movedNodes The nodes.
+ */
+ public void setMovedNodes(List<FSTreeNode> movedNodes) {
+ this.movedNodes = movedNodes;
+ }
+
+ /**
+ * Create the tree viewer and set it to the label provider.
+ */
+ @Override
+ protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
+ TreeViewer viewer = super.doCreateTreeViewer(parent, style);
+ viewer.getTree().setLinesVisible(false);
+ return viewer;
+ }
+
+ /**
+ * If the specified selection is a valid folder to be selected.
+ *
+ * @param selection The selected folders.
+ * @return An error status if it is invalid or an OK status indicating it is valid.
+ */
+ IStatus isValidFolder(Object[] selection) {
+ String pluginId = UIPlugin.getUniqueIdentifier();
+ IStatus error = new Status(IStatus.ERROR, pluginId, null);
+ if (selection == null || selection.length == 0) {
+ return error;
+ }
+ if (!(selection[0] instanceof FSTreeNode)) {
+ return error;
+ }
+ FSTreeNode target = (FSTreeNode) selection[0];
+ if (movedNodes != null) {
+ for (FSTreeNode node : movedNodes) {
+ if (node == target || node.isAncestorOf(target)) {
+ return error;
+ }
+ }
+ }
+ if(!target.isWritable()) {
+ return error;
+ }
+ return new Status(IStatus.OK, pluginId, null);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
new file mode 100644
index 000000000..89004bbf2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeViewerSorter;
+import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.IFSConstants;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.trees.FilterDescriptor;
+import org.eclipse.tcf.te.ui.trees.ViewerStateManager;
+import org.eclipse.ui.IDecoratorManager;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+
+
+/**
+ * File system open file dialog.
+ */
+public class FSOpenFileDialog extends ElementTreeSelectionDialog {
+ /**
+ * Create an FSFolderSelectionDialog using the specified shell as the parent.
+ *
+ * @param parentShell The parent shell.
+ */
+ public FSOpenFileDialog(Shell parentShell) {
+ this(parentShell, new FSTreeElementLabelProvider(), new FSTreeContentProvider());
+ }
+
+ /**
+ * Create an FSFolderSelectionDialog using the specified shell, an FSTreeLabelProvider, and a
+ * content provider that provides the tree nodes.
+ *
+ * @param parentShell The parent shell.
+ * @param labelProvider The label provider.
+ * @param contentProvider The content provider.
+ */
+ private FSOpenFileDialog(Shell parentShell, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+ super(parentShell, createDecoratingLabelProvider(labelProvider), contentProvider);
+ setTitle(Messages.FSOpenFileDialog_title);
+ setMessage(Messages.FSOpenFileDialog_message);
+ this.setAllowMultiple(false);
+ this.setStatusLineAboveButtons(false);
+ this.setComparator(new FSTreeViewerSorter());
+ this.setValidator(new ISelectionStatusValidator() {
+ @Override
+ public IStatus validate(Object[] selection) {
+ return isValidSelection(selection);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#setInput(java.lang.Object)
+ */
+ @Override
+ public void setInput(Object input) {
+ super.setInput(input);
+ FilterDescriptor[] filterDescriptors = ViewerStateManager.getInstance()
+ .getFilterDescriptors(IFSConstants.ID_TREE_VIEWER_FS, input);
+ if (filterDescriptors != null) {
+ for(FilterDescriptor descriptor : filterDescriptors) {
+ if(descriptor.isEnabled()) addFilter(descriptor.getFilter());
+ }
+ }
+ }
+
+ /**
+ * Create a decorating label provider using the specified label provider.
+ *
+ * @param labelProvider The label provider that actually provides labels and images.
+ * @return The decorating label provider.
+ */
+ private static ILabelProvider createDecoratingLabelProvider(ILabelProvider labelProvider) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IDecoratorManager manager = workbench.getDecoratorManager();
+ ILabelDecorator decorator = manager.getLabelDecorator();
+ return new DecoratingLabelProvider(labelProvider,decorator);
+ }
+
+ /**
+ * Create the tree viewer and set it to the label provider.
+ */
+ @Override
+ protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
+ TreeViewer viewer = super.doCreateTreeViewer(parent, style);
+ viewer.getTree().setLinesVisible(false);
+ return viewer;
+ }
+
+ /**
+ * If the specified selection is a valid folder to be selected.
+ *
+ * @param selection The selected folders.
+ * @return An error status if it is invalid or an OK status indicating it is valid.
+ */
+ IStatus isValidSelection(Object[] selection) {
+ String pluginId = UIPlugin.getUniqueIdentifier();
+ IStatus error = new Status(IStatus.ERROR, pluginId, null);
+ if (selection == null || selection.length == 0) {
+ return error;
+ }
+ if (!(selection[0] instanceof FSTreeNode)) {
+ return error;
+ }
+ FSTreeNode target = (FSTreeNode) selection[0];
+ if(!target.isFile()) {
+ return error;
+ }
+ return new Status(IStatus.OK, pluginId, null);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java
new file mode 100644
index 000000000..cc2547980
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.dialogs;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The TimeTriggeredProgressMonitorDialog is a progress monitor dialog that only
+ * opens if the runnable provided exceeds the specified long operation time.
+ *
+ * @since 3.7 - Copied from
+ * org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog
+ */
+public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
+
+ /**
+ * The time considered to be the long operation time.
+ */
+ /* default */ int longOperationTime;
+
+ /**
+ * The time at which the dialog should be opened.
+ */
+ /* default */ long triggerTime = -1;
+
+ /**
+ * Whether or not we've already opened a dialog.
+ */
+ /* default */ boolean dialogOpened = false;
+
+ /**
+ * Wrapped monitor so we can check ticks and open the dialog when
+ * appropriate
+ */
+ private IProgressMonitor wrappedMonitor;
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param parent
+ * the parent of the dialog
+ * @param longOperationTime
+ * the time (in milliseconds) considered to be a long enough
+ * execution time to warrant opening a dialog.
+ */
+ public TimeTriggeredProgressMonitorDialog(Shell parent, int longOperationTime) {
+ super(parent);
+ setOpenOnRun(false);
+ this.longOperationTime = longOperationTime;
+ }
+
+ /**
+ * Create a monitor for the receiver that wrappers the super classes monitor.
+ *
+ */
+ public void createWrappedMonitor() {
+ wrappedMonitor = new IProgressMonitor() {
+
+ @SuppressWarnings("synthetic-access")
+ IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super.getProgressMonitor();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int)
+ */
+ @Override
+ public void beginTask(String name, int totalWork) {
+ superMonitor.beginTask(name, totalWork);
+ checkTicking();
+ }
+
+ /**
+ * Check if we have ticked in the last 800ms.
+ */
+ private void checkTicking() {
+ if (triggerTime < 0) {
+ triggerTime = System.currentTimeMillis() + longOperationTime;
+ }
+ if (!dialogOpened && System.currentTimeMillis() > triggerTime) {
+ open();
+ dialogOpened = true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#done()
+ */
+ @Override
+ public void done() {
+ superMonitor.done();
+ checkTicking();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
+ */
+ @Override
+ public void internalWorked(double work) {
+ superMonitor.internalWorked(work);
+ checkTicking();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled()
+ */
+ @Override
+ public boolean isCanceled() {
+ return superMonitor.isCanceled();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean)
+ */
+ @Override
+ public void setCanceled(boolean value) {
+ superMonitor.setCanceled(value);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang
+ * .String)
+ */
+ @Override
+ public void setTaskName(String name) {
+ superMonitor.setTaskName(name);
+ checkTicking();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String
+ * )
+ */
+ @Override
+ public void subTask(String name) {
+ superMonitor.subTask(name);
+ checkTicking();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
+ */
+ @Override
+ public void worked(int work) {
+ superMonitor.worked(work);
+ checkTicking();
+
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.ProgressMonitorDialog#getProgressMonitor()
+ */
+ @Override
+ public IProgressMonitor getProgressMonitor() {
+ if (wrappedMonitor == null) {
+ createWrappedMonitor();
+ }
+ return wrappedMonitor;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.operations.IRunnableContext#run(boolean, boolean,
+ * IRunnableWithProgress)
+ */
+ @Override
+ public void run(final boolean fork, final boolean cancelable,
+ final IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ final InvocationTargetException[] invokes = new InvocationTargetException[1];
+ final InterruptedException[] interrupt = new InterruptedException[1];
+ Runnable dialogWaitRunnable = new Runnable() {
+ @Override
+ @SuppressWarnings("synthetic-access")
+ public void run() {
+ try {
+ TimeTriggeredProgressMonitorDialog.super.run(fork, cancelable, runnable);
+ } catch (InvocationTargetException e) {
+ invokes[0] = e;
+ } catch (InterruptedException e) {
+ interrupt[0] = e;
+ }
+ }
+ };
+ final Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display == null) {
+ return;
+ }
+ // show a busy cursor until the dialog opens
+ BusyIndicator.showWhile(display, dialogWaitRunnable);
+ if (invokes[0] != null) {
+ throw invokes[0];
+ }
+ if (interrupt[0] != null) {
+ throw interrupt[0];
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java
new file mode 100644
index 000000000..18c299ccf
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.filters;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * A filter implementation filtering hidden files or directories.
+ */
+public class HiddenFilesViewerFilter extends ViewerFilter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ // The element needs to be a tree node, but not a root node
+ if (element instanceof FSTreeNode && !((FSTreeNode)element).isRoot()) {
+ FSTreeNode node = (FSTreeNode) element;
+ if(node.isWindowsNode()) {
+ return !node.isHidden();
+ }
+ return !node.name.startsWith("."); //$NON-NLS-1$
+ }
+ // Let pass all other elements unharmed
+ return true;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java
new file mode 100644
index 000000000..bb15d12c9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.filters;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * A filter implementation filtering system files or directories.
+ */
+public class SystemFilesViewerFilter extends ViewerFilter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ // The element needs to be a tree node, but not a root node
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode)element;
+ return !node.isSystem();
+ }
+ // Let pass all other elements unharmed
+ return true;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java
new file mode 100644
index 000000000..6e5ed32d5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.help;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+
+/**
+ * Plugin context help id definitions.
+ */
+public interface IContextHelpIds {
+
+ /**
+ * Target Explorer file system UI plug-in common context help id prefix.
+ */
+ public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
+
+ /**
+ * Target Explorer details editor page: File system explorer
+ */
+ public final static String FS_EXPLORER_EDITOR_PAGE = PREFIX + "FSExplorerEditorPage"; //$NON-NLS-1$
+
+ /**
+ * The wizard for creating a new file.
+ */
+ public final static String FS_NEW_FILE_WIZARD_PAGE = PREFIX + "FSNewFilePage"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java
new file mode 100644
index 000000000..33c9f988e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.interfaces;
+
+/**
+ * UIConstants for file system.
+ */
+public interface IFSConstants extends org.eclipse.tcf.te.ui.interfaces.IUIConstants {
+
+ /**
+ * The viewer id of the file tree of Target Explorer.
+ */
+ public static final String ID_TREE_VIEWER_FS = ID_CONTROL_MENUS_BASE + ".viewer.fs"; //$NON-NLS-1$
+
+ /**
+ * The help id of the file tree of Target Explorer.
+ */
+ public static final String ID_TREE_VIEWER_FS_HELP = ID_TREE_VIEWER_FS + ".help"; //$NON-NLS-1$
+
+ /**
+ * The menu id of the file tree of Target Explorer.
+ */
+ public static final String ID_TREE_VIEWER_FS_CONTEXT_MENU = ID_CONTROL_MENUS_BASE + ".menu.fs"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java
new file mode 100644
index 000000000..69792d607
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.preferences;
+
+/**
+ * The bundle's preference key identifiers.
+ */
+public interface IPreferenceKeys {
+ /**
+ * Common prefix for all core preference keys
+ */
+ public final String PREFIX = "te.tcf.filesystem.core."; //$NON-NLS-1$
+
+ /**
+ * If set to <code>true</code>, the file system content contribution to the target
+ * explorer details editor will be activated and visible to the user.
+ */
+ public final String PREF_FEATURE_ENABLE_EDITOR_CONTENT_CONTRIBUTION = PREFIX + "feature.editor.content.enable"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
new file mode 100644
index 000000000..66b80e311
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal;
+
+/**
+ * File system plug-in Image registry constants.
+ */
+public interface ImageConsts {
+
+ // ***** The directory structure constants *****
+
+ /**
+ * The root directory where to load the images from, relative to
+ * the bundle directory.
+ */
+ public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load model object images from,
+ * relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_OBJ = "obj16/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load model object images from,
+ * relative to the image root directory.
+ */
+ public final static String IMAGE_DIR_OBJ32 = "obj32/"; //$NON-NLS-1$
+
+ /**
+ * The directory where to load the decorator image from.
+ */
+ public final static String IMAGE_DIR_OVR = "ovr/"; //$NON-NLS-1$
+
+ // ***** The image constants *****
+
+ /**
+ * The key to access the base folder object image.
+ */
+ public static final String FOLDER = "Folder"; //$NON-NLS-1$
+
+ /**
+ * The key to access the base root node object image.
+ */
+ public static final String ROOT = "Root"; //$NON-NLS-1$
+
+ /**
+ * The key to access the base root folder object image (closed).
+ */
+ public static final String ROOT_DRIVE = "RootDrive"; //$NON-NLS-1$
+
+ /**
+ * The key to access the base root folder object image (opened).
+ */
+ public static final String ROOT_DRIVE_OPEN = "RootDriveOpen"; //$NON-NLS-1$
+
+ /**
+ * The key to access the base pending node object image.
+ */
+ public static final String PENDING = "Pending"; //$NON-NLS-1$
+
+ /**
+ * The key to access the image of compare editor.
+ */
+ public static final String COMPARE_EDITOR = "CompareEditor"; //$NON-NLS-1$
+
+ /**
+ * The key to access the title image of "replace folder confirm" dialog.
+ */
+ public static final String REPLACE_FOLDER_CONFIRM = "ReplaceFolderConfirm"; //$NON-NLS-1$
+
+ /**
+ * The key to access the title image of "confirm read only delete" dialog.
+ */
+ public static final String DELETE_READONLY_CONFIRM = "ConfirmReadOnlyDelete"; //$NON-NLS-1$
+
+ /**
+ * The key to access the banner image of the advanced attributes dialog.
+ */
+ public static final String BANNER_IMAGE = "BannerImage"; //$NON-NLS-1$
+
+ /**
+ * The key to access the error image used in the tool tip popped up during renaming.
+ */
+ public static final String ERROR_IMAGE = "ErrorImage"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DeleteHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DeleteHandlerDelegate.java
new file mode 100644
index 000000000..e1e664630
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DeleteHandlerDelegate.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDelete;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.views.interfaces.handler.IDeleteHandlerDelegate;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * File System tree node delete handler delegate implementation.
+ */
+public class DeleteHandlerDelegate implements IDeleteHandlerDelegate {
+
+ // The key to access the selection in the state.
+ private static final String KEY_SELECTION = "selection"; //$NON-NLS-1$
+ // The key to access the processed state in the state.
+ private static final String KEY_PROCESSED = "processed"; //$NON-NLS-1$
+ // The deletion confirmation callback
+ private IConfirmCallback confirmCallback;
+ // The confirmation call for read only files.
+ private IConfirmCallback readonlyCallback;
+
+ /**
+ * Constructor
+ */
+ public DeleteHandlerDelegate() {
+ confirmCallback = new DeletionConfirmCallback();
+ readonlyCallback = new ReadOnlyConfirmCallback();
+ }
+
+ /**
+ * Set the confirmation callback
+ *
+ * @param confirmCallback The confirmation callback
+ */
+ public void setConfirmCallback(IConfirmCallback confirmCallback) {
+ this.confirmCallback = confirmCallback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IDeleteHandlerDelegate#canDelete(java.lang.Object)
+ */
+ @Override
+ public boolean canDelete(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ if (!node.isSystemRoot() && !node.isRoot()) {
+ return node.isWindowsNode() && !node.isReadOnly()
+ || !node.isWindowsNode() && node.isWritable();
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IDeleteHandlerDelegate#delete(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void delete(Object element, IPropertiesContainer state, ICallback callback) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(state);
+
+ UUID lastProcessed = (UUID) state.getProperty(KEY_PROCESSED);
+ if (lastProcessed == null || !lastProcessed.equals(state.getUUID())) {
+ state.setProperty(KEY_PROCESSED, state.getUUID());
+ if(confirmCallback != null) {
+ IStructuredSelection selection = (IStructuredSelection) state.getProperty(KEY_SELECTION);
+ if(!confirmCallback.requires(selection) || confirmCallback.confirms(selection) == IConfirmCallback.YES) {
+ List<FSTreeNode> nodes = selection.toList();
+ IOpExecutor executor = new UiExecutor(Messages.FSDelete_Deleting, callback);
+ executor.execute(new OpDelete(nodes, readonlyCallback));
+ }
+ }
+ }
+ }
+
+ static class ReadOnlyConfirmCallback implements IConfirmCallback {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback#requires(java.lang.Object)
+ */
+ @Override
+ public boolean requires(Object object) {
+ if(object instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) object;
+ return node.isWindowsNode() && node.isReadOnly() || !node.isWindowsNode() && !node.isWritable();
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback#confirms(java.lang.Object)
+ */
+ @Override
+ public int confirms(Object object) {
+ final FSTreeNode node = (FSTreeNode) object;
+ final int[] results = new int[1];
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ String title = Messages.FSDelete_ConfirmDelete;
+ String message = NLS.bind(Messages.FSDelete_ConfirmMessage, node.name);
+ final Image titleImage = UIPlugin.getImage(ImageConsts.DELETE_READONLY_CONFIRM);
+ MessageDialog qDialog = new MessageDialog(parent, title, null, message, MessageDialog.QUESTION, new String[] { Messages.FSDelete_ButtonYes, Messages.FSDelete_ButtonYes2All, Messages.FSDelete_ButtonNo, Messages.FSDelete_ButtonCancel }, 0) {
+ @Override
+ public Image getQuestionImage() {
+ return titleImage;
+ }
+ };
+ results[0] = qDialog.open();
+ }
+ });
+ return results[0];
+ }
+
+ }
+
+ static class DeletionConfirmCallback implements IConfirmCallback {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback#requires(java.lang.Object)
+ */
+ @Override
+ public boolean requires(Object object) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.interfaces.IConfirmCallback#confirms(java.lang.Object)
+ */
+ @Override
+ public int confirms(Object object) {
+ IStructuredSelection selection = (IStructuredSelection) object;
+ List<FSTreeNode> nodes = selection.toList();
+ String question;
+ if (nodes.size() == 1) {
+ FSTreeNode node = nodes.get(0);
+ question = NLS.bind(Messages.DeleteFilesHandler_DeleteOneFileConfirmation, node.name);
+ }
+ else {
+ question = NLS.bind(Messages.DeleteFilesHandler_DeleteMultipleFilesConfirmation, Integer.valueOf(nodes.size()));
+ }
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ if (MessageDialog.openQuestion(parent, Messages.DeleteFilesHandler_ConfirmDialogTitle, question)) {
+ return IConfirmCallback.YES;
+ }
+ return IConfirmCallback.NO;
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
new file mode 100644
index 000000000..a498c8357
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
+import org.eclipse.tcf.te.ui.views.interfaces.handler.IDeleteHandlerDelegate;
+import org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate;
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * The adapter factory of <code>FSTreeNode</code> over <code>IActionFilter</code>
+ */
+public class FSTreeNodeAdapterFactory implements IAdapterFactory {
+ private static ILabelProvider nodeLabelProvider = new FSTreeElementLabelProvider();
+ private static IDeleteHandlerDelegate deleteDelegate = new DeleteHandlerDelegate();
+ private static IRefreshHandlerDelegate refreshDelegate = new RefreshHandlerDelegate();
+ // The fFilters map caching fFilters for FS nodes.
+ private Map<FSTreeNode, NodeStateFilter> filters;
+
+ /**
+ * Constructor.
+ */
+ public FSTreeNodeAdapterFactory(){
+ this.filters = Collections.synchronizedMap(new HashMap<FSTreeNode, NodeStateFilter>());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if(adaptableObject instanceof FSTreeNode) {
+ if(adapterType == IActionFilter.class) {
+ FSTreeNode node = (FSTreeNode) adaptableObject;
+ NodeStateFilter filter = filters.get(node);
+ if(filter == null){
+ filter = new NodeStateFilter(node);
+ filters.put(node, filter);
+ }
+ return filter;
+ }
+ else if(adapterType == ILabelProvider.class) {
+ return nodeLabelProvider;
+ }
+ else if(adapterType == IRefreshHandlerDelegate.class) {
+ return refreshDelegate;
+ }
+ else if(adapterType == IDeleteHandlerDelegate.class) {
+ return deleteDelegate;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { IActionFilter.class, ILabelProvider.class, IRefreshHandlerDelegate.class, IDeleteHandlerDelegate.class };
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
new file mode 100644
index 000000000..b263de90f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpClipboard;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StateManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.CacheState;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * This action filter wraps an FSTreeNode and test its attribute of "cache.state".
+ * It serves as the expression filter of decorations of Target Explorer.
+ */
+public class NodeStateFilter implements IActionFilter {
+ private FSTreeNode node;
+
+ /**
+ * Constructor.
+ *
+ * @param node
+ * The wrapped tree node. Must not be <code>null</code>.
+ */
+ public NodeStateFilter(FSTreeNode node) {
+ Assert.isNotNull(node);
+ this.node = node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
+ */
+ @Override
+ public boolean testAttribute(Object target, String name, String value) {
+ if (name.equals("cache.state") && node.isFile()) { //$NON-NLS-1$
+ if(UIPlugin.isAutoSaving())
+ return false;
+ CacheState state = StateManager.getInstance().getCacheState(node);
+ if (value == null)
+ value = CacheState.consistent.name();
+ return value.equals(state.name());
+ }
+ else if (name.equals("edit.cut")) { //$NON-NLS-1$
+ OpClipboard cb = UIPlugin.getClipboard();
+ if (!cb.isEmpty()) {
+ if (cb.isCutOp()) {
+ List<FSTreeNode> files = cb.getFiles();
+ for (FSTreeNode file : files) {
+ if (node == file) return true;
+ }
+ }
+ }
+ }
+ else if (name.equals("hidden")) { //$NON-NLS-1$
+ if (value == null) value = "true"; //$NON-NLS-1$
+ boolean result = false;
+ if (!node.isRoot()) {
+ if (node.isWindowsNode()) {
+ result = node.isHidden();
+ }
+ else {
+ result = node.name.startsWith("."); //$NON-NLS-1$
+ }
+ }
+ return Boolean.toString(result).equals(value);
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerModelViewerInput.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerModelViewerInput.java
new file mode 100644
index 000000000..2131c2847
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerModelViewerInput.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import org.eclipse.tcf.te.core.interfaces.IViewerInput;
+import org.eclipse.tcf.te.core.utils.PropertyChangeProvider;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * The viewer input of an IPeerModel instance.
+ */
+public class PeerModelViewerInput extends PropertyChangeProvider implements IViewerInput {
+ // The peer model.
+ private IPeerModel peerModel;
+
+ /**
+ * Create an instance with a peer model.
+ *
+ * @param peerModel The peer model.
+ */
+ public PeerModelViewerInput(IPeerModel peerModel) {
+ this.peerModel = peerModel;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.IViewerInput#getInputId()
+ */
+ @Override
+ public String getInputId() {
+ return peerModel.getPeerId();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/RefreshHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/RefreshHandlerDelegate.java
new file mode 100644
index 000000000..dd5f5a5f8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/RefreshHandlerDelegate.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StateManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate;
+
+/**
+ * File System tree node refresh handler delegate implementation.
+ */
+public class RefreshHandlerDelegate implements IRefreshHandlerDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate#canRefresh(java.lang.Object)
+ */
+ @Override
+ public boolean canRefresh(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return node.isSystemRoot() || node.isRoot() || node.isDirectory()
+ || node.isFile() && !UIPlugin.isAutoSaving();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate#refresh(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void refresh(Object element, IPropertiesContainer state, final ICallback callback) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(state);
+
+ if (canRefresh(element)) {
+ FSTreeNode node = (FSTreeNode) element;
+ if (node.isSystemRoot() || node.isRoot() || node.isDirectory()) {
+ IOpExecutor executor = new JobExecutor(NLS.bind(Messages.RefreshDirectoryHandler_RefreshJobTitle, node.name), callback);
+ executor.execute(new OpRefresh(node));
+ }
+ else if (node.isFile() && !UIPlugin.isAutoSaving()) {
+ IStatus status = Status.OK_STATUS;
+ try {
+ StateManager.getInstance().refreshState(node);
+ }
+ catch (TCFException e) {
+ status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), Messages.StateManager_RefreshFailureTitle, e);
+ }
+ if (callback != null) {
+ callback.done(this, status);
+ }
+ }
+ }
+ else {
+ if (callback != null) {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java
new file mode 100644
index 000000000..8da22cdc4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.core.interfaces.IViewerInput;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * The adapter factory for IViewerInput.
+ */
+public class ViewerInputAdapterFactory implements IAdapterFactory {
+ // The key to store and access the the viewer input object.
+ private static final String VIEWER_INPUT_KEY = UIPlugin.getUniqueIdentifier()+".peer.viewerInput"; //$NON-NLS-1$
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if(adaptableObject instanceof IPeerModel) {
+ IPeerModel peerModel = (IPeerModel) adaptableObject;
+ return getViewerInput(peerModel);
+ }
+ return null;
+ }
+
+ /**
+ * Get a viewer input from the specified peer model.
+ *
+ * @param peerModel The peer model to get the viewer input from.
+ * @return The peer model's viewer input.
+ */
+ PeerModelViewerInput getViewerInput(final IPeerModel peerModel) {
+ if (peerModel != null) {
+ if (Protocol.isDispatchThread()) {
+ PeerModelViewerInput model = (PeerModelViewerInput) peerModel.getProperty(VIEWER_INPUT_KEY);
+ if (model == null) {
+ model = new PeerModelViewerInput(peerModel);
+ peerModel.setProperty(VIEWER_INPUT_KEY, model);
+ }
+ return model;
+ }
+ final AtomicReference<PeerModelViewerInput> reference = new AtomicReference<PeerModelViewerInput>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ reference.set(getViewerInput(peerModel));
+ }
+ });
+ return reference.get();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { IViewerInput.class };
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java
new file mode 100644
index 000000000..448073d60
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River) - [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.autosave;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IExecutionListener;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheCommit;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StateManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IURIEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The execution listener of command "SAVE ALL", which synchronizes the local
+ * file with the one on the target server after it is saved.
+ */
+public class SaveAllListener implements IExecutionListener {
+ // Dirty nodes that should be saved and synchronized.
+ List<FSTreeNode> fDirtyNodes;
+ /**
+ * Create the listener listening to command "SAVE ALL".
+ */
+ public SaveAllListener() {
+ this.fDirtyNodes = new ArrayList<FSTreeNode>();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#postExecuteSuccess(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void postExecuteSuccess(String commandId, Object returnValue) {
+ if (!fDirtyNodes.isEmpty()) {
+ if (UIPlugin.isAutoSaving()) {
+ FSTreeNode[] nodes = fDirtyNodes.toArray(new FSTreeNode[fDirtyNodes.size()]);
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_UploadingProgress);
+ executor.execute(new OpCacheCommit(nodes, false));
+ }
+ else {
+ SafeRunner.run(new SafeRunnable(){
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ for (FSTreeNode dirtyNode : fDirtyNodes) {
+ StateManager.getInstance().refreshState(dirtyNode);
+ }
+ }});
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#preExecute(java.lang.String, org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public void preExecute(String commandId, ExecutionEvent event) {
+ fDirtyNodes.clear();
+ IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
+ IEditorPart[] editors = page.getDirtyEditors();
+ for (IEditorPart editor : editors) {
+ IEditorInput input = editor.getEditorInput();
+ FSTreeNode node = getEditedNode(input);
+ if (node != null) {
+ // If it is a modified node, add it to the dirty node list.
+ fDirtyNodes.add(node);
+ }
+ }
+ }
+
+ /**
+ * Get the corresponding FSTreeNode from the input.
+ * If the input has no corresponding FSTreeNode, return null;
+ * @param input The editor input.
+ * @return The corresponding FSTreeNode or null if it has not.
+ */
+ private FSTreeNode getEditedNode(IEditorInput input){
+ if (input instanceof IURIEditorInput) {
+ //Get the file that is being edited.
+ IURIEditorInput fileInput = (IURIEditorInput) input;
+ URI uri = fileInput.getURI();
+ try {
+ IFileStore store = EFS.getStore(uri);
+ File localFile = store.toLocalFile(0, new NullProgressMonitor());
+ if (localFile != null) {
+ // Get the file's mapped FSTreeNode.
+ FSTreeNode node = FSModel.getTreeNode(localFile.toString());
+ return node;
+ }
+ }catch(CoreException e){}
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#notHandled(java.lang.String, org.eclipse.core.commands.NotHandledException)
+ */
+ @Override
+ public void notHandled(String commandId, NotHandledException exception) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#postExecuteFailure(java.lang.String, org.eclipse.core.commands.ExecutionException)
+ */
+ @Override
+ public void postExecuteFailure(String commandId, ExecutionException exception) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java
new file mode 100644
index 000000000..9fc3ddfef
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River) - [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.autosave;
+
+import java.io.File;
+import java.net.URI;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IExecutionListener;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheCommit;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StateManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IURIEditorInput;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The execution listener of command "SAVE", which synchronizes the local file
+ * with the one on the target server after it is saved.
+ */
+public class SaveListener implements IExecutionListener {
+ // Dirty node that should be committed or merged.
+ FSTreeNode dirtyNode;
+
+ /**
+ * Create a SaveListener listening to command "SAVE".
+ */
+ public SaveListener() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#postExecuteSuccess(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void postExecuteSuccess(String commandId, Object returnValue) {
+ if (dirtyNode != null) {
+ if (UIPlugin.isAutoSaving()) {
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_UploadingProgress);
+ executor.execute(new OpCacheCommit(new FSTreeNode[]{dirtyNode}, false));
+ }
+ else {
+ SafeRunner.run(new SafeRunnable(){
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ StateManager.getInstance().refreshState(dirtyNode);
+ }});
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#preExecute(java.lang.String, org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public void preExecute(String commandId, ExecutionEvent event) {
+ dirtyNode = null;
+ IEditorInput input = HandlerUtil.getActiveEditorInput(event);
+ if (input instanceof IURIEditorInput) {
+ IURIEditorInput fileInput = (IURIEditorInput) input;
+ URI uri = fileInput.getURI();
+ try {
+ IFileStore store = EFS.getStore(uri);
+ File localFile = store.toLocalFile(0, new NullProgressMonitor());
+ if (localFile != null) {
+ dirtyNode = FSModel.getTreeNode(localFile.toString());
+ }
+ }catch(CoreException e){
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#notHandled(java.lang.String, org.eclipse.core.commands.NotHandledException)
+ */
+ @Override
+ public void notHandled(String commandId, NotHandledException exception) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IExecutionListener#postExecuteFailure(java.lang.String, org.eclipse.core.commands.ExecutionException)
+ */
+ @Override
+ public void postExecuteFailure(String commandId, ExecutionException exception) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java
new file mode 100644
index 000000000..2d3fbfabb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor;
+
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.window.DefaultToolTip;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+
+/**
+ * FSCellListener is an <code>ICellEditorListener</code> that listens to the modification event and displays
+ * error messages in a tool tip when the new name entered is not valid.
+ */
+public class FSCellListener implements ICellEditorListener {
+ // The cell editor used to enter the new name for renaming.
+ private TextCellEditor editor;
+ // The tool tip used to display the error message.
+ private DefaultToolTip tooltip;
+
+ /**
+ * Create an FSCellListener using the specified cell editor.
+ *
+ * @param editor The cell editor
+ */
+ public FSCellListener(TextCellEditor editor) {
+ this.editor = editor;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellEditorListener#applyEditorValue()
+ */
+ @Override
+ public void applyEditorValue() {
+ disposeToolTip();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellEditorListener#cancelEditor()
+ */
+ @Override
+ public void cancelEditor() {
+ disposeToolTip();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellEditorListener#editorValueChanged(boolean, boolean)
+ */
+ @Override
+ public void editorValueChanged(boolean oldValidState, boolean newValidState) {
+ if (!newValidState) {
+ // If it is an invalid input, then display a tool tip showing the error.
+ if (tooltip == null) {
+ tooltip = new DefaultToolTip(editor.getControl(), ToolTip.RECREATE, true);
+ tooltip.setImage(UIPlugin.getImage(ImageConsts.ERROR_IMAGE));
+ }
+ tooltip.setText(editor.getErrorMessage());
+ Control control = editor.getControl();
+ Point pOnScr = control.getSize();
+ pOnScr.x = 0;
+ tooltip.show(pOnScr);
+ }
+ else {
+ // Dispose the tool tip if it is valid.
+ disposeToolTip();
+ }
+ }
+
+ /**
+ * Dispose the tool tip used to display error message.
+ */
+ private void disposeToolTip() {
+ if (tooltip != null) {
+ tooltip.hide();
+ tooltip = null;
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java
new file mode 100644
index 000000000..3ee3d5d29
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRename;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.RenameCallback;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * FSCellModifier is an <code>ICellModifier</code> of the file system tree of the target explorer.
+ */
+public class FSCellModifier implements ICellModifier {
+ // The column property used to get the name of a given file system node.
+ public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
+
+ public FSCellModifier() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public boolean canModify(Object element, String property) {
+ if (property.equals(PROPERTY_NAME)) {
+ if (element instanceof Item) {
+ element = ((Item) element).getData();
+ }
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ if (!node.isRoot()) {
+ return node.isWindowsNode() && !node.isReadOnly() || !node.isWindowsNode() && node.isWritable();
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public Object getValue(Object element, String property) {
+ if (property.equals(PROPERTY_NAME)) {
+ if (element instanceof Item) {
+ element = ((Item) element).getData();
+ }
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return node.name;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String,
+ * java.lang.Object)
+ */
+ @Override
+ public void modify(Object element, String property, Object value) {
+ if (property.equals(PROPERTY_NAME)) {
+ if (element instanceof Item) {
+ element = ((Item) element).getData();
+ }
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ Assert.isTrue(value != null && value instanceof String);
+ String newName = (String) value;
+ // Rename the node with the new name using an FSRename.
+ IOpExecutor executor = new JobExecutor(Messages.FSRename_JobTitle, new RenameCallback());
+ executor.execute(new OpRename(node, newName));
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java
new file mode 100644
index 000000000..902efa7db
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * FSCellValidator is an <code>ICellEditorValidator</code> that validates the name input in the file system
+ * tree cell editor.
+ */
+public class FSCellValidator implements ICellEditorValidator {
+ // The regular expression to define the pattern of a valid Unix file name(not '/').
+ public static final String UNIX_FILENAME_REGEX = "[^/]+"; //$NON-NLS-1$
+ // The regular expression to define the pattern of a valid Windows file name.
+ // (not '?', '\', '/','*','<','>' and '|').
+ public static final String WIN_FILENAME_REGEX = "[^(\\?|\\\\|/|:|\\*|<|>|\\|)]+"; //$NON-NLS-1$
+
+ // The tree viewer used to display the file system.
+ private TreeViewer viewer;
+ /**
+ * Create an FSCellValidator for the specified file system tree.
+ *
+ * @param viewer The tree viewer for the file system.
+ */
+ public FSCellValidator(TreeViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
+ */
+ @Override
+ public String isValid(Object value) {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ Object element = selection.getFirstElement();
+ Assert.isTrue(element instanceof FSTreeNode);
+ FSTreeNode node = (FSTreeNode) element;
+ if (value == null) return Messages.FSRenamingAssistant_SpecifyNonEmptyName;
+ String text = value.toString().trim();
+ if (text.length() == 0) return Messages.FSRenamingAssistant_SpecifyNonEmptyName;
+ if (node == null) return Messages.FSRenamingAssistant_NoNodeSelected;
+ if (hasChild(node, text)) {
+ return Messages.FSRenamingAssistant_NameAlreadyExists;
+ }
+ String formatRegex = node.isWindowsNode() ? WIN_FILENAME_REGEX : UNIX_FILENAME_REGEX;
+ if (!text.matches(formatRegex)) {
+ return node.isWindowsNode() ? Messages.FSRenamingAssistant_WinIllegalCharacters : Messages.FSRenamingAssistant_UnixIllegalCharacters;
+ }
+ return null;
+ }
+ /**
+ * To test if the folder has a child with the specified name.
+ *
+ * @param folder The folder node.
+ * @param name The name.
+ * @return true if it has a child with the name.
+ */
+ private boolean hasChild(FSTreeNode folder, String name) {
+ List<FSTreeNode> nodes = folder.parent.unsafeGetChildren();
+ for (FSTreeNode node : nodes) {
+ if (node.isWindowsNode()) {
+ if (node.name.equalsIgnoreCase(name)) return true;
+ }
+ else if (node.name.equals(name)) return true;
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java
new file mode 100644
index 000000000..67d84f867
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.RenameFilesHandler;
+import org.eclipse.tcf.te.ui.interfaces.IViewerCellEditorFactory;
+
+/**
+ * FSViewerCellEditorFactory implements <code>IViewerCellEditorFactory</code> to add
+ * cell editors to Target Explorer for renaming files or folders in the file system tree viewer.
+ */
+public class FSViewerCellEditorFactory implements IViewerCellEditorFactory, FocusListener {
+ // The tree viewer to add cell editing.
+ private TreeViewer viewer;
+ // The cell editors used to rename a file/folder.
+ private TextCellEditor cellEditor;
+ // The cell modifier used to modify a file/folder's name.
+ private ICellModifier cellModifer;
+
+ /**
+ * Create an instance.
+ */
+ public FSViewerCellEditorFactory() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.IViewerCellEditorFactory#init(org.eclipse.jface.viewers.TreeViewer)
+ */
+ @Override
+ public void init(TreeViewer aViewer) {
+ viewer = aViewer;
+ cellEditor = new TextCellEditor(aViewer.getTree(), SWT.BORDER);
+ cellEditor.setValidator(new FSCellValidator(aViewer));
+ cellEditor.addListener(new FSCellListener(cellEditor));
+ cellModifer = new FSCellModifier();
+ Tree tree = aViewer.getTree();
+ tree.addFocusListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.IViewerCellEditorFactory#getCellEditors()
+ */
+ @Override
+ public CellEditor[] getCellEditors() {
+ return new CellEditor[] { cellEditor };
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.IViewerCellEditorFactory#getCellModifier()
+ */
+ @Override
+ public ICellModifier getCellModifier() {
+ return cellModifer;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.IViewerCellEditorFactory#getColumnProperties()
+ */
+ @Override
+ public String[] getColumnProperties() {
+ return new String[] { FSCellModifier.PROPERTY_NAME };
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
+ */
+ @Override
+ public void focusGained(FocusEvent e) {
+ // Set the currently focused viewer.
+ RenameFilesHandler.setCurrentViewer(viewer);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
+ */
+ @Override
+ public void focusLost(FocusEvent e) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java
new file mode 100644
index 000000000..093a6bfa8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The comparator for the tree column "Date Accessed".
+ */
+public class AccessTimeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.FSTreeNodeComparator#doCompare(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public int doCompare(FSTreeNode node1, FSTreeNode node2) {
+ long atime1 = node1.attr != null ? node1.attr.atime : 0;
+ long atime2 = node2.attr != null ? node2.attr.atime : 0;
+ return atime1 < atime2 ? -1 : (atime1 > atime2 ? 1 : 0);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java
new file mode 100644
index 000000000..7b2be11ef
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The label provider for the tree column "Date Accessed".
+ */
+public class AccessTimeLabelProvider extends LabelProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ // Pending nodes does not have column texts at all
+ if(node.isPendingNode()) return ""; //$NON-NLS-1$
+ if (node.attr != null) {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yyyy h:mm aa"); //$NON-NLS-1$
+ return dateFormat.format(new Date(node.attr.atime));
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java
new file mode 100644
index 000000000..cef5820ba
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.io.File;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The image update adapter that updates the images of the file which
+ * has a local cache copy.
+ */
+public class CacheFileImageUpdater implements ImageUpdateAdapter {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageUpdateAdapter#getImageKey(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public String getImageKey(FSTreeNode node) {
+ return node.getLocationURL().toExternalForm();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageUpdateAdapter#getMirrorFile(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public File getMirrorFile(FSTreeNode node) {
+ return CacheManager.getInstance().getCacheFile(node);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageUpdateAdapter#getImgFile(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public File getImageFile(FSTreeNode node) {
+ File cacheFile = CacheManager.getInstance().getCacheFile(node);
+ File parentDir = cacheFile.getParentFile();
+ if (!parentDir.exists() && !parentDir.mkdirs()) {
+ parentDir = CacheManager.getInstance().getCacheRoot();
+ }
+ return new File(parentDir, node.name + ".png"); //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java
new file mode 100644
index 000000000..a727db640
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The default implementation of ImageProvider, defining the images
+ * based on predefined images based on the node type.
+ */
+public class DefaultImageProvider implements ImageProvider {
+ // The editor registry used to search a file's image.
+ private IEditorRegistry editorRegistry = null;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageProvider#getImage(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public Image getImage(FSTreeNode node) {
+ if (node.isPendingNode()) {
+ return UIPlugin.getImage(ImageConsts.PENDING);
+ }
+ else if (node.isSystemRoot()) {
+ return UIPlugin.getImage(ImageConsts.ROOT);
+ }
+ else if (node.isRoot()) {
+ return UIPlugin.getImage(ImageConsts.ROOT_DRIVE);
+ }
+ else if (node.isDirectory()) {
+ return UIPlugin.getImage(ImageConsts.FOLDER);
+ }
+ else if (node.isFile()) {
+ return getPredefinedImage(node);
+ }
+ return null;
+ }
+
+ /**
+ * Get a predefined image for the tree node. These images are retrieved from
+ * editor registry.
+ *
+ * @param node The file tree node.
+ * @return The editor image for this type.
+ */
+ protected Image getPredefinedImage(FSTreeNode node) {
+ Image image;
+ String key = node.name;
+ image = UIPlugin.getImage(key);
+ if (image == null) {
+ ImageDescriptor descriptor = getEditorRegistry().getImageDescriptor(key);
+ if (descriptor == null) {
+ descriptor = getEditorRegistry().getSystemExternalEditorImageDescriptor(key);
+ }
+ if (descriptor != null) {
+ UIPlugin.getDefault().getImageRegistry().put(key, descriptor);
+ }
+ image = UIPlugin.getImage(key);
+ }
+ return image;
+ }
+
+ /**
+ * Returns the workbench's editor registry.
+ */
+ private IEditorRegistry getEditorRegistry() {
+ if (editorRegistry == null) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench != null) editorRegistry = workbench.getEditorRegistry();
+ }
+ return editorRegistry;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java
new file mode 100644
index 000000000..dbecb7f4f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The comparator for the tree column "name".
+ */
+public class FSTreeElementComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.FSTreeNodeComparator#doCompare(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public int doCompare(FSTreeNode node1, FSTreeNode node2) {
+ String name1 = node1.name;
+ String name2 = node2.name;
+ if (name1 != null && name2 != null) {
+ if (name1.startsWith(".") && !name2.startsWith(".")) return -1; //$NON-NLS-1$ //$NON-NLS-2$
+ if (!name1.startsWith(".") && name2.startsWith(".")) return 1; //$NON-NLS-1$ //$NON-NLS-2$
+ return name1.compareToIgnoreCase(name2);
+ }
+ return 0;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java
new file mode 100644
index 000000000..73a09043d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.runtime.utils.Host;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The label provider for the tree column "name".
+ */
+public class FSTreeElementLabelProvider extends LabelProvider {
+ // The image provider to provide platform specific images.
+ private ImageProvider imgProvider;
+
+ /**
+ * Constructor.
+ */
+ public FSTreeElementLabelProvider() {
+ if(Host.isWindowsHost()) {
+ imgProvider = new WindowsImageProvider();
+ }
+ else {
+ imgProvider = new DefaultImageProvider();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FSTreeNode) {
+ return ((FSTreeNode) element).name;
+ }
+ return super.getText(element);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return imgProvider.getImage(node);
+ }
+ return super.getImage(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java
new file mode 100644
index 000000000..82c803de4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The base comparator for all the file system tree column.
+ */
+public abstract class FSTreeNodeComparator implements Comparator<FSTreeNode>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(FSTreeNode node1, FSTreeNode node2) {
+ // Get the type labels
+ String type1 = node1.type;
+ String type2 = node2.type;
+
+ // Group directories and files always together before sorting by name
+ if ((node1.isRoot() || node1.isDirectory()) && !(node2.isRoot() || node2.isDirectory())) {
+ return -1;
+ }
+
+ if ((node2.isRoot() || node2.isDirectory()) && !(node1.isRoot() || node1.isDirectory())) {
+ return 1;
+ }
+
+ // If the nodes are of the same type and one entry starts
+ // with a '.', it comes before the one without a '.'
+ if (type1 != null && type2 != null && type1.equals(type2)) {
+ return doCompare(node1, node2);
+ }
+ return 0;
+ }
+
+ /**
+ * Sort the node1 and node2 when they are both directories or files.
+ *
+ * @param node1 The first node.
+ * @param node2 The second node.
+ * @return The comparison result.
+ */
+ public abstract int doCompare(FSTreeNode node1, FSTreeNode node2);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java
new file mode 100644
index 000000000..ca1e56f75
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The image update adapter that updates the images of the file which does
+ * not have a local cache copy. The algorithm is based its extension.
+ */
+public class FileExtBasedImageUpdater implements ImageUpdateAdapter {
+ // The label provider update daemon
+ private LabelProviderUpdateDaemon updateDaemon;
+
+ /**
+ * Create an instance with the specified daemon.
+ *
+ * @param daemon The label provider update daemon.
+ */
+ public FileExtBasedImageUpdater(LabelProviderUpdateDaemon daemon) {
+ this.updateDaemon = daemon;
+ }
+
+ /**
+ * Get the node's file extension or null if there is no extension.
+ *
+ * @param node The file tree node.
+ * @return The file's extension or null.
+ */
+ private String getFileExt(FSTreeNode node) {
+ String name = node.name;
+ String ext = "noext"; //$NON-NLS-1$
+ int index = name.lastIndexOf("."); //$NON-NLS-1$
+ if (index != -1) ext = name.substring(index + 1);
+ return ext;
+ }
+
+ /**
+ * Get the directory to store the temporary mirror files.
+ *
+ * @return The directory to contain the mirror files.
+ */
+ private File getMirrorDir() {
+ File tmpDir = updateDaemon.getTempDir();
+ File mrrDir = new File(tmpDir, ".mrr"); //$NON-NLS-1$
+ if(!mrrDir.exists() && !mrrDir.mkdirs()) {
+ mrrDir = tmpDir;
+ }
+ return mrrDir;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageUpdateAdapter#getImageKey(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public String getImageKey(FSTreeNode node) {
+ String ext = getFileExt(node);
+ return "EXT_IMAGE@" + ext; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageUpdateAdapter#getMirrorFile(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public File getMirrorFile(FSTreeNode node) {
+ String ext = getFileExt(node);
+ File mrrDir = getMirrorDir();
+ File file = new File(mrrDir, "mirror" + "." + ext); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!file.exists()) {
+ try {
+ file.createNewFile();
+ }
+ catch (IOException e) {
+ }
+ }
+ return file;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.ImageUpdateAdapter#getImgFile(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public File getImageFile(FSTreeNode node) {
+ String ext = getFileExt(node);
+ return updateDaemon.getTempImg(ext);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java
new file mode 100644
index 000000000..c7c341e0d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The comparator for the tree column "type".
+ */
+public class FileTypeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.FSTreeNodeComparator#doCompare(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public int doCompare(FSTreeNode node1, FSTreeNode node2) {
+ String type1 = node1.getFileType();
+ String type2 = node2.getFileType();
+ return type1.compareTo(type2);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java
new file mode 100644
index 000000000..30d7d64ce
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The label provider for the tree column "type".
+ */
+public class FileTypeLabelProvider extends LabelProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return node.getFileType();
+ }
+ return super.getText(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java
new file mode 100644
index 000000000..d345d9b8a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * An image provider provides platform specific images for each files/folders.
+ * It is used by FSTreeElementLabelProvider to provide the images of a file
+ * node.
+ */
+public interface ImageProvider {
+ /**
+ * Get the image display for the specified file node.
+ *
+ * @param node The file node.
+ * @return The image that represents the file node.
+ */
+ Image getImage(FSTreeNode node);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java
new file mode 100644
index 000000000..4855e49c6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.io.File;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The interface to adapt the process of providing the image for two kinds of
+ * files, one which has a local copy or one which does not.
+ */
+public interface ImageUpdateAdapter {
+
+ /**
+ * Get an extension key as the image registry key for the
+ * specified node.
+ *
+ * @param node The node to get the key for.
+ * @return The key used to cache the image descriptor in the registry.
+ */
+ public String getImageKey(FSTreeNode node);
+
+ /**
+ * Return a mirror file that will be used to retrieve the image from.
+ *
+ * @param node The file system tree node.
+ * @return The corresponding mirror file.
+ */
+ public File getMirrorFile(FSTreeNode node);
+
+ /**
+ * Get the image file object for the specified temporary file name.
+ *
+ * @param tmpName The temporary file name.
+ * @return The file object.
+ */
+ public File getImageFile(FSTreeNode node);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java
new file mode 100644
index 000000000..d2fe740dc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import javax.imageio.ImageIO;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.filechooser.FileSystemView;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.core.interfaces.IViewerInput;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+
+/**
+ * The background daemon that updates the images of the file system using
+ * images retrieved by FileSystemView from Swing.
+ */
+public class LabelProviderUpdateDaemon extends Thread {
+ // The dummy AWT component used to render the icon.
+ Component dummyComponent = new JComponent(){private static final long serialVersionUID = 5926798769323111209L;};
+ //The queue that caches the current file nodes to be updated.
+ BlockingQueue<FSTreeNode> queueNodes;
+ // The image update adapter for a file which has a local cache copy.
+ ImageUpdateAdapter cacheAdapter;
+ // The image update adapter for a file which does not has a local cache copy.
+ ImageUpdateAdapter extAdapter;
+
+ /**
+ * Constructor
+ */
+ public LabelProviderUpdateDaemon() {
+ super("Image Updater Daemon"); //$NON-NLS-1$
+ setDaemon(true);
+ this.queueNodes = new LinkedBlockingQueue<FSTreeNode>();
+ this.cacheAdapter = new CacheFileImageUpdater();
+ this.extAdapter = new FileExtBasedImageUpdater(this);
+ }
+
+ /**
+ * Cache the node which is to be updated with its icon in the file tree.
+ *
+ * @param node The node to be enqueued
+ */
+ public void enqueue(final FSTreeNode node) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore
+ }
+
+ @Override
+ public void run() throws Exception {
+ queueNodes.put(node);
+ }
+ });
+ }
+
+ /**
+ * Take next node to be processed.
+ *
+ * @return The next node.
+ */
+ private FSTreeNode take() {
+ while (true) {
+ try {
+ return queueNodes.take();
+ }
+ catch (InterruptedException e) {
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
+ @Override
+ public void run() {
+ while (true) {
+ FSTreeNode node = take();
+ ImageUpdateAdapter adapter = getUpdateAdapter(node);
+ String imgKey = adapter.getImageKey(node);
+ ImageDescriptor image = UIPlugin.getImageDescriptor(imgKey);
+ if (image == null) {
+ File mrrFile = adapter.getMirrorFile(node);
+ File imgFile = adapter.getImageFile(node);
+ image = createImage(imgKey, mrrFile, imgFile);
+ }
+ if (image != null) {
+ sendNotification(node, node.name, null, image);
+ }
+ }
+ }
+
+ /**
+ * Select an image update adapter for the specified node.
+ *
+ * @param node The FSTreeNode.
+ * @return an image update adapter, either cache based or extension based.
+ */
+ private ImageUpdateAdapter getUpdateAdapter(FSTreeNode node) {
+ File cacheFile = CacheManager.getInstance().getCacheFile(node);
+ if (cacheFile.exists()) {
+ return cacheAdapter;
+ }
+ return extAdapter;
+ }
+
+ /**
+ * Get the image for the specified node from its
+ * image update adapter.
+ *
+ * @param node The file system tree node.
+ * @return The image or null if there's no image yet.
+ */
+ public Image getImage(FSTreeNode node) {
+ ImageUpdateAdapter adapter = getUpdateAdapter(node);
+ String key = adapter.getImageKey(node);
+ return UIPlugin.getImage(key);
+ }
+
+ /**
+ * Create an Image Descriptor based on the mirror file and store
+ * it in the imgFile and store it using the specified image key.
+ *
+ * @param imgKey The image key.
+ * @param mrrFile The mirror file used to create the image.
+ * @param imgFile The image file used to store the image data.
+ * @return The Image Descriptor describing the image or null if it is not successful.
+ */
+ private ImageDescriptor createImage(String imgKey, File mrrFile, File imgFile) {
+ ImageDescriptor image = UIPlugin.getImageDescriptor(imgKey);
+ if (image == null) {
+ if (!imgFile.exists()) {
+ FileSystemView view = FileSystemView.getFileSystemView();
+ Icon icon = view.getSystemIcon(mrrFile);
+ if (icon != null) createImageFromIcon(icon, imgFile);
+ }
+ if (imgFile.exists()) {
+ try {
+ image = ImageDescriptor.createFromURL(imgFile.toURI().toURL());
+ UIPlugin.getDefault().getImageRegistry().put(imgKey, image);
+ }
+ catch (MalformedURLException e) {
+ // Ignore
+ }
+ }
+ }
+ return image;
+ }
+
+ /**
+ * Get the image of disk drivers on Windows platform.
+ *
+ * @return The disk driver image.
+ */
+ public Image getDiskImage() {
+ String key = "SWING_ROOT_DRIVER_IMAGE"; //$NON-NLS-1$
+ ImageDescriptor imgDesc = UIPlugin.getImageDescriptor(key);
+ if (imgDesc == null) {
+ File[] roots = File.listRoots();
+ File mirror;
+ if (roots.length > 1) mirror = roots[1];
+ else mirror = roots[0];
+ File imgFile = getTempImg("_disk_drive_"); //$NON-NLS-1$
+ createImage(key, mirror, imgFile);
+ }
+ return UIPlugin.getImage(key);
+ }
+
+ /**
+ * Get the folder image on Windows platform.
+ *
+ * @return The folder image.
+ */
+ public Image getFolderImage() {
+ String key = "SWING_FOLDER_IMAGE"; //$NON-NLS-1$
+ ImageDescriptor imgDesc = UIPlugin.getImageDescriptor(key);
+ if (imgDesc == null) {
+ String dir = System.getProperty("work.dir"); //$NON-NLS-1$
+ if (dir == null) dir = System.getProperty("java.home"); //$NON-NLS-1$
+ File mirror = null;
+ if (dir != null) mirror = new File(dir);
+ else mirror = new File("."); //$NON-NLS-1$
+ File imgFile = getTempImg("_directory_"); //$NON-NLS-1$
+ createImage(key, mirror, imgFile);
+ }
+ return UIPlugin.getImage(key);
+ }
+
+ /**
+ * Get the temporary directory store the images and temporary mirror files.
+ * @return
+ */
+ protected File getTempDir() {
+ File cacheRoot = CacheManager.getInstance().getCacheRoot();
+ File tempDir = new File(cacheRoot, ".tmp"); //$NON-NLS-1$
+ if (!tempDir.exists() && !tempDir.mkdirs()) {
+ tempDir = cacheRoot;
+ }
+ return tempDir;
+ }
+
+ /**
+ * Get the an image file named "imgName" in the temporary image
+ * directory.
+ *
+ * @param imgName The image's file name.
+ * @return The file object of this image file.
+ */
+ protected File getTempImg(String imgName) {
+ File tempDir = getTempDir();
+ File imgDir = new File(tempDir, ".img"); //$NON-NLS-1$
+ if (!imgDir.exists() && !imgDir.mkdirs()) {
+ imgDir = tempDir;
+ }
+ return new File(imgDir, imgName + ".png"); //$NON-NLS-1$
+ }
+
+ /**
+ * Create an image file using "png" format
+ * for the specified temporary file.
+ *
+ * @param icon The icon that is used for the temporary file.
+ * @param tmpfile The temporary file.
+ */
+ private void createImageFromIcon(Icon icon, File imgFile) {
+ BufferedImage bi = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_4BYTE_ABGR);
+ Graphics g = bi.createGraphics();
+ icon.paintIcon(dummyComponent, g, 0, 0);
+ g.dispose();
+ try {
+ ImageIO.write(bi, "png", imgFile); //$NON-NLS-1$
+ }
+ catch (IOException e) {
+ }
+ }
+
+ /**
+ * Send a notification to inform the file tree for changed images.
+ *
+ * @param node The node whose image has changed.
+ * @param key The key used to store the images.
+ * @param oldImg The old image descriptor.
+ * @param newImg The new image descriptor.
+ */
+ private void sendNotification(FSTreeNode node, String key, ImageDescriptor oldImg, ImageDescriptor newImg) {
+ if (node.peerNode != null) {
+ IViewerInput viewerInput = (IViewerInput) node.peerNode.getAdapter(IViewerInput.class);
+ viewerInput.firePropertyChange(new PropertyChangeEvent(node, key, oldImg, newImg));
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java
new file mode 100644
index 000000000..c04f36320
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The comparator for the tree column "Date Modified".
+ */
+public class ModificationTimeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.FSTreeNodeComparator#doCompare(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public int doCompare(FSTreeNode node1, FSTreeNode node2) {
+ long mtime1 = node1.attr != null ? node1.attr.mtime : 0;
+ long mtime2 = node2.attr != null ? node2.attr.mtime : 0;
+ return mtime1 < mtime2 ? -1 : (mtime1 > mtime2 ? 1 : 0);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java
new file mode 100644
index 000000000..0180e1eb1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The label provider for the tree column "Date Modified".
+ */
+public class ModificationTimeLabelProvider extends LabelProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ // Pending nodes does not have column texts at all
+ if (node.isPendingNode()) return ""; //$NON-NLS-1$
+ if (node.attr != null) {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yyyy h:mm aa"); //$NON-NLS-1$
+ return dateFormat.format(new Date(node.attr.mtime));
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java
new file mode 100644
index 000000000..adbc140c3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The comparator for the tree column "size".
+ */
+public class SizeComparator extends FSTreeNodeComparator {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.FSTreeNodeComparator#doCompare(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public int doCompare(FSTreeNode node1, FSTreeNode node2) {
+ long size1 = node1.attr != null ? node1.attr.size : 0;
+ long size2 = node2.attr != null ? node2.attr.size : 0;
+ return size1 < size2 ? -1 : (size1 > size2 ? 1 : 0);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java
new file mode 100644
index 000000000..848516c5b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import java.text.DecimalFormat;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The label provider for the tree column "size".
+ */
+public class SizeLabelProvider extends LabelProvider {
+ // The size formatter.
+ private static final DecimalFormat SIZE_FORMAT = new DecimalFormat();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ // Pending nodes does not have column texts at all
+ if (node.isPendingNode()) return ""; //$NON-NLS-1$
+ // Directory nodes does not have a size
+ if (node.isFile() && node.attr != null) {
+ return SIZE_FORMAT.format(node.attr.size / 1024) + " KB"; //$NON-NLS-1$
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java
new file mode 100644
index 000000000..227b57413
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * Windows specific image provider extending the default image provider
+ * to retrieve the file's images based on file extension or cached file.
+ */
+public class WindowsImageProvider extends DefaultImageProvider {
+ // The background daemons that updates the images of the file system nodes.
+ static LabelProviderUpdateDaemon updateDaemon;
+ static {
+ updateDaemon = new LabelProviderUpdateDaemon();
+ updateDaemon.start();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.columns.DefaultImageProvider#getImage(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode)
+ */
+ @Override
+ public Image getImage(FSTreeNode node) {
+ if (node.isRoot()) {
+ return updateDaemon.getDiskImage();
+ }
+ else if (node.isDirectory()) {
+ return updateDaemon.getFolderImage();
+ }
+ else if(node.isFile()) {
+ Image image = updateDaemon.getImage(node);
+ if (image == null) {
+ updateDaemon.enqueue(node);
+ image = getPredefinedImage(node);
+ }
+ return image;
+ }
+ return super.getImage(node);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java
new file mode 100644
index 000000000..0b59e7402
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import org.eclipse.compare.SharedDocumentAdapter;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.IElementStateListener;
+
+/**
+ * A shared document adapter that tracks whether the element is connected to a
+ * shared document and whether the contents have been flushed from a compare
+ * viewer. When contents are flushed, this adapter will connect to the document
+ * provider to ensure that the changes are not lost (see
+ * {@link #hasBufferedContents()}). In order to avoid a leak, the buffer must
+ * either be saved (see
+ * {@link #saveDocument(IEditorInput, boolean, IProgressMonitor)}) or released
+ * (see {@link #releaseBuffer()}).
+ * <p>
+ * This adapter must have a one-to-one correspondence to a typed element.
+ *
+ * @since 3.7 - Copied from
+ * org.eclipse.team.internal.ui.synchronize.EditableSharedDocumentAdapter
+ */
+public class EditableSharedDocumentAdapter extends SharedDocumentAdapter implements IElementStateListener {
+
+ private int connectionCount;
+ private final ISharedDocumentAdapterListener listener;
+ private IEditorInput bufferedKey;
+
+ /**
+ * Interface that provides this adapter with the state of the typed element
+ * and supports call backs to the element when the adapter state changes.
+ */
+ public interface ISharedDocumentAdapterListener {
+
+ /**
+ * Method that is invoked when the adapter connects to the document
+ * provider. This method is only invoked when the adapter first connects
+ * to the document.
+ */
+ void handleDocumentConnected();
+
+ /**
+ * Method that is invoked when the adapter disconnects from the document
+ * provider. This method is only invoked when the adapter no longer has
+ * any connection to the document provider.
+ */
+ void handleDocumentDisconnected();
+
+ /**
+ * Method invoked when changes in the document are flushed to the
+ * adapter.
+ */
+ void handleDocumentFlushed();
+
+ /**
+ * Method invoked when the file behind the shared document is deleted.
+ */
+ void handleDocumentDeleted();
+
+ /**
+ * Method invoked when the document dirty state changes from dirty to
+ * clean.
+ */
+ void handleDocumentSaved();
+ }
+
+ /**
+ * Create the shared document adapter for the given element.
+ *
+ * @param listener
+ * access to element internals
+ */
+ public EditableSharedDocumentAdapter(ISharedDocumentAdapterListener listener) {
+ super();
+ this.listener = listener;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.SharedDocumentAdapter#connect(org.eclipse.ui.texteditor.IDocumentProvider, org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ public void connect(IDocumentProvider provider, IEditorInput documentKey)
+ throws CoreException {
+ super.connect(provider, documentKey);
+ connectionCount++;
+ if (connectionCount == 1) {
+ provider.addElementStateListener(this);
+ listener.handleDocumentConnected();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.SharedDocumentAdapter#disconnect(org.eclipse.ui.texteditor.IDocumentProvider, org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ public void disconnect(IDocumentProvider provider, IEditorInput documentKey) {
+ try {
+ super.disconnect(provider, documentKey);
+ } finally {
+ if (connectionCount > 0)
+ connectionCount--;
+ if (connectionCount == 0) {
+ provider.removeElementStateListener(this);
+ listener.handleDocumentDisconnected();
+ }
+ }
+ }
+
+ /**
+ * Return whether the element is connected to a shared document.
+ *
+ * @return whether the element is connected to a shared document
+ */
+ public boolean isConnected() {
+ return connectionCount > 0;
+ }
+
+ /**
+ * Save the shared document of the element of this adapter.
+ *
+ * @param input
+ * the document key of the element.
+ * @param monitor
+ * a progress monitor
+ * @return whether the save succeeded or not
+ * @throws CoreException
+ */
+ public boolean saveDocument(IEditorInput input, IProgressMonitor monitor)
+ throws CoreException {
+ if (isConnected()) {
+ IDocumentProvider provider = SharedDocumentAdapter
+ .getDocumentProvider(input);
+ try {
+ saveDocument(provider, input, provider.getDocument(input),
+ true, monitor);
+ } finally {
+ // When we write the document, remove out hold on the buffer
+ releaseBuffer();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Release the buffer if this adapter has buffered the contents in response
+ * to a
+ * {@link #flushDocument(IDocumentProvider, IEditorInput, IDocument, boolean)}
+ * .
+ */
+ public void releaseBuffer() {
+ if (bufferedKey != null) {
+ IDocumentProvider provider = SharedDocumentAdapter
+ .getDocumentProvider(bufferedKey);
+ provider.disconnect(bufferedKey);
+ bufferedKey = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.ISharedDocumentAdapter#flushDocument(org.eclipse.ui.texteditor.IDocumentProvider, org.eclipse.ui.IEditorInput, org.eclipse.jface.text.IDocument, boolean)
+ */
+ @Override
+ public void flushDocument(IDocumentProvider provider,
+ IEditorInput documentKey, IDocument document, boolean overwrite)
+ throws CoreException {
+ if (!hasBufferedContents()) {
+ // On a flush, make an extra connection to the shared document so it
+ // will be kept even
+ // if it is no longer being viewed.
+ bufferedKey = documentKey;
+ provider.connect(bufferedKey);
+ }
+ this.listener.handleDocumentFlushed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IElementStateListener#elementContentAboutToBeReplaced(java.lang.Object)
+ */
+ @Override
+ public void elementContentAboutToBeReplaced(Object element) {
+ // Nothing to do
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IElementStateListener#elementContentReplaced(java.lang.Object)
+ */
+ @Override
+ public void elementContentReplaced(Object element) {
+ // Nothing to do
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IElementStateListener#elementDeleted(java.lang.Object)
+ */
+ @Override
+ public void elementDeleted(Object element) {
+ listener.handleDocumentDeleted();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IElementStateListener#elementDirtyStateChanged(java.lang.Object, boolean)
+ */
+ @Override
+ public void elementDirtyStateChanged(Object element, boolean isDirty) {
+ if (!isDirty) {
+ this.listener.handleDocumentSaved();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IElementStateListener#elementMoved(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void elementMoved(Object originalElement, Object movedElement) {
+ // Nothing to do
+ }
+
+ /**
+ * Return whether the adapter has buffered contents. The adapter buffers
+ * contents by connecting to the document through the document provider.
+ * This means that the adapter must be disconnected either by saving or
+ * discarding the buffer.
+ *
+ * @return whether the adapter has buffered contents
+ */
+ public boolean hasBufferedContents() {
+ return bufferedKey != null;
+ }
+
+ /**
+ * Override getDocumentKey in the super class to provide an editor input
+ * when the element is a <code>LocalTypedElement</code>.
+ */
+ @Override
+ public IEditorInput getDocumentKey(Object element) {
+ if (element instanceof LocalTypedElement) {
+ LocalTypedElement localElement = (LocalTypedElement) element;
+ return localElement.getEditorInput();
+ }
+ return super.getDocumentKey(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java
new file mode 100644
index 000000000..d80d5c153
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java
@@ -0,0 +1,482 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.ICompareContainer;
+import org.eclipse.compare.IContentChangeListener;
+import org.eclipse.compare.IContentChangeNotifier;
+import org.eclipse.compare.ISharedDocumentAdapter;
+import org.eclipse.compare.SharedDocumentAdapter;
+import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheCommit;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.ISaveablesLifecycleListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartConstants;
+import org.eclipse.ui.Saveable;
+import org.eclipse.ui.SaveablesLifecycleEvent;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+
+/**
+ * A <code>LocalFileSaveable</code> is used as the saveable object that provides
+ * the save behavior for the merge editor input(<code>MergeEditorInput</code>).
+ */
+public class LocalFileSaveable extends Saveable implements
+ IPropertyChangeListener, ISharedDocumentAdapterListener,
+ IContentChangeListener {
+ // The property listener list.
+ private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
+
+ // The merge input that provides the left and the right compared elements.
+ private final MergeInput input;
+
+ // The input of the editor that provides the comparing view.
+ private final MergeEditorInput editorInput;
+
+ // If the current document of the file is being saved.
+ private boolean saving;
+
+ // The local file element.
+ private LocalTypedElement fileElement;
+
+ // The document provided by the local file.
+ private IDocument document;
+
+ // If the current document has been connected.
+ private boolean connected;
+
+ /**
+ * Create the file-based saveable comparison.
+ *
+ * @param input
+ * the compare input to be save
+ * @param editorInput
+ * the editor input containing the comparison
+ * @param fileElement
+ * the file element that handles the saving and change
+ * notification
+ */
+ public LocalFileSaveable(MergeInput input, MergeEditorInput editorInput, LocalTypedElement fileElement) {
+ Assert.isNotNull(input);
+
+ this.input = input;
+ this.editorInput = editorInput;
+ this.fileElement = fileElement;
+ this.fileElement.addContentChangeListener(this);
+ this.fileElement.setDocumentListener(this);
+ }
+
+ /**
+ * Dispose of the saveable.
+ */
+ public void dispose() {
+ fileElement.removeContentChangeListener(this);
+ fileElement.discardBuffer();
+ fileElement.setDocumentListener(null);
+ }
+
+ /**
+ * Performs the save.
+ *
+ * @param monitor The progress monitor.
+ *
+ * @throws CoreException If the save operation fails.
+ */
+ protected void performSave(IProgressMonitor monitor) throws CoreException {
+ try {
+ saving = true;
+ monitor.beginTask(null, 100);
+ // First, we need to flush the viewers so the changes get buffered
+ // in the input
+ flushViewers(monitor);
+ // Then we tell the input to commit its changes
+ // Only the left is ever saveable
+ if (fileElement.isDirty()) {
+ if (fileElement.isConnected()) {
+ fileElement.store2Document(monitor);
+ } else {
+ fileElement.store2Cache(monitor);
+ }
+ }
+ } finally {
+ // Make sure we fire a change for the compare input to update the
+ // viewers
+ fireInputChange();
+ setDirty(false);
+ saving = false;
+ monitor.done();
+ //Trigger upload action
+ FSTreeNode node = fileElement.getFSTreeNode();
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_UploadingProgress);
+ executor.execute(new OpCacheCommit(new FSTreeNode[]{node}, true));
+ }
+ }
+
+ /**
+ * Flush the contents of any viewers into the compare input.
+ *
+ * @param monitor
+ * a progress monitor
+ * @throws CoreException
+ */
+ protected void flushViewers(IProgressMonitor monitor) throws CoreException {
+ editorInput.saveChanges(monitor);
+ }
+
+ /**
+ * Fire an input change for the compare input after it has been saved.
+ */
+ protected void fireInputChange() {
+ editorInput.getCompareResult().fireInputChanged();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#isDirty()
+ */
+ @Override
+ public boolean isDirty() {
+ return editorInput.isSaveNeeded();
+ }
+
+ /**
+ * Marks the editor input dirty.
+ *
+ * @param dirty <code>True</code> if the editor is dirty, <code>false</code> if not.
+ */
+ protected void setDirty(boolean dirty) {
+ if (isDirty() != dirty) {
+ editorInput.setDirty(dirty);
+ firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#getName()
+ */
+ @Override
+ public String getName() {
+ // Return the name of the file element as held in the compare input
+ if (fileElement.equals(input.getLeft())) {
+ return input.getLeft().getName();
+ }
+ if (fileElement.equals(input.getRight())) {
+ return input.getRight().getName();
+ }
+
+ // Fallback call returning name of the main non-null element of the input
+ //
+ // see org.eclipse.team.internal.ui.mapping.AbstractCompareInput#getMainElement()
+ return input.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return editorInput.getToolTipText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ Image image = input.getImage();
+ if (image != null)
+ return ImageDescriptor.createFromImage(image);
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ String propertyName = e.getProperty();
+ if (CompareEditorInput.DIRTY_STATE.equals(propertyName)) {
+ boolean changed = false;
+ Object newValue = e.getNewValue();
+ if (newValue instanceof Boolean)
+ changed = ((Boolean) newValue).booleanValue();
+
+ ContentMergeViewer cmv = (ContentMergeViewer) e.getSource();
+
+ if (fileElement.equals(input.getLeft())) {
+ if (changed && cmv.internalIsLeftDirty())
+ setDirty(changed);
+ else if (!changed && !cmv.internalIsLeftDirty()) {
+ setDirty(changed);
+ }
+ }
+ if (fileElement.equals(input.getRight())) {
+ if (changed && cmv.internalIsRightDirty())
+ setDirty(changed);
+ else if (!changed && !cmv.internalIsRightDirty()) {
+ setDirty(changed);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ if (document != null) {
+ return document.hashCode();
+ }
+ return input.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (!(obj instanceof Saveable))
+ return false;
+
+ if (document != null) {
+ Object otherDocument = ((Saveable) obj).getAdapter(IDocument.class);
+
+ if (otherDocument == null)
+ return false;
+
+ return document.equals(otherDocument);
+ }
+
+ if (obj instanceof LocalFileSaveable) {
+ LocalFileSaveable saveable = (LocalFileSaveable) obj;
+ return saveable.input.equals(input);
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.Saveable#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IDocument.class) {
+ if (document != null)
+ return document;
+ if (fileElement.isConnected()) {
+ ISharedDocumentAdapter sda = (ISharedDocumentAdapter) fileElement
+ .getAdapter(ISharedDocumentAdapter.class);
+ if (sda != null) {
+ IEditorInput input = sda.getDocumentKey(fileElement);
+ if (input != null) {
+ IDocumentProvider provider = SharedDocumentAdapter
+ .getDocumentProvider(input);
+ if (provider != null)
+ return provider.getDocument(input);
+ }
+ }
+ }
+ }
+ if (adapter == IEditorInput.class) {
+ return fileElement.getEditorInput();
+ }
+ return super.getAdapter(adapter);
+ }
+
+ /**
+ * Get an ISaveablesLifecycleListener from the specified workbench
+ * part.
+ * @param part The workbench part.
+ * @return The listener.
+ */
+ private ISaveablesLifecycleListener getSaveablesLifecycleListener(
+ IWorkbenchPart part) {
+ if (part instanceof ISaveablesLifecycleListener)
+ return (ISaveablesLifecycleListener) part;
+
+ Object adapted = part.getAdapter(ISaveablesLifecycleListener.class);
+ if (adapted instanceof ISaveablesLifecycleListener)
+ return (ISaveablesLifecycleListener) adapted;
+
+ adapted = Platform.getAdapterManager().loadAdapter(part,
+ ISaveablesLifecycleListener.class.getName());
+ if (adapted instanceof ISaveablesLifecycleListener)
+ return (ISaveablesLifecycleListener) adapted;
+
+ return (ISaveablesLifecycleListener) part.getSite().getService(
+ ISaveablesLifecycleListener.class);
+ }
+
+ /**
+ * When the document of the local file is connected, register this saveable.
+ */
+ private void registerSaveable() {
+ ICompareContainer container = editorInput.getContainer();
+ IWorkbenchPart part = container.getWorkbenchPart();
+ if (part != null) {
+ ISaveablesLifecycleListener lifecycleListener = getSaveablesLifecycleListener(part);
+ // Remove this saveable from the lifecycle listener
+ lifecycleListener.handleLifecycleEvent(new SaveablesLifecycleEvent(
+ part, SaveablesLifecycleEvent.POST_CLOSE,
+ new Saveable[] { this }, false));
+ // Now fix the hashing so it uses the fConnected fDocument
+ IDocument document = (IDocument) getAdapter(IDocument.class);
+ if (document != null) {
+ this.document = document;
+ }
+ // Finally, add this saveable back to the listener
+ lifecycleListener.handleLifecycleEvent(new SaveablesLifecycleEvent(
+ part, SaveablesLifecycleEvent.POST_OPEN,
+ new Saveable[] { this }, false));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener#handleDocumentConnected()
+ */
+ @Override
+ public void handleDocumentConnected() {
+ if (connected)
+ return;
+ connected = true;
+ registerSaveable();
+ fileElement.setDocumentListener(null);
+ }
+
+ @Override
+ public void handleDocumentDeleted() {
+ // Ignore
+ }
+
+ @Override
+ public void handleDocumentDisconnected() {
+ // Ignore
+ }
+
+ @Override
+ public void handleDocumentFlushed() {
+ // Ignore
+ }
+
+ @Override
+ public void handleDocumentSaved() {
+ // Ignore
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.compare.IContentChangeListener#contentChanged(org.eclipse.compare.IContentChangeNotifier)
+ */
+ @Override
+ public void contentChanged(IContentChangeNotifier source) {
+ if (!saving) {
+ try {
+ performSave(new NullProgressMonitor());
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doSave(IProgressMonitor monitor) throws CoreException {
+ if (isDirty()) {
+ performSave(monitor);
+ setDirty(false);
+ }
+ }
+
+ /**
+ * Revert any changes in the buffer back to the last saved state.
+ *
+ * @param monitor
+ * a progress monitor on <code>null</code> if progress feedback
+ * is not required
+ */
+ public void doRevert(IProgressMonitor monitor) {
+ if (!isDirty())
+ return;
+ fileElement.discardBuffer();
+ setDirty(false);
+ }
+
+ /**
+ * Add a property change listener. Adding a listener that is already
+ * registered has no effect.
+ *
+ * @param listener
+ * the listener
+ */
+ public void addPropertyListener(IPropertyListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Remove a property change listener. Removing a listener that is not
+ * registered has no effect.
+ *
+ * @param listener
+ * the listener
+ */
+ public void removePropertyListener(IPropertyListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Fire a property change event for this buffer.
+ *
+ * @param property
+ * the property that changed
+ */
+ protected void firePropertyChange(final int property) {
+ Object[] allListeners = listeners.getListeners();
+ for (int i = 0; i < allListeners.length; i++) {
+ final Object object = allListeners[i];
+ SafeRunner.run(new SafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ ((IPropertyListener) object).propertyChanged(
+ LocalFileSaveable.this, property);
+ }
+ });
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java
new file mode 100644
index 000000000..af6805e74
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+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 org.eclipse.compare.IEditableContent;
+import org.eclipse.compare.ISharedDocumentAdapter;
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+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.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+
+/**
+ * A <code>LocalTypedElement</code> extends <code>MergeTypedElement</code> and
+ * wraps an <code>FSTreeNode</code> so that it can be used as the left element
+ * of a <code>MergeEditorInput</code>. It implements the interface
+ * <code>IEditableContent</code> so that it is editable.
+ */
+public class LocalTypedElement extends MergeTypedElement implements
+ IEditableContent, IAdaptable, ISharedDocumentAdapterListener {
+ // If the current edited file is dirty.
+ private boolean dirty;
+ // The shared document adapter
+ private EditableSharedDocumentAdapter documentAdapter;
+ // The shared document listener.
+ private ISharedDocumentAdapterListener documentListener;
+
+ /**
+ * Creates a <code>LocalTypedElement</code> for the given resource.
+ *
+ * @param resource
+ * the resource
+ */
+ public LocalTypedElement(FSTreeNode node) {
+ super(node);
+ setContent(getContent());
+ dirty = false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == ISharedDocumentAdapter.class) {
+ if (documentAdapter == null)
+ documentAdapter = new EditableSharedDocumentAdapter(this);
+ return documentAdapter;
+ }
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.BufferedContent#setContent(byte[])
+ */
+ @Override
+ public void setContent(byte[] contents) {
+ dirty = true;
+ super.setContent(contents);
+ }
+
+ /**
+ * Set the document listener.
+ *
+ * @param documentListener
+ * the document listener.
+ */
+ public void setDocumentListener(
+ ISharedDocumentAdapterListener documentListener) {
+ this.documentListener = documentListener;
+ }
+
+ /**
+ * Return an input stream that opens that locally cached file to provide the
+ * content.
+ *
+ * @return a buffered input stream containing the contents of this file
+ * @exception CoreException
+ * if the contents of this storage could not be accessed
+ */
+ @Override
+ protected InputStream createStream() throws CoreException {
+ try {
+ IPath cachePath = CacheManager.getInstance().getCachePath(node);
+ File cacheFile = cachePath.toFile();
+ return new BufferedInputStream(new FileInputStream(cacheFile));
+ } catch (FileNotFoundException e) {
+ IStatus error = new Status(IStatus.ERROR,
+ UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e);
+ throw new CoreException(error);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.IEditableContent#isEditable()
+ */
+ @Override
+ public boolean isEditable() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.IEditableContent#replace(org.eclipse.compare.ITypedElement, org.eclipse.compare.ITypedElement)
+ */
+ @Override
+ public ITypedElement replace(ITypedElement dest, ITypedElement src) {
+ return dest;
+ }
+
+ /**
+ * Save the shared document for this element. The save can only be performed
+ * if the element is connected to a shared document. If the element is not
+ * connected, <code>false</code> is returned.
+ *
+ * @param overwrite
+ * indicates whether overwrite should be performed while saving
+ * the given element if necessary
+ * @param monitor
+ * a progress monitor
+ * @throws CoreException
+ */
+ public boolean store2Document(IProgressMonitor monitor)
+ throws CoreException {
+ if (isConnected()) {
+ IEditorInput input = documentAdapter.getDocumentKey(this);
+ documentAdapter.saveDocument(input, monitor);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Judges whether the content has been changed.
+ *
+ * @return
+ */
+ public boolean isDirty() {
+ return dirty
+ || (documentAdapter != null && documentAdapter
+ .hasBufferedContents());
+ }
+
+ /**
+ * Set the dirty state.
+ *
+ * @param dirty
+ * The dirty state.
+ */
+ public void setDirty(boolean dirty) {
+ this.dirty = dirty;
+ }
+
+ /**
+ * If the document adapter has been connected.
+ *
+ * @return true if it is not null and connected.
+ */
+ public boolean isConnected() {
+ return documentAdapter != null && documentAdapter.isConnected();
+ }
+
+ /**
+ * Return the path to the local file of this node. It is used to compute its
+ * hash code and as the title of the comparison editor.
+ */
+ @Override
+ public String toString() {
+ File cacheFile = CacheManager.getInstance().getCacheFile(node);
+ return cacheFile.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener#handleDocumentConnected()
+ */
+ @Override
+ public void handleDocumentConnected() {
+ if (documentListener != null)
+ documentListener.handleDocumentConnected();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener#handleDocumentDeleted()
+ */
+ @Override
+ public void handleDocumentDeleted() {
+ if (documentListener != null)
+ documentListener.handleDocumentDeleted();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener#handleDocumentDisconnected()
+ */
+ @Override
+ public void handleDocumentDisconnected() {
+ if (documentListener != null)
+ documentListener.handleDocumentDisconnected();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener#handleDocumentFlushed()
+ */
+ @Override
+ public void handleDocumentFlushed() {
+ fireContentChanged();
+ if (documentListener != null)
+ documentListener.handleDocumentFlushed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.compare.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener#handleDocumentSaved()
+ */
+ @Override
+ public void handleDocumentSaved() {
+ if (documentListener != null)
+ documentListener.handleDocumentSaved();
+ }
+
+ /**
+ * Get an editor input for this file.
+ *
+ * @return The editor input.
+ */
+ public IEditorInput getEditorInput() {
+ IPath path = CacheManager.getInstance().getCachePath(node);
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(path);
+ return new FileStoreEditorInput(fileStore);
+ }
+
+ /**
+ * Save to its local file when the document has not been connected yet.
+ *
+ * @param monitor
+ * The monitor that reports the progress.
+ */
+ public void store2Cache(IProgressMonitor monitor) throws CoreException {
+ File cacheFile = CacheManager.getInstance().getCacheFile(node);
+ monitor.beginTask(Messages.LocalTypedElement_SavingFile + cacheFile.getName(), 100);
+ InputStream is = getContents();
+ BufferedOutputStream bos = null;
+ try {
+ long total = cacheFile.length();
+ bos = new BufferedOutputStream(new FileOutputStream(cacheFile));
+ byte[] data = new byte[10 * 1024];
+ int length;
+ long current = 0;
+ int currProgress = 0;
+ while ((length = is.read(data)) > 0) {
+ bos.write(data, 0, length);
+ bos.flush();
+ current += length;
+ int progress = (int) (current * 100 / total);
+ if (currProgress != progress) {
+ monitor.worked(progress - currProgress);
+ currProgress = progress;
+ }
+ }
+ setDirty(false);
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR,
+ UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e));
+ } finally {
+ if (is != null)
+ try {
+ is.close();
+ } catch (IOException ex) {
+ }
+ if (bos != null) {
+ try {
+ bos.close();
+ } catch (Exception e) {
+ }
+ }
+ // Notify the local file element that the document has changed.
+ fireContentChanged();
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java
new file mode 100644
index 000000000..cb2ce82d9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java
@@ -0,0 +1,419 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.IPropertyChangeNotifier;
+import org.eclipse.compare.structuremergeviewer.Differencer;
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.osgi.util.TextProcessor;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.ISaveablesSource;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.Saveable;
+/**
+ * A <code>MergeEditorInput</code> is the input of a compare editor used to
+ * compare the local file and the remote file in a Target Explorer file system.
+ */
+public class MergeEditorInput extends CompareEditorInput implements
+ ISaveablesSource, IPropertyListener, ICompareInputChangeListener {
+
+ // The left element is a local file which can be editable.
+ private LocalTypedElement left;
+ // The right element is the remote file which is read only.
+ private RemoteTypedElement right;
+
+ // The active page of the current workbench.
+ private final IWorkbenchPage page;
+
+ // The current input change listener list.
+ private final ListenerList inputChangeListeners = new ListenerList(ListenerList.IDENTITY);
+ // The current saveable for the left element, i.e., the local file.
+ private LocalFileSaveable saveable;
+
+ /**
+ * Creates a new MergeEditorInput.
+ *
+ * @param left
+ * @param right
+ * @param page
+ */
+ public MergeEditorInput(LocalTypedElement left, RemoteTypedElement right, IWorkbenchPage page) {
+ super(new CompareConfiguration());
+ this.page = page;
+ this.left = left;
+ this.right = right;
+ configureCompare();
+ }
+
+ /**
+ * Configure the compare configuration using the left
+ * and right elements. Set the left and right label.
+ * Set the editable status.
+ */
+ protected void configureCompare() {
+ CompareConfiguration cc = getCompareConfiguration();
+ cc.setLeftEditable(true);
+ cc.setRightEditable(false);
+
+ String name = TextProcessor.process(left.getName());
+ String label = NLS.bind(Messages.MergeEditorInput_LocalFile, name);
+ cc.setLeftLabel(label);
+
+ name = TextProcessor.process(right.toString());
+ label = NLS.bind(Messages.MergeEditorInput_RemoteFile, name);
+ cc.setRightLabel(label);
+ }
+
+ /**
+ * Returns <code>true</code> if the other object is of type
+ * <code>MergeEditorInput</code> and both of their corresponding fLeft and
+ * fRight objects are identical. The content is not considered.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj instanceof MergeEditorInput) {
+ MergeEditorInput other = (MergeEditorInput) obj;
+ return other.left.equals(left) && other.right.equals(right);
+ }
+ return false;
+ }
+
+ /**
+ * Override hashCode to provide identical value when
+ * two MergeEditorInputs are equal to each other.
+ */
+ @Override
+ public int hashCode() {
+ return left.hashCode() + right.hashCode();
+ }
+
+ /**
+ * Prepare the compare input of this editor input. This method is not
+ * intended to be overridden of extended by subclasses (but is not final for
+ * backwards compatibility reasons). The implementation of this method in
+ * this class delegates the creation of the compare input to the
+ * {@link #prepareCompareInput(IProgressMonitor)} method which subclasses
+ * must implement.
+ *
+ * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected Object prepareInput(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ right.cacheContents(monitor);
+ MergeInput input = new MergeInput(left, right);
+ setTitle(input.getName());
+ return input;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return NLS.bind(Messages.MergeEditorInput_CompareLeftAndRight, left, right);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#getTitle()
+ */
+ @Override
+ public String getTitle() {
+ return NLS.bind(Messages.MergeEditorInput_CompareWithLocalCache, left.getName());
+ }
+
+ /**
+ * Override the super method to provide clear typed input.
+ */
+ @Override
+ public MergeInput getCompareResult() {
+ return (MergeInput) super.getCompareResult();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#handleDispose()
+ */
+ @Override
+ protected void handleDispose() {
+ super.handleDispose();
+ ICompareInput compareInput = getCompareResult();
+ if (compareInput != null)
+ compareInput.removeCompareInputChangeListener(this);
+ if(getCompareResult()!=null){
+ getSaveable().removePropertyListener(this);
+ getSaveable().dispose();
+ }
+ left.discardBuffer();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#contentsCreated()
+ */
+ @Override
+ protected void contentsCreated() {
+ super.contentsCreated();
+ if (getCompareResult() != null) {
+ getCompareResult().addCompareInputChangeListener(this);
+ getSaveable().addPropertyListener(this);
+ setDirty(getSaveable().isDirty());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object, int)
+ */
+ @Override
+ public void propertyChanged(Object source, int propId) {
+ if (propId == IWorkbenchPartConstants.PROP_DIRTY && getCompareResult()!=null) {
+ setDirty(getSaveable().isDirty());
+ }
+ }
+
+ /**
+ * Close the editor if it is not dirty. If it is still dirty, let the
+ * content merge viewer handle the compare input change.
+ *
+ * @param checkForUnsavedChanges
+ * whether to check for unsaved changes
+ * @return <code>true</code> if the editor was closed (note that the close
+ * may be asynchronous)
+ */
+ protected boolean closeEditor(boolean checkForUnsavedChanges) {
+ if (isSaveNeeded() && checkForUnsavedChanges) {
+ return false;
+ }
+ final IWorkbenchPage page = getPage();
+ if (page == null)
+ return false;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Shell shell = page.getWorkbenchWindow().getShell();
+ if (shell == null)
+ return;
+
+ IEditorPart part = page.findEditor(MergeEditorInput.this);
+ getPage().closeEditor(part, false);
+ }
+ };
+ if (Display.getCurrent() != null) {
+ runnable.run();
+ } else {
+ Shell shell = page.getWorkbenchWindow().getShell();
+ if (shell == null)
+ return false;
+ Display display = shell.getDisplay();
+ display.asyncExec(runnable);
+ }
+ return true;
+ }
+
+ /**
+ * Get the current active page.
+ * @return the workbench page.
+ */
+ IWorkbenchPage getPage() {
+ if (page == null)
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return page;
+ }
+
+ /**
+ * Propagate the input change event to the compare input change listener list.
+ */
+ /* default */void propogateInputChange() {
+ if (!inputChangeListeners.isEmpty()) {
+ Object[] allListeners = inputChangeListeners.getListeners();
+ for (int i = 0; i < allListeners.length; i++) {
+ final ICompareInputChangeListener listener = (ICompareInputChangeListener) allListeners[i];
+ SafeRunner.run(new SafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ listener.compareInputChanged(getCompareResult());
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Get the fSaveable that provides the save behavior for this compare editor
+ * input. The {@link #createSaveable()} is called to create the fSaveable if
+ * it does not yet exist. This method cannot be called until after the input
+ * is prepared (i.e. until after the {@link #run(IProgressMonitor)} method
+ * is called which will in turn will invoke
+ * {@link #prepareCompareInput(IProgressMonitor)}.
+ *
+ * @return fSaveable that provides the save behavior for this compare editor
+ * input.
+ */
+ public LocalFileSaveable getSaveable() {
+ if (saveable == null) {
+ Assert.isNotNull(getCompareResult());
+ saveable = new LocalFileSaveable(getCompareResult(), this, left);
+ }
+ return saveable;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablesSource#getActiveSaveables()
+ */
+ @Override
+ public Saveable[] getActiveSaveables() {
+ if (getCompareResult() == null)
+ return new Saveable[0];
+ return new Saveable[] { getSaveable() };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablesSource#getSaveables()
+ */
+ @Override
+ public Saveable[] getSaveables() {
+ return getActiveSaveables();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#addCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
+ */
+ @Override
+ public void addCompareInputChangeListener(ICompareInput input,
+ ICompareInputChangeListener listener) {
+ if (input == getCompareResult()) {
+ inputChangeListeners.add(listener);
+ } else {
+ super.addCompareInputChangeListener(input, listener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#removeCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
+ */
+ @Override
+ public void removeCompareInputChangeListener(ICompareInput input,
+ ICompareInputChangeListener listener) {
+ if (input == getCompareResult()) {
+ inputChangeListeners.remove(listener);
+ } else {
+ super.removeCompareInputChangeListener(input, listener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#getTitleImage()
+ */
+ @Override
+ public Image getTitleImage() {
+ return UIPlugin.getImage(ImageConsts.COMPARE_EDITOR);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return UIPlugin.getImageDescriptor(ImageConsts.COMPARE_EDITOR);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#findContentViewer(org.eclipse.jface.viewers.Viewer, org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public Viewer findContentViewer(Viewer oldViewer, ICompareInput input,
+ Composite parent) {
+ Viewer newViewer = super.findContentViewer(oldViewer, input, parent);
+ boolean isNewViewer = newViewer != oldViewer;
+ if (isNewViewer && newViewer instanceof IPropertyChangeNotifier && getCompareResult()!=null) {
+ // Register the model for change events if appropriate
+ final IPropertyChangeNotifier dsp = (IPropertyChangeNotifier) newViewer;
+ dsp.addPropertyChangeListener(getSaveable());
+ Control c = newViewer.getControl();
+ c.addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ dsp.removePropertyChangeListener(getSaveable());
+ }
+ });
+ }
+ return newViewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#canRunAsJob()
+ */
+ @Override
+ public boolean canRunAsJob() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#isDirty()
+ */
+ @Override
+ public boolean isDirty() {
+ if (saveable != null)
+ return saveable.isDirty();
+ return super.isDirty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener#compareInputChanged(org.eclipse.compare.structuremergeviewer.ICompareInput)
+ */
+ @Override
+ public void compareInputChanged(ICompareInput source) {
+ if (source == getCompareResult()) {
+ boolean closed = false;
+ if (source.getKind() == Differencer.NO_CHANGE) {
+ closed = closeEditor(true);
+ }
+ if (!closed) {
+ // The editor was closed either because the compare
+ // input still has changes or because the editor input
+ // is dirty. In either case, fire the changes
+ // to the registered listeners
+ propogateInputChange();
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java
new file mode 100644
index 000000000..47e2942be
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.structuremergeviewer.Differencer;
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * An abstract compare input whose purpose is to support change notification
+ * through a {@link CompareInputChangeNotifier}.
+ */
+public class MergeInput implements ICompareInput {
+
+ // The left element.
+ private ITypedElement left;
+ // The right element.
+ private ITypedElement right;
+ // The compare input change listener list.
+ private final ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
+
+ /**
+ * Create a <code>MergeInput</code>.
+ * @param left the left element.
+ * @param right the right element.
+ */
+ public MergeInput(ITypedElement left, ITypedElement right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#addCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
+ */
+ @Override
+ public void addCompareInputChangeListener(ICompareInputChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#removeCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
+ */
+ @Override
+ public void removeCompareInputChangeListener(ICompareInputChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Fire a compare input change event. This method must be called from the UI
+ * thread.
+ */
+ void fireInputChanged() {
+ if (!listeners.isEmpty()) {
+ Object[] _listeners = listeners.getListeners();
+ for (int i = 0; i < _listeners.length; i++) {
+ final ICompareInputChangeListener listener = (ICompareInputChangeListener) _listeners[i];
+ SafeRunner.run(new SafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ listener.compareInputChanged(MergeInput.this);
+ }
+ });
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#copy(boolean)
+ */
+ @Override
+ public void copy(boolean leftToRight) {
+ Assert.isTrue(false, Messages.MergeInput_CopyNotSupported);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#getAncestor()
+ */
+ @Override
+ public ITypedElement getAncestor() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#getImage()
+ */
+ @Override
+ public Image getImage() {
+ ITypedElement element = getMainElement();
+ return element == null ? null : element.getImage();
+ }
+
+ /**
+ * Return the main non-null element that identifies this input. By default,
+ * the fLeft is returned if non-null. If the fLeft is null, the fRight is
+ * returned. If both the fLeft and fRight are null the ancestor is returned.
+ *
+ * @return the main non-null element that identifies this input
+ */
+ private ITypedElement getMainElement() {
+ if (left != null)
+ return left;
+ if (right != null)
+ return right;
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#getKind()
+ */
+ @Override
+ public int getKind() {
+ return Differencer.CHANGE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#getLeft()
+ */
+ @Override
+ public ITypedElement getLeft() {
+ return left;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#getName()
+ */
+ @Override
+ public String getName() {
+ ITypedElement element = getMainElement();
+ return element == null ? null : element.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.structuremergeviewer.ICompareInput#getRight()
+ */
+ @Override
+ public ITypedElement getRight() {
+ return right;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java
new file mode 100644
index 000000000..9055be0c0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import org.eclipse.compare.BufferedContent;
+import org.eclipse.compare.CompareUI;
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * A <code>MergeTypedElement</code> wraps an <code>FSTreeNode</code> so that it
+ * can be used as input for the differencing engine (<code>ITypedElement</code>).
+ */
+public abstract class MergeTypedElement extends BufferedContent implements ITypedElement {
+ // The File System tree node to be wrapped.
+ protected FSTreeNode node;
+
+ /**
+ * Create a MergeTypedElement for the given node.
+ *
+ * @param node
+ * The node.
+ */
+ public MergeTypedElement(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.ITypedElement#getImage()
+ */
+ @Override
+ public Image getImage() {
+ return CompareUI.getImage(getType());
+ }
+
+ /**
+ * Return the tree node wrapped.
+ *
+ * @return The tree node of the file
+ */
+ public FSTreeNode getFSTreeNode() {
+ return node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.ITypedElement#getType()
+ */
+ @Override
+ public String getType() {
+ if (node != null) {
+ if (node.isDirectory()) {
+ return ITypedElement.FOLDER_TYPE;
+ }
+ String s = node.name;
+ int dot = s.lastIndexOf('.');
+ if (dot != -1) s = s.substring(dot + 1);
+ if (s != null) return s;
+ }
+ return ITypedElement.UNKNOWN_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof ITypedElement) {
+ return toString().equals(other.toString());
+ }
+ return super.equals(other);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.ITypedElement#getName()
+ */
+ @Override
+ public String getName() {
+ return node.name;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ *
+ * Returns the hash code of the name.
+ */
+ @Override
+ public int hashCode() {
+ return toString().hashCode();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java
new file mode 100644
index 000000000..7036a1133
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+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.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpOutStreamOp;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * A <code>RemoteTypedElement</code> wraps an <code>FSTreeNode</code> so that it
+ * can be used as input for the differencing engine (<code>ITypedElement</code>)
+ * as the right element of the comparison editor.
+ *
+ * @since 3.7
+ */
+public class RemoteTypedElement extends MergeTypedElement {
+ /**
+ * Creates a <code>RemoteTypedElement</code> for the given node.
+ *
+ * @param node
+ * the tree node.
+ */
+ public RemoteTypedElement(FSTreeNode node) {
+ super(node);
+ }
+
+ /**
+ * Return an input stream that opens that remote file to provide the stream
+ * content.
+ *
+ * @return a buffered input stream containing the contents of this file
+ * @exception CoreException
+ * if the contents of this storage could not be accessed
+ */
+ @Override
+ protected InputStream createStream() throws CoreException {
+ try {
+ return node.getLocationURL().openStream();
+ } catch (IOException e) {
+ Status error = new Status(IStatus.ERROR,
+ UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e);
+ throw new CoreException(error);
+ }
+ }
+
+ /**
+ * Download the remote file and save the content so that it is cached for
+ * getContents call.
+ *
+ * @param monitor
+ * The monitor used to display downloading progress.
+ * @throws InvocationTargetException
+ * throws when an exception occurs during downloading.
+ */
+ public void cacheContents(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(NLS.bind(Messages.CacheManager_DowloadingFile, node.name), 100);
+ OutputStream output = null;
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ output = new BufferedOutputStream(baos);
+ monitor.beginTask(Messages.RemoteTypedElement_GettingRemoteContent + node.name, 100);
+ IOperation operation = new OpOutStreamOp(node, output);
+ operation.run(monitor);
+ if (!monitor.isCanceled()) {
+ setContent(baos.toByteArray());
+ }
+ }
+
+ /**
+ * Return the external form of the URL to the remote file of this node. It
+ * is used to compute its hash code and as the title of the comparison
+ * editor.
+ */
+ @Override
+ public String toString() {
+ return node.getLocationURI().toString();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java
new file mode 100644
index 000000000..e10952b86
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.decorators;
+
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
+/**
+ * The label decorator to decorate the FSTreeNodes that are cut or hidden.
+ */
+public class PhantomDecorator extends LabelProvider implements ILabelDecorator {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
+ */
+ @Override
+ public Image decorateImage(Image image, Object element) {
+ if (element instanceof FSTreeNode && image != null) {
+ // Create the cut image for the image to be decorated.
+ AbstractImageDescriptor descriptor = new PhantomImageDescriptor(image);
+ return UIPlugin.getSharedImage(descriptor);
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public String decorateText(String text, Object element) {
+ // Do not decorate its label.
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java
new file mode 100644
index 000000000..58cc90889
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.decorators;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
+
+/**
+ * The descriptor for a phantom-like image.
+ */
+public class PhantomImageDescriptor extends AbstractImageDescriptor {
+ // The alpha data when highlight the base image.
+ private static final int HIGHLIGHT_ALPHA = 127;
+ // The key to store the cut mask image.
+ private static final String ID_FS_NODE_CUT_MASK = "FS_NODE_CUT_MASK@"; //$NON-NLS-1$
+ // The key to store the cut decoration image.
+ private static final String ID_FS_NODE_CUT = "FS_NODE_CUT@"; //$NON-NLS-1$
+ // the base image to decorate with overlays
+ private Image baseImage;
+
+ /**
+ * Constructor.
+ */
+ public PhantomImageDescriptor(final Image baseImage) {
+ super(UIPlugin.getDefault().getImageRegistry());
+ this.baseImage = baseImage;
+ // build up the key for the image registry
+ String key = ID_FS_NODE_CUT + baseImage.hashCode();
+ setDecriptorKey(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, int)
+ */
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawCentered(baseImage, width, height);
+ drawCentered(getMaskImage(), width, height);
+ }
+
+ /**
+ * Get the mask image of the base image. The mask image is an image which
+ * has the data of the decorator image and the transparent mask of the
+ * base image. The decorator image (the key of which is CUT_DECORATOR_IMAGE)
+ * is a translucent white board, which will be drawn over the base image and
+ * make the base image sightly lighter. Try to the cut a file in a file explorer
+ * on Windows host, you'll see its icon is changed to a lighter version. The
+ * mask image created by this method will be drawn over the base image and
+ * generate the similar effect.
+ *
+ * @return The mask image used to decorate the base image.
+ */
+ private Image getMaskImage() {
+ String maskKey = ID_FS_NODE_CUT_MASK + baseImage.hashCode();
+ Image maskImage = UIPlugin.getImage(maskKey);
+ if (maskImage == null) {
+ ImageData baseData = baseImage.getImageData();
+ PaletteData palette = new PaletteData(new RGB[]{new RGB(255, 255, 255), new RGB(0,0,0)});
+ ImageData imageData = new ImageData(baseData.width, baseData.height, 1, palette);
+ // Get the base image's transparency mask.
+ imageData.alphaData = createAlphaData();
+ maskImage = new Image(baseImage.getDevice(), imageData);
+ UIPlugin.getDefault().getImageRegistry().put(maskKey, maskImage);
+ }
+ return maskImage;
+ }
+
+ /**
+ * Create the alpha data that will be used in the mask image data.
+ *
+ * @return The alpha data.
+ */
+ private byte[] createAlphaData() {
+ ImageData imageData = baseImage.getImageData();
+ if (imageData.maskData != null) {
+ if (imageData.depth == 32) {
+ return maskAlpha32();
+ }
+ return maskAlpha();
+ }
+ return nonMaskAlpha();
+ }
+
+ /**
+ * Create the alpha data for the base image that has no mask data.
+ *
+ * @return The alpha data.
+ */
+ private byte[] nonMaskAlpha() {
+ ImageData imageData = baseImage.getImageData();
+ Assert.isTrue(imageData.maskData == null);
+
+ byte[] alphaData = new byte[imageData.width * imageData.height];
+ int i = 0;
+ for (int y = 0; y < imageData.height; y++) {
+ for (int x = 0; x < imageData.width; x++) {
+ int pixel = imageData.getPixel(x, y);
+ int alpha = 255;
+ if (imageData.transparentPixel != -1 && imageData.transparentPixel == pixel) {
+ // If it has a transparent pixel and the current pixel is the transparent.
+ alpha = 0;
+ }
+ else if (imageData.alpha != -1) {
+ // If it has a global alpha value.
+ alpha = imageData.alpha;
+ }
+ else if (imageData.alphaData != null) {
+ // If it has alpha data.
+ alpha = imageData.getAlpha(x, y);
+ }
+ alphaData[i++] = (byte) (alpha * HIGHLIGHT_ALPHA / 255);
+ }
+ }
+ return alphaData;
+ }
+
+ /**
+ * Create the alpha data for the base image that has mask data, and the color depth is not of
+ * 32-bit.
+ *
+ * @return The alpha data
+ */
+ private byte[] maskAlpha() {
+ ImageData imageData = baseImage.getImageData();
+ Assert.isTrue(imageData.maskData != null && imageData.depth != 32);
+
+ ImageData mask = imageData.getTransparencyMask();
+ // Get the black index.
+ int blackIndex = getBlackIndex(mask);
+ byte[] alphaData = new byte[imageData.width * imageData.height];
+ int i = 0;
+ for (int y = 0; y < imageData.height; y++) {
+ for (int x = 0; x < imageData.width; x++) {
+ int alpha = mask.getPixel(x, y) == blackIndex ? 0 : 255;
+ alphaData[i++] = (byte) (alpha * HIGHLIGHT_ALPHA / 255);
+ }
+ }
+ return alphaData;
+ }
+
+ /**
+ * Create the alpha data for the base image that has mask data and the color depth is of 32-bit.
+ *
+ * @return The alpha data.
+ */
+ private byte[] maskAlpha32() {
+ ImageData imageData = baseImage.getImageData();
+ Assert.isTrue(imageData.maskData != null && imageData.depth == 32);
+
+ ImageData mask = imageData.getTransparencyMask();
+ // Get the black index.
+ int blackIndex = getBlackIndex(mask);
+ // Calculate the alpha mask and the alpha shift.
+ int alphaMask = ~(imageData.palette.redMask | imageData.palette.greenMask | imageData.palette.blueMask);
+ int alphaShift = 0;
+ while (alphaMask != 0 && ((alphaMask >>> alphaShift) & 1) == 0)
+ alphaShift++;
+ byte[] alphaData = new byte[imageData.width * imageData.height];
+ int i = 0;
+ for (int y = 0; y < imageData.height; y++) {
+ for (int x = 0; x < imageData.width; x++) {
+ int pixel = imageData.getPixel(x, y);
+ int alpha = (pixel & alphaMask) >>> alphaShift;
+ if (alpha <= 0 || alpha > 255) {
+ // If the alpha value is illegal, try to get it from the mask data.
+ alpha = mask.getPixel(x, y) == blackIndex ? 0 : 255;
+ }
+ alphaData[i++] = (byte) (alpha * HIGHLIGHT_ALPHA / 255);
+ }
+ }
+ return alphaData;
+ }
+
+ /**
+ * Get the black index from the palette of the mask data.
+ *
+ * @param mask
+ * @return
+ */
+ private int getBlackIndex(ImageData mask) {
+ RGB[] rgbs = mask.getRGBs();
+ if (rgbs != null) {
+ for (int i = 0; i < rgbs.length; i++) {
+ RGB rgb = rgbs[i];
+ if (rgb.red == 0 && rgb.green == 0 && rgb.blue == 0) {
+ return i;
+ }
+ }
+ }
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize()
+ */
+ @Override
+ protected Point getSize() {
+ return new Point(baseImage.getImageData().width, baseImage.getImageData().height);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ide.util.ui.AbstractImageDescriptor#getBaseImage()
+ */
+ @Override
+ protected Image getBaseImage() {
+ return baseImage;
+ }
+} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
new file mode 100644
index 000000000..f72505a16
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
@@ -0,0 +1,360 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopy;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpMove;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MoveCopyCallback;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.PlatformUI;
+/**
+ * Common DnD operations shared by File Explorer and Target Explorer.
+ */
+public class CommonDnD implements IConfirmCallback {
+
+ /**
+ * If the current selection is draggable.
+ *
+ * @param selection The currently selected nodes.
+ * @return true if it is draggable.
+ */
+ public boolean isDraggable(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ return false;
+ }
+ Object[] objects = selection.toArray();
+ for (Object object : objects) {
+ if (!isDraggableObject(object)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * If the specified object is a draggable element.
+ *
+ * @param object The object to be dragged.
+ * @return true if it is draggable.
+ */
+ private boolean isDraggableObject(Object object) {
+ if (object instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) object;
+ return !node.isRoot() && (node.isWindowsNode() && !node.isReadOnly() || !node.isWindowsNode() && node.isWritable());
+ }
+ return false;
+ }
+
+ /**
+ * Perform the drop operation over dragged files to the specified target folder.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param files The files being dropped.
+ * @param operations the current dnd operations.
+ * @param target the target folder the files to be dropped to.
+ * @return true if the dropping is successful.
+ */
+ public boolean dropFiles(TreeViewer viewer, String[] files, int operations, FSTreeNode target) {
+ IOpExecutor executor = null;
+ if ((operations & DND.DROP_MOVE) != 0) {
+ String question;
+ if (files.length == 1) {
+ question = NLS.bind(Messages.FSDropTargetListener_MovingWarningSingle, files[0]);
+ }
+ else {
+ question = NLS.bind(Messages.FSDropTargetListener_MovingWarningMultiple, Integer.valueOf(files.length));
+ }
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ if (MessageDialog.openQuestion(parent, Messages.FSDropTargetListener_ConfirmMoveTitle, question)) {
+ ICallback callback = getMoveCallback(viewer, files, target);
+ executor = new UiExecutor(Messages.FSUpload_UploadTitle, callback);
+ }
+ }
+ else if ((operations & DND.DROP_COPY) != 0) {
+ ICallback callback = getCopyCallback(viewer, files, target);
+ executor = new UiExecutor(Messages.FSUpload_UploadTitle, callback);
+ }
+ if (executor != null) {
+ IStatus status = executor.execute(new OpUpload(files, target, this));
+ return status != null && status.isOK();
+ }
+ return false;
+ }
+
+ /**
+ * Get the callback that refresh and select the files being dragged when the dragging gesture is
+ * copying.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param files The files being dragged.
+ * @param target The target folder to drag the files to.
+ * @return callback that handles refreshing and selection.
+ */
+ private ICallback getCopyCallback(final TreeViewer viewer, final String[] files, final FSTreeNode target) {
+ return new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ IOpExecutor executor = new JobExecutor(NLS.bind(Messages.RefreshDirectoryHandler_RefreshJobTitle, target.name), getSelectionCallback(viewer, files, target));
+ executor.execute(new OpRefresh(target));
+ }
+ };
+ }
+
+ /**
+ * Get the callback that delete the dragged source files, refresh and select the files being
+ * dragged when the dragging gesture is moving.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param files The files being dragged.
+ * @param target The target folder to drag the files to.
+ * @return callback that handles deletion, refreshing and selection.
+ */
+ private ICallback getMoveCallback(final TreeViewer viewer, final String[] files, final FSTreeNode target) {
+ return new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ boolean successful = true;
+ if (status != null && status.isOK()) {
+ for (String path : files) {
+ File file = new File(path);
+ successful &= file.delete();
+ }
+ }
+ if (successful) {
+ FSTreeNode root = FSModel.getFSModel(target.peerNode).getRoot();
+ IOpExecutor executor = new JobExecutor(NLS.bind(Messages.RefreshDirectoryHandler_RefreshJobTitle, target.name), getSelectionCallback(viewer, files, target));
+ executor.execute(new OpRefresh(root));
+ }
+ }
+ };
+ }
+
+ /**
+ * Get the callback that refresh the files being dragged after moving or copying.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param paths The paths of the files being dragged.
+ * @param target The target folder to drag the files to.
+ * @return callback that handles refreshing and selection.
+ */
+ ICallback getSelectionCallback(final TreeViewer viewer, final String[] paths, final FSTreeNode target) {
+ return new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ List<FSTreeNode> nodes = new ArrayList<FSTreeNode>();
+ List<FSTreeNode> children = target.unsafeGetChildren();
+ for (String path : paths) {
+ File file = new File(path);
+ String name = file.getName();
+ for (FSTreeNode child : children) {
+ if (name.equals(child.name)) {
+ nodes.add(child);
+ break;
+ }
+ }
+ }
+ Assert.isNotNull(Display.getCurrent());
+ if (viewer != null) {
+ viewer.refresh(target);
+ IStructuredSelection selection = new StructuredSelection(nodes.toArray());
+ viewer.setSelection(selection, true);
+ }
+ }
+ };
+ }
+
+ /**
+ * Perform the drop operation over dragged selection.
+ *
+ * @param aTarget the target Object to be moved to.
+ * @param operations the current dnd operations.
+ * @param selection The local selection being dropped.
+ * @return true if the dropping is successful.
+ */
+ public boolean dropLocalSelection(FSTreeNode target, int operations, IStructuredSelection selection) {
+ List<FSTreeNode> nodes = selection.toList();
+ ICallback callback = new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ UIPlugin.getClipboard().clear();
+ }
+ };
+ IOperation operation = null;
+ IOpExecutor executor = null;
+ if ((operations & DND.DROP_MOVE) != 0) {
+ operation = new OpMove(nodes, target, new MoveCopyCallback());
+ executor = new UiExecutor(Messages.FSMove_MovingFile, callback);
+ }
+ else if ((operations & DND.DROP_COPY) != 0) {
+ FSTreeNode dest = getCopyDestination(target, nodes);
+ boolean cpPerm = UIPlugin.isCopyPermission();
+ boolean cpOwn = UIPlugin.isCopyOwnership();
+ operation = new OpCopy(nodes, dest, cpPerm, cpOwn, new MoveCopyCallback());
+ executor = new UiExecutor(Messages.FSCopy_CopyingFile, callback);
+ }
+ if (executor != null) {
+ IStatus status = executor.execute(operation);
+ return status != null && status.isOK();
+ }
+ return false;
+ }
+
+ /**
+ * Return an appropriate destination directory for copying according to the specified hovered
+ * node. If the hovered node is a file, then return its parent directory. If the hovered node is
+ * a directory, then return its self if it is not a node being copied. Return its parent
+ * directory if it is a node being copied.
+ *
+ * @param hovered
+ * @param nodes
+ * @return
+ */
+ private FSTreeNode getCopyDestination(FSTreeNode hovered, List<FSTreeNode> nodes) {
+ if (hovered.isFile()) {
+ return hovered.parent;
+ }
+ else if (hovered.isDirectory()) {
+ for (FSTreeNode node : nodes) {
+ if (node == hovered) {
+ return hovered.parent;
+ }
+ }
+ }
+ return hovered;
+ }
+
+ /**
+ * Validate dropping when the elements being dragged are files.
+ *
+ * @param target The target object.
+ * @param operation The DnD operation.
+ * @param transferType The transfered data type.
+ * @return true if it is valid for dropping.
+ */
+ public boolean validateFilesDrop(Object target, int operation, TransferData transferType) {
+ FileTransfer transfer = FileTransfer.getInstance();
+ String[] elements = (String[]) transfer.nativeToJava(transferType);
+ if (elements.length > 0) {
+ boolean moving = (operation & DND.DROP_MOVE) != 0;
+ boolean copying = (operation & DND.DROP_COPY) != 0;
+ FSTreeNode hovered = (FSTreeNode) target;
+ if (hovered.isFile() && copying) {
+ hovered = hovered.parent;
+ }
+ return hovered.isDirectory() && hovered.isWritable() && (moving || copying);
+ }
+ return false;
+ }
+
+ /**
+ * Validate dropping when the elements being dragged are local selection.
+ *
+ * @param target The target object.
+ * @param operation The DnD operation.
+ * @param transferType The transfered data type.
+ * @return true if it is valid for dropping.
+ */
+ public boolean validateLocalSelectionDrop(Object target, int operation, TransferData transferType) {
+ FSTreeNode hovered = (FSTreeNode) target;
+ LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
+ IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
+ List<FSTreeNode> nodes = selection.toList();
+ boolean moving = (operation & DND.DROP_MOVE) != 0;
+ boolean copying = (operation & DND.DROP_COPY) != 0;
+ if (hovered.isDirectory() && hovered.isWritable() && (moving || copying)) {
+ FSTreeNode head = nodes.get(0);
+ String hid = head.peerNode.getPeerId();
+ String tid = hovered.peerNode.getPeerId();
+ if (hid.equals(tid)) {
+ for (FSTreeNode node : nodes) {
+ if (moving && node == hovered || node.isAncestorOf(hovered)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ else if (hovered.isFile() && copying) {
+ hovered = hovered.parent;
+ return validateLocalSelectionDrop(hovered, operation, transferType);
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.interfaces.IConfirmCallback#requires(java.lang.Object)
+ */
+ @Override
+ public boolean requires(Object object) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.interfaces.IConfirmCallback#confirms(java.lang.Object)
+ */
+ @Override
+ public int confirms(Object object) {
+ final int[] results = new int[1];
+ final File file = (File) object;
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ String title = Messages.FSUpload_OverwriteTitle;
+ String message = NLS.bind(Messages.FSUpload_OverwriteConfirmation, file.getName());
+ final Image titleImage = UIPlugin.getImage(ImageConsts.DELETE_READONLY_CONFIRM);
+ MessageDialog qDialog = new MessageDialog(parent, title, null, message,
+ MessageDialog.QUESTION, new String[] {Messages.FSUpload_Yes,
+ Messages.FSUpload_YesToAll, Messages.FSUpload_No, Messages.FSUpload_Cancel}, 0) {
+ @Override
+ public Image getQuestionImage() {
+ return titleImage;
+ }
+ };
+ results[0] = qDialog.open();
+ }
+ });
+ return results[0];
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java
new file mode 100644
index 000000000..d066d77bc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
+
+/**
+ * The drag assistant used by Target Explorer to extend its DnD support to FSTreeNode elements.
+ */
+public class FSDragAdapterAssistant extends CommonDragAdapterAssistant {
+ // The common dnd operation
+ CommonDnD dnd;
+
+ /**
+ * Create an instance.
+ */
+ public FSDragAdapterAssistant() {
+ dnd = new CommonDnD();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#dragStart(org.eclipse.swt.dnd.DragSourceEvent, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ public void dragStart(DragSourceEvent anEvent, IStructuredSelection aSelection) {
+ anEvent.doit = dnd.isDraggable(aSelection);
+ LocalSelectionTransfer.getTransfer().setSelection(aSelection);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#getSupportedTransferTypes()
+ */
+ @Override
+ public Transfer[] getSupportedTransferTypes() {
+ return new Transfer[] {};
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#setDragData(org.eclipse.swt.dnd.DragSourceEvent, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ public boolean setDragData(DragSourceEvent anEvent, IStructuredSelection aSelection) {
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java
new file mode 100644
index 000000000..95de0e244
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+
+/**
+ * The drag source listener for the file tree of Target Explorer.
+ */
+public class FSDragSourceListener implements DragSourceListener {
+ // The tree viewer in which the DnD gesture happens.
+ private TreeViewer viewer;
+ // The common dnd operation
+ CommonDnD dnd;
+
+ /**
+ * Create an FSDragSourceListener using the specified tree viewer.
+ *
+ * @param viewer The file system tree viewer.
+ */
+ public FSDragSourceListener(TreeViewer viewer) {
+ this.viewer = viewer;
+ dnd = new CommonDnD();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ @Override
+ public void dragStart(DragSourceEvent event) {
+ IStructuredSelection aSelection = (IStructuredSelection) viewer.getSelection();
+ event.doit = dnd.isDraggable(aSelection);
+ LocalSelectionTransfer.getTransfer().setSelection(aSelection);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ @Override
+ public void dragSetData(DragSourceEvent event) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
+ event.data = LocalSelectionTransfer.getTransfer().getSelection();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ @Override
+ public void dragFinished(DragSourceEvent event) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java
new file mode 100644
index 000000000..6dc06e660
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
+import org.eclipse.ui.navigator.CommonNavigator;
+
+/**
+ * The drop assistant used by Target Explorer to extend its DnD support to FSTreeNode elements.
+ */
+public class FSDropAdapterAssistant extends CommonDropAdapterAssistant {
+ // The common dnd operation
+ CommonDnD dnd;
+
+ /**
+ * Create an instance.
+ */
+ public FSDropAdapterAssistant() {
+ dnd = new CommonDnD();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
+ */
+ @Override
+ public IStatus validateDrop(Object target, int operation, TransferData transferType) {
+ boolean valid = false;
+ if (target instanceof FSTreeNode) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ valid = dnd.validateLocalSelectionDrop(target, operation, transferType);
+ }
+ else if(FileTransfer.getInstance().isSupportedType(transferType)) {
+ valid = dnd.validateFilesDrop(target, operation, transferType);
+ }
+ }
+ return valid ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#isSupportedType(org.eclipse.swt.dnd.TransferData)
+ */
+ @Override
+ public boolean isSupportedType(TransferData aTransferType) {
+ if(FileTransfer.getInstance().isSupportedType(aTransferType))
+ return true;
+ return super.isSupportedType(aTransferType);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#handleDrop(org.eclipse.ui.navigator.CommonDropAdapter, org.eclipse.swt.dnd.DropTargetEvent, java.lang.Object)
+ */
+ @Override
+ public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) {
+ boolean sucess = false;
+ TransferData transferType = aDropTargetEvent.currentDataType;
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ IStructuredSelection selection = (IStructuredSelection) aDropTargetEvent.data;
+ int operations = aDropAdapter.getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) aTarget;
+ sucess = dnd.dropLocalSelection(target, operations, selection);
+ }
+ else if(FileTransfer.getInstance().isSupportedType(transferType)) {
+ String[] files = (String[]) aDropTargetEvent.data;
+ int operations = aDropAdapter.getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) aTarget;
+ sucess = dnd.dropFiles(getCommonViewer(), files, operations, target);
+ }
+ return sucess ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ }
+
+ /**
+ * Get the tree viewer of Target Explorer view.
+ *
+ * @return The tree viewer of Target Explorer view or null if the view is not found.
+ */
+ private TreeViewer getCommonViewer() {
+ Assert.isNotNull(Display.getCurrent());
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ Assert.isNotNull(window);
+ IViewReference[] references = window.getActivePage().getViewReferences();
+ for(IViewReference reference : references) {
+ if(reference.getId().equals(IUIConstants.ID_EXPLORER)) {
+ CommonNavigator navigator = (CommonNavigator) reference.getPart(true);
+ return navigator.getCommonViewer();
+ }
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java
new file mode 100644
index 000000000..cc6505905
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The drop target listener for the file tree of Target Explorer.
+ */
+public class FSDropTargetListener extends ViewerDropAdapter {
+ // The tree viewer that the drop listener attached to.
+ TreeViewer viewer;
+ // The common dnd operation
+ CommonDnD dnd;
+ /**
+ * Create FSDropTargetListener using the viewer.
+ *
+ * @param viewer The file system tree viewer.
+ */
+ public FSDropTargetListener(TreeViewer viewer) {
+ super(viewer);
+ this.viewer = viewer;
+ dnd = new CommonDnD();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
+ */
+ @Override
+ public void dragEnter(DropTargetEvent event) {
+ super.dragEnter(event);
+ // Force the operation of file transfer from external application to DROP_COPY
+ for (int i = 0; i < event.dataTypes.length; i++) {
+ if (FileTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
+ event.currentDataType = event.dataTypes[i];
+ event.detail = DND.DROP_COPY;
+ super.dragEnter(event);
+ break;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
+ */
+ @Override
+ public boolean validateDrop(Object target, int operation, TransferData transferType) {
+ if (target instanceof FSTreeNode) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ return dnd.validateLocalSelectionDrop(target, operation, transferType);
+ }
+ else if (FileTransfer.getInstance().isSupportedType(transferType)) {
+ return dnd.validateFilesDrop(target, operation, transferType);
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
+ */
+ @Override
+ public boolean performDrop(Object data) {
+ boolean success = false;
+ TransferData transferType = getCurrentEvent().currentDataType;
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ IStructuredSelection selection = (IStructuredSelection) data;
+ int operations = getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) getCurrentTarget();
+ success = dnd.dropLocalSelection(target, operations, selection);
+ }
+ else if(FileTransfer.getInstance().isSupportedType(transferType)) {
+ String[] files = (String[]) data;
+ int operations = getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) getCurrentTarget();
+ success = dnd.dropFiles(viewer, files, operations, target);
+ }
+ return success;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java
new file mode 100644
index 000000000..2772317c7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheCommit;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler that commits the content of a modified file to the target file system.
+ */
+public class CommitHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ FSTreeNode node = (FSTreeNode) selection.getFirstElement();
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_UploadingProgress);
+ executor.execute(new OpCacheCommit(new FSTreeNode[]{node}, true));
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java
new file mode 100644
index 000000000..1ee448cb9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpClipboard;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.ui.handlers.HandlerUtil;
+/**
+ * The handler that copies the selected files or folders to the clip board.
+ */
+public class CopyFilesHandler extends AbstractHandler {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ OpClipboard cb = UIPlugin.getClipboard();
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+ if (!selection.isEmpty()) {
+ List<FSTreeNode> nodes = selection.toList();
+ // Copy these files to the clip board.
+ cb.copyFiles(nodes);
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java
new file mode 100644
index 000000000..188da3742
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpClipboard;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler that cuts the selected files or folders to the clip board.
+ */
+public class CutFilesHandler extends AbstractHandler {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ OpClipboard cb = UIPlugin.getClipboard();
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+ if (!selection.isEmpty()) {
+ List<FSTreeNode> nodes = selection.toList();
+ // Cut these files to the clip board.
+ cb.cutFiles(nodes);
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java
new file mode 100644
index 000000000..f360598d3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.compare.CompareUI;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare.LocalTypedElement;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare.MergeEditorInput;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.compare.RemoteTypedElement;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used to merge a file which is conflicting with its remote file.
+ */
+public class MergeHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ FSTreeNode node = (FSTreeNode) selection.getFirstElement();
+ LocalTypedElement local = new LocalTypedElement(node);
+ RemoteTypedElement remote = new RemoteTypedElement(node);
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ MergeEditorInput input = new MergeEditorInput(local, remote, page);
+ CompareUI.openCompareDialog(input);
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java
new file mode 100644
index 000000000..fc314532a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.PlatformUI;
+
+public class MoveCopyCallback implements IConfirmCallback {
+
+ @Override
+ public boolean requires(Object object) {
+ return true;
+ }
+
+ @Override
+ public int confirms(Object object) {
+ final FSTreeNode node = (FSTreeNode) object;
+ final int[] results = new int[1];
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ String title = node.isDirectory() ? Messages.FSOperation_ConfirmFolderReplaceTitle : Messages.FSOperation_ConfirmFileReplace;
+ String message = NLS.bind(node.isDirectory() ? Messages.FSOperation_ConfirmFolderReplaceMessage : Messages.FSOperation_ConfirmFileReplaceMessage, node.name);
+ final Image titleImage = UIPlugin.getImage(ImageConsts.REPLACE_FOLDER_CONFIRM);
+ MessageDialog qDialog = new MessageDialog(parent, title, null, message, MessageDialog.QUESTION, new String[] { Messages.FSOperation_ConfirmDialogYes, Messages.FSOperation_ConfirmDialogYesToAll, Messages.FSOperation_ConfirmDialogNo, Messages.FSOperation_ConfirmDialogCancel }, 0) {
+ @Override
+ public Image getQuestionImage() {
+ return titleImage;
+ }
+ };
+ results[0] = qDialog.open();
+ }
+ });
+ return results[0];
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java
new file mode 100644
index 000000000..d8946ce29
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpMove;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.dialogs.FSFolderSelectionDialog;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.ui.handlers.HandlerUtil;
+/**
+ * The handler that moves the selected files or folders to a destination folder.
+ */
+public class MoveFilesHandler extends AbstractHandler {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell shell = HandlerUtil.getActiveShellChecked(event);
+ FSFolderSelectionDialog dialog = new FSFolderSelectionDialog(shell);
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+ List<FSTreeNode> nodes = selection.toList();
+ IPeerModel peer = nodes.get(0).peerNode;
+ dialog.setInput(peer);
+ dialog.setMovedNodes(nodes);
+ if (dialog.open() == Window.OK) {
+ Object obj = dialog.getFirstResult();
+ Assert.isTrue(obj instanceof FSTreeNode);
+ FSTreeNode dest = (FSTreeNode) obj;
+ IOpExecutor executor = new UiExecutor(Messages.FSMove_MovingFile, new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ UIPlugin.getClipboard().clear();
+ }
+ });
+ executor.execute(new OpMove(nodes, dest, new MoveCopyCallback()));
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java
new file mode 100644
index 000000000..4d6f5fa2a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards.NewFileWizard;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * The handler to create a new file node in the file system of Target Explorer.
+ */
+public class NewFileHandler extends NewNodeHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.handlers.NewNodeHandler#createWizard()
+ */
+ @Override
+ protected IWorkbenchWizard createWizard() {
+ return new NewFileWizard();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java
new file mode 100644
index 000000000..63dd3116e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards.NewFolderWizard;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * The handler to create a new folder node in the file system of Target Explorer.
+ */
+public class NewFolderHandler extends NewNodeHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.handlers.NewNodeHandler#createWizard()
+ */
+ @Override
+ protected IWorkbenchWizard createWizard() {
+ return new NewFolderWizard();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java
new file mode 100644
index 000000000..d14eb0a01
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The base handler to create a new file/folder node in the file system of Target Explorer.
+ */
+public abstract class NewNodeHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWizard wizard;
+ wizard = createWizard();
+ ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
+ if (selection instanceof IStructuredSelection) {
+ wizard.init(window.getWorkbench(), (IStructuredSelection) selection);
+ }
+ else {
+ wizard.init(window.getWorkbench(), StructuredSelection.EMPTY);
+ }
+ Shell parent = window.getShell();
+ WizardDialog dialog = new WizardDialog(parent, wizard);
+ dialog.create();
+ dialog.open();
+ return null;
+ }
+
+ /**
+ * Create a "New" wizard to for creating a file/folder.
+ *
+ * @return the wizard to be used for creating a file/folder.
+ */
+ protected abstract IWorkbenchWizard createWizard();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java
new file mode 100644
index 000000000..1cfee21b3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River)- [345387]Open the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheUpdate;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.ContentTypeHelper;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * The action handler to open a file on the remote file system.
+ */
+public class OpenFileHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ final FSTreeNode node = (FSTreeNode) selection.getFirstElement();
+ IWorkbenchPage page = HandlerUtil.getActiveSite(event).getPage();
+ if (ContentTypeHelper.getInstance().isBinaryFile(node)) {
+ // If the file is a binary file.
+ Shell parent = HandlerUtil.getActiveShell(event);
+ MessageDialog.openWarning(parent, Messages.OpenFileHandler_Warning,
+ Messages.OpenFileHandler_OpeningBinaryNotSupported);
+ } else {
+ // Open the file node.
+ openFile(node, page);
+ }
+ return null;
+ }
+
+ /**
+ * Open the file node in an editor of the specified workbench page. If the
+ * local cache file of the node is stale, then download it. Then open its
+ * local cache file.
+ *
+ * @param node
+ * The file node to be opened.
+ * @param page
+ * The workbench page in which the editor is opened.
+ */
+ private void openFile(FSTreeNode node, IWorkbenchPage page) {
+ File file = CacheManager.getInstance().getCacheFile(node);
+ if (!file.exists()) {
+ // If the file node's local cache does not exist yet, download it.
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_DowloadingFile);
+ IStatus status = executor.execute(new OpCacheUpdate(node));
+ if (!status.isOK()) {
+ return;
+ }
+ }
+ openEditor(page, node);
+ }
+
+ /**
+ * Open the editor to display the file node in the UI thread.
+ *
+ * @param page
+ * The workbench page in which the editor is opened.
+ * @param node
+ * The file node whose local cache file is opened.
+ */
+ private void openEditor(final IWorkbenchPage page, final FSTreeNode node) {
+ Display display = page.getWorkbenchWindow().getWorkbench().getDisplay();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ IPath path = CacheManager.getInstance().getCachePath(node);
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(path);
+ String editorID = PersistenceManager.getInstance().getPersistentProperties(node).get(IDE.EDITOR_KEY);
+ try {
+ if(editorID!=null){
+ FileStoreEditorInput input = new FileStoreEditorInput(fileStore);
+ page.openEditor(input, editorID, true, IWorkbenchPage.MATCH_INPUT|IWorkbenchPage.MATCH_ID);
+ }else{
+ IDE.openEditorOnFileStore(page, fileStore);
+ }
+ } catch (PartInitException e) {
+ }
+ }
+ });
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java
new file mode 100644
index 000000000..943bd3e78
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River) [360494]Provide an "Open With" action in the pop
+ * up menu of file system nodes of Target Explorer.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * The dynamic contribution of "Open With" submenu items.
+ */
+public class OpenWithContribution extends CompoundContributionItem implements IWorkbenchContribution {
+ // Service locator to located the handler service.
+ private IServiceLocator serviceLocator;
+
+ /**
+ * Create the contribution instance.
+ */
+ public OpenWithContribution() {
+ }
+
+ /**
+ * Create the contribution instance with the specified id.
+ */
+ public OpenWithContribution(String id) {
+ super(id);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator
+ * )
+ */
+ @Override
+ public void initialize(IServiceLocator serviceLocator) {
+ this.serviceLocator = serviceLocator;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+ */
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ // Get the selected node.
+ IHandlerService service = (IHandlerService) this.serviceLocator
+ .getService(IHandlerService.class);
+ IEvaluationContext state = service.getCurrentState();
+ ISelection selection = (ISelection) state
+ .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ IStructuredSelection iss = (IStructuredSelection) selection;
+ Object obj = iss.getFirstElement();
+ Assert.isTrue(obj instanceof FSTreeNode);
+ FSTreeNode node = (FSTreeNode) obj;
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return new IContributionItem[] { new OpenWithMenu(page, node) };
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java
new file mode 100644
index 000000000..1203f9052
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River) [360494]Provide an "Open With" action in the pop
+ * up menu of file system nodes of Target Explorer.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.io.File;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+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.tcf.te.tcf.filesystem.core.internal.operations.OpCacheUpdate;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.ContentTypeHelper;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorRegistry;
+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.FileStoreEditorInput;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * A menu for opening files in the target explorer.
+ * <p>
+ * An <code>OpenWithMenu</code> is used to populate a menu with "Open With" actions. One action is
+ * added for each editor which is applicable to the selected file. If the user selects one of these
+ * items, the corresponding editor is opened on the file.
+ * </p>
+ *
+ * @since 3.7 - Copied and modified based on org.eclipse.ui.actions.OpenWithMenu to avoid
+ * introducing org.eclipse.core.resources
+ */
+public class OpenWithMenu extends ContributionItem {
+ private static final String DEFAULT_TEXT_EDITOR = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
+
+ /**
+ * The id of this action.
+ */
+ public static final String ID = UIPlugin.getUniqueIdentifier() + ".OpenWithMenu";//$NON-NLS-1$
+
+ /*
+ * Compares the labels from two IEditorDescriptor objects
+ */
+ private static final Comparator<IEditorDescriptor> comparer = new Comparator<IEditorDescriptor>() {
+ private Collator collator = Collator.getInstance();
+
+ @Override
+ public int compare(IEditorDescriptor arg0, IEditorDescriptor arg1) {
+ String s1 = arg0.getLabel();
+ String s2 = arg1.getLabel();
+ return collator.compare(s1, s2);
+ }
+ };
+ // The selected tree node.
+ FSTreeNode node;
+ // The current workbench page.
+ IWorkbenchPage page;
+ // The editor registry.
+ IEditorRegistry registry;
+
+ /**
+ * Create an instance using the specified page and the specified FSTreeNode.
+ *
+ * @param page The page to open the editor.
+ * @param node The FSTreeNode to be opened.
+ */
+ public OpenWithMenu(IWorkbenchPage page, FSTreeNode node) {
+ super(ID);
+ this.node = node;
+ this.page = page;
+ this.registry = PlatformUI.getWorkbench().getEditorRegistry();
+ }
+
+ /**
+ * 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
+ */
+ private Image getImage(IEditorDescriptor editorDesc) {
+ ImageDescriptor imageDesc = getImageDescriptor(editorDesc);
+ if (imageDesc == null) {
+ return null;
+ }
+ return imageDesc.createImage();
+ }
+
+ /**
+ * 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(node.name);
+ // TODO: is this case valid, and if so, what are the implications for content-type
+ // editor bindings?
+ }
+ else {
+ imageDesc = editorDesc.getImageDescriptor();
+ }
+ if (imageDesc == null) {
+ if (editorDesc.getId().equals(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)) {
+ imageDesc = registry.getSystemExternalEditorImageDescriptor(node.name);
+ }
+ }
+ 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>
+ */
+ private void createMenuItem(Menu menu, final IEditorDescriptor descriptor, final IEditorDescriptor preferredEditor) {
+ 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() {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Selection:
+ if (menuItem.getSelection()) {
+ syncOpen(descriptor, false);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ };
+ menuItem.addListener(SWT.Selection, listener);
+ }
+
+ /**
+ * Creates the Other... menu item
+ *
+ * @param menu the menu to add the item to
+ */
+ @SuppressWarnings("unused")
+ private void createOtherMenuItem(final Menu menu) {
+ new MenuItem(menu, SWT.SEPARATOR);
+ final MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
+ menuItem.setText(Messages.OpenWithMenu_OpenWith);
+ Listener listener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Selection:
+ EditorSelectionDialog dialog = new EditorSelectionDialog(menu.getShell());
+ dialog.setMessage(NLS
+ .bind(Messages.OpenWithMenu_ChooseEditorForOpening, node.name));
+ if (dialog.open() == Window.OK) {
+ IEditorDescriptor editor = dialog.getSelectedEditor();
+ if (editor != null) {
+ syncOpen(editor, editor.isOpenExternal());
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ };
+ menuItem.addListener(SWT.Selection, listener);
+ }
+
+ /**
+ * Get the default editor for this FSTreeNode.
+ *
+ * @return The descriptor of the default editor.
+ */
+ private IEditorDescriptor getDefaultEditor() {
+ // Try file specific editor.
+ try {
+ String editorID = PersistenceManager.getInstance().getPersistentProperties(node)
+ .get(IDE.EDITOR_KEY);
+ if (editorID != null) {
+ IEditorDescriptor desc = registry.findEditor(editorID);
+ if (desc != null) {
+ return desc;
+ }
+ }
+ }
+ catch (Exception e) {
+ // do nothing
+ }
+
+ IContentType contentType = null;
+ contentType = ContentTypeHelper.getInstance().getContentType(node);
+ // Try lookup with filename
+ return registry.getDefaultEditor(node.name, contentType);
+ }
+
+ /*
+ * (non-Javadoc) Fills the menu with perspective items.
+ */
+ @SuppressWarnings("unused")
+ @Override
+ public void fill(Menu menu, int index) {
+
+ IEditorDescriptor defaultEditor = registry.findEditor(DEFAULT_TEXT_EDITOR);
+ IEditorDescriptor preferredEditor = getDefaultEditor();
+
+ IEditorDescriptor[] editors = registry.getEditors(node.name, ContentTypeHelper
+ .getInstance().getContentType(node));
+ 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<IEditorDescriptor> alreadyMapped = new ArrayList<IEditorDescriptor>();
+
+ for (int i = 0; i < editors.length; i++) {
+ IEditorDescriptor editor = 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);
+
+ createDefaultMenuItem(menu);
+
+ // add Other... menu item
+ createOtherMenuItem(menu);
+ }
+
+ /*
+ * (non-Javadoc) Returns whether this menu is dynamic.
+ */
+ @Override
+ 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 being edited
+ */
+ private void createDefaultMenuItem(Menu menu) {
+ final MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
+ menuItem.setSelection(getDefaultEditor() == null);
+ menuItem.setText(Messages.OpenWithMenu_DefaultEditor);
+
+ Listener listener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Selection:
+ if (menuItem.getSelection()) {
+ PersistenceManager.getInstance().getPersistentProperties(node)
+ .put(IDE.EDITOR_KEY, null);
+ try {
+ syncOpen(getEditorDescriptor(), false);
+ }
+ catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ };
+
+ menuItem.addListener(SWT.Selection, listener);
+ }
+
+ /**
+ * Get an appropriate editor for the FSTreeNode. If the default editor is not found, it will
+ * search the in-place editor, the external editor and finally the default text editor.
+ *
+ * @return An appropriate editor to open the node using "Default Editor".
+ * @throws PartInitException
+ */
+ protected IEditorDescriptor getEditorDescriptor() throws PartInitException {
+ IEditorDescriptor defaultDescriptor = getDefaultEditor();
+ if (defaultDescriptor != null) {
+ return defaultDescriptor;
+ }
+
+ IEditorDescriptor editorDesc = null;
+
+ // next check the OS for in-place editor (OLE on Win32)
+ if (registry.isSystemInPlaceEditorAvailable(node.name)) {
+ editorDesc = registry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
+ }
+
+ // next check with the OS for an external editor
+ if (editorDesc == null && registry.isSystemExternalEditorAvailable(node.name)) {
+ editorDesc = registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
+ }
+
+ // next lookup the default text editor
+ if (editorDesc == null) {
+ editorDesc = registry.findEditor(DEFAULT_TEXT_EDITOR);
+ }
+
+ // if no valid editor found, bail out
+ if (editorDesc == null) {
+ throw new PartInitException(Messages.OpenWithMenu_NoEditorFound);
+ }
+
+ return editorDesc;
+ }
+
+ /**
+ * Synchronize and open the file using the specified editor descriptor. If openUsingDescriptor
+ * is true, it will try to use an external editor to open it if an eclipse editor is not
+ * available.
+ *
+ * @param editorDescriptor The editor descriptor used to open the node.
+ * @param openUsingDescriptor If an external editor should be used to open the node.
+ */
+ protected void syncOpen(IEditorDescriptor editorDescriptor, boolean openUsingDescriptor) {
+ File file = CacheManager.getInstance().getCacheFile(node);
+ if (!file.exists()) {
+ // If the file node's local cache does not exist yet, download it.
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_DowloadingFile);
+ IStatus status = executor.execute(new OpCacheUpdate(node));
+ if (!status.isOK()) {
+ return;
+ }
+ }
+ openInEditor(editorDescriptor, openUsingDescriptor);
+ }
+
+ /**
+ * Open the editor using the specified editor descriptor. If openUsingDescriptor is true, it
+ * will try to use an external editor to open it if an eclipse editor is not available.
+ *
+ * @param editorDescriptor The editor descriptor used to open the node.
+ * @param openUsingDescriptor If an external editor should be used to open the node.
+ */
+ private void openInEditor(IEditorDescriptor editorDescriptor, boolean openUsingDescriptor) {
+ try {
+ IPath path = CacheManager.getInstance().getCachePath(node);
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(path);
+ FileStoreEditorInput input = new FileStoreEditorInput(fileStore);
+ if (openUsingDescriptor) {
+ String editorId = editorDescriptor.getId();
+ page.openEditor(input, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
+ }
+ else {
+ String editorId = IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID;
+ if (editorDescriptor != null) editorId = editorDescriptor.getId();
+ page.openEditor(input, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
+ Map<QualifiedName, String> properties = PersistenceManager.getInstance()
+ .getPersistentProperties(node);
+ properties.put(IDE.EDITOR_KEY, editorId);
+ }
+ }
+ catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java
new file mode 100644
index 000000000..ff21a7236
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopy;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpMove;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd.CommonDnD;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.FsClipboard;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler that pastes the files or folders in the clip board.
+ */
+public class PasteFilesHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ FsClipboard cb = UIPlugin.getClipboard();
+ Clipboard clipboard = cb.getSystemClipboard();
+ Object contents = clipboard.getContents(FileTransfer.getInstance());
+ if(contents != null) {
+ String[] files = (String[]) contents;
+ // Get the files/folders from the clip board.
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ FSTreeNode hovered = (FSTreeNode) selection.getFirstElement();
+ CommonDnD dnd = new CommonDnD();
+ dnd.dropFiles(null, files, DND.DROP_COPY, hovered);
+ }
+ else if (!cb.isEmpty()) {
+ // Get the files/folders from the clip board.
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ List<FSTreeNode> nodes = cb.getFiles();
+ ICallback callback = new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ UIPlugin.getClipboard().clear();
+ }
+ };
+ IOpExecutor executor = null;
+ IOperation operation = null;
+ if (cb.isCutOp()) {
+ FSTreeNode dest = (FSTreeNode) selection.getFirstElement();
+ operation = new OpMove(nodes, dest, new MoveCopyCallback());
+ executor = new UiExecutor(Messages.FSMove_MovingFile, callback);
+ }
+ else if (cb.isCopyOp()) {
+ FSTreeNode hovered = (FSTreeNode) selection.getFirstElement();
+ FSTreeNode dest = getCopyDestination(hovered, nodes);
+ boolean cpPerm = UIPlugin.isCopyPermission();
+ boolean cpOwn = UIPlugin.isCopyOwnership();
+ operation = new OpCopy(nodes, dest, cpPerm, cpOwn, new MoveCopyCallback());
+ executor = new UiExecutor(Messages.FSCopy_CopyingFile, callback);
+ }
+ if (executor != null) {
+ executor.execute(operation);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return an appropriate destination directory for copying according to
+ * the specified hovered node. If the hovered node is a file, then return
+ * its parent directory. If the hovered node is a directory, then return its
+ * self if it is not a node being copied. Return its parent directory if it is
+ * a node being copied.
+ * @param hovered
+ * @param nodes
+ * @return
+ */
+ private FSTreeNode getCopyDestination(FSTreeNode hovered, List<FSTreeNode> nodes) {
+ if (hovered.isFile()) {
+ return hovered.parent;
+ }
+ else if (hovered.isDirectory()) {
+ for (FSTreeNode node : nodes) {
+ if (node == hovered) {
+ return hovered.parent;
+ }
+ }
+ }
+ return hovered;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
new file mode 100644
index 000000000..0b12e51d7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The action handler to refresh the whole file system tree.
+ */
+public class RefreshViewerHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorInput editorInput = HandlerUtil.getActiveEditorInputChecked(event);
+ IPeerModel peer = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
+ if (peer != null) {
+ FSTreeNode root = FSModel.getFSModel(peer).getRoot();
+ if (root != null) {
+ IOpExecutor executor = new JobExecutor(NLS.bind(Messages.RefreshDirectoryHandler_RefreshJobTitle, root.name));
+ executor.execute(new OpRefresh(root));
+ }
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java
new file mode 100644
index 000000000..8aee4a209
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.PlatformUI;
+
+public class RenameCallback extends Callback implements Runnable {
+ private String message;
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (!status.isOK()) {
+ message = status.getMessage();
+ PlatformUI.getWorkbench().getDisplay().asyncExec(this);
+ }
+ }
+ @Override
+ public void run() {
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ MessageDialog.openError(parent, Messages.FSRename_RenameFileFolderTitle, message);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java
new file mode 100644
index 000000000..a20fbe238
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRename;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor.FSCellValidator;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.dialogs.RenameDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler that renames the selected file or folder.
+ */
+public class RenameFilesHandler extends AbstractHandler {
+ // The currently focused viewer.
+ private static TreeViewer currentViewer;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ if (!sel.isEmpty()) {
+ FSTreeNode node = (FSTreeNode) sel.getFirstElement();
+ boolean inPlaceEditor = UIPlugin.isInPlaceEditor();
+ if (inPlaceEditor) {
+ // If it is configured to use in-place editor, then invoke the editor.
+ if (currentViewer != null) {
+ Control control = currentViewer.getControl();
+ if (!control.isDisposed()) {
+ currentViewer.editElement(node, 0);
+ }
+ }
+ }
+ else {
+ Shell shell = HandlerUtil.getActiveShellChecked(event);
+ RenameDialog dialog = createRenameDialog(shell, node);
+ int ok = dialog.open();
+ if (ok == Window.OK) {
+ // Do the renaming.
+ String newName = dialog.getNewName();
+ // Rename the node with the new name using an FSRename.
+ IOpExecutor executor = new JobExecutor(Messages.FSRename_JobTitle, new RenameCallback());
+ executor.execute(new OpRename(node, newName));
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a renaming dialog for the specified file/folder node.
+ *
+ * @param shell The parent shell.
+ * @param node The file/folder node.
+ * @return The renaming dialog.
+ */
+ private RenameDialog createRenameDialog(Shell shell, FSTreeNode node) {
+ String[] names = getUsedNames(node);
+ String title;
+ if (node.isFile()) {
+ title = Messages.RenameFilesHandler_TitleRenameFile;
+ }
+ else if (node.isDirectory()) {
+ title = Messages.RenameFilesHandler_TitleRenameFolder;
+ }
+ else {
+ title = Messages.RenameFilesHandler_TitleRename;
+ }
+ String formatRegex;
+ if (node.isWindowsNode()) {
+ formatRegex = FSCellValidator.WIN_FILENAME_REGEX;
+ }
+ else {
+ formatRegex = FSCellValidator.UNIX_FILENAME_REGEX;
+ }
+ String error;
+ if (node.isWindowsNode()) {
+ error = Messages.FSRenamingAssistant_WinIllegalCharacters;
+ }
+ else {
+ error = Messages.FSRenamingAssistant_UnixIllegalCharacters;
+ }
+ String prompt = Messages.RenameFilesHandler_RenamePromptMessage;
+ String usedError = Messages.FSRenamingAssistant_NameAlreadyExists;
+ String label = Messages.RenameFilesHandler_PromptNewName;
+ return new RenameDialog(shell, title, prompt, usedError, error, label, node.name, formatRegex, names, null);
+ }
+
+ /**
+ * Get the used names in the specified folder.
+ *
+ * @param folder The folder.
+ * @return Used names.
+ */
+ private String[] getUsedNames(FSTreeNode folder) {
+ List<String> usedNames = new ArrayList<String>();
+ List<FSTreeNode> nodes = folder.parent.unsafeGetChildren();
+ for (FSTreeNode node : nodes) {
+ usedNames.add(node.name);
+ }
+ return usedNames.toArray(new String[usedNames.size()]);
+ }
+
+ /**
+ * Set the currently focused tree viewer. Called by Target Explorer and FSTreeControl to set the
+ * current viewer.
+ *
+ * @param viewer The currently focused tree viewer.
+ */
+ public static void setCurrentViewer(TreeViewer viewer) {
+ currentViewer = viewer;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java
new file mode 100644
index 000000000..ce9c5f247
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheUpdate;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler to update the local file's content with the latest of its remote file.
+ *
+ */
+public class UpdateHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ FSTreeNode node = (FSTreeNode) selection.getFirstElement();
+ IOpExecutor executor = new UiExecutor(Messages.CacheManager_DowloadingFile);
+ executor.execute(new OpCacheUpdate(node));
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java
new file mode 100644
index 000000000..0d3de85bc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations;
+
+import java.util.List;
+
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpClipboard;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The clip board to which copy or cut files/folders.
+ */
+public class FsClipboard extends OpClipboard {
+ // The system clipboard.
+ private Clipboard clipboard;
+
+ /**
+ * Create a clip board instance.
+ */
+ public FsClipboard() {
+ super();
+ clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
+ }
+
+ /**
+ * Cut the specified files/folders to the clip board.
+ *
+ * @param files The file/folder nodes.
+ */
+ @Override
+ public void cutFiles(List<FSTreeNode> files) {
+ super.cutFiles(files);
+ clearSystemClipboard();
+ }
+
+ /**
+ * Copy the specified files/folders to the clip board.
+ *
+ * @param files The file/folder nodes.
+ */
+ @Override
+ public void copyFiles(List<FSTreeNode> files) {
+ super.copyFiles(files);
+ clearSystemClipboard();
+ }
+
+ /**
+ * Clear the clip board.
+ */
+ @Override
+ public void clear() {
+ super.clear();
+ clearSystemClipboard();
+ }
+
+ /**
+ * Make sure the system clip board is cleared in a UI thread.
+ */
+ void clearSystemClipboard() {
+ if (Display.getCurrent() != null) {
+ clipboard.clearContents();
+ }
+ else {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
+ @Override
+ public void run() {
+ clearSystemClipboard();
+ }});
+ }
+ }
+
+ /**
+ * Dispose the clipboard.
+ */
+ @Override
+ public void dispose() {
+ if(Display.getCurrent() != null) {
+ if (!clipboard.isDisposed()) {
+ try {
+ clipboard.dispose();
+ }
+ catch (SWTException e) {
+ }
+ }
+ }
+ else {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
+ @Override
+ public void run() {
+ dispose();
+ }});
+ }
+ }
+
+ /**
+ * Get the system clipboard.
+ *
+ * @return The system clipboard.
+ */
+ public Clipboard getSystemClipboard() {
+ return clipboard;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/IOpExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/IOpExecutor.java
new file mode 100644
index 000000000..dac885d4d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/IOpExecutor.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+
+/**
+ * The operation that is executed as a back ground job.
+ */
+public interface IOpExecutor {
+ public IStatus execute(IOperation operation);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/JobExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/JobExecutor.java
new file mode 100644
index 000000000..6e8f744b7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/JobExecutor.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpJob;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The operation that is executed as a back ground job.
+ */
+public class JobExecutor implements IOpExecutor{
+ // The callback
+ protected ICallback callback;
+ private String jobName;
+
+ public JobExecutor(String jobName) {
+ this(jobName, null);
+ }
+
+ /**
+ * Create an instance with the specified callback.
+ *
+ * @param callback called when the creation is done.
+ */
+ public JobExecutor(String jobName, ICallback callback) {
+ this.jobName = jobName;
+ this.callback = callback;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation#doit()
+ */
+ @Override
+ public IStatus execute(IOperation operation) {
+ Job job = new OpJob(jobName, operation);
+ job.addJobChangeListener(new JobChangeAdapter(){
+ @Override
+ public void done(final IJobChangeEvent event) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
+ @Override
+ public void run() {
+ doCallback(event);
+ }});
+ }});
+ job.schedule();
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Called when the creation is done. Must be called within UI-thread.
+ *
+ * @param event The job change event.
+ */
+ void doCallback(IJobChangeEvent event) {
+ Assert.isNotNull(Display.getCurrent());
+ IStatus status = event.getResult();
+ if(callback != null) {
+ callback.done(this, status);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java
new file mode 100644
index 000000000..1613062d5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.dialogs.TimeTriggeredProgressMonitorDialog;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The operation that is executed in an interactive progress dialog.
+ */
+public class UiExecutor implements IOpExecutor {
+ // The callback
+ protected ICallback callback;
+ private String opName;
+
+ public UiExecutor(String opName) {
+ this(opName, null);
+ }
+
+ public UiExecutor(String opName, ICallback callback) {
+ this.opName = opName;
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation#doit()
+ */
+ @Override
+ public IStatus execute(final IOperation operation) {
+ Assert.isNotNull(Display.getCurrent());
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ TimeTriggeredProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(parent, 250);
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ operation.run(monitor);
+ }};
+ dialog.setCancelable(true);
+ IStatus status = null;
+ try {
+ dialog.run(true, true, runnable);
+ status = Status.OK_STATUS;
+ }
+ catch (InvocationTargetException e) {
+ // Display the error during copy.
+ Throwable throwable = e.getTargetException() != null ? e.getTargetException() : e;
+ MessageDialog.openError(parent, opName, throwable.getLocalizedMessage());
+ status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), throwable.getLocalizedMessage(), throwable);
+ }
+ catch (InterruptedException e) {
+ // It is canceled.
+ status = Status.OK_STATUS;
+ }
+ if(callback != null) {
+ callback.done(this, status);
+ }
+ return status;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java
new file mode 100644
index 000000000..6206db5e3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * The preference page for configuring the preference options for
+ * the TCF File System Explorer.
+ *
+ */
+public class PreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+ // The preference key to access the option of auto saving
+ public static final String PREF_AUTOSAVING = "PrefAutoSaving"; //$NON-NLS-1$
+ // The default value of the option of auto saving.
+ public static final boolean DEFAULT_AUTOSAVING = true;
+ // The preference key to access the option using in-place editor during renaming.
+ public static final String PREF_RENAMING_IN_PLACE_EDITOR = "PrefRenamingInPlaceEditor"; //$NON-NLS-1$
+ // The default value of the option using in-place editor during renaming.
+ public static final boolean DEFAULT_RENAMING_IN_PLACE_EDITOR = true;
+ // The preference key to access the option of copy permission when copying files.
+ public static final String PREF_COPY_PERMISSION = "PrefCopyPermission"; //$NON-NLS-1$
+ // The default value of the option of copy permission.
+ public static final boolean DEFAULT_COPY_PERMISSION = true;
+ // The preference key to access the option of copy ownership when copying files.
+ public static final String PREF_COPY_OWNERSHIP = "PrefCopyOwnership"; //$NON-NLS-1$
+ // The default value of the option of copy ownership
+ public static final boolean DEFAULT_COPY_OWNERSHIP = true;
+
+ /***
+ * Create a preference page for Target Explorer File System Explorer.
+ */
+ public PreferencePage() {
+ super(GRID);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ UIPlugin plugin = UIPlugin.getDefault();
+ IPreferenceStore preferenceStore = plugin.getPreferenceStore();
+ setPreferenceStore(preferenceStore);
+ BooleanFieldEditor autoSaving = new BooleanFieldEditor(PREF_AUTOSAVING, Messages.PreferencePage_AutoSavingText, getFieldEditorParent());
+ addField(autoSaving);
+ BooleanFieldEditor renamingOption = new BooleanFieldEditor(PREF_RENAMING_IN_PLACE_EDITOR, Messages.PreferencePage_RenamingOptionText, getFieldEditorParent());
+ addField(renamingOption);
+ BooleanFieldEditor copyPermission = new BooleanFieldEditor(PREF_COPY_PERMISSION, Messages.PreferencePage_CopyPermissionText, getFieldEditorParent());
+ addField(copyPermission);
+ BooleanFieldEditor copyOwnership = new BooleanFieldEditor(PREF_COPY_OWNERSHIP, Messages.PreferencePage_CopyOwnershipText, getFieldEditorParent());
+ addField(copyOwnership);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ // do nothing
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java
new file mode 100644
index 000000000..935e02b9e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.preferences.IPreferenceKeys;
+
+
+/**
+ * The bundle's preference initializer implementation.
+ */
+public class PreferencesInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * Constructor.
+ */
+ public PreferencesInitializer() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ // Get the bundles preferences manager
+ IEclipsePreferences prefs = DefaultScope.INSTANCE.getNode(UIPlugin.getUniqueIdentifier());
+ if (prefs != null) {
+ // [Hidden] Editor content contribution: default on
+ prefs.putBoolean(IPreferenceKeys.PREF_FEATURE_ENABLE_EDITOR_CONTENT_CONTRIBUTION, true);
+ }
+ IPreferenceStore preferenceStore = UIPlugin.getDefault().getPreferenceStore();
+ preferenceStore.setDefault(PreferencePage.PREF_AUTOSAVING, PreferencePage.DEFAULT_AUTOSAVING);
+ preferenceStore.setDefault(PreferencePage.PREF_RENAMING_IN_PLACE_EDITOR, PreferencePage.DEFAULT_RENAMING_IN_PLACE_EDITOR);
+ preferenceStore.setDefault(PreferencePage.PREF_COPY_PERMISSION, PreferencePage.DEFAULT_COPY_PERMISSION);
+ preferenceStore.setDefault(PreferencePage.PREF_COPY_OWNERSHIP, PreferencePage.DEFAULT_COPY_OWNERSHIP);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java
new file mode 100644
index 000000000..4303e5ef2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java
@@ -0,0 +1,214 @@
+/*********************************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River) - [345384]Provide property pages for remote file system nodes
+ *********************************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.properties;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IWindowsFileAttributes;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * The dialog used to display the advanced attributes of a Windows file or
+ * folder.
+ */
+public class AdvancedAttributesDialog extends Dialog {
+
+ // The file or folder node whose advanced attributes are to be displayed.
+ FSTreeNode node;
+
+ /**
+ * Create the advanced attributes dialog with the specified node and a
+ * parent shell.
+ *
+ * @param parentShell
+ * The parent shell.
+ * @param node
+ * The file or folder node to be displayed.
+ */
+ public AdvancedAttributesDialog(Shell parentShell, FSTreeNode node) {
+ super(parentShell);
+ this.node = node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ Composite banner = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ banner.setLayout(layout);
+ Label label = new Label(banner, SWT.NONE);
+ Image bImg = getBannerImage();
+ label.setImage(bImg);
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+ label = new Label(banner, SWT.NONE);
+ if (node.isFile()) {
+ label.setText(Messages.AdvancedAttributesDialog_FileBanner);
+ } else if (node.isDirectory()) {
+ label.setText(Messages.AdvancedAttributesDialog_FolderBanner);
+ }
+ createArchiveAndIndexGroup(composite);
+ createCompressAndEncryptGroup(composite);
+ return composite;
+ }
+
+ /**
+ * Get the image in the banner area.
+ *
+ * @return The image in the banner area.
+ */
+ private Image getBannerImage() {
+ return UIPlugin.getImage(ImageConsts.BANNER_IMAGE);
+ }
+
+ /**
+ * Create the compress and encrypt options group.
+ *
+ * @param parent
+ * The parent composite where they are created.
+ */
+ private void createCompressAndEncryptGroup(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ group.setText(Messages.AdvancedAttributesDialog_CompressEncrypt);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ createCompress(group);
+ createEncrypt(group);
+ }
+
+ /**
+ * Create the archive and indexing options group.
+ *
+ * @param parent
+ * The parent composite where they are created.
+ */
+ private void createArchiveAndIndexGroup(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ group.setText(Messages.AdvancedAttributesDialog_ArchiveIndex);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ createArchive(group);
+ createIndexField(group);
+ }
+
+ /**
+ * Create the indexing option field.
+ *
+ * @param group
+ * The group widget where the field is created.
+ */
+ private void createIndexField(Group group) {
+ String label = node.isFile() ? Messages.AdvancedAttributesDialog_IndexFile
+ : (node.isDirectory() ? Messages.AdvancedAttributesDialog_IndexFolder
+ : null);
+ boolean on = !node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
+ createOptionField(group, label, IWindowsFileAttributes.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, on);
+ }
+
+ /**
+ * Create the archive option field.
+ *
+ * @param group
+ * The group widget where the field is created.
+ */
+ private void createArchive(Group group) {
+ String label = node.isFile() ? Messages.AdvancedAttributesDialog_FileArchive
+ : (node.isDirectory() ? Messages.AdvancedAttributesDialog_FolderArchive
+ : null);
+ boolean on = node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ARCHIVE);
+ createOptionField(group, label, IWindowsFileAttributes.FILE_ATTRIBUTE_ARCHIVE, on);
+ }
+
+ /**
+ * Create the encrypt option field.
+ *
+ * @param group
+ * The group widget where the field is created.
+ */
+ private void createEncrypt(Group group) {
+ String label = Messages.AdvancedAttributesDialog_Encrypt;
+ boolean on = node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ENCRYPTED);
+ createOptionField(group, label, IWindowsFileAttributes.FILE_ATTRIBUTE_ENCRYPTED, on);
+ }
+
+ /**
+ * Create the compress option field.
+ *
+ * @param group
+ * The group widget where the field is created.
+ */
+ private void createCompress(Group group) {
+ String label = Messages.AdvancedAttributesDialog_Compress;
+ boolean on = node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_COMPRESSED);
+ createOptionField(group, label, IWindowsFileAttributes.FILE_ATTRIBUTE_COMPRESSED, on);
+ }
+
+ /**
+ * Create an option field in the specified group, using the specified label,
+ * and with the specified boolean value.
+ *
+ * @param group
+ * The group widget where the field is created.
+ * @param label
+ * The label used by the field.
+ * @param bit
+ * The bit mask to be changed once the value is changed.
+ * @param on
+ * The boolean value to be set.
+ */
+ private void createOptionField(Group group, String label, final int bit, final boolean on) {
+ final Button button = new Button(group, SWT.CHECK);
+ button.setText(label);
+ button.setSelection(on);
+ // Only the owner can edit the properties
+ button.setEnabled(node.isAgentOwner());
+ button.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (button.getSelection() != on) {
+ node.setWin32Attr(bit, on);
+ }
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.AdvancedAttributesDialog_ShellTitle);
+ }
+
+ /**
+ * Get the result.
+ * @return The result.
+ */
+ public FSTreeNode getResult() {
+ return node;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java
new file mode 100644
index 000000000..fb0fe7a10
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java
@@ -0,0 +1,389 @@
+/*********************************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * William Chen (Wind River) - [345384]Provide property pages for remote file system nodes
+ * [361322]Minor improvements to the properties dialog of a file.
+ *********************************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.properties;
+
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.util.Date;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+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.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StateManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The general information page of a file's properties dialog.
+ */
+public class GeneralInformationPage extends PropertyPage {
+ // The formatter for the size of a file.
+ private static final DecimalFormat SIZE_FORMAT = new DecimalFormat();
+ // The original node.
+ FSTreeNode node;
+ // Cloned node for modification.
+ FSTreeNode clone;
+ // The button of "Read-Only"
+ Button btnReadOnly;
+ // The button of "Hidden"
+ Button btnHidden;
+ // The button of "Permissions"
+ Button[] btnPermissions;
+
+ /**
+ * Create a horizontal separator between field sections.
+ *
+ * @param parent
+ * The parent composite of the separator.
+ */
+ protected void createSeparator(Composite parent) {
+ Label label = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_ETCHED_IN | SWT.HORIZONTAL);
+ GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ }
+
+ /**
+ * Create a field displaying the a specific value with a specific label.
+ *
+ * @param text
+ * The label text for the field.
+ * @param value
+ * The value to be displayed.
+ * @param parent
+ * The parent composite of the field.
+ */
+ protected void createField(String text, String value, Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ GridData data = new GridData();
+ data.horizontalAlignment = SWT.LEFT;
+ data.verticalAlignment = SWT.TOP;
+ label.setLayoutData(data);
+ Text txt = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
+ data = new GridData();
+ data.verticalAlignment = SWT.TOP;
+ data.widthHint = 300;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ txt.setLayoutData(data);
+ txt.setBackground(txt.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ txt.setText(value);
+ }
+
+ /**
+ * Get the string of the file size using using the formatter, SIZE_FORMAT.
+ *
+ * @param size
+ * The size of the file to be formatted.
+ * @return The string in the format of SIZE_FORMAT.
+ */
+ protected String getSizeText(long size) {
+ return NLS.bind(Messages.GeneralInformationPage_FileSizeInfo, SIZE_FORMAT.format(size / 1024), SIZE_FORMAT.format(size));
+ }
+
+ /**
+ * Get the string of the specific time using the formatter, DATE_FORMAT.
+ *
+ * @param time
+ * The time to be formatted.
+ * @return The string in the format of DATE_FORMAT.
+ */
+ protected String getDateText(long time) {
+ DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
+ return dateFormat.format(new Date(time));
+ }
+
+ /**
+ * Create the attributes section for a Windows file/folder.
+ *
+ * @param parent
+ * The parent composite on which it is created.
+ */
+ protected void createAttributesSection(Composite parent) {
+ // Attributes
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.GeneralInformationPage_Attributes);
+ GridData data = new GridData();
+ data.horizontalAlignment = SWT.LEFT;
+ label.setLayoutData(data);
+
+ Composite attr = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, true);
+ layout.marginHeight = 0;
+ attr.setLayout(layout);
+ // Read-only
+ btnReadOnly = new Button(attr, SWT.CHECK);
+ btnReadOnly.setText(Messages.GeneralInformationPage_ReadOnly);
+ // Only the owner can edit this property
+ btnReadOnly.setEnabled(node.isAgentOwner());
+ btnReadOnly.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if(btnReadOnly.getSelection()!=clone.isReadOnly()){
+ clone.setReadOnly(btnReadOnly.getSelection());
+ }
+ }
+ });
+ // Hidden
+ btnHidden = new Button(attr, SWT.CHECK);
+ btnHidden.setText(Messages.GeneralInformationPage_Hidden);
+ // Only the owner can edit this property
+ btnHidden.setEnabled(node.isAgentOwner());
+ btnHidden.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button btnHidden = (Button) e.getSource();
+ if(btnHidden.getSelection()!=clone.isHidden()){
+ clone.setHidden(btnHidden.getSelection());
+ }
+ }
+ });
+ // Advanced Attributes
+ Button btnAdvanced = new Button(attr, SWT.PUSH);
+ btnAdvanced.setText(Messages.GeneralInformationPage_Advanced);
+ btnAdvanced.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ showAdvancedAttributes();
+ }
+ });
+ // Update the attribute values.
+ updateAttributes();
+ }
+
+ /**
+ * Update the value of attributes section.
+ */
+ private void updateAttributes() {
+ btnReadOnly.setSelection(clone.isReadOnly());
+ btnHidden.setSelection(clone.isHidden());
+ }
+
+ /**
+ * Show the advanced attributes dialog for the specified file/folder.
+ */
+ void showAdvancedAttributes() {
+ AdvancedAttributesDialog dialog = new AdvancedAttributesDialog(this.getShell(), (FSTreeNode)(clone.clone()));
+ if (dialog.open() == Window.OK) {
+ FSTreeNode result = dialog.getResult();
+ clone.attr = result.attr;
+ }
+ }
+
+ /**
+ * Create the permissions section for a Unix/Linux file/folder.
+ *
+ * @param parent
+ * The parent composite on which it is created.
+ */
+ protected void createPermissionsSection(Composite parent) {
+ GridLayout gridLayout;
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.GeneralInformationPage_PermissionText);
+ GridData data = new GridData();
+ data.horizontalAlignment = SWT.LEFT;
+ data.verticalAlignment = SWT.TOP;
+ label.setLayoutData(data);
+ Composite perms = new Composite(parent, SWT.NONE);
+ gridLayout = new GridLayout(2, false);
+ gridLayout.marginHeight = 0;
+ perms.setLayout(gridLayout);
+ btnPermissions = new Button[9];
+ createPermissionGroup(perms, 0,
+ Messages.PermissionsGroup_UserPermissions);
+ createPermissionGroup(perms, 3,
+ Messages.PermissionsGroup_GroupPermissions);
+ createPermissionGroup(perms, 6,
+ Messages.PermissionsGroup_OtherPermissions);
+ // Update the permission values.
+ updatePermissions();
+ }
+
+ /**
+ * Create a permission group for a role, such as a user, a group or others.
+ *
+ * @param parent
+ * The parent composite.
+ * @param bit
+ * The permission bit index.
+ * @param header
+ * The group's header label.
+ */
+ protected void createPermissionGroup(Composite parent, int bit, String header) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(header);
+ GridData data = new GridData();
+ data.horizontalAlignment = SWT.LEFT;
+ label.setLayoutData(data);
+ Composite group = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, true);
+ layout.marginHeight = 0;
+ group.setLayout(layout);
+ createPermissionButton(Messages.PermissionsGroup_Readable, bit, group);
+ createPermissionButton(Messages.PermissionsGroup_Writable, bit + 1, group);
+ createPermissionButton(Messages.PermissionsGroup_Executable, bit + 2, group);
+ }
+
+ /**
+ * Create a check-box field for a single permission item.
+ *
+ * @param label
+ * The label of the permission.
+ * @param index
+ * The index of current permission bit mask index.
+ * @param parent
+ * The parent to hold the check-box field.
+ */
+ private void createPermissionButton(String label, final int index, Composite parent) {
+ btnPermissions[index] = new Button(parent, SWT.CHECK);
+ btnPermissions[index].setText(label);
+ // Only the owner can edit its permission.
+ btnPermissions[index].setEnabled(node.isAgentOwner());
+ btnPermissions[index].addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int bit = 1 << (8 - index);
+ boolean on = (clone.attr.permissions & bit) != 0;
+ boolean newOn = btnPermissions[index].getSelection();
+ if (newOn != on) {
+ int permissions = clone.attr.permissions;
+ permissions = newOn ? (permissions | bit) : (permissions & ~bit);
+ clone.setPermissions(permissions);
+ }
+ }
+ });
+ }
+
+ /**
+ * Update the value of permissions section.
+ */
+ private void updatePermissions(){
+ for (int i = 0; i < 9; i++) {
+ final int bit = 1 << (8 - i);
+ final boolean on = (clone.attr.permissions & bit) != 0;
+ btnPermissions[i].setSelection(on);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ @Override
+ protected void performDefaults() {
+ clone = (FSTreeNode) node.clone();
+ if (node.isWindowsNode()) {
+ updateAttributes();
+ }
+ else {
+ updatePermissions();
+ }
+ super.performDefaults();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ if (hasAttrsChanged()) {
+ final boolean[] success = new boolean[1];
+ success[0] = true;
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ String errorMessage = NLS
+ .bind(Messages.GeneralInformationPage_PropertiesChangeFailure, new Object[] { node.name, exception
+ .getLocalizedMessage() });
+ MessageDialog.openError(getShell(), Messages.GeneralInformationPage_PropertiesChangeTitle, errorMessage);
+ success[0] = false;
+ }
+
+ @Override
+ public void run() throws Exception {
+ StateManager.getInstance().setFileAttrs(node, clone.attr);
+ }
+ });
+ return success[0];
+ }
+ return true;
+ }
+
+ /**
+ * If the attributes has been changed.
+ * @return If the attributes has been changed.
+ */
+ private boolean hasAttrsChanged(){
+ if(node.isWindowsNode()){
+ // If it is a Windows file, only check its attributes.
+ return node.getWin32Attrs() != clone.getWin32Attrs();
+ }
+ // If it is not a Windows file, only check its permissions.
+ return node.attr.permissions != clone.attr.permissions;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ IAdaptable element = getElement();
+ Assert.isTrue(element instanceof FSTreeNode);
+
+ node = (FSTreeNode) element;
+ clone = (FSTreeNode) node.clone();
+ Composite page = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ page.setLayout(gridLayout);
+ // Field "Name"
+ createField(Messages.GeneralInformationPage_Name, clone.name, page);
+ // Field "Type"
+ createField(Messages.GeneralInformationPage_Type, clone.getFileType(), page);
+ // Field "Location"
+ String location = clone.isSystemRoot() || clone.isRoot() ?
+ Messages.GeneralInformationPage_Computer : clone.getLocation();
+ createField(Messages.GeneralInformationPage_Location, location, page);
+ // Field "Size"
+ if (clone.isFile()) {
+ createField(Messages.GeneralInformationPage_Size, getSizeText(clone.attr.size), page);
+ }
+ // Field "Modified"
+ createField(Messages.GeneralInformationPage_Modified, getDateText(clone.attr.mtime), page);
+ // Field "Accessed"
+ if (clone.isFile()) {
+ createField(Messages.GeneralInformationPage_Accessed, getDateText(clone.attr.atime), page);
+ }
+ createSeparator(page);
+ if (clone.isWindowsNode()) {
+ createAttributesSection(page);
+ } else {
+ createPermissionsSection(page);
+ }
+ return page;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java
new file mode 100644
index 000000000..bba1e4e67
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The section that displays the basic information of a file.
+ */
+public class BasicFileSection extends BasicFolderSection {
+
+ // The text field for the size of the file.
+ protected Text sizeText;
+ // The text field for the access time of the file.
+ protected Text accessedText;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.tabbed.BasicFolderSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ sizeText = createTextField(null, Messages.GeneralInformationPage_Size);
+ accessedText = createTextField(sizeText, Messages.GeneralInformationPage_Accessed);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.tabbed.BasicFolderSection#refresh()
+ */
+ @Override
+ public void refresh() {
+ sizeText.setText(getSizeText(clone.attr.size));
+ accessedText.setText(getDateText(clone.attr.atime));
+ super.refresh();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
new file mode 100644
index 000000000..d494824f5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.util.Date;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The section that displays the basic information of a folder.
+ */
+public class BasicFolderSection extends BaseTitledSection {
+ // The formatter for the size of a file.
+ private static final DecimalFormat SIZE_FORMAT = new DecimalFormat();
+
+ // The original node to be displayed and edited.
+ protected FSTreeNode node;
+ // The copy used to be edited.
+ protected FSTreeNode clone;
+
+ // The text for the name of the node.
+ protected Text nameText;
+ // The text for the type of the node.
+ protected Text typeText;
+ // The text for the location of the node.
+ protected Text locationText;
+ // The text for the modified time of the node.
+ protected Text modifiedText;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ nameText = createTextField(null, Messages.GeneralInformationPage_Name);
+ typeText = createTextField(nameText, Messages.GeneralInformationPage_Type);
+ locationText = createWrapTextField(typeText, Messages.GeneralInformationPage_Location);
+ modifiedText = createTextField(locationText, Messages.GeneralInformationPage_Modified);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof FSTreeNode);
+ this.node = (FSTreeNode) input;
+ this.clone = (FSTreeNode) node.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ nameText.setText(clone.name);
+ typeText.setText(clone.getFileType());
+ String location = clone.isRoot() ? Messages.GeneralInformationPage_Computer : clone.getLocation();
+ locationText.setText(location);
+ modifiedText.setText(getDateText(clone.attr.mtime));
+ super.refresh();
+ }
+
+ /**
+ * Get the string of the specific time using the formatter, DATE_FORMAT.
+ *
+ * @param time The time to be formatted.
+ * @return The string in the format of DATE_FORMAT.
+ */
+ protected String getDateText(long time) {
+ DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
+ return dateFormat.format(new Date(time));
+ }
+
+ /**
+ * Get the string of the file size using using the formatter, SIZE_FORMAT.
+ *
+ * @param size
+ * The size of the file to be formatted.
+ * @return The string in the format of SIZE_FORMAT.
+ */
+ protected String getSizeText(long size) {
+ return NLS.bind(Messages.GeneralInformationPage_FileSizeInfo, SIZE_FORMAT.format(size / 1024), SIZE_FORMAT.format(size));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.BasicFolderSection_BasicInfoText;
+ }
+} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java
new file mode 100644
index 000000000..7f7686558
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The filter to test if a object is a file.
+ */
+public class FileFilter implements IFilter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object toTest) {
+ if(toTest instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) toTest;
+ return !node.isPendingNode() && !node.isSystemRoot() && node.isFile();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java
new file mode 100644
index 000000000..06627fd92
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The filter to select the folder from the file system.
+ */
+public class FolderFilter implements IFilter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object toTest) {
+ if(toTest instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) toTest;
+ return !node.isPendingNode() && !node.isSystemRoot() && node.isDirectory();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java
new file mode 100644
index 000000000..409b30f70
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * A filter to test if a object is a linux (non-Windows) node.
+ */
+public class LinuxFilter implements IFilter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object toTest) {
+ if(toTest instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) toTest;
+ return !node.isPendingNode() && !node.isSystemRoot() && !node.isWindowsNode();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java
new file mode 100644
index 000000000..c0ddc5612
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section for displaying the permissions of a linux file/folder.
+ */
+public class LinuxPermissionsSection extends BaseTitledSection {
+ // The original node.
+ protected FSTreeNode node;
+ // The copy node to be edited.
+ protected FSTreeNode clone;
+ // The button of "Permissions"
+ protected Button[] btnPermissions;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ btnPermissions = new Button[9];
+ Composite comp1 = createPermissionGroup(null, composite, 0, Messages.PermissionsGroup_UserPermissions);
+ Composite comp2 = createPermissionGroup(comp1, composite, 3, Messages.PermissionsGroup_GroupPermissions);
+ createPermissionGroup(comp2, composite, 6, Messages.PermissionsGroup_OtherPermissions);
+ }
+
+ /**
+ * Create a permission group for a role, such as a user, a group or others.
+ *
+ * @param prev The previous permission group to align with.
+ * @param parent The parent composite.
+ * @param bit The permission bit index.
+ * @param header The group's header label.
+ */
+ protected Composite createPermissionGroup(Composite prev, Composite parent, int bit, String header) {
+ Composite group = getWidgetFactory().createFlatFormComposite(parent);
+ FormLayout layout = (FormLayout) group.getLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.spacing = 0;
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment(100, 0);
+ if (prev == null) data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ else data.top = new FormAttachment(prev, ITabbedPropertyConstants.VSPACE);
+ group.setLayoutData(data);
+
+ createPermissionButton(Messages.PermissionsGroup_Readable, bit, group);
+ createPermissionButton(Messages.PermissionsGroup_Writable, bit + 1, group);
+ createPermissionButton(Messages.PermissionsGroup_Executable, bit + 2, group);
+
+ CLabel groupLabel = getWidgetFactory().createCLabel(parent, header);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(group, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(group, 0, SWT.TOP);
+ groupLabel.setLayoutData(data);
+
+ return group;
+ }
+
+ /**
+ * Create a check-box field for a single permission item.
+ *
+ * @param label The label of the permission.
+ * @param index The index of current permission bit mask index.
+ * @param parent The parent to hold the check-box field.
+ */
+ private void createPermissionButton(String label, final int index, Composite parent) {
+ btnPermissions[index] = getWidgetFactory().createButton(parent, label, SWT.CHECK);
+ FormData data = new FormData();
+ if ((index % 3) == 0) data.left = new FormAttachment(0, 0);
+ else data.left = new FormAttachment(btnPermissions[index - 1], ITabbedPropertyConstants.HSPACE);
+ data.right = new FormAttachment(((index % 3) + 1) * 33, 0);
+ if ((index % 3) == 0) data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ else data.top = new FormAttachment(btnPermissions[index - 1], 0, SWT.CENTER);
+ btnPermissions[index].setLayoutData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof FSTreeNode);
+ this.node = (FSTreeNode) input;
+ this.clone = (FSTreeNode) node.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ for (int i = 0; i < 9; i++) {
+ final int bit = 1 << (8 - i);
+ final boolean on = (clone.attr.permissions & bit) != 0;
+ btnPermissions[i].setSelection(on);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.LinuxPermissionsSection_Permissions;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java
new file mode 100644
index 000000000..fff7dff89
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IWindowsFileAttributes;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section for compress and encrypt attributes of a file/folder on Windows.
+ */
+public class WindowsAttributesCESection extends BaseTitledSection {
+
+ // The original node.
+ protected FSTreeNode node;
+
+ // The check box to display the compress attribute.
+ protected Button compressButton;
+ // The check box to display the encrypt attributes.
+ protected Button encryptButton;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ compressButton = getWidgetFactory().createButton(composite, Messages.AdvancedAttributesDialog_Compress, SWT.CHECK);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ compressButton.setLayoutData(data);
+
+ encryptButton = getWidgetFactory().createButton(composite, Messages.AdvancedAttributesDialog_Compress, SWT.CHECK);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(compressButton, ITabbedPropertyConstants.VSPACE);
+ encryptButton.setLayoutData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof FSTreeNode);
+ this.node = (FSTreeNode) input;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ boolean on = node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_COMPRESSED);
+ compressButton.setSelection(on);
+ on = node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ENCRYPTED);
+ encryptButton.setSelection(on);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.AdvancedAttributesDialog_CompressEncrypt;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java
new file mode 100644
index 000000000..05bfca7ec
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section for the attributes of a file/folder on Windows.
+ */
+public class WindowsAttributesSection extends BaseTitledSection {
+ // The original node.
+ protected FSTreeNode node;
+ // The copy node.
+ protected FSTreeNode clone;
+ // The check box for "Read Only" attribute.
+ protected Button readOnlyButton;
+ // The check box for "Hidden" attribute.
+ protected Button hiddenButton;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ readOnlyButton = getWidgetFactory().createButton(composite, Messages.GeneralInformationPage_ReadOnly, SWT.CHECK);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, ITabbedPropertyConstants.HMARGIN );
+ data.right = new FormAttachment(50, 0);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ readOnlyButton.setLayoutData(data);
+
+ hiddenButton = getWidgetFactory().createButton(composite, Messages.GeneralInformationPage_Hidden, SWT.CHECK);
+ data = new FormData();
+ data.left = new FormAttachment(readOnlyButton, ITabbedPropertyConstants.HSPACE);
+ data.right = new FormAttachment(100, -ITabbedPropertyConstants.HMARGIN );
+ data.top = new FormAttachment(readOnlyButton, 0, SWT.CENTER);
+ hiddenButton.setLayoutData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof FSTreeNode);
+ this.node = (FSTreeNode) input;
+ this.clone = (FSTreeNode) node.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ readOnlyButton.setSelection(clone.isReadOnly());
+ hiddenButton.setSelection(clone.isHidden());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.WindowsAttributesSection_Attributes;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java
new file mode 100644
index 000000000..738b13af0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * The property section to display the file's archive and index attributes on Windows.
+ */
+public class WindowsFileAISection extends WindowsFolderAISection {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.tabbed.WindowsFolderAISection#getAchiveText()
+ */
+ @Override
+ protected String getAchiveText() {
+ return Messages.AdvancedAttributesDialog_FileArchive;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.tabbed.WindowsFolderAISection#getIndexText()
+ */
+ @Override
+ protected String getIndexText() {
+ return Messages.AdvancedAttributesDialog_IndexFile;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java
new file mode 100644
index 000000000..cae1ebfbe
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The filter to test if a object is a Windows file.
+ */
+public class WindowsFileFilter implements IFilter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object toTest) {
+ if(toTest instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) toTest;
+ return !node.isPendingNode() && !node.isSystemRoot() && node.isWindowsNode() && node.isFile();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java
new file mode 100644
index 000000000..a7cdd53d1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The filter to test if a object is a Windows node.
+ */
+public class WindowsFilter implements IFilter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object toTest) {
+ if(toTest instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) toTest;
+ return !node.isPendingNode() && !node.isSystemRoot() && node.isWindowsNode() && (node.isFile() || node.isDirectory());
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java
new file mode 100644
index 000000000..dd67a8c81
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IWindowsFileAttributes;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display a folder's archive and index attributes on Windows.
+ */
+public class WindowsFolderAISection extends BaseTitledSection {
+
+ // The original node.
+ protected FSTreeNode node;
+
+ // The check box for archive attribute.
+ protected Button archiveButton;
+ // The check box for index attribute.
+ protected Button indexButton;
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets
+ * .Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ archiveButton = getWidgetFactory().createButton(composite, getAchiveText(), SWT.CHECK);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ archiveButton.setLayoutData(data);
+
+ indexButton = getWidgetFactory().createButton(composite, getIndexText(), SWT.CHECK);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(archiveButton, ITabbedPropertyConstants.VSPACE);
+ indexButton.setLayoutData(data);
+ }
+
+ /**
+ * Get the archive's label text.
+ *
+ * @return The archive's label text.
+ */
+ protected String getAchiveText() {
+ return Messages.AdvancedAttributesDialog_FolderArchive;
+ }
+
+ /**
+ * Get the index's label text.
+ *
+ * @return The index's label text.
+ */
+ protected String getIndexText() {
+ return Messages.AdvancedAttributesDialog_IndexFolder;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof FSTreeNode);
+ this.node = (FSTreeNode) input;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ boolean on = node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ARCHIVE);
+ archiveButton.setSelection(on);
+ on = !node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
+ indexButton.setSelection(on);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.AdvancedAttributesDialog_ArchiveIndex;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java
new file mode 100644
index 000000000..53ce06ebb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The filter to test if the object is a Windows folder.
+ */
+public class WindowsFolderFilter implements IFilter {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object toTest) {
+ if(toTest instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) toTest;
+ return !node.isPendingNode() && !node.isSystemRoot() && node.isWindowsNode() && node.isDirectory();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java
new file mode 100644
index 000000000..5ab7a7c5a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+
+/**
+ * Provide a tester to test if the current auto saving mode is on or off.
+ *
+ */
+public class CachePropertyTester extends PropertyTester {
+ /**
+ * Create a cache property tester.
+ */
+ public CachePropertyTester() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(property.equals("isAutoSavingOn")){ //$NON-NLS-1$
+ return UIPlugin.isAutoSaving();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java
new file mode 100644
index 000000000..d300f4a0f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers;
+
+import java.util.List;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.FsClipboard;
+/**
+ * Provide a tester to test if the paste operation is enabled.
+ */
+public class ClipboardPropertyTester extends PropertyTester {
+
+ /**
+ * Create an instance.
+ */
+ public ClipboardPropertyTester() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ Assert.isTrue(receiver instanceof IStructuredSelection);
+ if (property.equals("canPaste")) { //$NON-NLS-1$
+ FsClipboard cb = UIPlugin.getClipboard();
+ Clipboard clipboard = cb.getSystemClipboard();
+ Object contents = clipboard.getContents(FileTransfer.getInstance());
+ if(contents != null) {
+ List<FSTreeNode> selection = ((IStructuredSelection) receiver).toList();
+ FSTreeNode hovered = null;
+ Assert.isTrue(!selection.isEmpty());
+ if (selection.size() == 1) {
+ FSTreeNode node = selection.get(0);
+ if (node.isFile()) {
+ hovered = node.parent;
+ }
+ else {
+ hovered = node;
+ }
+ }
+ else {
+ for (FSTreeNode node : selection) {
+ if (hovered == null) hovered = node.parent;
+ else if (hovered != node.parent) return false;
+ }
+ }
+ if (hovered.isDirectory() && hovered.isWritable()) {
+ return true;
+ }
+ return false;
+ }
+ else if (!cb.isEmpty()) {
+ List<FSTreeNode> nodes = cb.getFiles();
+ boolean moving = cb.isCutOp();
+ boolean copying = cb.isCopyOp();
+ List<FSTreeNode> selection = ((IStructuredSelection) receiver).toList();
+ FSTreeNode hovered = null;
+ Assert.isTrue(!selection.isEmpty());
+ if (selection.size() == 1) {
+ FSTreeNode node = selection.get(0);
+ if (node.isDirectory() && moving) {
+ hovered = node;
+ }
+ else if (node.isRoot()) {
+ hovered = node;
+ }
+ else {
+ hovered = node.parent;
+ }
+ }
+ else {
+ for (FSTreeNode node : selection) {
+ if (hovered == null) hovered = node.parent;
+ else if (hovered != node.parent) return false;
+ }
+ }
+ if (hovered.isDirectory() && hovered.isWritable() && (moving || copying)) {
+ FSTreeNode head = nodes.get(0);
+ String hid = head.peerNode.getPeerId();
+ String tid = hovered.peerNode.getPeerId();
+ if (hid.equals(tid)) {
+ for (FSTreeNode node : nodes) {
+ if (moving && node.parent == hovered || node.isAncestorOf(hovered)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java
new file mode 100644
index 000000000..cc02faf5a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+
+/**
+ * The property tester of a ColumnViewerEditorActivationEvent.
+ * The properties include "isEditorActivation" which calculates
+ * if the event will trigger a cell editing action.
+ */
+public class EditorActivationEventPropertyTester extends PropertyTester {
+
+ /**
+ * Create an instance.
+ */
+ public EditorActivationEventPropertyTester() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ Assert.isTrue(receiver instanceof ColumnViewerEditorActivationEvent);
+ ColumnViewerEditorActivationEvent event = (ColumnViewerEditorActivationEvent) receiver;
+ if (property.equals("isEditorActivation")) { //$NON-NLS-1$
+ return event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
new file mode 100644
index 000000000..48580c487
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator to validate the path of the parent directory in the new file/folder wizard
+ * page is valid. It is only when it is not empty and it exists in the target peer.
+ *
+ * @see Validator
+ */
+public class FolderValidator extends Validator {
+ // The wizard page to create the new node.
+ private NewNodeWizardPage page;
+
+ /**
+ * Create a folder validator of the specified wizard page.
+ *
+ * @param page The wizard page to create the new file/folder.
+ */
+ public FolderValidator(NewNodeWizardPage page) {
+ super(ATTR_MANDATORY);
+ this.page = page;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.Validator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ if (newText == null || newText.trim().length() == 0) {
+ setMessage(Messages.FolderValidator_SpecifyFolder, IMessageProvider.ERROR);
+ return false;
+ }
+ FSTreeNode folder = page.getInputDir();
+ if (folder == null) {
+ setMessage(NLS.bind(Messages.FolderValidator_DirNotExist, newText), IMessageProvider.ERROR);
+ return false;
+ }
+ if (!folder.isWritable()) {
+ setMessage(NLS.bind(Messages.FolderValidator_NotWritable, newText), IMessageProvider.ERROR);
+ return false;
+ }
+ setMessage(null, IMessageProvider.NONE);
+ return true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java
new file mode 100644
index 000000000..33aefd3e1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.celleditor.FSCellValidator;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator to validate the name of a file/folder in the file system of Target Explorer.
+ *
+ * @see Validator
+ */
+public class NameValidator extends Validator {
+ // The folder in which the new file/folder is to be created.
+ NewNodeWizardPage wizard;
+
+ /**
+ * Create a NameValidator with the folder in which the file/folder is created.
+ *
+ * @param wizard The parent folder in which the file/folder is created.
+ */
+ public NameValidator(NewNodeWizardPage wizard) {
+ super(ATTR_MANDATORY);
+ this.wizard = wizard;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.Validator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ FSTreeNode folder = wizard.getInputDir();
+ if(folder == null) {
+ setMessage(Messages.NameValidator_SpecifyFolder, IMessageProvider.INFORMATION);
+ return false;
+ }
+ if (newText == null || newText.trim().length() == 0) {
+ setMessage(Messages.FSRenamingAssistant_SpecifyNonEmptyName, IMessageProvider.ERROR);
+ return false;
+ }
+ String text = newText.trim();
+ if (hasChild(text)) {
+ setMessage(Messages.FSRenamingAssistant_NameAlreadyExists, IMessageProvider.ERROR);
+ return false;
+ }
+ String formatRegex = folder.isWindowsNode() ? FSCellValidator.WIN_FILENAME_REGEX : FSCellValidator.UNIX_FILENAME_REGEX;
+ if (!text.matches(formatRegex)) {
+ setMessage(folder.isWindowsNode() ? Messages.FSRenamingAssistant_WinIllegalCharacters : Messages.FSRenamingAssistant_UnixIllegalCharacters, IMessageProvider.ERROR);
+ return false;
+ }
+ setMessage(null, IMessageProvider.NONE);
+ return true;
+ }
+
+ /**
+ * To test if the folder has a child with the specified name.
+ *
+ * @param name The name.
+ * @return true if it has a child with the name.
+ */
+ private boolean hasChild(String name) {
+ List<FSTreeNode> nodes = getChildren();
+ for (FSTreeNode node : nodes) {
+ if (node.isWindowsNode()) {
+ if (node.name.equalsIgnoreCase(name)) return true;
+ }
+ else if (node.name.equals(name)) return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get the folder's current children. If the children has not yet been loaded, then load it.
+ *
+ * @return The current children of the folder.
+ */
+ private List<FSTreeNode> getChildren() {
+ final FSTreeNode folder = wizard.getInputDir();
+ if (folder.childrenQueried) {
+ return folder.unsafeGetChildren();
+ }
+ final List<FSTreeNode> result = new ArrayList<FSTreeNode>();
+ SafeRunner.run(new SafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ result.addAll(new Operation().getChildren(folder));
+ }
+ });
+ return result;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java
new file mode 100644
index 000000000..4f6f6e569
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFile;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * The wizard to create a new file in the file system of Target Explorer.
+ */
+public class NewFileWizard extends NewNodeWizard {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizard#createWizardPage()
+ */
+ @Override
+ protected NewNodeWizardPage createWizardPage() {
+ return new NewFileWizardPage();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizard#getCreateOp(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, java.lang.String, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ protected OpCreate getCreateOp(FSTreeNode folder, String name) {
+ return new OpCreateFile(folder, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizard#getTitle()
+ */
+ @Override
+ protected String getTitle() {
+ return Messages.NewFileWizard_NewFileWizardTitle;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java
new file mode 100644
index 000000000..b2f812442
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * The wizard page to create a new file in the file system of Target Explorer.
+ */
+public class NewFileWizardPage extends NewNodeWizardPage {
+
+ /**
+ * Create a wizard page to create a new file in the specified folder.
+ */
+ public NewFileWizardPage() {
+ super("NewFileWizardPage"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizardPage#getPageTitle()
+ */
+ @Override
+ protected String getPageTitle() {
+ return Messages.NewFileWizardPage_NewFileWizardPageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizardPage#getPageDescription()
+ */
+ @Override
+ protected String getPageDescription() {
+ return Messages.NewFileWizardPage_NewFileWizardPageDescription;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizardPage#getNameFieldLabel()
+ */
+ @Override
+ protected String getNameFieldLabel() {
+ return Messages.NewFileWizardPage_NewFileWizardPageNameLabel;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java
new file mode 100644
index 000000000..296efabbe
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFolder;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * The wizard to create a new folder in the file system of Target Explorer.
+ */
+public class NewFolderWizard extends NewNodeWizard {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizard#createWizardPage()
+ */
+ @Override
+ protected NewNodeWizardPage createWizardPage() {
+ return new NewFolderWizardPage();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizard#getCreateOp(org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode, java.lang.String, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ protected OpCreate getCreateOp(FSTreeNode folder, String name) {
+ return new OpCreateFolder(folder, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizard#getTitle()
+ */
+ @Override
+ protected String getTitle() {
+ return Messages.NewFolderWizard_NewFolderWizardTitle;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java
new file mode 100644
index 000000000..8e495f031
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+
+/**
+ * The wizard page to create a new folder in the file system of Target Explorer.
+ */
+public class NewFolderWizardPage extends NewNodeWizardPage {
+
+ /**
+ * Create a wizard page to create a new folder in the specified folder.
+ */
+ public NewFolderWizardPage() {
+ super("NewFolderWizardPage"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizardPage#getPageTitle()
+ */
+ @Override
+ protected String getPageTitle() {
+ return Messages.NewFolderWizardPage_NewFolderWizardPageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizardPage#getPageDescription()
+ */
+ @Override
+ protected String getPageDescription() {
+ return Messages.NewFolderWizardPage_NewFolderWizardPageDescription;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.wizards.NewNodeWizardPage#getNameFieldLabel()
+ */
+ @Override
+ protected String getNameFieldLabel() {
+ return Messages.NewFolderWizardPage_NewFolderWizardPageNameLabel;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java
new file mode 100644
index 000000000..343ea1d62
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+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.jface.viewers.TreeViewer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
+import org.eclipse.tcf.te.ui.wizards.AbstractWizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.IFormPage;
+import org.eclipse.ui.navigator.CommonNavigator;
+
+/**
+ * The base wizard class to create a new file/folder in the file system of Target Explorer.
+ */
+public abstract class NewNodeWizard extends AbstractWizard implements INewWizard {
+ // The folder in which the new node is created.
+ private FSTreeNode folder;
+ // The target peer where the new node is created.
+ private IPeerModel peer;
+ // The wizard page used to create the new node.
+ private NewNodeWizardPage newPage;
+ // The workbench
+ private IWorkbench workbench;
+
+ /**
+ * Create an instance.
+ */
+ public NewNodeWizard() {
+ setNeedsProgressMonitor(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ // Set the window title
+ setWindowTitle(getTitle());
+ if (!selection.isEmpty()) {
+ Object element = selection.getFirstElement();
+ if (element instanceof FSTreeNode) {
+ folder = (FSTreeNode) element;
+ if (folder.isFile()) {
+ // If the selected is a file, then create the node in the parent folder.
+ folder = folder.parent;
+ }
+ peer = folder.peerNode;
+ }
+ else if (element instanceof IPeerModel) {
+ if(hasFileSystem((IPeerModel) element)) {
+ peer = (IPeerModel) element;
+ }
+ }
+ }
+ }
+
+ /**
+ * Test if the specified target peer has a file system service.
+ *
+ * @param peer The target peer.
+ * @return true if it has a file system service.
+ */
+ public boolean hasFileSystem(final IPeerModel peer) {
+ if(Protocol.isDispatchThread()) {
+ String services = null;
+ services = peer.getStringProperty(IPeerModelProperties.PROP_REMOTE_SERVICES);
+ if (services != null) {
+ // Lookup each service individually
+ for (String service : services.split(",")) { //$NON-NLS-1$
+ if (service != null && service.trim().equals("FileSystem")) { //$NON-NLS-1$
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ final boolean[] result = new boolean[1];
+ Protocol.invokeAndWait(new Runnable(){
+ @Override
+ public void run() {
+ result[0] = hasFileSystem(peer);
+ }});
+ return result[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ if (peer == null) {
+ addPage(new TargetSelectionPage());
+ }
+ addPage(newPage = createWizardPage());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ if (newPage != null) {
+ // Save the value so that next time it is used as the default input.
+ newPage.saveWidgetValues();
+ // Get the new name and create the node.
+ String name = newPage.getNodeName();
+ FSTreeNode dest = newPage.getInputDir();
+ final OpCreate create = getCreateOp(dest, name);
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ create.run(monitor);
+ }};
+ try {
+ getContainer().run(false, false, runnable);
+ final FSTreeNode newNode = create.getNode();
+ getShell().getDisplay().asyncExec(new Runnable(){
+ @Override
+ public void run() {
+ selectNewNode(newNode);
+ }});
+ return true;
+ }
+ catch (InvocationTargetException e) {
+ newPage.setErrorMessage(e.getLocalizedMessage());
+ }
+ catch (InterruptedException e) {
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Select the specified node in the selection provider.
+ *
+ * @param node The node to be selected.
+ */
+ void selectNewNode(FSTreeNode node) {
+ TreeViewer viewer = getFocusedViewer();
+ if(viewer != null) {
+ viewer.refresh(folder);
+ ISelection selection = new StructuredSelection(node);
+ viewer.setSelection(selection, true);
+ }
+ }
+
+ /**
+ * Get currently focused tree viewer.
+ *
+ * @return currently focused tree viewer or null.
+ */
+ TreeViewer getFocusedViewer() {
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window != null) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ IWorkbenchPart part = page.getActivePart();
+ if (part instanceof FormEditor) {
+ FormEditor formEditor = (FormEditor) part;
+ IFormPage formPage = formEditor.getActivePageInstance();
+ if (formPage instanceof TreeViewerExplorerEditorPage) {
+ TreeViewerExplorerEditorPage viewerPage = (TreeViewerExplorerEditorPage) formPage;
+ return (TreeViewer) viewerPage.getTreeControl().getViewer();
+ }
+ } else if (part instanceof CommonNavigator) {
+ CommonNavigator navigator = (CommonNavigator) part;
+ return navigator.getCommonViewer();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a wizard page to create a new node.
+ *
+ * @return The new wizard page.
+ */
+ protected abstract NewNodeWizardPage createWizardPage();
+
+ /**
+ * Create a Create operation instance using the specified folder and the new name.
+ *
+ * @param folder The folder in which the new node is created.
+ * @param name The name of the new node.
+ * @return a FSCreate instance to do the creation.
+ */
+ protected abstract OpCreate getCreateOp(FSTreeNode folder, String name);
+
+ /**
+ * The wizard's title to be used.
+ *
+ * @return The wizard's title to be used.
+ */
+ protected abstract String getTitle();
+
+ /**
+ * Get the current target peer selected.
+ *
+ * @return The target peer selected.
+ */
+ public IPeerModel getPeer(){
+ return peer;
+ }
+
+ /**
+ * Set the currently selected target peer.
+ *
+ * @param peer The newly selected target peer.
+ */
+ public void setPeer(IPeerModel peer) {
+ this.peer = peer;
+ newPage.setPeer(peer);
+ }
+
+ /**
+ * Get the current selected folder.
+ *
+ * @return the current selected folder.
+ */
+ public FSTreeNode getFolder() {
+ return folder;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
new file mode 100644
index 000000000..1ed6d275e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeViewerSorter;
+import org.eclipse.tcf.te.tcf.filesystem.ui.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.IFSConstants;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
+import org.eclipse.tcf.te.ui.trees.FilterDescriptor;
+import org.eclipse.tcf.te.ui.trees.ViewerStateManager;
+import org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage;
+import org.eclipse.ui.IDecoratorManager;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * The base wizard page class to create a new file/folder in the file system of Target Explorer.
+ */
+public abstract class NewNodeWizardPage extends AbstractValidatingWizardPage {
+ // The form toolkit to create the content of the wizard page.
+ private FormToolkit toolkit;
+ // The control for the user to enter the new name.
+ private BaseEditBrowseTextControl nameControl;
+ // The control for the user to enter the parent directory
+ private BaseEditBrowseTextControl folderControl;
+ // The viewer of the file tree displaying the file system.
+ private TreeViewer treeViewer;
+
+ /**
+ * Create an instance page with the specified page name.
+ *
+ * @param pageName The page name.
+ */
+ public NewNodeWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * Get the page's title.
+ *
+ * @return The page's title.
+ */
+ protected abstract String getPageTitle();
+
+ /**
+ * Get the page's description.
+ *
+ * @return The page's description.
+ */
+ protected abstract String getPageDescription();
+
+ /**
+ * Get the label of the text field to enter the new name.
+ *
+ * @return The label of the text field to enter the new name.
+ */
+ protected abstract String getNameFieldLabel();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ // Setup title and description
+ setTitle(getPageTitle());
+ setDescription(getPageDescription());
+
+ // Create the forms toolkit
+ toolkit = new FormToolkit(parent.getDisplay());
+
+ // Create the main panel
+ Composite mainPanel = toolkit.createComposite(parent);
+ mainPanel.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
+ mainPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ mainPanel.setBackground(parent.getBackground());
+
+ setControl(mainPanel);
+
+ // Setup the help
+ PlatformUI.getWorkbench().getHelpSystem()
+ .setHelp(mainPanel, IContextHelpIds.FS_NEW_FILE_WIZARD_PAGE);
+
+ // Do not validate the page while creating the controls
+ boolean changed = setValidationInProgress(true);
+ // Create the main panel sub controls
+ createMainPanelControls(mainPanel);
+ // Reset the validation in progress state
+ if (changed) setValidationInProgress(false);
+
+ // Adjust the font
+ Dialog.applyDialogFont(mainPanel);
+
+ // Validate the page for the first time
+ setPageComplete(false);
+ }
+
+ /**
+ * Create the main panel of this wizard page.
+ *
+ * @param parent The parent composite in which the page is created.
+ */
+ private void createMainPanelControls(Composite parent) {
+ Assert.isNotNull(parent);
+
+ // Create the client composite
+ Composite client = toolkit.createComposite(parent);
+ client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
+ client.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ client.setBackground(parent.getBackground());
+
+ Label label = new Label(client, SWT.NONE);
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ label.setText(Messages.NewNodeWizardPage_PromptFolderLabel);
+
+ folderControl = new BaseEditBrowseTextControl(this);
+ folderControl.setIsGroup(false);
+ folderControl.setHasHistory(false);
+ folderControl.setHideBrowseButton(true);
+ folderControl.setHideLabelControl(true);
+ folderControl.setAdjustBackgroundColor(true);
+ folderControl.setHideEditFieldControlDecoration(true);
+ folderControl.setFormToolkit(toolkit);
+ folderControl.setParentControlIsInnerPanel(true);
+ folderControl.setupPanel(client);
+ folderControl.setEditFieldValidator(new FolderValidator(this));
+ NewNodeWizard wizard = getWizard();
+ FSTreeNode folder = wizard.getFolder();
+ if (folder != null) folderControl.setEditFieldControlText(folder.getLocation());
+
+ treeViewer = new TreeViewer(client, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.horizontalSpan = 2;
+ data.heightHint = 193;
+ data.widthHint = 450;
+ treeViewer.getTree().setLayoutData(data);
+ treeViewer.setContentProvider(new FSTreeContentProvider());
+ treeViewer.setLabelProvider(createDecoratingLabelProvider(new FSTreeElementLabelProvider()));
+ treeViewer.setComparator(new FSTreeViewerSorter());
+ treeViewer.addFilter(new DirectoryFilter());
+ IPeerModel peer = wizard.getPeer();
+ if (peer != null) {
+ setInput(peer);
+ }
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ onSelectionChanged();
+ }
+ });
+ if (folder != null) treeViewer.setSelection(new StructuredSelection(folder));
+
+ nameControl = new BaseEditBrowseTextControl(this);
+ nameControl.setIsGroup(false);
+ nameControl.setHasHistory(false);
+ nameControl.setHideBrowseButton(true);
+ nameControl.setEditFieldLabel(getNameFieldLabel());
+ nameControl.setAdjustBackgroundColor(true);
+ nameControl.setFormToolkit(toolkit);
+ nameControl.setParentControlIsInnerPanel(true);
+ nameControl.setupPanel(client);
+ nameControl.setEditFieldValidator(new NameValidator(this));
+
+ if (folder == null) folderControl.getEditFieldControl().setFocus();
+ else nameControl.getEditFieldControl().setFocus();
+
+ // restore the widget values from the history
+ restoreWidgetValues();
+ }
+
+ /**
+ * The viewer filter to filter out files.
+ */
+ static class DirectoryFilter extends ViewerFilter {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ return node.isDirectory() || node.isPendingNode();
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Set the input of the tree viewer and apply the appropriate filters.
+ *
+ * @param input The tree viewer's input.
+ */
+ private void setInput(Object input) {
+ treeViewer.setInput(input);
+ FilterDescriptor[] filterDescriptors = ViewerStateManager.getInstance().getFilterDescriptors(IFSConstants.ID_TREE_VIEWER_FS, input);
+ if (filterDescriptors != null) {
+ for (FilterDescriptor descriptor : filterDescriptors) {
+ if (descriptor.isEnabled()) treeViewer.addFilter(descriptor.getFilter());
+ }
+ }
+ }
+
+ /**
+ * Create a decorating label provider using the specified label provider.
+ *
+ * @param labelProvider The label provider that actually provides labels and images.
+ * @return The decorating label provider.
+ */
+ private static ILabelProvider createDecoratingLabelProvider(ILabelProvider labelProvider) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IDecoratorManager manager = workbench.getDecoratorManager();
+ ILabelDecorator decorator = manager.getLabelDecorator();
+ return new DecoratingLabelProvider(labelProvider,decorator);
+ }
+
+ /**
+ * Event process handling method when the user select a new folder in the file tree.
+ */
+ protected void onSelectionChanged() {
+ if (treeViewer.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ if (selection.getFirstElement() instanceof FSTreeNode) {
+ FSTreeNode folder = (FSTreeNode) selection.getFirstElement();
+ folderControl.setEditFieldControlText(folder.getLocation());
+ }
+ else {
+ folderControl.setEditFieldControlText(""); //$NON-NLS-1$
+ }
+ }
+
+ // Update the wizard container UI elements
+ IWizardContainer container = getContainer();
+ if (container != null && container.getCurrentPage() != null) {
+ container.updateWindowTitle();
+ container.updateTitleBar();
+ container.updateButtons();
+ }
+ validate();
+ }
+
+ /**
+ * Set a new peer as the input of the file tree. Called
+ * by the wizard to update the file tree when an alternative
+ * target peer is selected in the target selection page.
+ *
+ * @param peer The new target peer.
+ */
+ public void setPeer(IPeerModel peer) {
+ if (peer != null) {
+ setInput(peer);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#validate()
+ */
+ @Override
+ public void validate() {
+ super.validate();
+ if (!isPageComplete()) return;
+
+ if (isValidationInProgress()) return;
+ setValidationInProgress(true);
+
+ boolean valid = true;
+ if (folderControl != null) {
+ valid &= folderControl.isValid();
+ setMessage(folderControl.getMessage(), folderControl.getMessageType());
+ }
+
+ if (nameControl != null) {
+ valid &= nameControl.isValid();
+ if (nameControl.getMessageType() > getMessageType()) {
+ setMessage(nameControl.getMessage(), nameControl.getMessageType());
+ }
+ }
+
+ setPageComplete(valid);
+ setValidationInProgress(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (nameControl != null) {
+ nameControl.dispose();
+ nameControl = null;
+ }
+ super.dispose();
+ }
+
+ /**
+ * Get the entered name of this node.
+ *
+ * @return The entered name of this node.
+ */
+ public String getNodeName() {
+ return nameControl.getEditFieldControlTextForValidation();
+ }
+
+ /**
+ * Get the parent wizard. Override the parent method to
+ * cast the result to NewNodeWizard.
+ */
+ @Override
+ public NewNodeWizard getWizard() {
+ return (NewNodeWizard) super.getWizard();
+ }
+
+ /**
+ * Get the currently input directory node. It parses
+ * the currently entered path and tries to find the
+ * corresponding directory node in the file system of
+ * the target peer.
+ *
+ * @return The directory node if it exists or else null.
+ */
+ public FSTreeNode getInputDir() {
+ NewNodeWizard wizard = getWizard();
+ IPeerModel peer = wizard.getPeer();
+ if (peer == null) return null;
+ final String text = folderControl.getEditFieldControlText();
+ if (text != null) {
+ String path = text.trim();
+ return FSModel.findTreeNode(peer, path);
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetContentProvider.java
new file mode 100644
index 000000000..0592a2dc1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetContentProvider.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.ui.views.interfaces.IRoot;
+
+/**
+ * The content provider used by TargetSelectionPage to provide the current
+ * target list.
+ */
+public class TargetContentProvider implements ITreeContentProvider {
+ private final static Object[] NO_ELEMENTS = new Object[0];
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Object[] children = NO_ELEMENTS;
+ // If it is the locator model, get the peers
+ if (parentElement instanceof ILocatorModel) {
+ children = ((ILocatorModel)parentElement).getPeers();
+ }
+ return children;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ // If it is a peer model node, return the parent locator model
+ if (element instanceof IPeerModel) {
+ return ((IPeerModel)element).getModel();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ boolean hasChildren = false;
+ if (element instanceof ILocatorModel) {
+ hasChildren = ((ILocatorModel)element).getPeers().length > 0;
+ }
+ return hasChildren;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ final ILocatorModel model = Model.getModel();
+ if (model != null && newInput instanceof IRoot) {
+ // Refresh the model asynchronously
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ model.getService(ILocatorModelRefreshService.class).refresh();
+ }
+ });
+ }
+ }
+}
+
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java
new file mode 100644
index 000000000..78b71b7ed
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java
@@ -0,0 +1,49 @@
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.ui.navigator.LabelProvider;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+/**
+ * A class that handles filtering wizard node items based on a supplied matching
+ * string and keywords
+ * <p>
+ * This class is copied and adapted from <code>org.eclipse.ui.internal.dialogs.WizardPatternFilter</code>.
+ *
+ * @since 3.8
+ */
+public class TargetPatternFilter extends PatternFilter {
+ private LabelProvider targetLabelProvider = new LabelProvider();
+ /**
+ * Create a new instance of a WizardPatternFilter
+ * @param isMatchItem
+ */
+ public TargetPatternFilter() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.internal.dialogs.PatternFilter#isElementSelectable(java.lang.Object)
+ */
+ @Override
+ public boolean isElementSelectable(Object element) {
+ return element instanceof IPeerModel;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.internal.dialogs.PatternFilter#isElementMatch(org.eclipse.jface.viewers.Viewer, java.lang.Object)
+ */
+ @Override
+ protected boolean isLeafMatch(Viewer viewer, Object element) {
+ if ( element instanceof IPeerModel) {
+ String text = targetLabelProvider.getText(element);
+ if (wordMatches(text)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
new file mode 100644
index 000000000..785b2bf2a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+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.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.ui.navigator.LabelProvider;
+import org.eclipse.tcf.te.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.interfaces.IUIConstants;
+import org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+/**
+ * The New Target creation wizard selection page implementation.
+ * <p>
+ * This class is copied and adapted from <code>org.eclipse.tcf.te.ui.wizards.newWizard.NewWizardSelectionPage</code>.
+ *
+ * @since 3.8
+ */
+public class TargetSelectionPage extends AbstractValidatingWizardPage {
+ // References to the page subcontrol's
+ private FilteredTree filteredTree;
+ private PatternFilter filteredTreeFilter;
+
+ // The workbench instance as passed in by init(...)
+ private IWorkbench workbench;
+ // The selection as passed in by init(...)
+ private IStructuredSelection selection;
+ // The tree viewer to display the targets.
+ private TreeViewer treeViewer;
+
+ /**
+ * Internal class. The wizard viewer comparator is responsible for the sorting in the tree.
+ * Current implementation is not prioritizing categories.
+ */
+ /* default */static class TargetViewerComparator extends ViewerComparator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerComparator#isSorterProperty(java.lang.Object,
+ * java.lang.String)
+ */
+ @Override
+ public boolean isSorterProperty(Object element, String property) {
+ // The comparator is affected if the label of the elements should change.
+ return property.equals(IBasicPropertyConstants.P_TEXT);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param wizardRegistry The new target wizard registry. Must not be <code>null</code>.
+ */
+ public TargetSelectionPage() {
+ super(TargetSelectionPage.class.getSimpleName());
+ setTitle(getDefaultTitle());
+ setDescription(getDefaultDescription());
+ }
+
+ @Override
+ public NewNodeWizard getWizard() {
+ return (NewNodeWizard) super.getWizard();
+ }
+ /**
+ * Returns the default page title.
+ *
+ * @return The default page title. Must be never <code>null</code>.
+ */
+ protected String getDefaultTitle() {
+ return Messages.TargetSelectionPage_Title;
+ }
+
+ /**
+ * Returns the default page description.
+ *
+ * @return The default page description. Must be never <code>null</code>.
+ */
+ protected String getDefaultDescription() {
+ return Messages.TargetSelectionPage_Description;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ label.setText(Messages.TargetSelectionPage_Targets);
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ filteredTreeFilter = new TargetPatternFilter();
+ filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filteredTreeFilter, true);
+ filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 250;
+ layoutData.widthHint = 450;
+ filteredTree.setLayoutData(layoutData);
+
+ treeViewer = filteredTree.getViewer();
+ treeViewer.setContentProvider(new TargetContentProvider());
+ treeViewer.setLabelProvider(new LabelProvider());
+ treeViewer.setComparator(new TargetViewerComparator());
+ ViewerFilter fsPeerFilter = new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IPeerModel) {
+ IPeerModel peer = (IPeerModel) element;
+ NewNodeWizard wizard = getWizard();
+ return wizard.hasFileSystem(peer);
+ }
+ return false;
+ }
+ };
+ treeViewer.addFilter(fsPeerFilter);
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ onSelectionChanged();
+ }
+ });
+ treeViewer.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ // Double-click on a connection type is triggering the sub wizard
+ if (event.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ // The tree is single selection, so look for the first element only.
+ Object element = selection.getFirstElement();
+ if (element instanceof IPeerModel) {
+ // Double-click on a connection type is triggering the sub wizard
+ getWizard().getContainer().showPage(getNextPage());
+ }
+ else if (event.getViewer() instanceof TreeViewer) {
+ TreeViewer viewer = (TreeViewer) event.getViewer();
+ if (viewer.isExpandable(element)) {
+ viewer.setExpandedState(element, !viewer.getExpandedState(element));
+ }
+ }
+ }
+ }
+ });
+
+ treeViewer.setInput(Model.getModel());
+ NewNodeWizard wizard = getWizard();
+ IPeerModel peer = wizard.getPeer();
+ if (wizard.getPeer() != null) {
+ treeViewer.setSelection(new StructuredSelection(peer), true);
+ }
+
+ // apply the standard dialog font
+ Dialog.applyDialogFont(composite);
+
+ setControl(composite);
+
+ // Restore the tree state
+ restoreWidgetValues();
+
+ // Initialize the context help id
+ PlatformUI.getWorkbench().getHelpSystem()
+ .setHelp(getControl(), IUIConstants.HELP_NEW_WIZARD_SELECTION_PAGE);
+
+ setPageComplete(peer != null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#validate()
+ */
+ @Override
+ public void validate() {
+ super.validate();
+ if (!isPageComplete()) return;
+ if (isValidationInProgress()) return;
+ setValidationInProgress(true);
+ boolean valid = true;
+ ISelection selection = treeViewer.getSelection();
+ if (selection.isEmpty()) {
+ setMessage(getDefaultDescription(), IMessageProvider.ERROR);
+ valid = false;
+ }
+ setPageComplete(valid);
+ setValidationInProgress(false);
+ }
+
+ /**
+ * Initialize the page with the current workbench instance and the current workbench selection.
+ *
+ * @param workbench The current workbench.
+ * @param selection The current object selection.
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+ /**
+ * Returns the current workbench.
+ *
+ * @return The current workbench or <code>null</code> if not set.
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ /**
+ * Returns the current object selection.
+ *
+ * @return The current object selection or <code>null</code> if not set.
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * Called from the selection listener to propagate the current system type selection to the
+ * underlying wizard.
+ */
+ protected void onSelectionChanged() {
+ if (filteredTree.getViewer().getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection filteredTreeSelection = (IStructuredSelection) filteredTree
+ .getViewer().getSelection();
+ NewNodeWizard wizard = getWizard();
+ if (filteredTreeSelection.getFirstElement() instanceof IPeerModel) {
+ wizard.setPeer((IPeerModel) filteredTreeSelection.getFirstElement());
+ }
+ else {
+ wizard.setPeer(null);
+ }
+ }
+
+ // Update the wizard container UI elements
+ IWizardContainer container = getContainer();
+ if (container != null && container.getCurrentPage() != null) {
+ container.updateWindowTitle();
+ container.updateTitleBar();
+ container.updateButtons();
+ }
+ validate();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#getDialogSettings()
+ */
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ // If the wizard is set and returns dialog settings, we re-use them here
+ IDialogSettings settings = super.getDialogSettings();
+ // If the dialog settings could not set from the wizard, fallback to the plugin's
+ // dialog settings store.
+ if (settings == null) settings = UIPlugin.getDefault().getDialogSettings();
+ String sectionName = this.getClass().getName();
+ if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
+ settings = settings.getSection(sectionName);
+
+ return settings;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
new file mode 100644
index 000000000..8e659d1d6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ * William Chen (Wind River) - [345384] Provide property pages for remote file system nodes
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.nls;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * File System plug-in externalized strings management.
+ */
+public class Messages extends NLS {
+
+ // The plug-in resource bundle name
+ private static final String BUNDLE_NAME = "org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages"; //$NON-NLS-1$
+
+ /**
+ * Static constructor.
+ */
+ static {
+ // Load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * Returns if or if not this NLS manager contains a constant for
+ * the given externalized strings key.
+ *
+ * @param key The externalized strings key or <code>null</code>.
+ * @return <code>True</code> if a constant for the given key exists, <code>false</code> otherwise.
+ */
+ public static boolean hasString(String key) {
+ if (key != null) {
+ try {
+ Field field = Messages.class.getDeclaredField(key);
+ return field != null;
+ } catch (NoSuchFieldException e) { /* ignored on purpose */ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the corresponding string for the given externalized strings
+ * key or <code>null</code> if the key does not exist.
+ *
+ * @param key The externalized strings key or <code>null</code>.
+ * @return The corresponding string or <code>null</code>.
+ */
+ public static String getString(String key) {
+ if (key != null) {
+ try {
+ Field field = Messages.class.getDeclaredField(key);
+ if (field != null) {
+ return (String)field.get(null);
+ }
+ } catch (Exception e) { /* ignored on purpose */ }
+ }
+
+ return null;
+ }
+
+ // **** Declare externalized string id's down here *****
+
+ public static String AdvancedAttributesDialog_Archive;
+ public static String AdvancedAttributesDialog_ArchiveIndex;
+ public static String AdvancedAttributesDialog_Compress;
+ public static String AdvancedAttributesDialog_Compressed;
+ public static String AdvancedAttributesDialog_CompressEncrypt;
+ public static String AdvancedAttributesDialog_Device;
+ public static String AdvancedAttributesDialog_Directory;
+ public static String AdvancedAttributesDialog_Encrypt;
+ public static String AdvancedAttributesDialog_Encrypted;
+ public static String AdvancedAttributesDialog_FileArchive;
+ public static String AdvancedAttributesDialog_FileBanner;
+ public static String AdvancedAttributesDialog_FolderArchive;
+ public static String AdvancedAttributesDialog_FolderBanner;
+ public static String AdvancedAttributesDialog_Hidden;
+ public static String AdvancedAttributesDialog_Indexed;
+ public static String AdvancedAttributesDialog_IndexFile;
+ public static String AdvancedAttributesDialog_IndexFolder;
+ public static String AdvancedAttributesDialog_Normal;
+ public static String AdvancedAttributesDialog_Offline;
+ public static String AdvancedAttributesDialog_ReadOnly;
+ public static String AdvancedAttributesDialog_Reparse;
+ public static String AdvancedAttributesDialog_ShellTitle;
+ public static String AdvancedAttributesDialog_Sparse;
+ public static String AdvancedAttributesDialog_System;
+ public static String AdvancedAttributesDialog_Temporary;
+ public static String AdvancedAttributesDialog_Virtual;
+ public static String BasicFolderSection_BasicInfoText;
+
+ public static String CacheManager_Bytes;
+ public static String CacheManager_DowloadingFile;
+ public static String CacheManager_DownloadingError;
+ public static String CacheManager_DownloadingProgress;
+ public static String CacheManager_KBs;
+ public static String CacheManager_MBs;
+ public static String CacheManager_MkdirFailed;
+ public static String CacheManager_SetLastModifiedFailed;
+ public static String CacheManager_SetReadOnlyFailed;
+ public static String CacheManager_UploadingProgress;
+ public static String CacheManager_UploadNFiles;
+ public static String CacheManager_UploadSingleFile;
+
+ public static String CmmitHandler_Cancel;
+ public static String CmmitHandler_CommitAnyway;
+ public static String CmmitHandler_ErrorTitle;
+ public static String CmmitHandler_FileDeleted;
+ public static String CmmitHandler_Merge;
+ public static String CmmitHandler_StateChangedDialogTitle;
+ public static String CmmitHandler_StateChangedMessage;
+
+ public static String FolderValidator_DirNotExist;
+ public static String FolderValidator_NotWritable;
+ public static String FolderValidator_SpecifyFolder;
+ public static String FSDelete_ButtonCancel;
+ public static String FSDelete_ButtonNo;
+ public static String FSDelete_ButtonYes;
+ public static String FSDelete_ButtonYes2All;
+ public static String FSDelete_CannotRemoveFile;
+ public static String FSDelete_CannotRemoveFolder;
+ public static String FSDelete_ConfirmDelete;
+ public static String FSDelete_ConfirmMessage;
+ public static String FSDelete_Deleting;
+ public static String FSDelete_PrepareToDelete;
+ public static String FSDelete_RemovingFileFolder;
+
+ public static String DeleteFilesHandler_DeleteMultipleFilesConfirmation;
+ public static String DeleteFilesHandler_DeleteOneFileConfirmation;
+ public static String DeleteFilesHandler_ConfirmDialogTitle;
+
+ public static String GeneralInformationPage_Accessed;
+ public static String GeneralInformationPage_Advanced;
+ public static String GeneralInformationPage_Attributes;
+ public static String GeneralInformationPage_Computer;
+ public static String GeneralInformationPage_File;
+ public static String GeneralInformationPage_FileSizeInfo;
+ public static String GeneralInformationPage_Folder;
+ public static String GeneralInformationPage_Hidden;
+ public static String GeneralInformationPage_Location;
+ public static String GeneralInformationPage_Modified;
+ public static String GeneralInformationPage_Name;
+ public static String GeneralInformationPage_ReadOnly;
+ public static String GeneralInformationPage_Size;
+ public static String GeneralInformationPage_Type;
+ public static String GeneralInformationPage_PermissionText;
+ public static String GeneralInformationPage_PropertiesChangeFailure;
+ public static String GeneralInformationPage_PropertiesChangeTitle;
+ public static String GeneralInformationPage_UnknownFileType;
+
+ public static String FSExplorerTreeControl_section_title;
+
+ public static String FSFolderSelectionDialog_MoveDialogMessage;
+ public static String FSFolderSelectionDialog_MoveDialogTitle;
+
+ public static String FSTreeControl_column_name_label;
+ public static String FSTreeControl_column_size_label;
+ public static String FSTreeControl_column_modified_label;
+
+ public static String FSTreeNode_TypeFile;
+ public static String FSTreeNode_TypeFileFolder;
+ public static String FSTreeNode_TypeLocalDisk;
+ public static String FSTreeNode_TypeSystemFile;
+
+ public static String FSTreeNodeContentProvider_rootNode_label;
+
+ public static String FSOpenFileDialog_message;
+ public static String FSOpenFileDialog_title;
+ public static String FSOperation_CopyNOfFile;
+ public static String FSOperation_CopyOfFile;
+
+ public static String LinuxPermissionsSection_Permissions;
+ public static String LocalTypedElement_SavingFile;
+
+ public static String OpenFileHandler_Cancel;
+ public static String OpenFileHandler_ConflictingMessage;
+ public static String OpenFileHandler_ConflictingTitle;
+ public static String OpenFileHandler_Merge;
+ public static String OpenFileHandler_OpenAnyway;
+ public static String OpenFileHandler_OpeningBinaryNotSupported;
+ public static String OpenFileHandler_Warning;
+
+ public static String OpenWithMenu_ChooseEditorForOpening;
+ public static String OpenWithMenu_DefaultEditor;
+ public static String OpenWithMenu_NoEditorFound;
+ public static String OpenWithMenu_OpenWith;
+
+ public static String FSCopy_CannotCopyFile;
+ public static String FSCopy_CopyFileFolderTitle;
+ public static String FSCopy_Copying;
+ public static String FSCopy_CopyingFile;
+ public static String FSCopy_PrepareToCopy;
+
+ public static String FSCreate_CreationFailed;
+ public static String FSCreate_JobTitle;
+ public static String FSCreate_TaskName;
+ public static String FSMove_CannotMove;
+ public static String FSMove_FileExistsError;
+ public static String FSMove_FolderExistsError;
+ public static String FSMove_MovingFile;
+ public static String FSMove_Moving;
+ public static String FSMove_PrepareToMove;
+ public static String FSMove_MoveFileFolderTitle;
+
+ public static String FSDelete_DeleteFileFolderTitle;
+
+ public static String FSDropTargetListener_ConfirmMoveTitle;
+ public static String FSDropTargetListener_MovingWarningMultiple;
+ public static String FSDropTargetListener_MovingWarningSingle;
+ public static String FSRename_CannotRename;
+ public static String FSRename_JobTitle;
+ public static String FSRename_RenameFileFolderTitle;
+
+ public static String FSOperation_CannotCreateDirectory;
+ public static String FSOperation_ConfirmDialogCancel;
+ public static String FSOperation_ConfirmDialogNo;
+ public static String FSOperation_ConfirmDialogYes;
+ public static String FSOperation_ConfirmDialogYesToAll;
+ public static String FSOperation_ConfirmFileReplace;
+ public static String FSOperation_ConfirmFileReplaceMessage;
+ public static String FSOperation_ConfirmFolderReplaceMessage;
+ public static String FSOperation_ConfirmFolderReplaceTitle;
+ public static String FSOperation_NoFileSystemError;
+ public static String FSOperation_NotResponding;
+ public static String FSOperation_CannotOpenDir;
+ public static String FSOperation_CannotReadDir;
+ public static String FSOperation_DeletingFileFailed;
+ public static String FSOperation_TimedOutWhenOpening;
+
+ public static String PermissionsGroup_Executable;
+ public static String PermissionsGroup_GroupPermissions;
+ public static String PermissionsGroup_OtherPermissions;
+ public static String PermissionsGroup_Readable;
+ public static String PermissionsGroup_UserPermissions;
+ public static String PermissionsGroup_Writable;
+
+ public static String RefreshDirectoryHandler_RefreshJobTitle;
+ public static String RefreshViewerHandler_RefreshJobTitle;
+ public static String RemoteTypedElement_GettingRemoteContent;
+ public static String RenameFilesHandler_PromptNewName;
+ public static String RenameFilesHandler_RenamePromptMessage;
+ public static String RenameFilesHandler_TitleRename;
+ public static String RenameFilesHandler_TitleRenameFile;
+ public static String RenameFilesHandler_TitleRenameFolder;
+ public static String FSRenamingAssistant_NameAlreadyExists;
+ public static String FSRenamingAssistant_NoNodeSelected;
+ public static String FSRenamingAssistant_SpecifyNonEmptyName;
+ public static String FSRenamingAssistant_UnixIllegalCharacters;
+ public static String FSRenamingAssistant_WinIllegalCharacters;
+ public static String FSUpload_Cancel;
+ public static String FSUpload_No;
+ public static String FSUpload_OverwriteConfirmation;
+ public static String FSUpload_OverwriteTitle;
+ public static String FSUpload_UploadTitle;
+ public static String FSUpload_Yes;
+ public static String FSUpload_YesToAll;
+
+ public static String SaveAllListener_Cancel;
+ public static String SaveAllListener_Merge;
+ public static String SaveAllListener_SaveAnyway;
+ public static String SaveAllListener_SingularMessage;
+ public static String SaveAllListener_StateChangedDialogTitle;
+
+ public static String SaveListener_Cancel;
+ public static String SaveListener_Merge;
+ public static String SaveListener_SaveAnyway;
+ public static String SaveListener_StateChangedDialogTitle;
+ public static String SaveListener_StateChangedMessage;
+
+ public static String StateManager_CannotGetFileStateMessage2;
+ public static String StateManager_CannotGetFileStatMessage;
+ public static String StateManager_CannotSetFileStateMessage;
+ public static String StateManager_CannotSetFileStateMessage2;
+ public static String StateManager_CommitFailureTitle;
+ public static String StateManager_RefreshFailureTitle;
+ public static String StateManager_TCFNotProvideFSMessage;
+ public static String StateManager_TCFNotProvideFSMessage2;
+ public static String StateManager_UpdateFailureTitle;
+
+ public static String PreferencePage_AutoSavingText;
+ public static String PreferencePage_CopyOwnershipText;
+ public static String PreferencePage_CopyPermissionText;
+ public static String PreferencePage_RenamingOptionText;
+
+ public static String TargetSelectionPage_Description;
+ public static String TargetSelectionPage_Targets;
+ public static String TargetSelectionPage_Title;
+
+ public static String TcfInputStream_CloseTimeout;
+ public static String TcfInputStream_NoDataAvailable;
+ public static String TcfInputStream_NoFileReturned;
+ public static String TcfInputStream_NoFSServiceAvailable;
+ public static String TcfInputStream_OpenFileTimeout;
+ public static String TcfInputStream_OpenTCFTimeout;
+ public static String TcfInputStream_ReadTimeout;
+ public static String TcfInputStream_StreamClosed;
+
+ public static String TcfOutputStream_StreamClosed;
+ public static String TcfOutputStream_WriteTimeout;
+
+ public static String TcfURLConnection_CloseFileTimeout;
+ public static String TcfURLConnection_NoFileHandleReturned;
+ public static String TcfURLConnection_NoFSServiceAvailable;
+ public static String TcfURLConnection_NoPeerFound;
+ public static String TcfURLConnection_NoSuchTcfAgent;
+ public static String TcfURLConnection_OpenFileTimeout;
+ public static String TcfURLConnection_OpenTCFChannelTimeout;
+ public static String TcfURLStreamHandlerService_ErrorURLFormat;
+ public static String TcfURLStreamHandlerService_IllegalCharacter;
+ public static String TcfURLStreamHandlerService_OnlyDiskPartError;
+
+ public static String OpeningChannelFailureMessage;
+ public static String OpeningChannelFailureTitle;
+
+ public static String UpdateHandler_Cancel;
+ public static String UpdateHandler_Merge;
+ public static String UpdateHandler_StateChangedDialogTitle;
+ public static String UpdateHandler_StateChangedMessage;
+ public static String UpdateHandler_UpdateAnyway;
+
+ public static String UserManager_CannotGetUserAccountMessage;
+ public static String UserManager_CannotGetUserAccountMessage2;
+ public static String UserManager_TCFNotProvideFSMessage;
+ public static String UserManager_UserAccountTitle;
+
+ public static String MergeEditorInput_CompareLeftAndRight;
+ public static String MergeEditorInput_CompareWithLocalCache;
+ public static String MergeEditorInput_LocalFile;
+ public static String MergeEditorInput_RemoteFile;
+ public static String MergeInput_CopyNotSupported;
+ public static String NameValidator_SpecifyFolder;
+ public static String NewFileWizard_NewFileWizardTitle;
+ public static String NewFileWizardPage_NewFileWizardPageDescription;
+ public static String NewFileWizardPage_NewFileWizardPageNameLabel;
+ public static String NewFileWizardPage_NewFileWizardPageTitle;
+ public static String NewFolderWizard_NewFolderWizardTitle;
+ public static String NewFolderWizardPage_NewFolderWizardPageDescription;
+ public static String NewFolderWizardPage_NewFolderWizardPageNameLabel;
+ public static String NewFolderWizardPage_NewFolderWizardPageTitle;
+ public static String NewNodeWizardPage_LstatTimedout;
+ public static String NewNodeWizardPage_PromptFolderLabel;
+ public static String WindowsAttributesSection_Attributes;
+ public static String PendingOperation_label;
+ public static String QueryDoneOpenChannel_NoFService;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
new file mode 100644
index 000000000..e149108a3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
@@ -0,0 +1,279 @@
+FolderValidator_SpecifyFolder=Please specify the folder where the file/folder is going to be created.
+#
+# org.eclipse.tcf.te.tcf.filesystem
+# Externalized Strings.
+#
+
+FolderValidator_DirNotExist=The directory {0} does not exist in the current target.
+FolderValidator_NotWritable=The directory {0} is not writable. Please choose a different one.
+
+FSExplorerTreeControl_section_title=Exploring File System
+
+FSFolderSelectionDialog_MoveDialogMessage=Choose destination for the files to be moved:
+FSFolderSelectionDialog_MoveDialogTitle=Move Files and Folders
+
+FSTreeControl_column_name_label=Name
+FSTreeControl_column_size_label=Size
+FSTreeControl_column_modified_label=Date Modified
+
+FSTreeNode_TypeFile=file
+FSTreeNode_TypeFileFolder=File Folder
+FSTreeNode_TypeLocalDisk=Local Disk
+FSTreeNode_TypeSystemFile=System file
+
+FSTreeNodeContentProvider_rootNode_label=File System
+
+FSOpenFileDialog_message=Please select an image file for the process.
+FSOpenFileDialog_title=Select Process Image
+
+FSOperation_CopyNOfFile=Copy ({0}) of {1}
+FSOperation_CopyOfFile=Copy of {0}
+
+GeneralInformationPage_Accessed=Accessed:
+GeneralInformationPage_Advanced=\ A&dvanced...
+GeneralInformationPage_Attributes=Attributes:
+GeneralInformationPage_File=File ({0})
+GeneralInformationPage_FileSizeInfo={0} KB ({1} bytes)
+GeneralInformationPage_Folder=Folder
+GeneralInformationPage_Hidden=Hidden
+GeneralInformationPage_ReadOnly=Read-only
+GeneralInformationPage_Computer=computer
+GeneralInformationPage_Location=Location:
+GeneralInformationPage_Modified=Modified:
+GeneralInformationPage_Name=Name:
+GeneralInformationPage_Size=Size:
+GeneralInformationPage_Type=Type:
+GeneralInformationPage_PermissionText=Permissions:
+GeneralInformationPage_PropertiesChangeFailure=Properties changes to {0} failed due to the following reason:{1}
+GeneralInformationPage_PropertiesChangeTitle=Properties Change
+GeneralInformationPage_UnknownFileType=Unknown File
+
+AdvancedAttributesDialog_Archive=Archive
+AdvancedAttributesDialog_ArchiveIndex=Archive and Index attributes
+AdvancedAttributesDialog_Compress=Compress contents to save disk space
+AdvancedAttributesDialog_Compressed=Compressed
+AdvancedAttributesDialog_CompressEncrypt=Compress or Encrypt attributes
+AdvancedAttributesDialog_Device=Device
+AdvancedAttributesDialog_Directory=Directory
+AdvancedAttributesDialog_Encrypt=Encrypt contents to secure data
+AdvancedAttributesDialog_Encrypted=Encrypted
+AdvancedAttributesDialog_FileArchive=File is ready for archiving
+AdvancedAttributesDialog_FileBanner=Choose the options you want for this file.
+AdvancedAttributesDialog_FolderArchive=Folder is ready for archiving
+AdvancedAttributesDialog_FolderBanner=Choose the settings you want for this folder.\n\nWhen you apply these changes you will be asked if you want the\n changes to affect all subfolders and files as well.
+AdvancedAttributesDialog_Hidden=Hidden
+AdvancedAttributesDialog_Indexed=Indexed
+AdvancedAttributesDialog_IndexFile=For fast searching, allow Indexing Service to index this file
+AdvancedAttributesDialog_IndexFolder=For fast searching, allow Indexing Service to index this folder
+AdvancedAttributesDialog_Normal=Normal
+AdvancedAttributesDialog_Offline=Offline
+AdvancedAttributesDialog_ReadOnly=Read-only
+AdvancedAttributesDialog_Reparse=Reparse
+AdvancedAttributesDialog_ShellTitle=Advanced Attributes
+AdvancedAttributesDialog_Sparse=Sparse
+AdvancedAttributesDialog_System=System
+AdvancedAttributesDialog_Temporary=Temporary
+AdvancedAttributesDialog_Virtual=Virtual
+BasicFolderSection_BasicInfoText=Basic Information
+
+CacheManager_Bytes=\ bytes
+CacheManager_DowloadingFile=Downloading file {0}...
+CacheManager_DownloadingError=Downloading Error
+CacheManager_DownloadingProgress=Downloading {0}/{1}.
+CacheManager_KBs=\ KBs
+CacheManager_MBs=\ MBs
+CacheManager_MkdirFailed=Making directory {0} failed
+CacheManager_SetLastModifiedFailed=Setting the last modified time of {0} failed\!
+CacheManager_SetReadOnlyFailed=Setting the read-only attribute of {0} failed\!
+CacheManager_UploadingProgress=Uploading file {0}: {1}/{2}
+CacheManager_UploadNFiles=Uploading {0} files...
+CacheManager_UploadSingleFile=Uploading file {0}...
+
+CmmitHandler_Cancel=Cancel
+CmmitHandler_CommitAnyway=Commit anyway
+CmmitHandler_ErrorTitle=File Deleted
+CmmitHandler_FileDeleted=The local file {0} that you are trying to commit has been deleted\!
+CmmitHandler_Merge=Merge
+CmmitHandler_StateChangedDialogTitle=State Changed
+CmmitHandler_StateChangedMessage={0} on the target has changed and is conflicting with the local file. What do you want?
+FSDelete_ButtonCancel=Cancel
+FSDelete_ButtonNo=&No
+FSDelete_ButtonYes=&Yes
+FSDelete_ButtonYes2All=Yes to &All
+FSDelete_CannotRemoveFile=Cannot remove the file {0}\!. Caused by {1}
+FSDelete_CannotRemoveFolder=Cannot remove the folder {0}\!. Caused by {1}
+FSDelete_ConfirmDelete=Confirm Delete
+DeleteFilesHandler_ConfirmDialogTitle=Confirm Delete
+FSDelete_ConfirmMessage=Are you sure you want to remove the read-only file {0}?
+DeleteFilesHandler_DeleteMultipleFilesConfirmation=Are you sure you want to delete these {0} files/folders?
+DeleteFilesHandler_DeleteOneFileConfirmation=Are you sure you want to delete {0}?
+FSDelete_Deleting=Deleting files
+FSDelete_PrepareToDelete=Prepare to delete files ...
+FSDelete_RemovingFileFolder=Removing {0} ...
+
+LinuxPermissionsSection_Permissions=Permissions
+LocalTypedElement_SavingFile=Saving file:
+
+OpenFileHandler_Cancel=Cancel
+OpenFileHandler_ConflictingMessage=The local {0} is conflicting with the remote version. What do you want?
+OpenFileHandler_ConflictingTitle=Conflicting content
+OpenFileHandler_Merge=Merge
+OpenFileHandler_OpenAnyway=Open anyway
+OpenFileHandler_OpeningBinaryNotSupported=Opening a binary file is not supported yet.
+OpenFileHandler_Warning=Warning
+
+OpenWithMenu_ChooseEditorForOpening=Choose the editor for opening {0}
+OpenWithMenu_DefaultEditor=&Default Editor
+OpenWithMenu_NoEditorFound=No editor found to edit the file resource.
+OpenWithMenu_OpenWith=Open With
+
+FSCopy_CannotCopyFile=Cannot copy file {0} because: {1}
+FSOperation_CannotCreateDirectory=Cannot create the directory {0} because: {1}
+FSMove_CannotMove=Cannot move {0} because {1}
+FSMove_FileExistsError=Cannot replace {0}: There is already a file with the same name as the folder you are moving.
+FSMove_FolderExistsError=Cannot replace {0}: There is already a folder with the same name as the file you are moving.
+FSRename_CannotRename=Cannot rename {0} because {1}
+FSRename_JobTitle=Renaming
+FSOperation_ConfirmDialogCancel=Cancel
+FSOperation_ConfirmDialogNo=&No
+FSOperation_ConfirmDialogYes=&Yes
+FSOperation_ConfirmDialogYesToAll=Yes to &All
+FSOperation_ConfirmFileReplace=Confirm File Replace
+FSOperation_ConfirmFileReplaceMessage=This folder already contains a file named {0}.\n\n If the files in the existing folder have the same name as files in the folder you are moving or copying, they will be replaced. Do you still want to move or copy the file?
+FSOperation_ConfirmFolderReplaceMessage=This folder already contains a folder named {0}.\n\n If the files in the existing folder have the same name as files in the folder you are moving or copying, they will be replaced. Do you still want to move or copy the folder?
+FSOperation_ConfirmFolderReplaceTitle=Confirm Folder Replace
+FSCopy_CopyFileFolderTitle=Error Copying File or Folder
+FSMove_MoveFileFolderTitle=Error Moving File or Folder
+FSRename_RenameFileFolderTitle=Error Renaming File or Folder
+FSDelete_DeleteFileFolderTitle=Error Deleting File or Folder
+FSDropTargetListener_ConfirmMoveTitle=Confirm Move
+FSDropTargetListener_MovingWarningMultiple=This operation will delete the files after moving. You can copy them without deletion by ctrl + dragging. \n\nAre you sure you want to move these {0} files/folders?
+FSDropTargetListener_MovingWarningSingle=This operation will delete the file after moving. You can copy it without deletion by ctrl + dragging. \n\nAre you sure you want to move {0}?
+FSCopy_Copying=Copying {0} ...
+FSCopy_CopyingFile=Copying files
+FSMove_MovingFile=Moving files
+FSMove_Moving=Moving {0} ...
+FSOperation_NoFileSystemError=This TCF agent, {0}, does not provide a file system service\!
+FSOperation_NotResponding=The TCF agent on the target {0} is probably down. It is not responding.
+FSCopy_PrepareToCopy=Prepare to copy files ...
+FSCreate_CreationFailed=Creation Failed
+FSCreate_JobTitle=Create file or folder
+FSCreate_TaskName=Creating {0}...
+FSMove_PrepareToMove=Prepare to move files...
+PermissionsGroup_Executable=Executable
+PermissionsGroup_GroupPermissions=Group:
+PermissionsGroup_OtherPermissions=Other:
+PermissionsGroup_Readable=Readable
+PermissionsGroup_UserPermissions=User:
+PermissionsGroup_Writable=Writable
+
+RefreshDirectoryHandler_RefreshJobTitle=Refresh {0}
+RefreshViewerHandler_RefreshJobTitle=Refresh the file system
+RemoteTypedElement_GettingRemoteContent=Getting content from the remote file:
+RenameFilesHandler_PromptNewName=New name:
+RenameFilesHandler_RenamePromptMessage=Please enter a new name
+RenameFilesHandler_TitleRename=Rename
+RenameFilesHandler_TitleRenameFile=Rename File
+RenameFilesHandler_TitleRenameFolder=Rename Folder
+FSRenamingAssistant_NameAlreadyExists=A file/folder with the name you specified already exists\! Specify a different name.
+FSRenamingAssistant_NoNodeSelected=No node is selected.
+FSRenamingAssistant_SpecifyNonEmptyName=Specify a non-empty name.
+FSRenamingAssistant_UnixIllegalCharacters=A file/folder name cannot contain any of the following characters:\n/
+FSRenamingAssistant_WinIllegalCharacters=A file/folder name cannot contain any of the following characters:\n\\/:*?<>|
+
+SaveAllListener_Cancel=Cancel
+SaveAllListener_Merge=Merge
+SaveAllListener_SaveAnyway=Save anyway
+SaveAllListener_SingularMessage=The file {0} on the target has changed and is conflicting with the local file. What do you want?
+SaveAllListener_StateChangedDialogTitle=State Changed
+
+SaveListener_Cancel=Cancel
+SaveListener_Merge=Merge
+SaveListener_SaveAnyway=Save anyway
+SaveListener_StateChangedDialogTitle=State Changed
+SaveListener_StateChangedMessage={0} on the target has changed and is conflicting with the local file. What do you want?
+
+StateManager_CannotGetFileStateMessage2=Cannot get the file's stat of {0}\!. Caused by {1}
+StateManager_CannotGetFileStatMessage=Cannot get the file's stat of {0}\!. Caused by {1}
+StateManager_CannotSetFileStateMessage=Cannot set the file's stat of {0}\!. Caused by {1}
+StateManager_CannotSetFileStateMessage2=Cannot set the file's stat of {0}\!. Caused by {1}
+StateManager_CommitFailureTitle=Commit Failure
+StateManager_RefreshFailureTitle=Refresh Failure
+StateManager_TCFNotProvideFSMessage=This TCF agent, {0}, does not provide a file system service\!
+StateManager_TCFNotProvideFSMessage2=This TCF agent, {0}, does not provide a file system service\!
+StateManager_UpdateFailureTitle=Update Failure
+
+PreferencePage_AutoSavingText=Automatically upload files to targets upon saving
+PreferencePage_CopyOwnershipText=Copy source UID and GID when copying files
+PreferencePage_CopyPermissionText=Copy source permissions when copying files
+PreferencePage_RenamingOptionText=Use In-place Editor when renaming a file/folder
+TargetSelectionPage_Description=Please select the target where the new file/folder is created.
+TargetSelectionPage_Targets=Targets:
+TargetSelectionPage_Title=Select the target.
+TcfInputStream_CloseTimeout=Closing has timed out\!
+TcfInputStream_NoDataAvailable=No data available
+TcfInputStream_NoFileReturned=No file handle returned\!
+TcfInputStream_NoFSServiceAvailable=No remote File System Service available\!
+TcfInputStream_OpenFileTimeout=Opening file has timed out\!
+TcfInputStream_OpenTCFTimeout=Opening TCF channel has timed out\!
+TcfInputStream_ReadTimeout=Reading has timed out\!
+TcfInputStream_StreamClosed=Stream is already closed\!
+
+TcfOutputStream_StreamClosed=Stream is already closed\!
+TcfOutputStream_WriteTimeout=Writing has timed out\!
+
+TcfURLConnection_CloseFileTimeout=Closing has timed out\!
+TcfURLConnection_NoFileHandleReturned=No file handle returned\!
+TcfURLConnection_NoFSServiceAvailable=No remote File System Service available\!
+TcfURLConnection_NoPeerFound=Cound find the specified peer with the ID {0}
+TcfURLConnection_NoSuchTcfAgent=TCF agent is already disconnected\!
+TcfURLConnection_OpenFileTimeout=Opening file has timed out\!
+TcfURLConnection_OpenTCFChannelTimeout=Opening TCF channel has timed out\!
+TcfURLStreamHandlerService_ErrorURLFormat=Error TCF URL format\!
+TcfURLStreamHandlerService_IllegalCharacter=A Windows path does not permit character {0}.
+TcfURLStreamHandlerService_OnlyDiskPartError=A Windows path should not contain only disk part.
+
+OpeningChannelFailureMessage=We cannot open a TCF channel to the target: {0}. It is caused by {1}.
+OpeningChannelFailureTitle=Opening Channel
+
+UpdateHandler_Cancel=Cancel
+UpdateHandler_Merge=Merge
+UpdateHandler_StateChangedDialogTitle=State Changed
+UpdateHandler_StateChangedMessage=The local {0} has changed and is conflicting with the remote file. What do you want?
+UpdateHandler_UpdateAnyway=Update anyway
+
+UserManager_CannotGetUserAccountMessage=Cannot get the user account from the agent {0}
+UserManager_CannotGetUserAccountMessage2=Cannot get the user account from the agent {0}. Caused by: networking too slow.
+UserManager_TCFNotProvideFSMessage=This TCF agent, {0}, does not provide a file system service\!
+UserManager_UserAccountTitle=User Account
+
+FSOperation_CannotOpenDir=Cannot open directory {0} because {1}
+FSOperation_CannotReadDir=Cannot read directory {0} because {1}
+FSOperation_DeletingFileFailed=Deleting {0} failed\!
+FSOperation_TimedOutWhenOpening=it has timed out when opening the directory\!
+FSUpload_Cancel=Cancel
+FSUpload_No=No
+FSUpload_OverwriteConfirmation=A file with a same name already exists. Are you sure to overwrite {0}?
+FSUpload_OverwriteTitle=Confirm Overwrite
+FSUpload_UploadTitle=Upload Files
+FSUpload_Yes=Yes
+FSUpload_YesToAll=Yes to All
+MergeEditorInput_CompareLeftAndRight=Compare {0} and {1}
+MergeEditorInput_CompareWithLocalCache=Compare {0} with Local Cache
+MergeEditorInput_LocalFile=Local: {0}
+MergeEditorInput_RemoteFile=Remote: {0}
+MergeInput_CopyNotSupported=Copy is not support by this type of compare input
+NameValidator_SpecifyFolder=Please specify the folder where the file/folder is going to be created.
+NewFileWizard_NewFileWizardTitle=New File Wizard
+NewFileWizardPage_NewFileWizardPageDescription=Create a new file in the directory.
+NewFileWizardPage_NewFileWizardPageNameLabel=File name:
+NewFileWizardPage_NewFileWizardPageTitle=New File
+NewFolderWizard_NewFolderWizardTitle=New Folder Wizard
+NewFolderWizardPage_NewFolderWizardPageDescription=Create a new folder in the directory.
+NewFolderWizardPage_NewFolderWizardPageNameLabel=Folder name:
+NewFolderWizardPage_NewFolderWizardPageTitle=New Folder
+NewNodeWizardPage_LstatTimedout=lstat timed out\!
+NewNodeWizardPage_PromptFolderLabel=Enter or select the parent folder:
+WindowsAttributesSection_Attributes=Attributes
+PendingOperation_label=Pending...
+QueryDoneOpenChannel_NoFService=No File System service\!

Back to the top