Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-02-17 09:32:24 +0000
committerUwe Stieber2015-02-17 09:32:24 +0000
commit3e7bc9fefb2d3e8e5abbb593a81c08b827f63e88 (patch)
tree0af0a16b03e08b7dcc3deb33abf01fed349762c0 /target_explorer/plugins
parentf00c0e318e23353e6a15bec9479d85e9856f7db5 (diff)
downloadorg.eclipse.tcf-3e7bc9fefb2d3e8e5abbb593a81c08b827f63e88.tar.gz
org.eclipse.tcf-3e7bc9fefb2d3e8e5abbb593a81c08b827f63e88.tar.xz
org.eclipse.tcf-3e7bc9fefb2d3e8e5abbb593a81c08b827f63e88.zip
Terminals: Move terminals plugins and features into separate directory structure
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.classpath (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.project (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.core.prefs77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.ui.prefs (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.ui.prefs)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.pde.prefs (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/META-INF/MANIFEST.MF38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/about.html (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/build.properties (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.properties (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.properties)10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.xml108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/pom.xml (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/pom.xml)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/activator/CorePlugin.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IConfirmCallback.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IOperation.java61
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IWindowsFileAttributes.java97
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java)25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/steps/IFileSystemStepAttributes.java26
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/UserAccount.java95
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/CallbackBase.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpen.java82
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpenChannel.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneReadDir.java96
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneRoots.java64
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneOpenChannel.java88
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneStat.java111
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFChannelException.java44
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFException.java73
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFFileSystemException.java45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/IOpExecutor.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/JobExecutor.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/NullOpExecutor.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheFileDigest.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheUpdate.java76
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java113
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java85
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java258
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java192
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java81
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java72
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java232
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java206
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java205
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpOutStreamOp.java98
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java227
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java193
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java125
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpStreamOp.java74
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java110
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java431
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUser.java167
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/Operation.java618
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/FSTreeNodePropertyTester.java116
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/TargetPropertyTester.java68
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfInputStream.java148
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java119
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java306
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLStreamHandlerService.java216
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/BlockingFileSystemProxy.java880
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java204
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/ContentTypeHelper.java120
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java257
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManager.java203
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java289
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java342
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/CacheState.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSTreeNode.java681
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java228
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/UserAccount.java95
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.java121
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.properties100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java523
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/FileTransferStep.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java71
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.classpath (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.classpath)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.project (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.project)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.jdt.core.prefs (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.core.prefs)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.pde.prefs (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.pde.prefs)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/META-INF/MANIFEST.MF57
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/about.html (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/about.html)0
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/build.properties (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/build.properties)1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/error.gifbin0 -> 354 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/folder.gifbin0 -> 216 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/hidden_file_filter.pngbin0 -> 438 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfile_wiz.gifbin0 -> 353 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfolder_wiz.gifbin0 -> 349 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/refresh.gifbin0 -> 327 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/root.gifbin0 -> 909 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/rootdrive.gifbin0 -> 336 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/synch_synch.gifbin0 -> 353 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/system_file_filter.pngbin0 -> 243 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win7_rootdrive.pngbin0 -> 250 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win8_rootdrive.pngbin0 -> 250 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/xp_rootdrive.pngbin0 -> 525 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/banner.pngbin0 -> 2315 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/delete_readonly.pngbin0 -> 367 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/replace_confirm.pngbin0 -> 847 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_conflict.pngbin0 -> 98 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_modified.pngbin0 -> 97 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_outdated.pngbin0 -> 98 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.properties119
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.xml1997
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/pom.xml (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/pom.xml)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java251
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java74
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IUIConstants.java)22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java162
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java209
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java329
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java263
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java240
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/help/IContextHelpIds.java)21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFileSystemUIDelegate.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java85
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java121
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java50
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeLoader.java75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java78
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerNodeViewerInput.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PersistableNode.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java81
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java131
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java110
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java82
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java84
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java70
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java63
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java289
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java256
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java481
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java307
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java419
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java158
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java99
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java102
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java224
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java409
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java64
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java115
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DeleteHandler.java128
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java66
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/tracing/ITraceIds.java)24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java62
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java141
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java419
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshHandler.java44
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java138
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java106
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java101
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java63
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java50
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java214
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java405
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/DateValidator.java108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSBaseSearchable.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSGeneralSearchable.java302
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSModifiedSearchable.java253
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSSizeSearchable.java255
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeMatcher.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeSearchable.java87
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/NameValidator.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/SizeValidator.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java116
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java139
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java94
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java92
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java250
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java359
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java57
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java305
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java251
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties171
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf82
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gifbin938 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml130
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java127
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java195
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java374
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java129
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java460
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java88
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java181
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java490
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf82
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java301
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java134
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java106
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java299
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java196
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java113
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java34
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gifbin938 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml111
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java113
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java111
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java134
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java789
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java689
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java51
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java160
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java64
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java68
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties46
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.pde.prefs32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java111
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java425
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java181
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java133
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java214
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java171
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.options3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.ui.prefs56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/about.html28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/build.properties19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gifbin385 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gifbin239 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gifbin139 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gifbin239 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gifbin890 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gifbin938 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml315
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd215
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java189
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java85
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java265
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java448
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java173
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java141
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java96
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java69
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java231
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java569
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java62
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java157
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java143
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java421
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java130
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java641
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java115
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java202
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java615
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java359
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java174
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java368
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java319
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java117
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java115
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java202
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java102
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java73
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java794
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java385
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java371
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java132
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java705
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java210
415 files changed, 26554 insertions, 22290 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.classpath
index ad32c83a7..ad32c83a7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.classpath
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.project
index e4317e21b..744c287ad 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals.serial</name>
+ <name>org.eclipse.tcf.te.filesystem.core</name>
<comment></comment>
<projects>
</projects>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..642a9e7d6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,77 @@
+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.compliance=1.6
+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=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+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=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+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=disabled
+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=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+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=warning
+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=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+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=enabled
+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=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+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=disabled
+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=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+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
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.ui.prefs
index 88bb9570e..da531539f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.ui.prefs
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,7 +1,5 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Target Explorer Java STD
-formatter_settings_version=12
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.pde.prefs
index cf80c8bc5..cf80c8bc5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/.settings/org.eclipse.pde.prefs
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..f16304f41
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/META-INF/MANIFEST.MF
@@ -0,0 +1,38 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.filesystem.core;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.core.filesystem;bundle-version="1.3.200",
+ org.eclipse.tcf.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.persistence;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.core.model;bundle-version="1.3.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.filesystem.core.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.core.interfaces,
+ org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime,
+ org.eclipse.tcf.te.tcf.filesystem.core.interfaces.steps,
+ org.eclipse.tcf.te.tcf.filesystem.core.internal;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.callbacks;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.operations;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.testers;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.url;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.utils;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.model,
+ org.eclipse.tcf.te.tcf.filesystem.core.nls;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.core.services,
+ org.eclipse.tcf.te.tcf.filesystem.core.steps
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/about.html
index 0f07cf034..0f07cf034 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/about.html
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/build.properties
index 221a2d955..221a2d955 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/build.properties
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.properties
index 80cdf13ce..3b7f461be 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.properties
@@ -1,5 +1,5 @@
##################################################################################
-# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved.
+# Copyright (c) 2012, 2014 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
@@ -8,9 +8,9 @@
# Wind River Systems - initial API and implementation
##################################################################################
-pluginName = Target Explorer, Telnet Terminals Extensions
providerName = Eclipse.org - Target Explorer
+pluginName = Target Explorer, TCF File System Extensions Core
-# ----- Terminal Launcher Delegates -----
-
-TelnetLauncherDelegate.label=Telnet Terminal
+FileTransferStep.name=Transfer File
+InitializeModelStep.name=Initialize Filesystem Runtime Model
+DisposeModelStep.name=Dispose Filesystem Runtime Model
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.xml
new file mode 100644
index 000000000..5f982e785
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/plugin.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Persistence delegate contributions -->
+ <extension
+ point="org.eclipse.tcf.te.runtime.persistence.delegates">
+ <delegate
+ class="org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManagerDelegate"
+ id="org.eclipse.tcf.te.tcf.filesystem.core.map">
+ </delegate>
+ </extension>
+
+<!-- Persistence delegate binding contributions -->
+ <extension
+ point="org.eclipse.tcf.te.runtime.persistence.bindings">
+ <binding
+ delegateId="org.eclipse.tcf.te.tcf.filesystem.core.map"
+ id="org.eclipse.tcf.te.tcf.filesystem.core.map.binding">
+ <enablement>
+ <with variable="container">
+ <instanceof
+ value="java.net.URI">
+ </instanceof>
+ </with>
+ <with variable="context">
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager">
+ </instanceof>
+ </with>
+ </enablement>
+ </binding>
+ </extension>
+
+<!-- Property tester contributions -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.FSTreeNodePropertyTester"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode"
+ namespace="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode"
+ properties="isFile,isDirectory,isBinaryFile,isReadable,isWritable,isExecutable,isRoot,isReadOnly,isHidden,isWindows,testParent,getCacheState,isSystemRoot"
+ type="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </propertyTester>
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester"
+ id="org.eclipse.tcf.te.tcf.filesystem.propertytester.peer"
+ namespace="org.eclipse.tcf.te.tcf.filesystem.propertytester.peer"
+ properties="isWindows"
+ type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode">
+ </propertyTester>
+ </extension>
+
+<!-- Launch Step contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
+ <step
+ id="org.eclipse.tcf.te.tcf.filesystem.core.fileTransferStep"
+ class="org.eclipse.tcf.te.tcf.filesystem.core.steps.FileTransferStep"
+ label="%FileTransferStep.name">
+ <requires id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
+ </step>
+
+ <step
+ class="org.eclipse.tcf.te.tcf.filesystem.core.steps.InitializeModelStep"
+ id="org.eclipse.tcf.te.tcf.filesystem.core.initializeModelStep"
+ label="%InitializeModelStep.name">
+ </step>
+ <step
+ class="org.eclipse.tcf.te.tcf.filesystem.core.steps.DisposeModelStep"
+ id="org.eclipse.tcf.te.tcf.filesystem.core.disposeModelStep"
+ label="%DisposeModelStep.name">
+ </step>
+ </extension>
+
+<!-- Step group contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.connectStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.initializeModelStep"
+ insertAfter="org.eclipse.tcf.te.tcf.locator.connectNoAttachStepGroup"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.disconnectStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.disposeModelStep"
+ insertBefore="org.eclipse.tcf.te.tcf.core.shutDownStep"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.connectionRecoveringStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.initializeModelStep"
+ insertAfter="org.eclipse.tcf.te.tcf.locator.waitForReadyStep"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.connectionLostStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.disposeModelStep"
+ insertBefore="org.eclipse.tcf.te.tcf.core.shutDownStep"/>
+ </references>
+ </stepGroup>
+ </extension>
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/pom.xml
index 70a861781..069926344 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/pom.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/pom.xml
@@ -12,6 +12,6 @@
</parent>
<version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals.rse</artifactId>
+ <artifactId>org.eclipse.tcf.te.filesystem.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/activator/CorePlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/activator/CorePlugin.java
new file mode 100644
index 000000000..35a9a4623
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/activator/CorePlugin.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.core.activator;
+
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLStreamHandlerService;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.url.URLConstants;
+import org.osgi.service.url.URLStreamHandlerService;
+
+/**
+ * The activator class of the core file system plugin.
+ */
+public class CorePlugin extends Plugin {
+
+ // The bundle context of this plugin.
+ private static BundleContext context;
+ // The shared instance of this plug-in.
+ private static CorePlugin plugin;
+ // The service registration for the "tcf" URL stream handler.
+ private ServiceRegistration<?> regURLStreamHandlerService;
+
+ /**
+ * Get the bundle context of this plugin.
+ * @return The bundle context object.
+ */
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ CorePlugin.context = bundleContext;
+ plugin = this;
+ // Register the "tcf" URL stream handler service.
+ Hashtable<String, String[]> properties = new Hashtable<String, String[]>();
+ properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] { TcfURLConnection.PROTOCOL_SCHEMA });
+ regURLStreamHandlerService = context.registerService(URLStreamHandlerService.class.getName(), new TcfURLStreamHandlerService(), properties);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ if (PersistenceManager.needsDisposal()) PersistenceManager.getInstance().dispose();
+ if (regURLStreamHandlerService != null) {
+ // When URL stream handler service is unregistered, any URL related operation will be invalid.
+ regURLStreamHandlerService.unregister();
+ regURLStreamHandlerService = null;
+ }
+ CorePlugin.context = null;
+ plugin = null;
+ super.stop(bundleContext);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CorePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getContext() != null && getContext().getBundle() != null) {
+ return getContext().getBundle().getSymbolicName();
+ }
+ return "org.eclipse.tcf.te.tcf.filesystem.core"; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IConfirmCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IConfirmCallback.java
new file mode 100644
index 000000000..844b1416c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IConfirmCallback.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.interfaces;
+
+/**
+ * A confirmation callback used to get UI confirmation from user for a long process
+ */
+public interface IConfirmCallback {
+ // Yes button ID.
+ int YES = 0;
+ // Yes to All button ID.
+ int YES_TO_ALL = 1;
+ // No to All button ID.
+ int NO = 2;
+ // Cancel button ID.
+ int CANCEL = 3;
+ // OK button ID.
+ int OK = YES;
+ // No to all button ID.
+ int NO_TO_ALL = 4;
+ /**
+ * Test if the given object requires confirmation.
+ *
+ * @param object The object being tested.
+ * @return true if it requires confirmation.
+ */
+ boolean requires(Object object);
+ /**
+ * Confirm with the user weather the process should continue, continue for all, skip or cancel.
+ *
+ * @param object The object being tested.
+ * @return a button ID the user selects during confirmation.
+ */
+ int confirms(Object object);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IOperation.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IOperation.java
new file mode 100644
index 000000000..99a5a4ed1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IOperation.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.core.interfaces;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * A class that implement this interface represents an file system operation,
+ * which is an abstract of the action operated over files/folders.
+ */
+public interface IOperation {
+
+ /**
+ * The algorithm of calculating the message digest of a file.
+ */
+ public static final String MD_ALG = "MD5"; //$NON-NLS-1$
+
+ /**
+ * Runs this operation. Progress should be reported to the given progress monitor.
+ * A request to cancel the operation should be honored and acknowledged
+ * by throwing <code>InterruptedException</code>.
+ *
+ * @param monitor the progress monitor to use to display progress and receive
+ * requests for cancellation
+ * @exception InvocationTargetException if the run method must propagate a checked exception,
+ * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
+ * wrapped in an <code>InvocationTargetException</code> by the calling context
+ * @exception InterruptedException if the operation detects a request to cancel,
+ * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
+ * <code>InterruptedException</code>
+ *
+ */
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException;
+
+ /**
+ * Get the operation's name. This name will be used as the task name of
+ * the given monitor.
+ *
+ * @see IProgressMonitor#beginTask(String, int)
+ * @return The name of the operation.
+ */
+ public String getName();
+
+ /**
+ * Get the total amount of work which will used by the progress
+ * monitor to set the total work.
+ *
+ * @see IProgressMonitor#beginTask(String, int)
+ * @return The total amount of work or UNKNOWN if it is in-determinant
+ */
+ public int getTotalWork();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IWindowsFileAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IWindowsFileAttributes.java
new file mode 100644
index 000000000..f333e54f3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/IWindowsFileAttributes.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.interfaces;
+
+/**
+ * Windows specific file system attribute definitions.
+ *
+ * @see <nop>Windows File Attribute Constants for more details.
+ */
+public interface IWindowsFileAttributes {
+
+ /**
+ * If set, the file is read-only. Read-only files cannot be modified or deleted.
+ * The attributes does not apply to directories.
+ */
+ public int FILE_ATTRIBUTE_READONLY = 1;
+
+ /**
+ * If set, the file or directory is hidden. Hidden files or directories should not
+ * be included in default directory content lists.
+ */
+ public int FILE_ATTRIBUTE_HIDDEN = 2;
+
+ /**
+ * If set, the file or directory is reserved to be used by the OS.
+ */
+ public int FILE_ATTRIBUTE_SYSTEM = 4;
+
+ /**
+ * The file system object is a directory.
+ */
+ public int FILE_ATTRIBUTE_DIRECTORY = 16;
+
+ /**
+ * If set, the file or directory is an archive file or directory.
+ */
+ public int FILE_ATTRIBUTE_ARCHIVE = 32;
+
+ /**
+ * Reserved for system use.
+ */
+ public int FILE_ATTRIBUTE_DEVICE = 64;
+
+ /**
+ * The file system object is a file with no other attributes set. Valid
+ * only if used exclusively.
+ */
+ public int FILE_ATTRIBUTE_NORMAL = 128;
+
+ /**
+ * If set, the file is used for temporary storage.
+ */
+ public int FILE_ATTRIBUTE_TEMPORARY = 256;
+
+ /**
+ * The file is a sparse file.
+ */
+ public int FILE_ATTRIBUTE_SPARSE_FILE = 512;
+
+ /**
+ * If set, the file or directory has an associated reparse point or is a symbolic link.
+ */
+ public int FILE_ATTRIBUTE_REPARSE_POINT = 1024;
+
+ /**
+ * If set, the file or directory is compressed.
+ */
+ public int FILE_ATTRIBUTE_COMPRESSED = 2048;
+
+ /**
+ * If set, the content of the file is currently not available.
+ * This attribute should not be changed by applications.
+ */
+ public int FILE_ATTRIBUTE_OFFLINE = 4096;
+
+ /**
+ * If set, the file or directory is not indexed.
+ */
+ public int FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192;
+
+ /**
+ * If set, the file or directory is encrypted.
+ */
+ public int FILE_ATTRIBUTE_ENCRYPTED = 16384;
+
+ /**
+ * Reserved for system use.
+ */
+ public int FILE_ATTRIBUTE_VIRTUAL = 65536;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java
index 5f7b41081..c89068eb4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java
@@ -7,23 +7,22 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.local.help;
+package org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime;
-import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
/**
- * UI Context help id definitions.
+ * A model dealing with the filesystem at runtime.
*/
-public interface IContextHelpIds {
+public interface IRuntimeModel extends IModel, IPeerNodeProvider {
- /**
- * UI plug-in common context help id prefix.
- */
- public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
-
- /**
- * External executables dialog.
- */
- public final static String EXTERNAL_EXECUTABLES_DIALOG = PREFIX + "ExternalExecutablesDialog"; //$NON-NLS-1$
+ /**
+ * Get the root node of the peer model.
+ *
+ * @return The root node.
+ */
+ public FSTreeNode getRoot();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/steps/IFileSystemStepAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/steps/IFileSystemStepAttributes.java
new file mode 100644
index 000000000..8801a4c7e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/steps/IFileSystemStepAttributes.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.core.interfaces.steps;
+
+/**
+ * Defines filesystem related step data attribute id's.
+ */
+public interface IFileSystemStepAttributes {
+
+ /**
+ * Define the prefix used by all other attribute id's as prefix.
+ */
+ public static final String ATTR_PREFIX = "org.eclipse.tcf.te.tcf.filesystem.core"; //$NON-NLS-1$
+
+ /**
+ * The file transfer item the stepper is currently operating with.
+ */
+ public static final String ATTR_FILE_TRANSFER_ITEM = ATTR_PREFIX + ".file_transfer_item"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/UserAccount.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/UserAccount.java
new file mode 100644
index 000000000..b46ed125a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/UserAccount.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River) - [352302]Opening a file in an editor depending on
+ * the client's permissions.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal;
+
+/**
+ * The data model of a user account.
+ */
+public class UserAccount {
+ // The user's id.
+ private int uid;
+ // The user's group id.
+ private int gid;
+ // The user's effective id.
+ private int euid;
+ // The user's effective group id.
+ private int egid;
+ // The user's home directory.
+ private String home;
+
+ /**
+ * Create a user account with given data.
+ *
+ * @param uid
+ * The user's id
+ * @param gid
+ * The user's group id
+ * @param euid
+ * The user's effective id.
+ * @param egid
+ * The user's effective group id.
+ * @param home
+ * The user's home directory.
+ */
+ public UserAccount(int uid, int gid, int euid, int egid, String home) {
+ this.uid = uid;
+ this.gid = gid;
+ this.euid = euid;
+ this.egid = egid;
+ this.home = home;
+ }
+
+ /**
+ * Get the user's id.
+ *
+ * @return The user's id.
+ */
+ public int getUID() {
+ return uid;
+ }
+
+ /**
+ * Get the user's group id.
+ *
+ * @return The user's group id.
+ */
+ public int getGID() {
+ return gid;
+ }
+
+ /**
+ * Get the user's effective id.
+ *
+ * @return The user's effective id.
+ */
+ public int getEUID() {
+ return euid;
+ }
+
+ /**
+ * Get the user's effective group id.
+ *
+ * @return The user's effective group id.
+ */
+ public int getEGID() {
+ return egid;
+ }
+
+ /**
+ * Get the user's home directory.
+ *
+ * @return The user's home directory.
+ */
+ public String getHome() {
+ return home;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/CallbackBase.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/CallbackBase.java
new file mode 100644
index 000000000..e85a38595
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/CallbackBase.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.core.internal.callbacks;
+
+import org.eclipse.tcf.protocol.IErrorReport;
+/**
+ * The base class for all callback classes.
+ */
+public class CallbackBase {
+
+ /**
+ * Get the error message from the throwable error.
+ *
+ * @param error The throwable error.
+ * @return The error message.
+ */
+ protected String getErrorMessage(Throwable error) {
+ String message = null;
+ if(error instanceof IErrorReport) {
+ IErrorReport report = (IErrorReport) error;
+ message = (String)report.getAttributes().get(IErrorReport.ERROR_FORMAT);
+ }
+ else {
+ message = error.getMessage();
+ }
+ return message;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpen.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpen.java
new file mode 100644
index 000000000..42ddeb53b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpen.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.callbacks;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneClose;
+import org.eclipse.tcf.services.IFileSystem.DoneOpen;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.services.IFileSystem.IFileHandle;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The callback handler that handles the event that a directory is opened.
+ */
+public class QueryDoneOpen extends CallbackBase implements DoneOpen {
+ // The tcf channel used.
+ IChannel channel;
+ // The file system service.
+ IFileSystem service;
+ // The parent node being queried.
+ FSTreeNode parentNode;
+ // The callback
+ ICallback callback;
+
+ /**
+ * Create an instance with parameters to initialize the fields.
+ *
+ * @param callback the callback
+ * @param channel The tcf channel.
+ * @param service The file system service.
+ * @param node The parent node.
+ */
+ public QueryDoneOpen(ICallback callback, IChannel channel, IFileSystem service, FSTreeNode node) {
+ this.callback = callback;
+ this.channel = channel;
+ this.service = service;
+ this.parentNode = node;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem.DoneOpen#doneOpen(org.eclipse.tcf.protocol.IToken, org.eclipse.tcf.services.IFileSystem.FileSystemException, org.eclipse.tcf.services.IFileSystem.IFileHandle)
+ */
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, IFileHandle handle) {
+ if (error == null) {
+ // Read the directory content until finished
+ service.readdir(handle, new QueryDoneReadDir(callback, channel, service, handle, parentNode));
+ }
+ else if (callback != null) {
+ // Close the handle and channel if EOF is signaled or an error occurred.
+ if (handle != null) {
+ service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ IStatus status;
+ if (error == null) status = Status.OK_STATUS;
+ else status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), getErrorMessage(error), error);
+ callback.done(this, status);
+ }
+ });
+ }
+ else {
+ IStatus status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), getErrorMessage(error), error);
+ callback.done(this, status);
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpenChannel.java
new file mode 100644
index 000000000..62298c98e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneOpenChannel.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.callbacks;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The callback handler that handles the event when the channel opens.
+ */
+public class QueryDoneOpenChannel extends CallbackBase implements DoneOpenChannel {
+ // The parent node to be queried.
+ FSTreeNode parentNode;
+ // Callback object.
+ ICallback callback;
+
+ /**
+ * Create an instance with a parent node.
+ *
+ * @param parentNode The parent node.
+ */
+ public QueryDoneOpenChannel(FSTreeNode parentNode) {
+ this(parentNode, null);
+ }
+
+ /**
+ * Create an instance with a parent node.
+ *
+ * @param parentNode The parent node.
+ * @param callback Callback object.
+ */
+ public QueryDoneOpenChannel(FSTreeNode parentNode, ICallback callback) {
+ this.parentNode = parentNode;
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel#doneOpenChannel(java.lang.Throwable, org.eclipse.tcf.protocol.IChannel)
+ */
+ @Override
+ public void doneOpenChannel(Throwable error, final IChannel channel) {
+ Assert.isTrue(Protocol.isDispatchThread());
+ if(error == null) {
+ ICallback proxy = new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ // Reset the children query markers
+ parentNode.queryDone();
+ Tcf.getChannelManager().closeChannel(channel);
+ if(callback != null) {
+ callback.done(caller, status);
+ }
+ }
+ };
+ IFileSystem service = channel.getRemoteService(IFileSystem.class);
+ if(service != null) {
+ if(parentNode.isSystemRoot()) {
+ service.roots(new QueryDoneRoots(proxy, parentNode));
+ } else {
+ String absPath = parentNode.getLocation();
+ service.opendir(absPath, new QueryDoneOpen(proxy, channel, service, parentNode));
+ }
+ } else {
+ Status status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), Messages.Operation_NoFileSystemError, null);
+ proxy.done(this, status);
+ }
+ }
+ else if(!(error instanceof OperationCanceledException) && callback != null) {
+ IStatus status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), getErrorMessage(error), error);
+ callback.done(this, status);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneReadDir.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneReadDir.java
new file mode 100644
index 000000000..35b8ad64e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneReadDir.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.callbacks;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.DoneClose;
+import org.eclipse.tcf.services.IFileSystem.DoneReadDir;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The callback handler that handles the event when a directory is read.
+ */
+public class QueryDoneReadDir extends CallbackBase implements DoneReadDir {
+ // The tcf channel.
+ IChannel channel;
+ // The file system service.
+ IFileSystem service;
+ // The file handle of the parent directory.
+ IFileSystem.IFileHandle handle;
+ // The parent node being queried.
+ FSTreeNode parentNode;
+ // The callback object.
+ ICallback callback;
+ /**
+ * Create an instance with parameters to initialize the fields.
+ *
+ * @param channel The tcf channel.
+ * @param service The file system service.
+ * @param handle The directory's file handle.
+ * @param parentNode The parent directory.
+ */
+ public QueryDoneReadDir(ICallback callback, IChannel channel, IFileSystem service, IFileSystem.IFileHandle handle, FSTreeNode parentNode) {
+ this.callback = callback;
+ this.channel = channel;
+ this.service = service;
+ this.handle = handle;
+ this.parentNode = parentNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem.DoneReadDir#doneReadDir(org.eclipse.tcf.protocol.IToken, org.eclipse.tcf.services.IFileSystem.FileSystemException, org.eclipse.tcf.services.IFileSystem.DirEntry[], boolean)
+ */
+ @Override
+ public void doneReadDir(IToken token, FileSystemException error, DirEntry[] entries, boolean eof) {
+ // Process the returned data
+ if (error == null) {
+ if (entries != null && entries.length > 0) {
+ for (DirEntry entry : entries) {
+ FSTreeNode node = new FSTreeNode(parentNode, entry, false);
+ parentNode.addChild(node);
+ }
+ }
+
+ if (eof) {
+ // Close the handle and channel if EOF is signaled or an error occurred.
+ service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ if(callback != null) {
+ IStatus status = error == null ? Status.OK_STATUS : new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), error.getMessage(), error);
+ callback.done(this, status);
+ }
+ }});
+ }
+ else {
+ // And invoke ourself again
+ service.readdir(handle, new QueryDoneReadDir(callback, channel, service, handle, parentNode));
+ }
+ } else if(callback != null) {
+ // Close the handle and channel if EOF is signaled or an error occurred.
+ service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ IStatus status = error == null ? Status.OK_STATUS : new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), getErrorMessage(error), error);
+ callback.done(this, status);
+ }
+ });
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneRoots.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneRoots.java
new file mode 100644
index 000000000..70f1967cf
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/QueryDoneRoots.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.callbacks;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.DoneRoots;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The callback handler that handles the event when the roots are listed.
+ */
+public class QueryDoneRoots extends CallbackBase implements DoneRoots {
+ // The parent directory node.
+ FSTreeNode parentNode;
+ // The callback object
+ ICallback callback;
+
+ /**
+ * Create an instance with parameters to initialize the fields.
+ *
+ * @param callback the callback.
+ * @param parentNode The parent directory node.
+ */
+ public QueryDoneRoots(ICallback callback, FSTreeNode parentNode) {
+ this.callback = callback;
+ this.parentNode = parentNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem.DoneRoots#doneRoots(org.eclipse.tcf.protocol.IToken, org.eclipse.tcf.services.IFileSystem.FileSystemException, org.eclipse.tcf.services.IFileSystem.DirEntry[])
+ */
+ @Override
+ public void doneRoots(IToken token, FileSystemException error, DirEntry[] entries) {
+ if (error == null) {
+ if (entries.length > 0) {
+ for (DirEntry entry : entries) {
+ FSTreeNode node = new FSTreeNode(parentNode, entry, true);
+ parentNode.addChild(node);
+ }
+ }
+ else {
+ parentNode.clearChildren();
+ }
+ }
+ if(callback != null) {
+ IStatus status = error == null ? Status.OK_STATUS : new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), getErrorMessage(error), error);
+ callback.done(this, status);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneOpenChannel.java
new file mode 100644
index 000000000..d194fb97e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneOpenChannel.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.core.internal.callbacks;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The callback to process the channel opened event for refreshing the state of a
+ * file system node.
+ */
+public class RefreshStateDoneOpenChannel extends CallbackBase implements IChannelManager.DoneOpenChannel{
+ // The node to be refreshed.
+ FSTreeNode node;
+ // The callback after the refreshing is done.
+ ICallback callback;
+
+ /**
+ * Create an instance.
+ */
+ public RefreshStateDoneOpenChannel(FSTreeNode node, ICallback callback) {
+ this.node = node;
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel#doneOpenChannel(java.lang.Throwable, org.eclipse.tcf.protocol.IChannel)
+ */
+ @Override
+ public void doneOpenChannel(Throwable error, IChannel channel) {
+ IPeer peer = node.peerNode.getPeer();
+ if (error != null) {
+ if(channel != null) {
+ Tcf.getChannelManager().closeChannel(channel);
+ }
+ if (!(error instanceof OperationCanceledException)) {
+ String message = getErrorMessage(error);
+ IStatus status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), message, error);
+ invokeCallback(status);
+ }
+ }
+ else {
+ IFileSystem service = channel.getRemoteService(IFileSystem.class);
+ if (service != null) {
+ String path = node.getLocation(true);
+ service.stat(path, new RefreshStateDoneStat(node, channel, callback));
+ }
+ else {
+ Tcf.getChannelManager().closeChannel(channel);
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, peer.getID());
+ IStatus status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), message, new TCFFileSystemException(IStatus.ERROR, message));
+ invokeCallback(status);
+ }
+ }
+ }
+
+ /**
+ * Invoke the callback using the specified status, if the callback
+ * is not null.
+ *
+ * @param status The processing result.
+ */
+ private void invokeCallback(IStatus status) {
+ if(callback != null) {
+ callback.done(this, status);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneStat.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneStat.java
new file mode 100644
index 000000000..aab2d304e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/callbacks/RefreshStateDoneStat.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.core.internal.callbacks;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem.DoneStat;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpTargetFileDigest;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The callback to process the stat done event when
+ * refreshing the state of a file system node.
+ */
+public class RefreshStateDoneStat extends CallbackBase implements DoneStat {
+ // The channel used to refresh the node's state.
+ IChannel channel;
+ // The node whose state is being refreshed.
+ FSTreeNode node;
+ // The callback to be invoked after refreshing.
+ ICallback callback;
+
+ /**
+ * Create an instance
+ */
+ public RefreshStateDoneStat(FSTreeNode node, IChannel channel, ICallback callback) {
+ this.node = node;
+ this.channel = channel;
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem.DoneStat#doneStat(org.eclipse.tcf.protocol.IToken, org.eclipse.tcf.services.IFileSystem.FileSystemException, org.eclipse.tcf.services.IFileSystem.FileAttrs)
+ */
+ @Override
+ public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) {
+ Tcf.getChannelManager().closeChannel(channel);
+ if (error == null) {
+ FileAttrs oldAttrs = node.attr;
+ node.setAttributes(attrs);
+ // Only update a file's cache diagest.
+ if (node.isFile()) {
+ // Only update its target digest when it has a local cache file.
+ File file = CacheManager.getCacheFile(node);
+ if (file.exists()) {
+ FileState fileDigest = PersistenceManager.getInstance().getFileDigest(node);
+ if (fileDigest.getTargetDigest() == null || (oldAttrs == null && attrs != null || oldAttrs != null && attrs == null || oldAttrs != null && attrs != null && oldAttrs.mtime != attrs.mtime)) {
+ // Its modification time has changed. Update the digest.
+ updateTargetDigest();
+ }
+ else {
+ invokeCallback(Status.OK_STATUS);
+ }
+ }
+ else {
+ invokeCallback(Status.OK_STATUS);
+ }
+ }
+ else {
+ invokeCallback(Status.OK_STATUS);
+ }
+ }
+ else {
+ String message = getErrorMessage(error);
+ IStatus status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), message, error);
+ invokeCallback(status);
+ }
+ }
+
+ /**
+ * Invoke the callback handler if it is not null using
+ * the specified status.
+ *
+ * @param status The refreshing result.
+ */
+ protected void invokeCallback(IStatus status) {
+ if(callback != null) {
+ callback.done(this, status);
+ }
+ }
+
+ /**
+ * Update the node's target digest and invoke the callback
+ * when the job is done.
+ */
+ private void updateTargetDigest() {
+ JobExecutor executor = new JobExecutor(callback);
+ executor.execute(new OpTargetFileDigest(node));
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFChannelException.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFChannelException.java
new file mode 100644
index 000000000..d75e79796
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFChannelException.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions;
+
+/**
+ * TCF channel exception.
+ */
+public class TCFChannelException extends TCFException {
+ private static final long serialVersionUID = 7414816212710485160L;
+
+ /**
+ * Constructor.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param message
+ * The exception detail message or <code>null</code>.
+ */
+ public TCFChannelException(int severity, String message) {
+ super(severity, message);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param message
+ * The exception detail message or <code>null</code>.
+ * @param cause
+ * The exception cause or <code>null</code>.
+ */
+ public TCFChannelException(int severity, String message, Throwable cause){
+ super(severity, message, cause);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFException.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFException.java
new file mode 100644
index 000000000..e42569a5a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFException.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions;
+
+/**
+ * TCF file system implementation base exception.
+ */
+public class TCFException extends Exception {
+ private static final long serialVersionUID = -220092425137980661L;
+
+ // The severity code of this exception, could be used in job status handling.
+ private int severity;
+
+ /**
+ * Constructor.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param message
+ * The exception detail message or <code>null</code>.
+ */
+ public TCFException(int severity, String message) {
+ super(message);
+ this.severity = severity;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param message
+ * The exception detail message or <code>null</code>.
+ * @param cause
+ * The exception cause or <code>null</code>.
+ */
+ public TCFException(int severity, String message, Throwable cause) {
+ super(message, cause);
+ this.severity = severity;
+ }
+
+ /**
+ * Returns the severity. The severities are as follows (in
+ * descending order):
+ * <ul>
+ * <li><code>CANCEL</code> - cancelation occurred</li>
+ * <li><code>ERROR</code> - a serious error (most severe)</li>
+ * <li><code>WARNING</code> - a warning (less severe)</li>
+ * <li><code>INFO</code> - an informational ("fyi") message (least severe)</li>
+ * <li><code>OK</code> - everything is just fine</li>
+ * </ul>
+ * <p>
+ * The severity of a multi-status is defined to be the maximum
+ * severity of any of its children, or <code>OK</code> if it has
+ * no children.
+ * </p>
+ *
+ * @return the severity: one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @see #matches(int)
+ */
+ public int getSeverity() {
+ return severity;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFFileSystemException.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFFileSystemException.java
new file mode 100644
index 000000000..85f70b662
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/exceptions/TCFFileSystemException.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions;
+
+/**
+ * TCF remote file system exception.
+ */
+public class TCFFileSystemException extends TCFException {
+ private static final long serialVersionUID = -5203855887734608373L;
+
+ /**
+ * Constructor.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param message
+ * The exception detail message or <code>null</code>.
+ */
+ public TCFFileSystemException(int severity, String message) {
+ super(severity, message);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param message
+ * The exception detail message or <code>null</code>.
+ * @param cause
+ * The exception cause or <code>null</code>.
+ */
+ public TCFFileSystemException(int severity, String message, Throwable cause) {
+ super(severity, message, cause);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/IOpExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/IOpExecutor.java
new file mode 100644
index 000000000..f88fdb173
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/IOpExecutor.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+
+/**
+ * The interface is to defined an operation executor, which executes
+ * the given operation providing the context including the progress monitor.
+ */
+public interface IOpExecutor {
+ /**
+ * Execute the specified operation providing an execution
+ * context.
+ *
+ * @param operation The operation to be executed.
+ * @return a result status of the execution.
+ */
+ public IStatus execute(IOperation operation);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/JobExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/JobExecutor.java
new file mode 100644
index 000000000..a46e64e62
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/JobExecutor.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+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.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+
+/**
+ * The operation that is executed as a back ground job.
+ */
+public class JobExecutor implements IOpExecutor{
+ // The callback
+ protected ICallback callback;
+
+ /**
+ * Create an instance with no callback.
+ */
+ public JobExecutor() {
+ this(null);
+ }
+
+ /**
+ * Create an instance with the specified callback.
+ *
+ * @param callback called when the creation is done.
+ */
+ public JobExecutor(ICallback callback) {
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor#execute(org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation)
+ */
+ @Override
+ public IStatus execute(final IOperation operation) {
+ Job job = new Job(operation.getName()){
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ monitor.setTaskName(operation.getName());
+ monitor.beginTask(operation.getName(), operation.getTotalWork());
+ operation.run(monitor);
+ return Status.OK_STATUS;
+ }
+ catch (InvocationTargetException e) {
+ Throwable throwable = e.getTargetException();
+ if(throwable instanceof TCFException) {
+ int severity = ((TCFException)throwable).getSeverity();
+ return new Status(severity, CorePlugin.getUniqueIdentifier(), throwable.getMessage(), throwable);
+ }
+ return new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), throwable.getMessage(), throwable);
+ }
+ catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ finally {
+ monitor.done();
+ }
+ }};
+ job.addJobChangeListener(new JobChangeAdapter(){
+ @Override
+ public void done(final IJobChangeEvent event) {
+ doCallback(operation, event);
+ }
+ });
+ job.schedule();
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Called when the creation is done.
+ *
+ * @param operation The operation object.
+ * @param event The job change event.
+ */
+ void doCallback(IOperation operation, IJobChangeEvent event) {
+ IStatus status = event.getResult();
+ if(callback != null) {
+ callback.done(operation, status);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/NullOpExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/NullOpExecutor.java
new file mode 100644
index 000000000..369b9063b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/NullOpExecutor.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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+
+/**
+ * An operation executor that executes an operation directly and silently.
+ */
+public class NullOpExecutor implements IOpExecutor {
+ // The callback being invoked after execution.
+ ICallback callback;
+
+ /**
+ * Empty argument constructor
+ */
+ public NullOpExecutor() {
+ this(null);
+ }
+
+ /**
+ * Create an instance with a callback.
+ *
+ * @param callback The callback to be invoked after execution.
+ */
+ public NullOpExecutor(ICallback callback) {
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor#execute(org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation)
+ */
+ @Override
+ public IStatus execute(IOperation operation) {
+ IProgressMonitor monitor = new NullProgressMonitor();
+ IStatus status;
+ try {
+ monitor.setTaskName(operation.getName());
+ monitor.beginTask(operation.getName(), operation.getTotalWork());
+ operation.run(monitor);
+ status = Status.OK_STATUS;
+ }
+ catch (InvocationTargetException e) {
+ Throwable throwable = e.getTargetException();
+ if (throwable instanceof TCFException) {
+ int severity = ((TCFException) throwable).getSeverity();
+ status = new Status(severity, CorePlugin.getUniqueIdentifier(), throwable.getMessage(), throwable);
+ }
+ else {
+ status = new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), throwable.getMessage(), throwable);
+ }
+ }
+ catch (InterruptedException e) {
+ status = Status.CANCEL_STATUS;
+ }
+ finally {
+ monitor.done();
+ }
+ if(callback != null) callback.done(operation, status);
+ return status;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheFileDigest.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheFileDigest.java
new file mode 100644
index 000000000..7aaca2c18
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheFileDigest.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.core.internal.operations;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The operation to calculate the message digest of a cache file.
+ */
+public class OpCacheFileDigest implements IOperation {
+ // The digest of which is going to be computed.
+ FSTreeNode node;
+ // The computing result
+ byte[] digest;
+
+ /**
+ * Create an operation to compute the digest of its local cache file.
+ *
+ * @param node The file system node.
+ */
+ public OpCacheFileDigest(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ File file = CacheManager.getCacheFile(node);
+ BufferedInputStream input = null;
+ try {
+ long totalSize = file.length();
+ int chunk_size = (int) totalSize / 100;
+ int percentRead = 0;
+ long bytesRead = 0;
+ MessageDigest digest = MessageDigest.getInstance(MD_ALG);
+ input = new BufferedInputStream(new DigestInputStream(new FileInputStream(file), digest));
+ byte[] data = new byte[OpStreamOp.DEFAULT_CHUNK_SIZE];
+ int length;
+ while ((length = input.read(data)) >= 0){
+ bytesRead += length;
+ if (chunk_size != 0) {
+ int percent = (int) bytesRead / chunk_size;
+ if (percent != percentRead) { // Update the progress.
+ monitor.worked(percent - percentRead);
+ percentRead = percent; // Remember the percentage.
+ }
+ }
+ }
+ this.digest = digest.digest();
+ }
+ catch (NoSuchAlgorithmException e) {
+ throw new InvocationTargetException(e);
+ }
+ catch (IOException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (input != null) {
+ try {input.close();} catch (Exception e) {}
+ }
+ }
+ }
+
+ /**
+ * Get the computing result.
+ *
+ * @return The message digest of this cache file.
+ */
+ public byte[] getDigest() {
+ return digest;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return "Update cache digest"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return 100;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheUpdate.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheUpdate.java
new file mode 100644
index 000000000..d9f668c6a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCacheUpdate.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.core.internal.operations;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The operation class that updates the local cache to target file systems.
+ */
+public class OpCacheUpdate extends OpDownload {
+
+ /**
+ * Create an instance of an OpCacheUpdate which
+ * updates the specified nodes.
+ *
+ * @param nodes The nodes to be updated.
+ */
+ public OpCacheUpdate(FSTreeNode... nodes) {
+ super(nodes);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDownload#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ for (FSTreeNode node : srcNodes) {
+ // Write the data to its local cache file.
+ File file = CacheManager.getCachePath(node).toFile();
+ if (file.exists() && !file.canWrite()) {
+ // If the file exists and is read-only, delete it.
+ deleteFileChecked(file);
+ }
+ }
+ try {
+ super.run(monitor);
+ } finally {
+ if (!monitor.isCanceled()) {
+ for (FSTreeNode node : srcNodes) {
+ File file = CacheManager.getCachePath(node).toFile();
+ if (file.exists()) {
+ // If downloading is successful, update the attributes of the file and
+ // set the last modified time to that of its corresponding file.
+ if (!node.isWritable()) setReadOnlyChecked(file);
+ }
+ }
+ }
+ monitor.done();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDownload#updateNodeDigest(org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode, byte[])
+ */
+ @Override
+ protected void updateNodeDigest(FSTreeNode node, byte[] digest) {
+ FileState fdigest = PersistenceManager.getInstance().getFileDigest(node);
+ fdigest.reset(digest);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java
new file mode 100644
index 000000000..4b92a59b8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.beans.PropertyChangeEvent;
+import java.util.List;
+
+import org.eclipse.tcf.te.core.utils.PropertyChangeProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The clip board to which copy or cut files/folders.
+ */
+public class OpClipboard extends PropertyChangeProvider {
+ // The constants to define the current operation type of the clip board.
+ private static final int NONE = -1;
+ private static final int CUT = 0;
+ private static final int COPY = 1;
+ // The operation type, CUT, COPY or NONE.
+ private int operation;
+ // The currently selected files/folders.
+ private List<FSTreeNode> files;
+
+ /**
+ * Create a clip board instance.
+ */
+ public OpClipboard() {
+ operation = NONE;
+ }
+
+ /**
+ * If the current operation is a cut operation.
+ *
+ * @return true if it is.
+ */
+ public boolean isCutOp() {
+ return operation == CUT;
+ }
+
+ /**
+ * If the current operation is a copy operation.
+ *
+ * @return true if it is.
+ */
+ public boolean isCopyOp() {
+ return operation == COPY;
+ }
+
+ /**
+ * If the clip board is empty.
+ *
+ * @return true if the operation is NONE and no files are selected.
+ */
+ public boolean isEmpty() {
+ return operation == NONE && (files == null || files.isEmpty());
+ }
+
+ /**
+ * Get the currently selected files/folders to operated.
+ *
+ * @return The file/folder list using their location URLs.
+ */
+ public List<FSTreeNode> getFiles() {
+ return files;
+ }
+
+ /**
+ * Cut the specified files/folders to the clip board.
+ *
+ * @param files The file/folder nodes.
+ */
+ public void cutFiles(List<FSTreeNode> files) {
+ operation = CUT;
+ this.files = files;
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "cut", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Copy the specified files/folders to the clip board.
+ *
+ * @param files The file/folder nodes.
+ */
+ public void copyFiles(List<FSTreeNode> files) {
+ operation = COPY;
+ this.files = files;
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "copy", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Clear the clip board.
+ */
+ public void clear() {
+ operation = NONE;
+ this.files = null;
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "clear", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Dispose the clipboard.
+ */
+ public void dispose() {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java
new file mode 100644
index 000000000..6e95f637f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneSetStat;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+/**
+ * The operation implementation to commit the new attributes to
+ * the file system node.
+ */
+public class OpCommitAttr extends Operation {
+ // The node whose attributes are being updated.
+ FSTreeNode node;
+ // The new attributes for the file system node.
+ IFileSystem.FileAttrs attrs;
+
+ /**
+ * Create an instance
+ */
+ public OpCommitAttr(FSTreeNode node, IFileSystem.FileAttrs attrs) {
+ this.node = node;
+ this.attrs = attrs;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ IChannel channel = null;
+ try {
+ channel = openChannel(node.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = Operation.getBlockingFileSystem(channel);
+ if (service != null) {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ String path = node.getLocation(true);
+ service.setstat(path, attrs, new DoneSetStat() {
+ @Override
+ public void doneSetStat(IToken token, FileSystemException error) {
+ if (error == null) {
+ node.setAttributes(attrs);
+ } else {
+ errors[0] = newTCFException(IStatus.WARNING, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ } else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, node.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ catch(TCFException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java
new file mode 100644
index 000000000..eec8ce292
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneCopy;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The operation class that copies selected FSTreeNodes to a specify destination folder.
+ */
+public class OpCopy extends Operation {
+ // The nodes to be copied.
+ List<FSTreeNode> nodes;
+ // The destination folder to be copied to.
+ FSTreeNode dest;
+ // The callback invoked to confirm overwriting when there're files with same names.
+ IConfirmCallback confirmCallback;
+ // If it is required to copy the permissions.
+ boolean cpPermission;
+ // If it is required to copy the ownership.
+ boolean cpOwnership;
+
+ /**
+ * Create a copy operation using the specified nodes and destination folder.
+ *
+ * @param nodes The file/folder nodes to be copied.
+ * @param dest The destination folder to be copied to.
+ */
+ public OpCopy(List<FSTreeNode> nodes, FSTreeNode dest) {
+ this(nodes, dest, false, false, null);
+ }
+
+ /**
+ * Create a copy operation using the specified nodes and destination folder,
+ * using the specified flags of copying permissions and ownership and a callback
+ * to confirm to overwrite existing files.
+ *
+ * @param nodes The file/folder nodes to be copied.
+ * @param dest The destination folder to be copied to.
+ */
+ public OpCopy(List<FSTreeNode> nodes, FSTreeNode dest, boolean cpPerm, boolean cpOwn, IConfirmCallback confirmCallback) {
+ super();
+ this.nodes = getAncestors(nodes);
+ this.dest = dest;
+ this.cpOwnership = cpOwn;
+ this.cpPermission = cpPerm;
+ this.confirmCallback = confirmCallback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ FSTreeNode head = nodes.get(0);
+ IChannel channel = null;
+ try {
+ channel = openChannel(head.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ for (FSTreeNode node : nodes) {
+ // Iterate the nodes and copy each of them to the destination folder.
+ copyNode(service, node, dest);
+ }
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, head.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e, e.getMessage());
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ monitor.done();
+ }
+ }
+
+ /**
+ * Copy the file/folder represented by the specified node to the destination folder.
+ *
+ * @param service The file system service to do the remote copying.
+ * @param node The file/folder node to be copied.
+ * @param dest The destination folder.
+ * @throws TCFFileSystemException The exception thrown during copying
+ * @throws InterruptedException The exception thrown when the operation is canceled.
+ */
+ void copyNode(IFileSystem service, FSTreeNode node, FSTreeNode dest) throws TCFFileSystemException, InterruptedException {
+ if (node.isFile()) {
+ copyFile(service, node, dest);
+ }
+ else if (node.isDirectory()) {
+ copyFolder(service, node, dest);
+ }
+ }
+
+ /**
+ * Copy the folder represented by the specified node to the destination folder.
+ *
+ * @param service The file system service to do the remote copying.
+ * @param node The folder node to be copied.
+ * @param dest The destination folder.
+ * @throws TCFFileSystemException The exception thrown during copying
+ * @throws InterruptedException The exception thrown when the operation is canceled.
+ */
+ private void copyFolder(IFileSystem service, FSTreeNode node, FSTreeNode dest) throws TCFFileSystemException, InterruptedException {
+ if (monitor.isCanceled()) throw new InterruptedException();
+ FSTreeNode copy = findChild(service, dest, node.name);
+ if (copy == null) {
+ // If no existing directory with the same name, create it.
+ copy = (FSTreeNode) node.clone();
+ addChild(service, dest, copy);
+ mkdir(service, copy);
+ copyChildren(service, node, copy);
+ }
+ else if (node.equals(copy)) {
+ copy = createCopyDestination(service, node, dest);
+ mkdir(service, copy);
+ copyChildren(service, node, copy);
+ }
+ else if (confirmReplace(node, confirmCallback)) {
+ copyChildren(service, node, copy);
+ }
+ monitor.worked(1);
+ }
+
+ /**
+ * Copy the children of the node to the destination folder.
+ *
+ * @param service The file system service to do the remote copying.
+ * @param node The folder node to be copied.
+ * @param dest The destination folder.
+ * @throws TCFFileSystemException The exception thrown during copying
+ * @throws InterruptedException The exception thrown when the operation is canceled.
+ */
+ private void copyChildren(IFileSystem service, FSTreeNode node, FSTreeNode dest) throws TCFFileSystemException, InterruptedException {
+ List<FSTreeNode> children = getChildren(node, service);
+ if (!children.isEmpty()) {
+ for (FSTreeNode child : children) {
+ // Iterate and copy its children nodes.
+ copyNode(service, child, dest);
+ }
+ }
+ }
+
+ /**
+ * Copy the file represented by the specified node to the destination folder.
+ *
+ * @param service The file system service to do the remote copying.
+ * @param node The file node to be copied.
+ * @param dest The destination folder.
+ * @throws TCFFileSystemException The exception thrown during copying
+ * @throws InterruptedException The exception thrown when the operation is canceled.
+ */
+ private void copyFile(IFileSystem service, FSTreeNode node, FSTreeNode dest) throws TCFFileSystemException, InterruptedException {
+ if (monitor.isCanceled()) throw new InterruptedException();
+ monitor.subTask(NLS.bind(Messages.OpCopy_Copying, node.name));
+ // Create the copy target file
+ final FSTreeNode copy = createCopyDestination(service, node, dest);
+ String src_path = node.getLocation(true);
+ String dst_path = copy.getLocation(true);
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ // Get the options of copy permission and ownership.
+ service.copy(src_path, dst_path, cpPermission, cpOwnership, new DoneCopy() {
+ @Override
+ public void doneCopy(IToken token, FileSystemException error) {
+ if (error != null) {
+ String message = NLS.bind(Messages.OpCopy_CannotCopyFile, copy.name, error);
+ errors[0] = new TCFFileSystemException(IStatus.ERROR, message, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ removeChild(service, dest, copy);
+ throw errors[0];
+ }
+ monitor.worked(1);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return Messages.OpCopy_CopyingFile;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ if(nodes != null && !nodes.isEmpty()) {
+ final AtomicReference<Integer> ref = new AtomicReference<Integer>();
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose.
+ }
+ @Override
+ public void run() throws Exception {
+ FSTreeNode head = nodes.get(0);
+ IChannel channel = null;
+ try {
+ channel = openChannel(head.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ ref.set(Integer.valueOf(count(service, nodes)));
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, head.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ }});
+ Integer value = ref.get();
+ return value == null ? IProgressMonitor.UNKNOWN : value.intValue();
+ }
+ return IProgressMonitor.UNKNOWN;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java
new file mode 100644
index 000000000..ad9460869
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.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.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneStat;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The base operation class for creating a file or a folder in the file system of Target
+ * Explorer.
+ */
+public abstract class OpCreate extends Operation {
+ // The folder in which a file/folder is going to be created.
+ final protected FSTreeNode folder;
+ // The node that is created after the operation.
+ protected FSTreeNode node;
+ // The name of the node to be created.
+ final protected String name;
+
+ /**
+ * Create an FSCreate instance with the specified folder and the name of the new node.
+ *
+ * @param folder The folder in which the new node is going to be created. Must not be <code>null</code>.
+ * @param name The new node's name. Must not be <code>null</code>.
+ */
+ public OpCreate(FSTreeNode folder, String name) {
+ Assert.isNotNull(folder);
+ this.folder = folder;
+ Assert.isNotNull(name);
+ this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ IChannel channel = null;
+ try {
+ channel = openChannel(folder.peerNode.getPeer());
+ monitor.worked(1);
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ if (!folder.childrenQueried) {
+ // If the children of folder is not queried, load it first.
+ loadChildren(folder, service);
+ monitor.worked(1);
+ }
+ monitor.worked(1);
+ create(service);
+ monitor.worked(1);
+ addNode(service);
+ monitor.worked(1);
+ refresh(service);
+ monitor.worked(1);
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, folder.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e, e.getMessage());
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ monitor.done();
+ }
+ }
+
+ /**
+ * Refresh new node's stat using the file system service.
+ *
+ * @param service The file system service.
+ * @throws TCFFileSystemException Thrown when refreshing the new node's stat.
+ */
+ void refresh(final IFileSystem service) throws TCFFileSystemException {
+ if (node != null) {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ String path = node.getLocation(true);
+ service.stat(path, new DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) {
+ if (error == null) {
+ if (node != null) node.setAttributes(attrs);
+ }
+ else {
+ errors[0] = newTCFException(IStatus.WARNING, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ }
+ }
+
+ /**
+ * Add the new node to the folder and its RuntimeModel.
+ *
+ * @param service The file system service to be used.
+ * @throws TCFFileSystemException Thrown when adding.
+ */
+ void addNode(final IFileSystem service) throws TCFFileSystemException {
+ if (Protocol.isDispatchThread()) {
+ node = newTreeNode();
+ folder.addChild(node);
+ }
+ else {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ addNode(service);
+ }
+ catch (TCFFileSystemException e) {
+ errors[0] = e;
+ }
+ }
+ });
+ if (errors[0] != null) throw errors[0];
+ }
+ }
+
+ /**
+ * Create the new node, either a directory node or a file node.
+ *
+ * @return The new node.
+ */
+ protected abstract FSTreeNode newTreeNode();
+
+ /**
+ * Create the node in the target system.
+ *
+ * @param service The file system service used to create the new node.
+ * @throws TCFFileSystemException Thrown when creating the node.
+ */
+ protected abstract void create(IFileSystem service) throws TCFFileSystemException;
+
+ /**
+ * Get the node that is created by this operation.
+ *
+ * @return the node created.
+ */
+ public FSTreeNode getNode() {
+ return node;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return NLS.bind(Messages.OpCreate_TaskName, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return folder.childrenQueried ? 5 : 6;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java
new file mode 100644
index 000000000..44d9bdc98
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.operations;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneClose;
+import org.eclipse.tcf.services.IFileSystem.DoneOpen;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.services.IFileSystem.IFileHandle;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.RuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The file operation class to create a file in the file system of Target Explorer.
+ */
+public class OpCreateFile extends OpCreate {
+
+ /**
+ * Create an instance to create a file with the name in the folder.
+ *
+ * @param folder The folder in which the file is to be created. Must not be <code>null</code>.
+ * @param name The new file's name. Must not be <code>null</code>.
+ */
+ public OpCreateFile(FSTreeNode folder, String name) {
+ super(folder, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate#create(org.eclipse.tcf.services.IFileSystem)
+ */
+ @Override
+ protected void create(IFileSystem service) throws TCFFileSystemException {
+ String path = folder.getLocation(true);
+ if (!path.endsWith("/")) path += "/"; //$NON-NLS-1$ //$NON-NLS-2$
+ path += name;
+ final FileSystemException[] errors = new FileSystemException[1];
+ // Open the file.
+ final IFileHandle[] handles = new IFileHandle[1];
+ service.open(path, IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_TRUNC, null, new DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, IFileHandle hdl) {
+ errors[0] = error;
+ handles[0] = hdl;
+ }
+ });
+ if (errors[0] != null) {
+ TCFFileSystemException exception = new TCFFileSystemException(IStatus.ERROR, errors[0].toString());
+ exception.initCause(errors[0]);
+ throw exception;
+ }
+ if (handles[0] == null) {
+ throw new TCFFileSystemException(IStatus.ERROR, Messages.TcfURLConnection_NoFileHandleReturned);
+ }
+ service.close(handles[0], new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate#newTreeNode()
+ */
+ @Override
+ protected FSTreeNode newTreeNode() {
+ return RuntimeModel.createFileNode(name, folder);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java
new file mode 100644
index 000000000..f2ff3a59b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.operations;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneMkDir;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.RuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The file operation class to create a folder in the file system of Target Explorer.
+ */
+public class OpCreateFolder extends OpCreate {
+
+ /**
+ * Create an instance to create a folder with the name in the folder.
+ *
+ * @param folder The folder in which the new folder is to be created. Must not be <code>null</code>.
+ * @param name The name of the new folder. Must not be <code>null</code>.
+ */
+ public OpCreateFolder(FSTreeNode folder, String name) {
+ super(folder, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate#create(org.eclipse.tcf.services.IFileSystem)
+ */
+ @Override
+ protected void create(IFileSystem service) throws TCFFileSystemException {
+ String path = folder.getLocation(true);
+ if (!path.endsWith("/")) path += "/"; //$NON-NLS-1$ //$NON-NLS-2$
+ path += name;
+ final FileSystemException[] errors = new FileSystemException[1];
+ service.mkdir(path, null, new DoneMkDir() {
+ @Override
+ public void doneMkDir(IToken token, FileSystemException error) {
+ if (error != null) {
+ errors[0] = error;
+ }
+ }
+ });
+ if (errors[0] != null) {
+ TCFFileSystemException exception = new TCFFileSystemException(IStatus.ERROR, errors[0].toString());
+ exception.initCause(errors[0]);
+ throw exception;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreate#newTreeNode()
+ */
+ @Override
+ protected FSTreeNode newTreeNode() {
+ FSTreeNode node = RuntimeModel.createFolderNode(name, folder);
+ // Newly created folder does not have any children. Mark it as queried.
+ node.queryDone();
+ return node;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java
new file mode 100644
index 000000000..5dea3e520
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * FSDelete deletes the selected FSTreeNode list.
+ */
+public class OpDelete extends Operation {
+ private static final int RETRY_TIMES = 3;
+ //The nodes to be deleted.
+ List<FSTreeNode> nodes;
+ //The callback invoked to confirm deleting read-only files.
+ IConfirmCallback confirmCallback;
+
+ /**
+ * Create a delete operation using the specified nodes.
+ *
+ * @param nodes The nodes to be deleted.
+ */
+ public OpDelete(List<FSTreeNode> nodes, IConfirmCallback confirmCallback) {
+ this.nodes = getAncestors(nodes);
+ this.confirmCallback = confirmCallback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ FSTreeNode head = nodes.get(0);
+ IChannel channel = null;
+ try {
+ channel = openChannel(head.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ for (FSTreeNode node : nodes) {
+ remove(node, service);
+ }
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, head.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e, e.getMessage());
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ monitor.done();
+ }
+ }
+
+ /**
+ * Delete the file/folder node using the file system service.
+ *
+ * @param monitor The monitor to report the progress.
+ * @param node The file/folder node to be deleted.
+ * @param service The file system service.
+ * @throws TCFFileSystemException The exception thrown during deleting.
+ * @throws InterruptedException Thrown when the operation is canceled.
+ */
+ void remove(FSTreeNode node, IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if (node.isFile()) {
+ removeFile(node, service);
+ }
+ else if (node.isDirectory()) {
+ removeFolder(node, service);
+ }
+ }
+
+ /**
+ * Delete the folder node and its children using the file system service.
+ *
+ * @param monitor The monitor to report the progress.
+ * @param node The folder node to be deleted.
+ * @param service The file system service.
+ * @throws TCFFileSystemException The exception thrown during deleting.
+ * @throws InterruptedException Thrown when the operation is canceled.
+ */
+ @Override
+ protected void removeFolder(final FSTreeNode node, IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ List<FSTreeNode> children = getChildren(node, service);
+ if (!children.isEmpty()) {
+ for (FSTreeNode child : children) {
+ // Delete each child node.
+ remove(child, service);
+ }
+ }
+ monitor.subTask(NLS.bind(Messages.OpDelete_RemovingFileFolder, node.name));
+ super.removeFolder(node, service);
+ monitor.worked(1);
+ }
+
+ /**
+ * Delete the file node using the file system service.
+ *
+ * @param node The file node to be deleted.
+ * @param service The file system service.
+ * @throws TCFFileSystemException The exception thrown during deleting.
+ * @throws InterruptedException Thrown when the operation is canceled.
+ */
+ protected void removeFile(final FSTreeNode node, IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if (monitor.isCanceled()) throw new InterruptedException();
+ monitor.subTask(NLS.bind(Messages.OpDelete_RemovingFileFolder, node.name));
+ // If the file is read only on windows or not writable on unix, then make it deletable.
+ if (confirmCallback != null && confirmCallback.requires(node)) {
+ if (!yes2All) {
+ int result = confirmCallback.confirms(node);
+ if (result == 1) {
+ yes2All = true;
+ }
+ else if (result == 2) {
+ monitor.worked(1);
+ return;
+ }
+ else if (result == 3) {
+ // Cancel the whole operation
+ monitor.setCanceled(true);
+ throw new InterruptedException();
+ }
+ }
+ IStatus status = mkWritable(node);
+ if (!status.isOK()) return;
+ }
+ super.removeFile(node, service);
+ monitor.worked(1);
+ }
+
+ /**
+ * Make the file/folder writable by changing its properties.
+ * It will try several times before return.
+ *
+ * @param node the file/folder node.
+ */
+ private IStatus mkWritable(FSTreeNode node) {
+ final FSTreeNode clone = (FSTreeNode) node.clone();
+ if (node.isWindowsNode()) {
+ clone.setReadOnly(false);
+ }
+ else {
+ clone.setWritable(true);
+ }
+ // Make the file writable.
+ OpCommitAttr op = new OpCommitAttr(node, clone.attr);
+ IOpExecutor executor = new NullOpExecutor();
+ IStatus status = null;
+ for (int i = 0; i < RETRY_TIMES; i++) {
+ status = executor.execute(op);
+ if (status.isOK()) return status;
+ }
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return Messages.OpDelete_Deleting;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ if(nodes != null && !nodes.isEmpty()) {
+ final AtomicReference<Integer> ref = new AtomicReference<Integer>();
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose.
+ }
+ @Override
+ public void run() throws Exception {
+ FSTreeNode head = nodes.get(0);
+ IChannel channel = null;
+ try {
+ channel = openChannel(head.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ ref.set(Integer.valueOf(count(service, nodes)));
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, head.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ }});
+ Integer value = ref.get();
+ return value == null ? IProgressMonitor.UNKNOWN : value.intValue();
+ }
+ return IProgressMonitor.UNKNOWN;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java
new file mode 100644
index 000000000..3b72c9355
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.operations;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection;
+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.core.nls.Messages;
+
+/**
+ * Download multiple files from local system to a remote system.
+ */
+public class OpDownload extends OpStreamOp {
+ // The destination files to be downloaded to.
+ protected File[] dstFiles;
+ // The source nodes to be downloaded from.
+ protected FSTreeNode[] srcNodes;
+
+ /**
+ * Create a download operation to download a file node
+ * to a local file.
+ *
+ * @param dstFile The local file to be downloaded to.
+ * @param srcNode The source node to be downloaded from.
+ */
+ public OpDownload(File dstFile, FSTreeNode srcNode) {
+ this(new File[]{dstFile}, new FSTreeNode[]{srcNode});
+ }
+
+ /**
+ * Create a download operation to download file nodes
+ * to local files.
+ *
+ * @param dstFiles The local files to be downloaded to.
+ * @param srcNodes The source nodes to be downloaded from.
+ */
+ public OpDownload(File[] dstFiles, FSTreeNode[] srcNodes) {
+ this.dstFiles = dstFiles;
+ this.srcNodes = srcNodes;
+ }
+
+ /**
+ * Create a download operation to download specified nodes
+ * to its local cache files.
+ *
+ * @param srcNodes The source file nodes to be downloaded.
+ */
+ public OpDownload(FSTreeNode... srcNodes) {
+ this.srcNodes = srcNodes;
+ this.dstFiles = new File[srcNodes.length];
+ for (int i = 0; i < srcNodes.length; i++) {
+ this.dstFiles[i] = CacheManager.getCacheFile(srcNodes[i]);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ try {
+ downloadFiles(dstFiles, srcNodes);
+ if(monitor.isCanceled()) throw new InterruptedException();
+ } catch (MalformedURLException e) {
+ throw new InvocationTargetException(e, e.getLocalizedMessage());
+ } catch (IOException e) {
+ throw new InvocationTargetException(e, e.getLocalizedMessage());
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /**
+ * Download the specified file list to the specified locations, reporting the progress
+ * using the specified monitor.
+ *
+ * @param dstFiles The file list to be downloaded to.
+ * @param srcNodes The node list to be downloaded from.
+ * @param monitor The monitor that reports progress.
+ * @throws IOException The exception reported during downloading.
+ */
+ private void downloadFiles(File[] dstFiles, FSTreeNode[] srcNodes) throws IOException {
+ // The buffer used to download the file.
+ byte[] data = new byte[DEFAULT_CHUNK_SIZE];
+ // Calculate the total size.
+ long totalSize = 0;
+ for (FSTreeNode node:srcNodes) {
+ totalSize += node.attr == null ? 0L : node.attr.size;
+ }
+ // Calculate the chunk size of one percent.
+ int chunk_size = (int) totalSize / 100;
+ // The current reading percentage.
+ int percentRead = 0;
+ // The current length of read bytes.
+ long bytesRead = 0;
+ for (int i = 0; i < srcNodes.length && !monitor.isCanceled(); i++) {
+ FSTreeNode node = srcNodes[i];
+ long size = node.attr == null ? 0L : node.attr.size;
+ MessageDigest digest = null;
+ BufferedInputStream input = null;
+ BufferedOutputStream output = null;
+ try {
+ URL url = node.getLocationURL();
+ TcfURLConnection connection = (TcfURLConnection) url.openConnection();
+ try {
+ digest = MessageDigest.getInstance(MD_ALG);
+ input = new BufferedInputStream(new DigestInputStream(connection.getInputStream(), digest));
+ }
+ catch (NoSuchAlgorithmException e) {
+ input = new BufferedInputStream(connection.getInputStream());
+ }
+ output = new BufferedOutputStream(new FileOutputStream(dstFiles[i]));
+
+ // Total size displayed on the progress dialog.
+ String fileLength = formatSize(size);
+ int length;
+ while ((length = input.read(data)) >= 0 && !monitor.isCanceled()) {
+ output.write(data, 0, length);
+ output.flush();
+ bytesRead += length;
+ if (chunk_size != 0) {
+ int percent = (int) bytesRead / chunk_size;
+ if (percent != percentRead) { // Update the progress.
+ monitor.worked(percent - percentRead);
+ percentRead = percent; // Remember the percentage.
+ // Report the progress.
+ monitor.subTask(NLS.bind(Messages.OpDownload_Downloading, new Object[]{node.name, formatSize(bytesRead), fileLength}));
+ }
+ }
+ }
+ }
+ finally {
+ if (output != null) {
+ try {
+ output.close();
+ } catch (Exception e) {
+ }
+ }
+ if (input != null) {
+ try {
+ input.close();
+ } catch (Exception e) {
+ }
+ }
+ if(digest != null) {
+ updateNodeDigest(node, digest.digest());
+ }
+ }
+ }
+ }
+
+ /**
+ * Update the node's digest using the digest data.
+ *
+ * @param node The node whose digest should updated.
+ * @param digest The digest data.
+ */
+ protected void updateNodeDigest(FSTreeNode node, byte[] digest) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ String message;
+ if(dstFiles.length==1)
+ message = NLS.bind(Messages.OpDownload_DownloadingSingleFile, dstFiles[0].getName());
+ else
+ message = NLS.bind(Messages.OpDownload_DownloadingMultipleFiles, Long.valueOf(dstFiles.length));
+ return message;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return 100;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java
new file mode 100644
index 000000000..d1d0e50d1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneRename;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * FSMove moves specified tree nodes to a destination folder.
+ */
+public class OpMove extends Operation {
+ // The file/folder nodes to be moved.
+ List<FSTreeNode> nodes;
+ // The destination folder to be moved to.
+ FSTreeNode dest;
+ // The callback
+ IConfirmCallback confirmCallback;
+
+ /**
+ * Create a move operation to move the specified nodes to the destination folder.
+ *
+ * @param nodes The nodes to be moved.
+ * @param dest the destination folder to move to.
+ */
+ public OpMove(List<FSTreeNode> nodes, FSTreeNode dest) {
+ this(nodes, dest, null);
+ }
+
+ /**
+ * Create a move operation to move the specified nodes to the destination folder
+ * and a confirmation callback.
+ *
+ * @param nodes The nodes to be moved.
+ * @param dest the destination folder to move to.
+ * @param confirmCallback the confirmation callback.
+ */
+ public OpMove(List<FSTreeNode> nodes, FSTreeNode dest, IConfirmCallback confirmCallback) {
+ super();
+ this.nodes = getAncestors(nodes);
+ this.dest = dest;
+ this.confirmCallback = confirmCallback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ // Remove its self from the clipped nodes.
+ nodes.remove(dest);
+ IChannel channel = null;
+ try {
+ if (!nodes.isEmpty()) {
+ FSTreeNode head = nodes.get(0);
+ channel = openChannel(head.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ for (FSTreeNode node : nodes) {
+ // Move each node.
+ moveNode(service, node, dest);
+ }
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, head.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e, e.getMessage());
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ monitor.done();
+ }
+ }
+
+ /**
+ * Move the file/folder to the destination folder using the specified file system service.
+ *
+ * @param monitor The monitor used to report the moving progress.
+ * @param service The file system service used to move the remote files.
+ * @param node The file/folder node to be moved.
+ * @param dest The destination folder.
+ * @throws TCFFileSystemException The exception thrown during moving.
+ * @throws InterruptedException Thrown when the operation is canceled.
+ */
+ void moveNode(IFileSystem service, final FSTreeNode node, FSTreeNode dest) throws TCFFileSystemException, InterruptedException {
+ if (monitor.isCanceled()) throw new InterruptedException();
+ monitor.subTask(NLS.bind(Messages.OpMove_Moving, node.name));
+ FSTreeNode copy = findChild(service, dest, node.name);
+ if (copy == null || !copy.equals(node) && confirmReplace(node, confirmCallback)) {
+ if (copy != null && copy.isDirectory() && node.isDirectory()) {
+ List<FSTreeNode> children = getChildren(node, service);
+ for (FSTreeNode child : children) {
+ moveNode(service, child, copy);
+ }
+ removeFolder(node, service);
+ monitor.worked(1);
+ }
+ else if (copy != null && copy.isFile() && node.isDirectory()) {
+ String error = NLS.bind(Messages.OpMove_FileExistsError, copy.name);
+ throw new TCFFileSystemException(IStatus.ERROR, error);
+ }
+ else if (copy != null && copy.isDirectory() && node.isFile()) {
+ String error = NLS.bind(Messages.OpMove_FolderExistsError, copy.name);
+ throw new TCFFileSystemException(IStatus.ERROR, error);
+ }
+ else {
+ if (copy != null && copy.isFile() && node.isFile()) {
+ removeFile(copy, service);
+ }
+ else if (copy == null) {
+ copy = (FSTreeNode) node.clone();
+ }
+ addChild(service, dest, copy);
+ String dst_path = copy.getLocation(true);
+ String src_path = node.getLocation(true);
+ final FSTreeNode copyNode = copy;
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ service.rename(src_path, dst_path, new DoneRename() {
+ @Override
+ public void doneRename(IToken token, FileSystemException error) {
+ if (error != null) {
+ String message = NLS.bind(Messages.OpMove_CannotMove, node.name, error);
+ errors[0] = new TCFFileSystemException(IStatus.ERROR, message, error);
+ }
+ else {
+ cleanUpNode(node, copyNode);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ removeChild(service, dest, copy);
+ throw errors[0];
+ }
+ monitor.worked(1);
+ }
+ }
+ }
+
+ /**
+ * Clean up the node after successful moving.
+ *
+ * @param node The node being moved.
+ * @param copyNode The target node that is moved to.
+ */
+ void cleanUpNode(FSTreeNode node, FSTreeNode copyNode) {
+ if (node.isFile()) {
+ super.cleanUpFile(node);
+ }
+ else if (node.isDirectory()) {
+ super.cleanUpFolder(node);
+ List<FSTreeNode> children = node.getChildren();
+ copyNode.addChidren(children);
+ for (FSTreeNode child : children) {
+ child.setParent(copyNode);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return Messages.OpMove_MovingFile;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return nodes == null ? IProgressMonitor.UNKNOWN : nodes.size();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpOutStreamOp.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpOutStreamOp.java
new file mode 100644
index 000000000..314feab03
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpOutStreamOp.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.core.internal.operations;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The operation class that download a file node to a specified output stream.
+ */
+public class OpOutStreamOp extends OpStreamOp {
+ // The output stream to write to.
+ private OutputStream output;
+ // The file node to download from.
+ private FSTreeNode node;
+
+ /**
+ * Create an operation instance to download the specified file to the specified
+ * output stream.
+ *
+ * @param node The file to be downloaded.
+ * @param output The output stream to write to.
+ */
+ public OpOutStreamOp(FSTreeNode node, OutputStream output) {
+ this.node = node;
+ this.output = output;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ InputStream input = null;
+ // Open the input stream of the node using the tcf stream protocol.
+ try {
+ URL url = node.getLocationURL();
+ InputStream in = url.openStream();
+ input = new BufferedInputStream(in);
+ // The buffer used to download the file.
+ byte[] data = new byte[DEFAULT_CHUNK_SIZE];
+ // Calculate the chunk size of one percent.
+ int chunk_size = (int) node.attr.size / 100;
+ // Total size displayed on the progress dialog.
+ String total_size = formatSize(node.attr.size);
+
+ int percentRead = 0;
+ long bytesRead = 0;
+ int length;
+ while ((length = input.read(data)) >= 0 && !monitor.isCanceled()) {
+ output.write(data, 0, length);
+ output.flush();
+ bytesRead += length;
+ if (chunk_size != 0) {
+ int percent = (int) bytesRead / chunk_size;
+ if (percent != percentRead) { // Update the progress.
+ monitor.worked(percent - percentRead);
+ percentRead = percent; // Remember the percentage.
+ // Report the progress.
+ monitor.subTask(NLS.bind(Messages.OpOutStreamOp_DownloadingProgress, formatSize(bytesRead), total_size));
+ }
+ }
+ }
+ if(monitor.isCanceled()) throw new InterruptedException();
+ }
+ catch (IOException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (input != null) {
+ try {
+ input.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ monitor.done();
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java
new file mode 100644
index 000000000..625f37747
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 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.core.internal.operations;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.utils.Host;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester;
+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.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+
+/**
+ * The operation to parse a platform specific path to a target's node.
+ */
+public class OpParsePath extends Operation {
+ // The peer on which the file is located.
+ IPeerNode peer;
+ // The path on the target.
+ String path;
+ // The parsing result.
+ FSTreeNode result;
+
+ /**
+ * Create an instance with a path on a specified target.
+ *
+ * @param peer The target peer.
+ * @param path The path to be parsed.
+ */
+ public OpParsePath(IPeerNode peer, String path) {
+ this.peer = peer;
+ this.path = path;
+ }
+
+ /**
+ * The path of the cache file to be parsed.
+ *
+ * @param filePath The local cache's file.
+ */
+ public OpParsePath(String filePath) {
+ String cache_root = CacheManager.getCacheRoot().getAbsolutePath();
+ if (filePath.startsWith(cache_root)) {
+ filePath = filePath.substring(cache_root.length() + 1);
+ int slash = filePath.indexOf(File.separator);
+ if (slash != -1) {
+ String peerId = filePath.substring(0, slash);
+ peerId = peerId.replace(CacheManager.PATH_ESCAPE_CHAR, ':');
+
+ final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
+ final String finPeerId = peerId;
+
+ Runnable runnable = new Runnable() {
+
+ @Override
+ public void run() {
+ peerNode.set(ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(finPeerId));
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ this.peer = peerNode.get();
+ if (peer != null) {
+ boolean hostWindows = Host.isWindowsHost();
+ boolean windows = TargetPropertyTester.isWindows(peer);
+ filePath = filePath.substring(slash + 1);
+ if (hostWindows) {
+ if (windows) {
+ slash = filePath.indexOf(File.separator);
+ if (slash != -1) {
+ String disk = filePath.substring(0, slash);
+ filePath = filePath.substring(slash + 1);
+ disk = disk.replace(CacheManager.PATH_ESCAPE_CHAR, ':');
+ filePath = disk + File.separator + filePath;
+ }
+ }
+ else {
+ filePath = "/" + filePath.replace('\\', '/'); //$NON-NLS-1$
+ }
+ }
+ else {
+ if (windows) {
+ slash = filePath.indexOf(File.separator);
+ if (slash != -1) {
+ String disk = filePath.substring(0, slash);
+ filePath = filePath.substring(slash + 1);
+ disk = disk.replace(CacheManager.PATH_ESCAPE_CHAR, ':');
+ filePath = disk + File.separator + filePath;
+ }
+ filePath = filePath.replace(File.separatorChar, '\\');
+ }
+ else {
+ filePath = "/" + filePath; //$NON-NLS-1$
+ }
+ }
+ path = filePath;
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the parsing result, which is a node that representing
+ * a file on the target system.
+ *
+ * @return The file system node.
+ */
+ public FSTreeNode getResult() {
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ if (peer != null && path != null) {
+ final FSTreeNode root = org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager.getRuntimeModel(peer).getRoot();
+ if (!root.childrenQueried) {
+ new NullOpExecutor().execute(new OpRefreshRoots(root));
+ }
+ Object[] elements = root.getChildren().toArray();
+ if (elements != null && elements.length != 0 && path.length() != 0) {
+ final FSTreeNode[] children = new FSTreeNode[elements.length];
+ System.arraycopy(elements, 0, children, 0, elements.length);
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+
+ @Override
+ public void run() throws Exception {
+ result = findPath(peer.getPeer(), children, path);
+ }
+ });
+ }
+ }
+ }
+
+
+ /**
+ * Search the path in the children list. If it exists, then search the children of the found
+ * node recursively until the whole path is found. Or else return null.
+ *
+ * @param children The children nodes to search the path.
+ * @param path The path to be searched.
+ * @return The leaf node that has the searched path.
+ * @throws TCFException Thrown during searching.
+ */
+ FSTreeNode findPath(IPeer peer, FSTreeNode[] children, String path) throws TCFException, InterruptedException {
+ Assert.isTrue(children != null && children.length != 0);
+ Assert.isTrue(path != null && path.length() != 0);
+ FSTreeNode node = children[0];
+ String osPathSep = node.isWindowsNode() ? "\\" : "/"; //$NON-NLS-1$ //$NON-NLS-2$
+ int delim = path.indexOf(osPathSep);
+ String segment = null;
+ if (delim != -1) {
+ segment = path.substring(0, delim);
+ path = path.substring(delim + 1);
+ if (node.isRoot()) {
+ // If it is root directory, the name ends with the path separator.
+ segment += osPathSep;
+ }
+ }
+ else {
+ segment = path;
+ path = null;
+ }
+ node = findPathSeg(children, segment);
+ if (path == null || path.trim().length() == 0) {
+ // The end of the path.
+ return node;
+ }
+ else if (node != null) {
+ if (node.isDirectory()) {
+ List<FSTreeNode> nodes= new Operation().getChildren(node);
+ children = nodes.toArray(new FSTreeNode[nodes.size()]);
+ }
+ else {
+ children = null;
+ }
+ if (children != null && children.length != 0) {
+ return findPath(peer, children, path);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Find in the children array the node that has the specified name.
+ *
+ * @param children The children array in which to find the node.
+ * @param name The name of the node to be searched.
+ * @return The node that has the specified name.
+ */
+ private FSTreeNode findPathSeg(FSTreeNode[] children, String name) {
+ for (FSTreeNode child : children) {
+ if (child.isWindowsNode()) {
+ if (child.name.equalsIgnoreCase(name)) return child;
+ }
+ else if (child.name.equals(name)) return child;
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java
new file mode 100644
index 000000000..8df9e38eb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * FSRefresh refreshes a specified tree node and its children and grand children recursively.
+ */
+public class OpRefresh extends Operation {
+ //The root node to be refreshed.
+ FSTreeNode node;
+
+ /**
+ * Create an FSRefresh to refresh the specified node and its descendants.
+ *
+ * @param node The root node to be refreshed.
+ */
+ public OpRefresh(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /**
+ * Create an FSRefresh to refresh the specified nodes and its descendants.
+ *
+ * @param nodes The node list to be refreshed.
+ */
+ public OpRefresh(List<FSTreeNode> nodes) {
+ this.node = getAncestor(nodes);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ if (node != null && (node.childrenQueried || node.isFile())) {
+ IChannel channel = null;
+ try {
+ channel = openChannel(node.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ refresh(node, service);
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, node.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e, e.getMessage());
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ monitor.done();
+ }
+ }
+ else {
+ monitor.done();
+ }
+ }
+
+ /**
+ * Refresh the specified node and its children recursively using the file system service.
+ *
+ * @param node The node to be refreshed.
+ * @param service The file system service.
+ * @throws TCFFileSystemException Thrown during refreshing.
+ */
+ void refresh(final FSTreeNode node, final IFileSystem service) throws InterruptedException {
+ if(monitor.isCanceled()) throw new InterruptedException();
+ if ((node.isSystemRoot() || node.isDirectory()) && node.childrenQueried) {
+ if (!node.isSystemRoot()) {
+ try {
+ updateChildren(node, service);
+ }
+ catch (TCFException e) {
+ }
+ }
+ monitor.worked(1);
+ List<FSTreeNode> children = node.getChildren();
+ for (FSTreeNode child : children) {
+ refresh(child, service);
+ }
+ }
+ else if(node.isFile()) {
+ node.refresh();
+ }
+ }
+
+
+ /**
+ * Update the children of the specified folder node using the file system service.
+ *
+ * @param node The folder node.
+ * @param service The file system service.
+ * @throws TCFFileSystemException Thrown during querying the children nodes.
+ */
+ protected void updateChildren(final FSTreeNode node, final IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if(monitor.isCanceled()) throw new InterruptedException();
+ List<FSTreeNode> current = node.getChildren();
+ List<FSTreeNode> latest = queryChildren(node, service);
+ List<FSTreeNode> newNodes = diff(latest, current);
+ List<FSTreeNode> deleted = diff(current, latest);
+ node.removeChildren(deleted);
+ node.addChidren(newNodes);
+ }
+
+ /**
+ * Find those nodes which are in aList yet not in bList and return them as a list.
+ *
+ * @param aList
+ * @param bList
+ * @return the difference list.
+ */
+ private List<FSTreeNode> diff(List<FSTreeNode> aList, List<FSTreeNode> bList) {
+ List<FSTreeNode> newList = new ArrayList<FSTreeNode>();
+ for (FSTreeNode aNode : aList) {
+ boolean found = false;
+ for (FSTreeNode bNode : bList) {
+ if (aNode.name.equals(bNode.name)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ newList.add(aNode);
+ }
+ }
+ return newList;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return NLS.bind(Messages.OpRefresh_RefreshJobTitle, node == null ? "" : node.name); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return count(node);
+ }
+
+ /**
+ * Count the nodes that should be refreshed under
+ * the specified directory.
+ *
+ * @param node The specified directory.
+ * @return the total count of the qualified nodes.
+ */
+ private int count(FSTreeNode node) {
+ if ((node.isSystemRoot() || node.isDirectory()) && node.childrenQueried) {
+ int total = 1;
+ List<FSTreeNode> children = node.getChildren();
+ for (FSTreeNode child : children) {
+ total += count(child);
+ }
+ return total;
+ }
+ return 0;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java
new file mode 100644
index 000000000..6470c6e12
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.operations;
+
+/**
+ * The file operation class to create the root node in the file system of Target Explorer.
+ */
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The operation to refresh the root of the file system.
+ */
+public class OpRefreshRoots extends Operation {
+ /* default */FSTreeNode root;
+
+ /**
+ * Create an instance using the peer model.
+ *
+ * @param peerModel The peer model.
+ */
+ public OpRefreshRoots(FSTreeNode root) {
+ this.root = root;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ IChannel channel = null;
+ try {
+ channel = openChannel(root.peerNode.getPeer());
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ root.queryStarted();
+ service.roots(new IFileSystem.DoneRoots() {
+ @Override
+ public void doneRoots(IToken token, FileSystemException error, DirEntry[] entries) {
+ if (error == null) {
+ for (DirEntry entry : entries) {
+ FSTreeNode node = new FSTreeNode(root, entry, true);
+ root.addChild(node);
+ }
+ }
+ }
+ });
+ // Reset the children query markers
+ root.queryDone();
+ }
+ }
+ catch(TCFChannelException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java
new file mode 100644
index 000000000..f7a0661c5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneRename;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+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.core.nls.Messages;
+/**
+ * FSRename renames the specified file/folder to a
+ * new name.
+ *
+ */
+public class OpRename extends Operation {
+ // The file/folder node to be renamed.
+ FSTreeNode node;
+ // The new name the file/folder is renamed to.
+ String newName;
+
+ /**
+ * Create a rename operation that renames the node with the new name.
+ *
+ * @param node The file/folder node to be renamed.
+ * @param newName The new name of this node.
+ */
+ public OpRename(FSTreeNode node, String newName) {
+ this.node = node;
+ this.newName = newName;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ IChannel channel = null;
+ try {
+ channel = openChannel(node.peerNode.getPeer());
+ if (channel != null) {
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ renameNode(service);
+ }
+ else {
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, node.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e, e.getMessage());
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ monitor.done();
+ }
+ }
+
+ /**
+ * Rename the node using the new name.
+ *
+ * @param service File system service used to rename.
+ * @throws TCFFileSystemException The exception thrown during renaming.
+ */
+ void renameNode(IFileSystem service) throws TCFFileSystemException {
+ String src_path = node.getLocation(true);
+ String oldName = node.name;
+ node.name = newName;
+ String dst_path = node.getLocation(true);
+ node.name = oldName;
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ service.rename(src_path, dst_path, new DoneRename() {
+ @Override
+ public void doneRename(IToken token, FileSystemException error) {
+ if (error != null) {
+ String message = NLS.bind(Messages.OpRename_CannotRename, node.name, error);
+ errors[0] = new TCFFileSystemException(IStatus.ERROR, message, error);
+ }
+ else {
+ final File file = CacheManager.getCacheFile(node);
+ if (node.isFile() && file.exists()) {
+ PersistenceManager.getInstance().removeFileDigest(node.getLocationURI());
+ }
+ deleteFileChecked(file);
+ node.setName(newName);
+ }
+ }
+ });
+ monitor.worked(1);
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return Messages.OpRename_TitleRename;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpStreamOp.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpStreamOp.java
new file mode 100644
index 000000000..c2768a6e1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpStreamOp.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.core.internal.operations;
+
+import java.io.File;
+import java.text.DecimalFormat;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The operation class that streams file upward downward. It is the base
+ * class for uploading, downloading, cache update and commit.
+ */
+public abstract class OpStreamOp extends Operation {
+ // The formatter used to format the size displayed while downloading.
+ protected static final DecimalFormat SIZE_FORMAT = new DecimalFormat("#,##0.##"); //$NON-NLS-1$
+ // The default chunk size of the buffer used during downloading files.
+ public static final int DEFAULT_CHUNK_SIZE = 5 * 1024;
+
+ /**
+ * Check if the file exists and set its read-only attribute if it does. Record
+ * the failure message if it fails.
+ *
+ * @param file The file to be set.
+ */
+ protected void setReadOnlyChecked(final File file) {
+ if (file.exists()) {
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void run() throws Exception {
+ if (!file.setReadOnly()) {
+ throw new Exception(NLS.bind(Messages.OpStreamOp_SetReadOnlyFailed, file.getAbsolutePath()));
+ }
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }});
+ }
+ }
+
+ /**
+ * Use the SIZE_FORMAT to format the file's size. The rule is: 1. If the
+ * size is less than 1024 bytes, then show it as "####" bytes. 2. If the
+ * size is less than 1024 KBs, while more than 1 KB, then show it as
+ * "####.##" KBs. 3. If the size is more than 1 MB, then show it as
+ * "####.##" MBs.
+ *
+ * @param size
+ * The file size to be displayed.
+ * @return The string representation of the size.
+ */
+ protected String formatSize(long size) {
+ double kbSize = size / 1024.0;
+ if (kbSize < 1.0) {
+ return SIZE_FORMAT.format(size) + Messages.OpStreamOp_Bytes;
+ }
+ double mbSize = kbSize / 1024.0;
+ if (mbSize < 1.0)
+ return SIZE_FORMAT.format(kbSize) + Messages.OpStreamOp_KBs;
+ return SIZE_FORMAT.format(mbSize) + Messages.OpStreamOp_MBs;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java
new file mode 100644
index 000000000..328acbd3a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.core.internal.operations;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The operation that computes the digest of the cache file in the background.
+ */
+public class OpTargetFileDigest implements IOperation {
+ // The digest of which is going to be computed.
+ FSTreeNode node;
+ // The computing result
+ byte[] digest;
+
+ /**
+ * Create an operation to compute the digest of its target file.
+ *
+ * @param node The file system node.
+ */
+ public OpTargetFileDigest(FSTreeNode node) {
+ this.node = node;
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ BufferedInputStream input = null;
+ try {
+ long totalSize = node.attr.size;
+ int chunk_size = (int) totalSize / 100;
+ int percentRead = 0;
+ long bytesRead = 0;
+ URL url = node.getLocationURL();
+ MessageDigest digest = MessageDigest.getInstance(MD_ALG);
+ input = new BufferedInputStream(new DigestInputStream(url.openStream(), digest));
+ // The buffer used to download the file.
+ byte[] data = new byte[OpStreamOp.DEFAULT_CHUNK_SIZE];
+ int length;
+ while ((length = input.read(data)) >= 0){
+ bytesRead += length;
+ if (chunk_size != 0) {
+ int percent = (int) bytesRead / chunk_size;
+ if (percent != percentRead) { // Update the progress.
+ monitor.worked(percent - percentRead);
+ percentRead = percent; // Remember the percentage.
+ }
+ }
+ }
+ this.digest = digest.digest();
+ }
+ catch (NoSuchAlgorithmException e) {
+ throw new InvocationTargetException(e);
+ }
+ catch (IOException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (input != null) {
+ try {input.close();} catch (Exception e) {}
+ }
+ }
+ }
+
+ /**
+ * Get the computing result.
+ *
+ * @return The message digest of this cache file.
+ */
+ public byte[] getDigest() {
+ return digest;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return "Update target digest"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return 100;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java
new file mode 100644
index 000000000..54e20fcd9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java
@@ -0,0 +1,431 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState;
+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.core.nls.Messages;
+
+/**
+ * Upload multiple files from local system to a remote system.
+ */
+public class OpUpload extends OpStreamOp {
+ // The source files to be uploaded.
+ File[] srcFiles;
+ // The destination URLs to be uploaded to.
+ URL[] dstURLs;
+ // The confirm callback
+ IConfirmCallback confirmCallback;
+ // The parent folder map to search files that have same names.
+ Map<File, FSTreeNode> parentFolders;
+ // The files that are to be committed to its target file system.
+ FSTreeNode[] nodes;
+
+ /**
+ * Constructor.
+ *
+ * @param srcFile The source file to be uploaded.
+ * @param dstURL The destination URL.
+ */
+ public OpUpload(File srcFile, URL dstURL) {
+ this(new File[]{srcFile}, new URL[]{dstURL});
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param srcFiles The source files to be uploaded.
+ * @param dstURLs The destination URLs.
+ */
+ public OpUpload(File[] srcFiles, URL[] dstURLs) {
+ this(srcFiles, dstURLs, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param sourceFiles The source files in the native file system to be uploaded.
+ * @param targetFolder The taret parent folder to upload these files to.
+ */
+ public OpUpload(String[]sourceFiles, FSTreeNode targetFolder) {
+ this(sourceFiles, targetFolder, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param sourceFiles The source files in the native file system to be uploaded.
+ * @param targetFolder The target parent folder to upload these files to.
+ * @param confirmCallback the confirmation callback to confirm overwriting.
+ */
+ public OpUpload(File[] srcFiles, URL[] dstURLs, IConfirmCallback confirmCallback) {
+ this.srcFiles = srcFiles;
+ this.dstURLs = dstURLs;
+ this.confirmCallback = confirmCallback;
+ }
+
+ /**
+ * Constructor that upload the local cache files of the specified nodes.
+ *
+ * @param nodes The nodes to be uploaded.
+ */
+ public OpUpload(FSTreeNode... nodes) {
+ srcFiles = new File[nodes.length];
+ dstURLs = new URL[nodes.length];
+ for (int i = 0; i < nodes.length; i++) {
+ srcFiles[i] = CacheManager.getCacheFile(nodes[i]);
+ dstURLs[i] = nodes[i].getLocationURL();
+ }
+ this.nodes = nodes;
+ }
+
+ /**
+ * Create an instance with specified files, target folder and a callback.
+ *
+ * @param sourceFiles the source files being uploaded.
+ * @param targetFolder the target folder to upload the files to.
+ * @param callback the callback that is invoked after uploading.
+ */
+ public OpUpload(String[] sourceFiles, FSTreeNode targetFolder, IConfirmCallback confirmCallback) {
+ this.confirmCallback = confirmCallback;
+ List<File> fileList = new ArrayList<File>();
+ List<URL> urlList = new ArrayList<URL>();
+ prepareDirStruct(sourceFiles, fileList, urlList, targetFolder);
+ srcFiles = fileList.toArray(new File[fileList.size()]);
+ dstURLs = urlList.toArray(new URL[urlList.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ try {
+ uploadFiles(srcFiles, dstURLs);
+ if(monitor.isCanceled()) throw new InterruptedException();
+ } catch (MalformedURLException e) {
+ throw new InvocationTargetException(e);
+ } catch (IOException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+ /**
+ * Test if the specified file should be confirmed.
+ *
+ * @param file The file to be confirmed.
+ * @return true if it is.
+ */
+ private boolean requireConfirmation(File file) {
+ return parentFolders != null && confirmCallback != null && !yes2All && confirmCallback.requires(file) && findNode(file) != null;
+ }
+
+ /**
+ * Upload the specified file list to the specified locations, reporting the progress
+ * using the specified monitor.
+ *
+ * @param files The file list to be uploaded.
+ * @param urls The
+ * @param monitor
+ * @throws IOException
+ */
+ private void uploadFiles(File[] files, URL[] urls) throws IOException {
+ // The buffer used to download the file.
+ byte[] data = new byte[DEFAULT_CHUNK_SIZE];
+ // Calculate the total size.
+ long totalSize = 0;
+ for (File file:files) {
+ totalSize += file.length();
+ }
+ // Calculate the chunk size of one percent.
+ int chunk_size = (int) totalSize / 100;
+ // The current reading percentage.
+ int percentRead = 0;
+ // The current length of read bytes.
+ long bytesRead = 0;
+ for (int i = 0; i < files.length && !monitor.isCanceled(); i++) {
+ File file = files[i];
+ if (requireConfirmation(file)) {
+ int result = confirmCallback.confirms(file);
+ switch (result) {
+ case IConfirmCallback.YES:
+ break;
+ case IConfirmCallback.YES_TO_ALL:
+ yes2All = true;
+ break;
+ case IConfirmCallback.NO:
+ bytesRead += file.length();
+ if (chunk_size != 0) {
+ int percent = (int) bytesRead / chunk_size;
+ if (percent != percentRead) { // Update the progress.
+ monitor.worked(percent - percentRead);
+ percentRead = percent; // Remember the percentage.
+ // Report the progress.
+ monitor.subTask(NLS
+ .bind(Messages.OpUpload_UploadingProgress, new Object[] { file
+ .getName(), formatSize(bytesRead), formatSize(file
+ .length()) }));
+ }
+ }
+ continue;
+ case IConfirmCallback.CANCEL:
+ monitor.setCanceled(true);
+ continue;
+ }
+ }
+ BufferedInputStream input = null;
+ BufferedOutputStream output = null;
+ MessageDigest digest = null;
+ try {
+ URL url = urls[i];
+ TcfURLConnection connection = (TcfURLConnection) url.openConnection();
+ connection.setDoInput(false);
+ connection.setDoOutput(true);
+ if (nodes != null) {
+ try {
+ digest = MessageDigest.getInstance(MD_ALG);
+ input = new BufferedInputStream(new DigestInputStream(new FileInputStream(file), digest));
+ }
+ catch (NoSuchAlgorithmException e) {
+ input = new BufferedInputStream(new FileInputStream(file));
+ }
+ }
+ else {
+ input = new BufferedInputStream(new FileInputStream(file));
+ }
+ output = new BufferedOutputStream(connection.getOutputStream());
+
+ // Total size displayed on the progress dialog.
+ String fileLength = formatSize(file.length());
+ int length;
+ while ((length = input.read(data)) >= 0 && !monitor.isCanceled()) {
+ output.write(data, 0, length);
+ output.flush();
+ bytesRead += length;
+ if (chunk_size != 0) {
+ int percent = (int) bytesRead / chunk_size;
+ if (percent != percentRead) { // Update the progress.
+ monitor.worked(percent - percentRead);
+ percentRead = percent; // Remember the percentage.
+ // Report the progress.
+ monitor.subTask(NLS.bind(Messages.OpUpload_UploadingProgress, new Object[]{file.getName(), formatSize(bytesRead), fileLength}));
+ }
+ }
+ }
+ } finally {
+ if (output != null) {
+ try {
+ output.close();
+ } catch (Exception e) {
+ }
+ }
+ if (input != null) {
+ try {
+ input.close();
+ } catch (Exception e) {
+ }
+ }
+ if(digest != null && nodes != null) {
+ FileState filedigest = PersistenceManager.getInstance().getFileDigest(nodes[i]);
+ filedigest.reset(digest.digest());
+ }
+ }
+ }
+ }
+
+ /**
+ * Prepare the directory structure on the remote target, creating necessary intermediate directories
+ * and found all files that should be uploaded. The resulting files to be uploaded should be stored
+ * to the file list. The resulting corresponding target file URLs should be stored in the url list.
+ *
+ * @param fileList The file list to store the files that should be uploaded.
+ * @param urlList The list containing the corresponding urls.
+ */
+ private void prepareDirStruct(String[] sourceFiles, List<File> fileList, List<URL> urlList, FSTreeNode targetFolder) {
+ parentFolders = Collections.synchronizedMap(new HashMap<File, FSTreeNode>());
+ List<File> files = new ArrayList<File>();
+ for(String path: sourceFiles) {
+ files.add(new File(path));
+ }
+ // Find the root nodes of these files.
+ List<File> topFiles = getTopFiles(files);
+ for(File topFile : topFiles) {
+ appendFile(topFile, fileList, urlList, targetFolder);
+ }
+ }
+
+ /**
+ * Append the specified file object to the file list and url list. If the file object is a file
+ * then append it to the two lists. If the file object is a directory, then recursively
+ * add its children and grand children to the two list. During this process, the parents of
+ * these files and directories traversed should be put into the parent folders map so that
+ * it could be queried to check if it has a file/directory with a same name.
+ *
+ * @param file The file to be added
+ * @param fileList The file list
+ * @param urlList The url list
+ * @param parent The current parent node
+ */
+ private void appendFile(final File file, final List<File> fileList, final List<URL> urlList, final FSTreeNode parent) {
+ parentFolders.put(file, parent);
+ if(file.isFile()) {
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void run() throws Exception {
+ URL folderURL = parent.getLocationURL();
+ URL url = new URL(folderURL, file.getName());
+ fileList.add(file);
+ urlList.add(url);
+ }
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }});
+ } else if(file.isDirectory()) {
+ FSTreeNode node = findNode(file);
+ if(node == null) {
+ OpCreateFolder create = new OpCreateFolder(parent, file.getName());
+ new NullOpExecutor().execute(create);
+ node = create.getNode();
+ }
+ File[] children = file.listFiles();
+ for(File child : children) {
+ appendFile(child, fileList, urlList, node);
+ }
+ }
+ }
+
+ /**
+ * Get the root files of the specified files/folders in the list.
+ *
+ * @param files The files to be checked.
+ * @return Root nodes of these files that has no parent.
+ */
+ private List<File> getTopFiles(List<File>files) {
+ List<File> result = new ArrayList<File>();
+ for(File file : files) {
+ if(!hasFileAncestor(file, files)) {
+ result.add(file);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Check if the target file has an ancestral parent in the specified list.
+ *
+ * @param target The target file to be checked.
+ * @param files The file list to be searched.
+ * @return true if it has an ancestral parent.
+ */
+ private boolean hasFileAncestor(File target, List<File> files) {
+ for(File file : files) {
+ if(isFileAncestor(file, target)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if the specified "file" is an ancestral parent of the "target" file.
+ *
+ * @param file The ancestral file.
+ * @param target The target file.
+ * @return true if "file" is an ancestral parent of "target"
+ */
+ private boolean isFileAncestor(File file, File target) {
+ if(target == null) return false;
+ File parent = target.getParentFile();
+ if(file.equals(parent)) return true;
+ return isFileAncestor(file, parent);
+ }
+
+ /**
+ * Check if the specified file has a same-named file under its corresponding
+ * parent folder.
+ *
+ * @param file The file to checked.
+ * @return the node that has the same name with the file.
+ */
+ private FSTreeNode findNode(File file) {
+ final FSTreeNode parent = parentFolders.get(file);
+ if (parent != null) {
+ final List<FSTreeNode> targetChildren = new ArrayList<FSTreeNode>();
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ targetChildren.addAll(getChildren(parent));
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ });
+ String name = file.getName();
+ for (FSTreeNode child : targetChildren) {
+ if (name.equals(child.name)) return child;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ String message;
+ if(srcFiles.length==1)
+ message = NLS.bind(Messages.OpUpload_UploadSingleFile, srcFiles[0].getName());
+ else
+ message = NLS.bind(Messages.OpUpload_UploadNFiles, Long.valueOf(srcFiles.length));
+ return message;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return 100;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUser.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUser.java
new file mode 100644
index 000000000..269f9b142
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUser.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 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.core.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.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneUser;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.UserAccount;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * The operation to get the user account of a specified peer.
+ */
+public class OpUser extends Operation {
+ // The key to save and retrieve the user account in a peer model.
+ /* default */ static final String USER_ACCOUNT_KEY = CorePlugin.getUniqueIdentifier()+".user.account"; //$NON-NLS-1$
+
+ // The target peer.
+ IPeerNode peerNode;
+ // The resulting account.
+ UserAccount result;
+
+ /**
+ * Create an operation using the target peer.
+ * @param peerNode The peer whose user account to be checked.
+ */
+ public OpUser(IPeerNode peerNode) {
+ this.peerNode = peerNode;
+ }
+
+ /**
+ * Get the checking result.
+ *
+ * @return The user account checked.
+ */
+ public UserAccount getUserAccount() {
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ if(peerNode != null) {
+ result = getUserFromPeer(peerNode);
+ if (result == null) {
+ final UserAccount[] accounts = new UserAccount[1];
+ IChannel channel = null;
+ try {
+ channel = Operation.openChannel(peerNode.getPeer());
+ if (channel != null) {
+ accounts[0] = getUserByChannel(channel);
+ if (accounts[0] != null) setUserToPeer(peerNode, accounts[0]);
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ result = accounts[0];
+ }
+ }
+ }
+
+ /**
+ * Get the user account from the peer using the channel connected to the
+ * remote target.
+ *
+ * @param channel
+ * The channel connected to the remote target.
+ * @return The user account information or null if it fails.
+ */
+ UserAccount getUserByChannel(final IChannel channel) throws TCFFileSystemException {
+ IFileSystem service = Operation.getBlockingFileSystem(channel);
+ if (service != null) {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ final UserAccount[] accounts = new UserAccount[1];
+ service.user(new DoneUser() {
+ @Override
+ public void doneUser(IToken token, FileSystemException error, int real_uid, int effective_uid, int real_gid, int effective_gid, String home) {
+ if (error == null) {
+ accounts[0] = new UserAccount(real_uid, real_gid, effective_uid, effective_gid, home);
+ }else {
+ errors[0] = newTCFException(IStatus.WARNING, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ return accounts[0];
+ }
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, channel.getRemotePeer().getID());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+
+ /**
+ * Get the user account stored in the specified peer model using a key named
+ * "user.account" defined by the constant USER_ACCOUNT_KEY.
+ *
+ * @param peer
+ * The peer model from which the user account is retrieved.
+ * @return The user account if it exists or null if not.
+ */
+ private UserAccount getUserFromPeer(final IPeerNode peer) {
+ Assert.isNotNull(peer);
+ if (Protocol.isDispatchThread()) {
+ return (UserAccount) peer.getProperty(USER_ACCOUNT_KEY);
+ }
+ final UserAccount[] accounts = new UserAccount[1];
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ accounts[0] = (UserAccount) peer.getProperty(USER_ACCOUNT_KEY);
+ }
+ });
+ return accounts[0];
+ }
+
+ /**
+ * Save the user account to the specified peer model using a key named
+ * "user.account" defined by the constant USER_ACCOUNT_KEY.
+ *
+ * @param peer
+ * The peer model to which the user account is saved.
+ */
+ void setUserToPeer(final IPeerNode peer, final UserAccount account) {
+ Assert.isNotNull(peer);
+ Assert.isNotNull(account);
+
+ if (Protocol.isDispatchThread()) {
+ peer.setProperty(USER_ACCOUNT_KEY, account);
+ } else {
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ peer.setProperty(USER_ACCOUNT_KEY, account);
+ }
+ });
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/Operation.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/Operation.java
new file mode 100644
index 000000000..117667b3e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/Operation.java
@@ -0,0 +1,618 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.operations;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.net.ConnectException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IErrorReport;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.DoneMkDir;
+import org.eclipse.tcf.services.IFileSystem.DoneOpen;
+import org.eclipse.tcf.services.IFileSystem.DoneReadDir;
+import org.eclipse.tcf.services.IFileSystem.DoneRemove;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.services.IFileSystem.IFileHandle;
+import org.eclipse.tcf.te.core.utils.Ancestor;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.concurrent.Rendezvous;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel;
+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.exceptions.TCFChannelException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.BlockingFileSystemProxy;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+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.core.nls.Messages;
+
+/**
+ * Operation is the base class of file system operation classes.
+ * @see IOperation
+ */
+public class Operation extends Ancestor<FSTreeNode> implements IOperation {
+ // The default timeout waiting for blocked invocations.
+ public static final long DEFAULT_TIMEOUT = 60000L;
+ // The flag indicating if the following action should be executed without asking.
+ protected boolean yes2All = false;
+
+ // The current progress monitor, probably null.
+ protected IProgressMonitor monitor = new NullProgressMonitor();
+
+ /**
+ * Create an instance.
+ */
+ public Operation() {
+ }
+
+ /**
+ * Create a TCFFileSystemException from a FileSystemException.
+ *
+ * @param error The FileSystemException
+ * @return a TCFFileSystemException
+ */
+ protected TCFFileSystemException newTCFException(int severity, FileSystemException error) {
+ String message = null;
+ if(error instanceof IErrorReport) {
+ IErrorReport report = (IErrorReport) error;
+ message = (String)report.getAttributes().get(IErrorReport.ERROR_FORMAT);
+ }
+ return new TCFFileSystemException(severity, message, error);
+ }
+
+ /**
+ * Clean up the folder node after moving, deleting or copying.
+ *
+ * @param node the folder node that is to be cleaned.
+ */
+ protected void cleanUpFolder(FSTreeNode node) {
+ File file = CacheManager.getCacheFile(node);
+ deleteFileChecked(file);
+ FSTreeNode parent = node.getParent();
+ if (parent != null) {
+ parent.removeChild(node);
+ }
+ }
+
+ /**
+ * Check if the file exists and delete if it does. Record
+ * the failure message if deleting fails.
+ *
+ * @param file The file to be deleted.
+ */
+ protected void deleteFileChecked(final File file) {
+ if (file.exists()) {
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void run() throws Exception {
+ if (!file.delete()) {
+ throw new Exception(NLS.bind(Messages.Operation_DeletingFileFailed, file.getAbsolutePath()));
+ }
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }});
+ }
+ }
+
+ /**
+ * Clean up the file node after moving, deleting or copying.
+ *
+ * @param node the file node that is to be cleaned.
+ */
+ protected void cleanUpFile(FSTreeNode node) {
+ final File file = CacheManager.getCacheFile(node);
+ deleteFileChecked(file);
+ PersistenceManager.getInstance().removeFileDigest(node.getLocationURI());
+ FSTreeNode parent = node.getParent();
+ if (parent != null) {
+ parent.removeChild(node);
+ }
+ }
+
+ /**
+ * Open a channel connected to the target represented by the peer.
+ *
+ * @return The channel or null if the operation fails.
+ */
+ public static IChannel openChannel(final IPeer peer) throws TCFChannelException {
+ final TCFChannelException[] errors = new TCFChannelException[1];
+ final IChannel[] channels = new IChannel[1];
+ final Rendezvous rendezvous = new Rendezvous();
+ Tcf.getChannelManager().openChannel(peer, null, new DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(Throwable error, IChannel channel) {
+ if (error != null) {
+ if (error instanceof ConnectException) {
+ String message = NLS.bind(Messages.Operation_NotResponding, peer.getID());
+ errors[0] = new TCFChannelException(IStatus.ERROR, message);
+ }
+ else if(!(error instanceof OperationCanceledException)) {
+ String message = NLS.bind(Messages.Operation_OpeningChannelFailureMessage, peer.getID(), error.getMessage());
+ errors[0] = new TCFChannelException(IStatus.OK, message, error);
+ }
+ }
+ else {
+ channels[0] = channel;
+ }
+ rendezvous.arrive();
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch(TimeoutException e) {
+ throw new TCFChannelException(IStatus.ERROR, Messages.Operation_TimeoutOpeningChannel);
+ }
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ return channels[0];
+ }
+
+ /**
+ * Get a blocking file system service from the channel. The
+ * returned file system service is a service that delegates the
+ * method call to the file system proxy. If the method returns
+ * asynchronously with a callback, it will block the call until
+ * the callback returns.
+ * <p>
+ * <em>Note: All the method of the returned file system
+ * service must be called outside of the dispatching thread.</em>
+ *
+ * @param channel The channel to get the file system service.
+ * @return The blocking file system service.
+ */
+ public static IFileSystem getBlockingFileSystem(final IChannel channel) {
+ if(Protocol.isDispatchThread()) {
+ IFileSystem service = channel.getRemoteService(IFileSystem.class);
+ return new BlockingFileSystemProxy(service);
+ }
+ final IFileSystem[] service = new IFileSystem[1];
+ Protocol.invokeAndWait(new Runnable(){
+ @Override
+ public void run() {
+ service[0] = getBlockingFileSystem(channel);
+ }});
+ return service[0];
+ }
+
+ /**
+ * Count the total nodes in the node list including their children and grand children
+ * recursively.
+ *
+ * @param service The file system service used to open those folders that are not expanded yet.
+ * @param nodes The node list to be counted.
+ * @return The count of the total nodes.
+ * @throws TCFFileSystemException Thrown when expanding the unexpanded folders.
+ */
+ protected int count(IFileSystem service, List<FSTreeNode> nodes) throws TCFFileSystemException, InterruptedException {
+ int count = 0;
+ for (FSTreeNode node : nodes) {
+ if (node.isFile()) {
+ count++;
+ }
+ else if (node.isDirectory()) {
+ List<FSTreeNode> children = getChildren(node, service);
+ count += count(service, children) + 1;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Get the children of the specified folder node. If the folder node is not expanded, then
+ * expanded using the specified file system service.
+ *
+ * @param node The folder node.
+ * @param service The file system service.
+ * @return The children of the folder node.
+ * @throws TCFFileSystemException Thrown during querying the children nodes.
+ */
+ protected List<FSTreeNode> getChildren(final FSTreeNode node, final IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if (node.childrenQueried) {
+ return node.getChildren();
+ }
+ loadChildren(node, service);
+ return getChildren(node, service);
+ }
+
+ /**
+ * Get the children the specified folder node. If the folder has not yet been loaded, then load it.
+ *
+ * @param node The folder node.
+ * @return The children of the folder node.
+ * @throws TCFException Thrown during querying the children nodes.
+ */
+ public List<FSTreeNode> getChildren(final FSTreeNode node) throws TCFException, InterruptedException {
+ if(node.childrenQueried) {
+ return node.getChildren();
+ }
+ IChannel channel = null;
+ try {
+ channel = openChannel(node.peerNode.getPeer());
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ return getChildren(node, service);
+ }
+ String message = NLS.bind(Messages.Operation_NoFileSystemError, node.peerNode.getPeerId());
+ throw new TCFFileSystemException(IStatus.ERROR, message);
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ }
+
+ /**
+ * Load the children of the specified folder node using the file system service.
+ *
+ * @param node The folder node.
+ * @param service The file system service.
+ * @throws TCFFileSystemException Thrown during querying the children nodes.
+ */
+ protected void loadChildren(final FSTreeNode node, final IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ List<FSTreeNode> children = queryChildren(node, service);
+ node.addChidren(children);
+ node.queryDone();
+ }
+
+ /**
+ * Query the children of the specified node using the file system service.
+ *
+ * @param node The folder node.
+ * @param service The file system service.
+ * @return The children of the folder node.
+ * @throws TCFFileSystemException Thrown during querying the children nodes.
+ */
+ protected List<FSTreeNode> queryChildren(final FSTreeNode node, final IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if(monitor.isCanceled()) throw new InterruptedException();
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ final IFileHandle[] handles = new IFileHandle[1];
+ try {
+ String dir = node.getLocation();
+ service.opendir(dir, new DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, IFileHandle handle) {
+ if (error != null) {
+ String message = NLS.bind(Messages.Operation_CannotOpenDir, node.name, error);
+ errors[0] = new TCFFileSystemException(IStatus.WARNING, message, error);
+ }
+ else {
+ handles[0] = handle;
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ errors[0] = null;
+ final List<FSTreeNode> children = new ArrayList<FSTreeNode>();
+ final boolean[] eofs = new boolean[1];
+ while (!eofs[0]) {
+ service.readdir(handles[0], new DoneReadDir() {
+ @Override
+ public void doneReadDir(IToken token, FileSystemException error, DirEntry[] entries, boolean eof) {
+ if (eof) {
+ eofs[0] = true;
+ }
+ if (error == null) {
+ if (entries != null && entries.length > 0) {
+ for (DirEntry entry : entries) {
+ FSTreeNode childNode = new FSTreeNode(node, entry, false);
+ children.add(childNode);
+ }
+ }
+ }
+ else {
+ errors[0] = newTCFException(IStatus.INFO, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ }
+ return children;
+ }
+ finally {
+ if (handles[0] != null) {
+ service.close(handles[0], new IFileSystem.DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Remove the child from the children list of the specified folder. If the folder has not yet
+ * expanded, then expand it.
+ *
+ * @param service The file system service.
+ * @param folder The folder node from which the node is going to be removed.
+ * @param child The child node to be removed.
+ * @throws TCFFileSystemException Thrown during children querying.
+ */
+ protected void removeChild(final IFileSystem service, final FSTreeNode folder, final FSTreeNode child) throws TCFFileSystemException, InterruptedException {
+ if (Protocol.isDispatchThread()) {
+ if (!folder.childrenQueried) {
+ loadChildren(folder, service);
+ }
+ folder.removeChild(child);
+ child.setParent(null);
+ }
+ else {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ final InterruptedException[] iexs = new InterruptedException[1];
+ Protocol.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ removeChild(service, folder, child);
+ }
+ catch (TCFFileSystemException e) {
+ errors[0] = e;
+ }
+ catch (InterruptedException e) {
+ iexs[0] = e;
+ }
+ }
+ });
+ if (errors[0] != null) throw errors[0];
+ if (iexs[0] != null) throw iexs[0];
+ }
+ }
+
+ /**
+ * Find the node with the name from the children list of the folder.
+ *
+ * @param service The file system service.
+ * @param folder The folder node.
+ * @param name The target node's name.
+ * @return The node with the specified name or null if no such node is found.
+ * @throws TCFFileSystemException Thrown when querying the children.
+ */
+ protected FSTreeNode findChild(IFileSystem service, FSTreeNode folder, String name) throws TCFFileSystemException, InterruptedException {
+ List<FSTreeNode> children = getChildren(folder, service);
+ for (FSTreeNode child : children) {
+ if (child.name.equals(name)) return child;
+ }
+ return null;
+ }
+
+ /**
+ * Create the name for the target file that is copied. If there exists a file with the same
+ * name, then "Copy of xxxx" and "Copy (n) of xxxx" will be used as the target file name.
+ *
+ * @param service File system service used to query the children nodes of the folder.
+ * @param node The node whose target file is to be created.
+ * @param dest The destination folder.
+ * @return The new target node with the new name following the rule.
+ * @throws TCFFileSystemException Thrown during children querying.
+ */
+ protected FSTreeNode createCopyDestination(IFileSystem service, FSTreeNode node, FSTreeNode dest) throws TCFFileSystemException, InterruptedException {
+ FSTreeNode copy = (FSTreeNode) node.clone();
+ String name = node.name;
+ FSTreeNode possibleChild = findChild(service, dest, name);
+ for (int n = 0; possibleChild != null; n++) {
+ if (n > 0) {
+ name = NLS.bind(Messages.Operation_CopyNOfFile, Integer.valueOf(n), node.name);
+ }
+ else {
+ name = NLS.bind(Messages.Operation_CopyOfFile, node.name);
+ }
+ possibleChild = findChild(service, dest, name);
+ }
+ copy.name = name;
+ addChild(service, dest, copy);
+ return copy;
+ }
+
+ /**
+ * Make a new directory with for the new node.
+ *
+ * @param service The file system service.
+ * @param node The directory node to be made.
+ * @throws TCFFileSystemException Thrown during children querying.
+ */
+ protected void mkdir(IFileSystem service, final FSTreeNode node) throws TCFFileSystemException {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ String path = node.getLocation(true);
+ service.mkdir(path, node.attr, new DoneMkDir() {
+ @Override
+ public void doneMkDir(IToken token, FileSystemException error) {
+ if (error != null) {
+ String message = NLS
+ .bind(Messages.Operation_CannotCreateDirectory, new Object[] { node.name, error });
+ errors[0] = new TCFFileSystemException(IStatus.WARNING, message, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ }
+
+ /**
+ * Confirm if the file/folder represented by the specified should be replaced.
+ *
+ * @param node The file/folder node.
+ * @return The confirming result. true yes, false no.
+ * @throws InterruptedException Thrown when canceled.
+ */
+ protected boolean confirmReplace(final FSTreeNode node, IConfirmCallback confirmCallback) throws InterruptedException {
+ if(confirmCallback == null) return true;
+ if (yes2All) return true;
+ int result = confirmCallback.confirms(node);
+ switch (result) {
+ case 0:
+ return true;
+ case 1:
+ yes2All = true;
+ return true;
+ case 2:
+ return false;
+ }
+ throw new InterruptedException();
+ }
+
+ /**
+ * Add the specified child to the folder node's children list.
+ *
+ * @param service The file system service.
+ * @param folder The folder node.
+ * @param child The child node to be added.
+ * @throws TCFFileSystemException Thrown during children querying.
+ */
+ protected void addChild(final IFileSystem service, final FSTreeNode folder, final FSTreeNode child) throws TCFFileSystemException, InterruptedException {
+ if (Protocol.isDispatchThread()) {
+ if (!folder.childrenQueried) {
+ loadChildren(folder, service);
+ }
+ child.setParent(folder);
+ folder.addChild(child);
+ }
+ else {
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ final InterruptedException[] iexs = new InterruptedException[1];
+ Protocol.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ addChild(service, folder, child);
+ }
+ catch (TCFFileSystemException e) {
+ errors[0] = e;
+ }
+ catch (InterruptedException e) {
+ iexs[0] = e;
+ }
+ }
+ });
+ if (errors[0] != null) throw errors[0];
+ if (iexs[0] != null) throw iexs[0];
+ }
+ }
+
+ /**
+ * Remove the file.
+ *
+ * @param node
+ * @param service
+ * @throws TCFFileSystemException
+ */
+ protected void removeFile(final FSTreeNode node, IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if (monitor.isCanceled()) throw new InterruptedException();
+ // Do the actual deleting.
+ String path = node.getLocation(true);
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ service.remove(path, new DoneRemove() {
+ @Override
+ public void doneRemove(IToken token, FileSystemException error) {
+ if (error == null) {
+ cleanUpFile(node);
+ }
+ else {
+ errors[0] = newTCFException(IStatus.WARNING, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ }
+
+ /**
+ * Remove the folder.
+ *
+ * @param node
+ * @param service
+ * @throws TCFFileSystemException
+ */
+ protected void removeFolder(final FSTreeNode node, IFileSystem service) throws TCFFileSystemException, InterruptedException {
+ if (monitor.isCanceled()) throw new InterruptedException();
+ // Do the actual deleting.
+ String path = node.getLocation(true);
+ final TCFFileSystemException[] errors = new TCFFileSystemException[1];
+ service.rmdir(path, new DoneRemove() {
+ @Override
+ public void doneRemove(IToken token, FileSystemException error) {
+ if (error == null) {
+ cleanUpFolder(node);
+ }
+ else {
+ errors[0] = newTCFException(IStatus.WARNING, error);
+ }
+ }
+ });
+ if (errors[0] != null) {
+ throw errors[0];
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ this.monitor = monitor;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getName()
+ */
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation#getTotalWork()
+ */
+ @Override
+ public int getTotalWork() {
+ return IProgressMonitor.UNKNOWN;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.core.utils.Ancestor#getParent(java.lang.Object)
+ */
+ @Override
+ protected FSTreeNode getParent(FSTreeNode element) {
+ return element.getParent();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/FSTreeNodePropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/FSTreeNodePropertyTester.java
new file mode 100644
index 000000000..ec31cf72c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/FSTreeNodePropertyTester.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River) - [345387]Open the remote files with a proper editor
+ * William Chen (Wind River) - [352302]Opening a file in an editor depending on
+ * the client's permissions.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.testers;
+
+import java.io.File;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+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.model.CacheState;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The property tester of an FSTreeNode. The properties include "isFile"
+ * if it is a file node, "isDirectory" if it is a directory, "isBinaryFile"
+ * if it is a binary file, "isReadable" if it is readable, "isWritable" if
+ * it is writable, "isExecutable" if it is executable, "isRoot" if it is a
+ * root directory, "isWindows" if it is a windows file node, "isReadOnly"
+ * if it is read only, "isHidden" if it is hidden, "getCacheState" to
+ * get a node's state.
+ * <p>
+ * "testParent" is a property by which the parent or even the grand parent
+ * of a node can be tested. The arguments is a recursive list of the above
+ * test property including "testParent".
+ * <p>
+ * The following is an example of how it is used.
+ * <pre>
+ * &lt;test
+ * args="isWritable"
+ * property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent"&gt;
+ * &lt;/test&gt;
+ * </pre>
+ * <p>
+ * The above example tests if the parent node is writable.
+ * <pre>
+ * &lt;test
+ * args="testParent,isWritable"
+ * property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent"&gt;
+ * &lt;/test&gt;
+ * </pre>
+ * <p>
+ * The above example tests if the grand parent node is writable.
+ * <p>
+ * And so on, you can test its ancestor recursively:
+ * <pre>
+ * &lt;test
+ * args="testParent,testParent,testParent,...,isWritable"
+ * property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent"&gt;
+ * &lt;/test&gt;
+ * </pre>
+ */
+public class FSTreeNodePropertyTester extends PropertyTester {
+
+ /* (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(receiver == null)
+ return false;
+ Assert.isTrue(receiver instanceof FSTreeNode);
+ FSTreeNode node = (FSTreeNode) receiver;
+ if (property.equals("isFile")) { //$NON-NLS-1$
+ return node.isFile();
+ } else if (property.equals("isDirectory")) { //$NON-NLS-1$
+ return node.isDirectory();
+ } else if (property.equals("isBinaryFile")) { //$NON-NLS-1$
+ return ContentTypeHelper.isBinaryFile(node);
+ } else if (property.equals("isReadable")){ //$NON-NLS-1$
+ return node.isReadable();
+ } else if (property.equals("isWritable")){ //$NON-NLS-1$
+ return node.isWritable();
+ } else if (property.equals("isExecutable")){ //$NON-NLS-1$
+ return node.isExecutable();
+ } else if (property.equals("isRoot")) { //$NON-NLS-1$
+ return node.isRoot();
+ } else if (property.equals("isSystemRoot")) { //$NON-NLS-1$
+ return node.isSystemRoot();
+ } else if (property.equals("isWindows")) { //$NON-NLS-1$
+ return node.isWindowsNode();
+ } else if (property.equals("isReadOnly")) { //$NON-NLS-1$
+ return node.isReadOnly();
+ } else if (property.equals("isHidden")) { //$NON-NLS-1$
+ return node.isHidden();
+ } else if (property.equals("testParent")) { //$NON-NLS-1$
+ return testParent(node, args, expectedValue);
+ } else if (property.equals("getCacheState")){ //$NON-NLS-1$
+ File file = CacheManager.getCacheFile(node);
+ if(!file.exists())
+ return false;
+ CacheState state = node.getCacheState();
+ return state.name().equals(expectedValue);
+ }
+ return false;
+ }
+
+ private boolean testParent(FSTreeNode node, Object[] args, Object expectedValue) {
+ if(args == null || args.length == 0)
+ return false;
+ String arg = (String) args[0];
+ Object[] newArgs = new Object[args.length -1];
+ System.arraycopy(args, 1, newArgs, 0, args.length - 1);
+ return test(node.getParent(), arg, newArgs, expectedValue);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/TargetPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/TargetPropertyTester.java
new file mode 100644
index 000000000..3b6ca32b0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/testers/TargetPropertyTester.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.testers;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * The property tester to test if the target OS is a Windows OS.
+ */
+public class TargetPropertyTester extends PropertyTester {
+
+ /*
+ * (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(receiver instanceof IPeerNode) {
+ final IPeerNode peerNode = (IPeerNode) receiver;
+ if(property.equals("isWindows")) { //$NON-NLS-1$
+ return isWindows(peerNode);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if the target represented by the peer model is a windows target.
+ *
+ * @param peerNode The peer model of the target.
+ * @return true if it is a windows target.
+ */
+ public static boolean isWindows(final IPeerNode peerNode) {
+ final String osName = getOSName(peerNode);
+ return osName == null ? false : (osName.startsWith("Windows")); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the OS name from the peer model.
+ *
+ * @param peerNode The peer model.
+ * @return OS name.
+ */
+ public static String getOSName(final IPeerNode peerNode) {
+ final String[] osName = new String[1];
+ if (Protocol.isDispatchThread()) {
+ osName[0] = peerNode.getPeer().getOSName();
+ }
+ else {
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ osName[0] = peerNode.getPeer().getOSName();
+ }
+ });
+ }
+ return osName[0];
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfInputStream.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfInputStream.java
new file mode 100644
index 000000000..613bf6f64
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfInputStream.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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:
+ * William Chen (Wind River)- [345387]Open the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.url;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem.DoneRead;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The TCF input stream returned by {@link TcfURLConnection#getInputStream()}.
+ */
+public class TcfInputStream extends InputStream {
+ // Default chunk size while pumping the data.
+ private static final int DEFAULT_CHUNK_SIZE = 5 * 1024;
+
+ // Current reading position
+ long position;
+ // The byte array used to buffer data.
+ byte[] buffer;
+ // The offset being read in the buffer.
+ int offset;
+
+ // If the reading has reached the end of the file.
+ boolean EOF;
+ // If the stream has been closed.
+ boolean closed;
+ // The current error during reading.
+ Exception ERROR;
+
+ // The chunk size of the reading buffer.
+ int chunk_size = 0;
+
+ // The URL Connection
+ TcfURLConnection connection;
+
+ /**
+ * Create a TCF input stream connected the specified peer with specified
+ * path to the remote resource.
+ *
+ * @param peer
+ * The TCF agent peer.
+ * @param path
+ * The path to the remote resource.
+ */
+ public TcfInputStream(TcfURLConnection connection) {
+ this(connection, DEFAULT_CHUNK_SIZE);
+ }
+
+ /**
+ * Create a TCF input stream connected the specified peer with specified
+ * path to the remote resource using the specified buffer size.
+ *
+ * @param peer
+ * The TCF agent peer.
+ * @param path
+ * The path to the remote resource.
+ * @param chunk_size
+ * The buffer size.
+ */
+ public TcfInputStream(TcfURLConnection connection, int chunk_size) {
+ this.connection = connection;
+ this.chunk_size = chunk_size;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.InputStream#read()
+ */
+ @Override
+ public int read() throws IOException {
+ if (closed)
+ throw new IOException(Messages.TcfInputStream_StreamClosed);
+ if (ERROR != null) {
+ IOException exception = new IOException(ERROR.toString());
+ exception.initCause(ERROR);
+ throw exception;
+ }
+ if (buffer == null) {
+ if (EOF) {
+ return -1;
+ }
+ readBlock();
+ return read();
+ }
+ if (EOF) {
+ if (offset == buffer.length) {
+ return -1;
+ }
+ // Note that convert the byte to an integer correctly
+ return 0xff & buffer[offset++];
+ }
+ if (offset == buffer.length) {
+ readBlock();
+ return read();
+ }
+ // Note that convert the byte to an integer correctly
+ return 0xff & buffer[offset++];
+ }
+
+ /**
+ * Read a block of data into the buffer. Reset the offset, increase the
+ * current position and remember the EOF status. If there's an error,
+ * remember it for read() to check.
+ */
+ private void readBlock() {
+ connection.service.read(connection.handle, position, chunk_size, new DoneRead() {
+ @Override
+ public void doneRead(IToken token, FileSystemException error, byte[] data, boolean eof) {
+ if (error != null) {
+ ERROR = error;
+ }
+ if (data == null) {
+ ERROR = new IOException(Messages.TcfInputStream_NoDataAvailable);
+ }
+ EOF = eof;
+ buffer = data;
+ if (buffer != null)
+ position += buffer.length;
+ offset = 0;
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.InputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ if (!closed) {
+ connection.closeStream(this);
+ closed = true;
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java
new file mode 100644
index 000000000..6f1c7e202
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.url;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem.DoneWrite;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The TCF output stream returned by {@link TcfURLConnection#getOutputStream()}.
+ */
+public class TcfOutputStream extends OutputStream {
+ // Default chunk size while pumping the data.
+ private static final int DEFAULT_CHUNK_SIZE = 5 * 1024;
+
+ // Current writing position
+ long position;
+ // The byte array used to buffer data.
+ byte[] buffer;
+ // The offset being written in the buffer.
+ int offset;
+
+ // If the stream has been closed.
+ boolean closed;
+ // The current error during writing.
+ Exception ERROR;
+
+ // The URL Connection
+ TcfURLConnection connection;
+ /**
+ * Create a TCF output stream connected the specified peer with specified
+ * path to the remote resource.
+ *
+ * @param peer
+ * The TCF agent peer.
+ * @param path
+ * The path to the remote resource.
+ */
+ public TcfOutputStream(TcfURLConnection connection) {
+ this(connection, DEFAULT_CHUNK_SIZE);
+ }
+
+ /**
+ * Create a TCF output stream connected the specified peer with specified
+ * path to the remote resource using the specified buffer size.
+ *
+ * @param peer
+ * The TCF agent peer.
+ * @param path
+ * The path to the remote resource.
+ * @param chunk_size
+ * The buffer size.
+ */
+ public TcfOutputStream(TcfURLConnection connection, int chunk_size) {
+ this.connection = connection;
+ buffer = new byte[chunk_size];
+ offset = 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(int)
+ */
+ @Override
+ public void write(int b) throws IOException {
+ if (closed)
+ throw new IOException(Messages.TcfOutputStream_StreamClosed);
+ if (ERROR != null) {
+ IOException exception = new IOException(ERROR.toString());
+ exception.initCause(ERROR);
+ throw exception;
+ }
+ if (offset < buffer.length) {
+ buffer[offset++] = (byte) b;
+ }
+ if (offset == buffer.length)
+ flush();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#flush()
+ */
+ @Override
+ public void flush() throws IOException {
+ if (offset > 0) {
+ connection.service.write(connection.handle, position, buffer, 0, offset, new DoneWrite() {
+ @Override
+ public void doneWrite(IToken token, FileSystemException error) {
+ if (error != null) {
+ ERROR = error;
+ }
+ position += offset;
+ offset = 0;
+ }
+ });
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ if (!closed) {
+ connection.closeStream(this);
+ closed = true;
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java
new file mode 100644
index 000000000..3d1e53126
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.internal.url;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneClose;
+import org.eclipse.tcf.services.IFileSystem.DoneOpen;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.services.IFileSystem.IFileHandle;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+
+/**
+ * The URL connection returned by TCF stream service used to handle "tcf"
+ * stream protocol.
+ */
+public class TcfURLConnection extends URLConnection {
+ // Default connecting timeout.
+ private static final int DEFAULT_CONNECT_TIMEOUT = 5000;
+ // Default file opening timeout.
+ private static final int DEFAULT_OPEN_TIMEOUT = 5000;
+ // Default file reading timeout.
+ private static final int DEFAULT_READ_TIMEOUT = 5000;
+ // Default file closing timeout.
+ private static final int DEFAULT_CLOSE_TIMEOUT = 5000;
+ // The schema name of the stream protocol.
+ public static final String PROTOCOL_SCHEMA = "tcf"; //$NON-NLS-1$
+
+ // The input stream of this connection.
+ private TcfInputStream inputStream;
+ // The output stream of this connection.
+ private TcfOutputStream outputStream;
+
+ // The TCF agent peer of the connection.
+ private IPeer peer;
+ // The path to the resource on the remote file system.
+ String path;
+ // The timeout for opening a file.
+ private int openTimeout;
+ // The timeout for closing a file.
+ private int closeTimeout;
+
+ // The TCF channel used to open and read the resource.
+ IChannel channel;
+ // The file's handle
+ IFileHandle handle;
+ // The file service
+ IFileSystem service;
+
+ /**
+ * Create a TCF URL Connection using the specified url. The format of this
+ * URL should be: tcf:/<TCF_AGENT_ID>/remote/path/to/the/resource... The
+ * stream protocol schema is designed in this way in order to retrieve the
+ * agent peer ID without knowing the structure of a TCF peer id.
+ *
+ * @see TcfURLStreamHandlerService#parseURL(URL, String, int, int)
+ * @param url
+ * The URL of the resource.
+ */
+ public TcfURLConnection(final URL url) {
+ super(url);
+ // The peerId is stored as the host name in URL. See TcfURLStreamHandlerService#parseURL for details.
+ String peerId = url.getHost();
+ Assert.isNotNull(peerId);
+ peer = findPeer(peerId);
+ if(peer == null) {
+ throw new IllegalArgumentException(NLS.bind(Messages.TcfURLConnection_NoPeerFound, peerId));
+ }
+ path = url.getPath();
+ // Set default timeout.
+ setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
+ setOpenTimeout(DEFAULT_OPEN_TIMEOUT);
+ setReadTimeout(DEFAULT_READ_TIMEOUT);
+ setCloseTimeout(DEFAULT_CLOSE_TIMEOUT);
+ }
+
+ /**
+ * Find the TCF peer with the specified ID.
+ *
+ * @param peerId The target peer's ID.
+ * @return The peer with this ID or null if not found.
+ */
+ private IPeer findPeer(final String peerId) {
+ Assert.isNotNull(peerId);
+
+ final AtomicReference<IPeer> peer = new AtomicReference<IPeer>();
+
+ Runnable runnable = new Runnable() {
+
+ @Override
+ public void run() {
+ IPeer p = Protocol.getLocator().getPeers().get(peerId);
+ if (p == null) {
+ IPeerNode peerNode = ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId);
+ if (peerNode != null) p = peerNode.getPeer();
+ }
+ peer.set(p);
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return peer.get();
+ }
+
+ /**
+ * Get the timeout for closing a file.
+ *
+ * @return the timeout in milliseconds.
+ */
+ public long getCloseTimeout() {
+ return closeTimeout;
+ }
+
+ /**
+ * Set the timeout for closing a file.
+ *
+ * @param closeTimeout
+ * the timeout in milliseconds.
+ */
+ public void setCloseTimeout(int closeTimeout) {
+ this.closeTimeout = closeTimeout;
+ }
+
+ /**
+ * Get the timeout for opening a file.
+ *
+ * @return the timeout in milliseconds.
+ */
+ public long getOpenTimeout() {
+ return openTimeout;
+ }
+
+ /**
+ * Set the timeout for opening a file.
+ *
+ * @param openTimeout
+ * the timeout in milliseconds.
+ */
+ public void setOpenTimeout(int openTimeout) {
+ this.openTimeout = openTimeout;
+ }
+
+ /**
+ * Open a file on the remote file system for read/write and store the file handle.
+ *
+ * @throws IOException Opening file fails.
+ */
+ private void openFile() throws IOException {
+ if(peer == null)
+ throw new IOException(Messages.TcfURLConnection_NoSuchTcfAgent);
+ try {
+ // Open the channel
+ channel = Operation.openChannel(peer);
+ } catch (TCFChannelException e) {
+ throw new IOException(e.getMessage());
+ }
+ if (channel != null) {
+ service = Operation.getBlockingFileSystem(channel);
+ if (service != null) {
+ final FileSystemException[] errors = new FileSystemException[1];
+ // Open the file.
+ int open_flag = 0;
+ if (doInput)
+ open_flag |= IFileSystem.TCF_O_READ;
+ if (doOutput)
+ open_flag |= IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_TRUNC;
+ service.open(path, open_flag, null, new DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, IFileHandle hdl) {
+ errors[0] = error;
+ handle = hdl;
+ }
+ });
+ if (errors[0] != null) {
+ IOException exception = new IOException(errors[0].toString());
+ exception.initCause(errors[0]);
+ throw exception;
+ }
+ if (handle == null) {
+ throw new IOException(Messages.TcfURLConnection_NoFileHandleReturned);
+ }
+ } else {
+ throw new IOException(Messages.Operation_NoFileSystemError);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.net.URLConnection#connect()
+ */
+ @Override
+ public void connect() throws IOException {
+ if (!connected) {
+ openFile();
+ if (doInput) {
+ inputStream = new TcfInputStream(this);
+ }
+ if (doOutput) {
+ outputStream = new TcfOutputStream(this);
+ }
+ connected = true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.net.URLConnection#getInputStream()
+ */
+ @Override
+ public InputStream getInputStream() throws IOException {
+ if (!connected)
+ connect();
+ return inputStream;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.net.URLConnection#getOutputStream()
+ */
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ if (!connected)
+ connect();
+ return outputStream;
+ }
+
+ /**
+ * Close the stream, release its file handler and close
+ * the TCF channel used if possible.
+ *
+ * @param stream The stream either the input stream or the output stream.
+ * @throws IOException If closing file handle times out.
+ */
+ public synchronized void closeStream(Closeable stream) throws IOException {
+ boolean shouldClose = shouldCloseFileHandle(stream);
+ if (shouldClose) {
+ service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ Tcf.getChannelManager().closeChannel(channel);
+ }
+ });
+ }
+ }
+
+ /**
+ * Decide if the file handle and the TCF channel should be closed if
+ * the specified stream is closed. If the stream is the last stream
+ * that depends on the file handle and the TCF channel, then it should
+ * be closed.
+ *
+ * @param stream The stream to be closed.
+ * @return true if the file handle and the TCF channel should be closed.
+ */
+ private boolean shouldCloseFileHandle(Closeable stream) {
+ boolean shouldClose = false;
+ if (stream == inputStream) {
+ if (doOutput) {
+ if (outputStream.closed) {
+ shouldClose = true;
+ }
+ } else {
+ shouldClose = true;
+ }
+ } else if (stream == outputStream) {
+ if (doInput) {
+ if (inputStream.closed)
+ shouldClose = true;
+ } else {
+ shouldClose = true;
+ }
+ }
+ return shouldClose;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLStreamHandlerService.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLStreamHandlerService.java
new file mode 100644
index 000000000..dabe51149
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLStreamHandlerService.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.url;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.osgi.service.url.AbstractURLStreamHandlerService;
+
+/**
+ * The stream handler service used to parse tcf stream protocol.
+ */
+public class TcfURLStreamHandlerService extends AbstractURLStreamHandlerService {
+ // The pattern of a windows path.
+ private static final String WINPATH_PATTERN = "[A-Za-z]:.*"; //$NON-NLS-1$
+ private static final char[] WINPATH_FORBIDDEN_CHARS = {':', '*', '?', '"', '<', '>', '|' };
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.service.url.AbstractURLStreamHandlerService#openConnection(java.net.URL)
+ */
+ @Override
+ public URLConnection openConnection(URL u) throws IOException {
+ return new TcfURLConnection(u);
+ }
+
+ /**
+ * Parse the given spec to the specified URL object. The expected format is:
+ * <p>
+ *
+ * <pre>
+ * TCF_URL = tcf:/<strong>PEER_ID</strong>/(<strong>URL_PATH</strong>)?
+ * PEER_ID = (.^/)+
+ * URL_PATH = <strong>WIN_PATH</strong> | <strong>RELATIVE_PATH</strong>
+ * WIN_PATH = <strong>DISK_SEG</strong> / (<strong>RELATIVE_PATH</strong>)?
+ * DISK_SEG = [a-zA-Z]:
+ * RELATIVE_PATH = <strong>PATH_SEG</strong> | <strong>PATH_SEG</strong>/<strong>RELATIVE_PATH</strong>
+ * Unix/Linux PATH_SEG = (.^[/])+
+ * Windows PATH_SEG = (.^[\/:*?"<>|])+
+ * </pre>
+ */
+ @Override
+ protected void parseURL(URL u, String spec, int start, int limit) {
+ if (u.getPath() != null) {
+ String path = u.getPath();
+ if (!path.endsWith("/")) { //$NON-NLS-1$
+ path += "/"; //$NON-NLS-1$
+ }
+ path += spec;
+ setURL(u, u.getProtocol(), u.getHost(), u.getPort(), u.getAuthority(), u.getUserInfo(), path, u.getQuery(), u.getRef());
+ }
+ else {
+ IllegalArgumentException errorFormat = new IllegalArgumentException(Messages.TcfURLStreamHandlerService_ErrorURLFormat);
+ int end = spec.indexOf("/", start); //$NON-NLS-1$
+ if (end == -1) throw errorFormat;
+ start = end + 1;
+ end = spec.indexOf("/", start); //$NON-NLS-1$
+ if (end == -1) throw errorFormat;
+ String peerId = spec.substring(start, end);
+ if (peerId.trim().length() == 0) throw errorFormat;
+ start = end + 1;
+ String path = spec.substring(start);
+ if (path.length() > 0) {
+ if (path.matches(WINPATH_PATTERN)) {
+ String pathext = path.substring(2); // Cut the path after ':'.
+ if (pathext.length() == 0) throw new IllegalArgumentException(Messages.TcfURLStreamHandlerService_OnlyDiskPartError);
+ pathext = pathext.substring(1); // Cut the path after the disk part.
+ checkWinPath(pathext);
+ }
+ else {
+ path = "/" + path; //$NON-NLS-1$
+ }
+ }
+ else {
+ path = "/"; //$NON-NLS-1$
+ }
+ final String path2decode = path;
+ final AtomicReference<String> pathRef = new AtomicReference<String>();
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ @Override
+ public void run() throws Exception {
+ pathRef.set(decodeURLPath(path2decode));
+ }});
+ path = pathRef.get();
+ setURL(u, TcfURLConnection.PROTOCOL_SCHEMA, peerId, -1, null, null, path, null, null);
+ }
+ }
+
+ /**
+ * Decode the path from URI compatible path to a
+ * file system path.
+ *
+ * @see FSTreeNode#getURLEncodedPath
+ * @param path The URL whose path is to be decoded.
+ * @return The file system path.
+ * @throws UnsupportedEncodingException
+ */
+ String decodeURLPath(String path) throws UnsupportedEncodingException {
+ StringTokenizer st = new StringTokenizer(path, "/"); //$NON-NLS-1$
+ StringBuilder builder = new StringBuilder();
+ while(st.hasMoreTokens()) {
+ if(builder.length() > 0) {
+ builder.append("/"); //$NON-NLS-1$
+ }
+ String segment = st.nextToken();
+ builder.append(URLDecoder.decode(segment, "UTF-8")); //$NON-NLS-1$
+ }
+ String relative = builder.toString();
+ return path.startsWith("/") ? "/" + relative : relative; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ /**
+ * Check the format of the specified windows path.
+ *
+ * @param path The relative path to a disk part.
+ */
+ private void checkWinPath(String path) {
+ for (int i = 0; i < path.length(); i++) {
+ char c = path.charAt(i);
+ for(int j=0;j<WINPATH_FORBIDDEN_CHARS.length;j++) {
+ if(c==WINPATH_FORBIDDEN_CHARS[j]) {
+ throw new IllegalArgumentException(NLS.bind(Messages.TcfURLStreamHandlerService_IllegalCharacter, "'"+c+"'")); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+ }
+ }
+
+ /**
+ * Encode the path from a file system path to
+ * URI compatible path.
+ *
+ * @see FSTreeNode#getURLEncodedPath
+ * @param path The URL whose path is to be decoded.
+ * @return The file system path.
+ * @throws UnsupportedEncodingException
+ */
+ String encodeURLPath(String path) throws UnsupportedEncodingException {
+ StringTokenizer st = new StringTokenizer(path, "/"); //$NON-NLS-1$
+ StringBuilder builder = new StringBuilder();
+ while(st.hasMoreTokens()) {
+ if(builder.length() > 0) {
+ builder.append("/"); //$NON-NLS-1$
+ String segment = st.nextToken();
+ builder.append(URLEncoder.encode(segment, "UTF-8")); //$NON-NLS-1$
+ }
+ else {
+ String segment = st.nextToken();
+ if(path.matches(WINPATH_PATTERN)) {
+ builder.append(segment);
+ }
+ else{
+ builder.append(URLEncoder.encode(segment, "UTF-8")); //$NON-NLS-1$
+ }
+ }
+ }
+ String relative = builder.toString();
+ return path.startsWith("/") ? "/" + relative : relative; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.service.url.AbstractURLStreamHandlerService#toExternalForm(java.net.URL)
+ */
+ @Override
+ public String toExternalForm(final URL u) {
+ String peerId = u.getHost();
+ StringBuilder builder = new StringBuilder();
+ builder.append(TcfURLConnection.PROTOCOL_SCHEMA);
+ builder.append(":/"); //$NON-NLS-1$
+ builder.append(peerId);
+ final AtomicReference<String> pathRef = new AtomicReference<String>();
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore
+ }
+ @Override
+ public void run() throws Exception {
+ pathRef.set(encodeURLPath(u.getPath()));
+ }});
+ String path = pathRef.get();
+ if(path == null) {
+ builder.append("/"); //$NON-NLS-1$
+ } else if(path.length() == 0) {
+ builder.append("/"); //$NON-NLS-1$
+ } else if(path.matches(WINPATH_PATTERN)) {
+ builder.append("/"); //$NON-NLS-1$
+ builder.append(path);
+ } else {
+ builder.append(path);
+ }
+ return builder.toString();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/BlockingFileSystemProxy.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/BlockingFileSystemProxy.java
new file mode 100644
index 000000000..98a4b189b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/BlockingFileSystemProxy.java
@@ -0,0 +1,880 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.core.internal.utils;
+
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.te.tcf.core.concurrent.Rendezvous;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * A blocking call proxy for a file system service. All calls to the service method are blocked
+ * until its "Done" handler is invoked.
+ * <p>
+ * <em>Note that all method call over the proxy must be made <b>OUTSIDE</b> of
+ * the dispatching thread.</em> If it is called inside of the dispatching thread, the call will be
+ * blocked forever.
+ * <p>
+ * This class is used to replace BlockingProxyCall for better debugability.
+ *
+ * @see BlockingCallProxy
+ */
+public class BlockingFileSystemProxy implements IFileSystem {
+ // The default timeout waiting for blocked invocations.
+ private static final long DEFAULT_TIMEOUT = Operation.DEFAULT_TIMEOUT;
+ // The actual object that provides file system services.
+ IFileSystem service;
+
+ /**
+ * Constructor with an delegating service.
+ *
+ * @param service The delegating service.
+ */
+ public BlockingFileSystemProxy(IFileSystem service) {
+ Assert.isNotNull(service);
+ this.service = service;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.protocol.IService#getName()
+ */
+ @Override
+ public String getName() {
+ return service.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#open(java.lang.String, int, org.eclipse.tcf.services.IFileSystem.FileAttrs, org.eclipse.tcf.services.IFileSystem.DoneOpen)
+ */
+ @Override
+ public IToken open(final String file_name, final int flags, final FileAttrs attrs, final DoneOpen done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.open(file_name, flags, attrs, new DoneOpen() {
+ @Override
+ public void doneOpen(final IToken token, final FileSystemException error, final IFileHandle handle) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneOpen(token, error, handle);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutOpeningFile, file_name));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#close(org.eclipse.tcf.services.IFileSystem.IFileHandle, org.eclipse.tcf.services.IFileSystem.DoneClose)
+ */
+ @Override
+ public IToken close(final IFileHandle handle, final DoneClose done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneClose(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutClosingFile, handle));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#read(org.eclipse.tcf.services.IFileSystem.IFileHandle, long, int, org.eclipse.tcf.services.IFileSystem.DoneRead)
+ */
+ @Override
+ public IToken read(final IFileHandle handle, final long offset, final int len, final DoneRead done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.read(handle, offset, len, new DoneRead() {
+ @Override
+ public void doneRead(final IToken token, final FileSystemException error, final byte[] data, final boolean eof) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneRead(token, error, data, eof);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutReadingFile, handle));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#write(org.eclipse.tcf.services.IFileSystem.IFileHandle, long, byte[], int, int, org.eclipse.tcf.services.IFileSystem.DoneWrite)
+ */
+ @Override
+ public IToken write(final IFileHandle handle, final long offset, final byte[] data, final int data_pos, final int data_size, final DoneWrite done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.write(handle, offset, data, data_pos, data_size, new DoneWrite() {
+ @Override
+ public void doneWrite(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneWrite(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutWritingFile, handle));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#stat(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneStat)
+ */
+ @Override
+ public IToken stat(final String path, final DoneStat done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.stat(path, new DoneStat() {
+ @Override
+ public void doneStat(final IToken token, final FileSystemException error, final FileAttrs attrs) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneStat(token, error, attrs);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutStat, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#lstat(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneStat)
+ */
+ @Override
+ public IToken lstat(final String path, final DoneStat done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.lstat(path, new DoneStat() {
+ @Override
+ public void doneStat(final IToken token, final FileSystemException error, final FileAttrs attrs) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneStat(token, error, attrs);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutLstat, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#fstat(org.eclipse.tcf.services.IFileSystem.IFileHandle, org.eclipse.tcf.services.IFileSystem.DoneStat)
+ */
+ @Override
+ public IToken fstat(final IFileHandle handle, final DoneStat done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.fstat(handle, new DoneStat() {
+ @Override
+ public void doneStat(final IToken token, final FileSystemException error, final FileAttrs attrs) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneStat(token, error, attrs);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutFstat, handle));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#setstat(java.lang.String, org.eclipse.tcf.services.IFileSystem.FileAttrs, org.eclipse.tcf.services.IFileSystem.DoneSetStat)
+ */
+ @Override
+ public IToken setstat(final String path, final FileAttrs attrs, final DoneSetStat done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.setstat(path, attrs, new DoneSetStat() {
+ @Override
+ public void doneSetStat(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneSetStat(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutSetStat, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#fsetstat(org.eclipse.tcf.services.IFileSystem.IFileHandle, org.eclipse.tcf.services.IFileSystem.FileAttrs, org.eclipse.tcf.services.IFileSystem.DoneSetStat)
+ */
+ @Override
+ public IToken fsetstat(final IFileHandle handle, final FileAttrs attrs, final DoneSetStat done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.fsetstat(handle, attrs, new DoneSetStat() {
+ @Override
+ public void doneSetStat(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneSetStat(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutFSetStat, handle));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#opendir(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneOpen)
+ */
+ @Override
+ public IToken opendir(final String path, final DoneOpen done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.opendir(path, new DoneOpen() {
+ @Override
+ public void doneOpen(final IToken token, final FileSystemException error, final IFileHandle handle) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneOpen(token, error, handle);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutOpeningDir, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#readdir(org.eclipse.tcf.services.IFileSystem.IFileHandle, org.eclipse.tcf.services.IFileSystem.DoneReadDir)
+ */
+ @Override
+ public IToken readdir(final IFileHandle handle, final DoneReadDir done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.readdir(handle, new DoneReadDir() {
+ @Override
+ public void doneReadDir(final IToken token, final FileSystemException error, final DirEntry[] entries, final boolean eof) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneReadDir(token, error, entries, eof);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutReadingDir, handle));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#mkdir(java.lang.String, org.eclipse.tcf.services.IFileSystem.FileAttrs, org.eclipse.tcf.services.IFileSystem.DoneMkDir)
+ */
+ @Override
+ public IToken mkdir(final String path, final FileAttrs attrs, final DoneMkDir done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.mkdir(path, attrs, new DoneMkDir() {
+ @Override
+ public void doneMkDir(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneMkDir(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutMakingDir, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#rmdir(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneRemove)
+ */
+ @Override
+ public IToken rmdir(final String path, final DoneRemove done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.rmdir(path, new DoneRemove() {
+ @Override
+ public void doneRemove(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneRemove(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutRemovingDir, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#roots(org.eclipse.tcf.services.IFileSystem.DoneRoots)
+ */
+ @Override
+ public IToken roots(final DoneRoots done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.roots(new DoneRoots() {
+ @Override
+ public void doneRoots(final IToken token, final FileSystemException error, final DirEntry[] entries) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneRoots(token, error, entries);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(Messages.BlockingFileSystemProxy_TimeoutListingRoots);
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#remove(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneRemove)
+ */
+ @Override
+ public IToken remove(final String file_name, final DoneRemove done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.remove(file_name, new DoneRemove() {
+ @Override
+ public void doneRemove(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneRemove(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutRemovingFile, file_name));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#realpath(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneRealPath)
+ */
+ @Override
+ public IToken realpath(final String path, final DoneRealPath done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.realpath(path, new DoneRealPath() {
+ @Override
+ public void doneRealPath(final IToken token, final FileSystemException error, final String path) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneRealPath(token, error, path);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutGettingRealPath, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#rename(java.lang.String, java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneRename)
+ */
+ @Override
+ public IToken rename(final String old_path, final String new_path, final DoneRename done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.rename(old_path, new_path, new DoneRename() {
+ @Override
+ public void doneRename(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneRename(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutRenamingFile, old_path, new_path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#readlink(java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneReadLink)
+ */
+ @Override
+ public IToken readlink(final String path, final DoneReadLink done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.readlink(path, new DoneReadLink() {
+ @Override
+ public void doneReadLink(final IToken token, final FileSystemException error, final String path) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneReadLink(token, error, path);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutReadingLink, path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#symlink(java.lang.String, java.lang.String, org.eclipse.tcf.services.IFileSystem.DoneSymLink)
+ */
+ @Override
+ public IToken symlink(final String link_path, final String target_path, final DoneSymLink done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.symlink(link_path, target_path, new DoneSymLink() {
+ @Override
+ public void doneSymLink(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneSymLink(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutSymLink, link_path, target_path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#copy(java.lang.String, java.lang.String, boolean, boolean, org.eclipse.tcf.services.IFileSystem.DoneCopy)
+ */
+ @Override
+ public IToken copy(final String src_path, final String dst_path, final boolean copy_permissions, final boolean copy_ownership, final DoneCopy done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.copy(src_path, dst_path, copy_permissions, copy_ownership, new DoneCopy() {
+ @Override
+ public void doneCopy(final IToken token, final FileSystemException error) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneCopy(token, error);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(NLS.bind(Messages.BlockingFileSystemProxy_TimeoutCopying, src_path, dst_path));
+ }
+ return ref.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.services.IFileSystem#user(org.eclipse.tcf.services.IFileSystem.DoneUser)
+ */
+ @Override
+ public IToken user(final DoneUser done) {
+ Assert.isTrue(!Protocol.isDispatchThread());
+ final Rendezvous rendezvous = new Rendezvous();
+ final AtomicReference<IToken> ref = new AtomicReference<IToken>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ IToken token = service.user(new DoneUser() {
+ @Override
+ public void doneUser(final IToken token, final FileSystemException error, final int real_uid, final int effective_uid, final int real_gid, final int effective_gid, final String home) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ }
+
+ @Override
+ public void run() throws Exception {
+ done.doneUser(token, error, real_uid, effective_uid, real_gid, effective_gid, home);
+ }
+ });
+ rendezvous.arrive();
+ }
+ });
+ ref.set(token);
+ }
+ });
+ try {
+ rendezvous.waiting(DEFAULT_TIMEOUT);
+ }
+ catch (TimeoutException e) {
+ throw new RuntimeException(Messages.BlockingFileSystemProxy_TimeoutGettingUser);
+ }
+ return ref.get();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java
new file mode 100644
index 000000000..c5749959f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.core.internal.utils;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The local file system cache used to manage the temporary files downloaded from a remote file
+ * system.
+ */
+public class CacheManager {
+ public static final char PATH_ESCAPE_CHAR = '$';
+
+ /**
+ * Get the local path of a node's cached file.
+ * <p>
+ * The preferred location is within the plugin's state location, in example
+ * <code>&lt;state location&gt;agent_<hashcode_of_peerId>/remote/path/to/the/file...</code>.
+ * <p>
+ * If the plug-in is loaded in a RCP workspace-less environment, the fall back strategy is to
+ * use the users home directory.
+ *
+ * @param node The file/folder node.
+ * @return The local path of the node's cached file.
+ */
+ public static IPath getCachePath(FSTreeNode node) {
+ File location = getCacheRoot();
+ String agentId = node.peerNode.getPeerId();
+ // Use Math.abs to avoid negative hash value.
+ String agent = agentId.replace(':', PATH_ESCAPE_CHAR);
+ IPath agentDir = new Path(location.getAbsolutePath()).append(agent);
+ File agentDirFile = agentDir.toFile();
+ mkdirChecked(agentDirFile);
+ return appendNodePath(agentDir, node);
+ }
+
+ /**
+ * Check and make a directory if it does not exist. Record the failure message if making fails.
+ *
+ * @param file The file to be deleted.
+ */
+ static void mkdirChecked(final File dir) {
+ if (!dir.exists()) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ if (!dir.mkdir()) {
+ throw new Exception(NLS.bind(Messages.CacheManager_MkdirFailed, dir
+ .getAbsolutePath()));
+ }
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ });
+ }
+ }
+
+ /**
+ * Check if the file exists and delete if it does. Record the failure message if deleting fails.
+ *
+ * @param file The file to be deleted.
+ */
+ static void deleteFileChecked(final File file) {
+ if (file.exists()) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ if (!file.delete()) {
+ throw new Exception(NLS.bind(Messages.Operation_DeletingFileFailed, file
+ .getAbsolutePath()));
+ }
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ });
+ }
+ }
+
+ /**
+ * Check if the file exists and set its read-only attribute if it does. Record the failure
+ * message if it fails.
+ *
+ * @param file The file to be set.
+ */
+ static void setReadOnlyChecked(final File file) {
+ if (file.exists()) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ if (!file.setReadOnly()) {
+ throw new Exception(NLS.bind(Messages.OpStreamOp_SetReadOnlyFailed, file
+ .getAbsolutePath()));
+ }
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ });
+ }
+ }
+
+ /**
+ * Get the local file of the specified node.
+ *
+ * <p>
+ * The preferred location is within the plugin's state location, in example
+ * <code>&lt;state location&gt;agent_<hashcode_of_peerId>/remote/path/to/the/file...</code>.
+ * <p>
+ * If the plug-in is loaded in a RCP workspace-less environment, the fall back strategy is to
+ * use the users home directory.
+ *
+ * @param node The file/folder node.
+ * @return The file object of the node's local cache.
+ */
+ public static File getCacheFile(FSTreeNode node) {
+ return getCachePath(node).toFile();
+ }
+
+ /**
+ * Get the cache file system's root directory on the local host's file system.
+ *
+ * @return The root folder's location of the cache file system.
+ */
+ public static File getCacheRoot() {
+ File location;
+ try {
+ location = CorePlugin.getDefault().getStateLocation().toFile();
+ }
+ catch (IllegalStateException e) {
+ // An RCP workspace-less environment (-data @none)
+ location = new File(System.getProperty("user.home"), ".tcf"); //$NON-NLS-1$ //$NON-NLS-2$
+ location = new File(location, "fs"); //$NON-NLS-1$
+ }
+
+ // Create the location if it not exist
+ mkdirChecked(location);
+ return location;
+ }
+
+ /**
+ * Append the path with the specified node's context path.
+ *
+ * @param path The path to be appended.
+ * @param node The file/folder node.
+ * @return The path to the node.
+ */
+ private static IPath appendNodePath(IPath path, FSTreeNode node) {
+ if (!node.isRoot() && node.getParent() != null) {
+ path = appendNodePath(path, node.getParent());
+ return appendPathSegment(node, path, node.name);
+ }
+ if (node.isWindowsNode()) {
+ String name = node.name;
+ name = name.substring(0, name.length() - 1);
+ name = name.replace(':', PATH_ESCAPE_CHAR);
+ return appendPathSegment(node, path, name);
+ }
+ return path;
+ }
+
+ /**
+ * Append the path with the segment "name". Create a directory if the node is a directory which
+ * does not yet exist.
+ *
+ * @param node The file/folder node.
+ * @param path The path to appended.
+ * @param name The segment's name.
+ * @return The path with the segment "name" appended.
+ */
+ private static IPath appendPathSegment(FSTreeNode node, IPath path, String name) {
+ IPath newPath = path.append(name);
+ File newFile = newPath.toFile();
+ if (node.isDirectory()) {
+ mkdirChecked(newFile);
+ }
+ return newPath;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/ContentTypeHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/ContentTypeHelper.java
new file mode 100644
index 000000000..24914f38e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/ContentTypeHelper.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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:
+ * William Chen (Wind River)- [345387]Open the remote files with a proper editor
+ * 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.core.internal.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The content type helper used to provide helping methods about the content
+ * types of the files in the remote file system.
+ */
+public class ContentTypeHelper {
+ // The binary content type's id.
+ private static final String CONTENT_TYPE_BINARY_ID = "org.eclipse.cdt.core.binaryFile"; //$NON-NLS-1$
+
+ /**
+ * Judges if the node is a binary file.
+ *
+ * @param node
+ * The file node.
+ * @return true if the node is a binary file or else false.
+ */
+ public static boolean isBinaryFile(FSTreeNode node) {
+ IContentType contentType = getContentType(node);
+ if (contentType != null) {
+ IContentType binaryFile = Platform.getContentTypeManager()
+ .getContentType(CONTENT_TYPE_BINARY_ID);
+ if (binaryFile != null && contentType.isKindOf(binaryFile))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get the content type of the specified file node.
+ *
+ * @param node
+ * The file node.
+ * @return The content type of the file node.
+ */
+ public static IContentType getContentType(FSTreeNode node) {
+ if (PersistenceManager.getInstance().isUnresovled(node))
+ // If it is already known unresolvable.
+ return null;
+ IContentType contentType = PersistenceManager.getInstance().getResolved(node);
+ if (contentType != null)
+ // If it is already known to have a certain content type.
+ return contentType;
+ // First check the content type by its name.
+ contentType = Platform.getContentTypeManager().findContentTypeFor(
+ node.name);
+ if (contentType == null) { // Then find the content type by its stream.
+ try {
+ contentType = findContentTypeByStream(node);
+ } catch (Exception e) {
+ }
+ }
+ if (contentType != null) { // If it is resolved, cache it.
+ PersistenceManager.getInstance().addResovled(node, contentType);
+ } else { // Or else, remember it as an unresolvable.
+ PersistenceManager.getInstance().addUnresolved(node);
+ }
+ return contentType;
+ }
+
+ /**
+ * Find the content type of the file using its content stream.
+ *
+ * @param node
+ * The file node.
+ * @return The content type of the file.
+ * @throws CoreException
+ * If the path of its local cache file couldn't be found.
+ * @throws IOException
+ * If something goes wrong during the content type parsing.
+ */
+ private static IContentType findContentTypeByStream(FSTreeNode node) throws CoreException, IOException {
+ InputStream is = null;
+ try {
+ File file = CacheManager.getCacheFile(node);
+ if (file.exists()) {
+ // If the local cache file exits.
+ IPath path = CacheManager.getCachePath(node);
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(path);
+ is = fileStore.openInputStream(EFS.NONE, null);
+ } else {
+ // Use its URL stream.
+ URL url = node.getLocationURL();
+ is = url.openStream();
+ }
+ return Platform.getContentTypeManager().findContentTypeFor(is, node.name);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java
new file mode 100644
index 000000000..dbd7a342f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * 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.core.internal.utils;
+
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+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.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheFileDigest;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.CacheState;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The state object to describe a file's state.
+ */
+public class FileState {
+ /**
+ * The base digest of the file data.
+ */
+ private byte[] base_digest = null;
+
+ /**
+ * The message digest of the file data.
+ */
+ private byte[] target_digest = null;
+
+ /**
+ * The message digest of the local cache data
+ */
+ private byte[] cache_digest = null;
+
+ /**
+ * The cache file's modification time.
+ */
+ private long cache_mtime;
+
+ /**
+ * If the job that computes the local cache's digest is running.
+ */
+ transient boolean cache_digest_running = false;
+
+ /**
+ * If the job that computes the target file's digest is running.
+ */
+ transient boolean target_digest_running = false;
+
+ /**
+ * The file system node whose state is described.
+ */
+ private transient FSTreeNode node;
+
+ /**
+ * Create a file state using the node.
+ *
+ * @param node The file system node.
+ */
+ public FileState(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /**
+ * Create a file state using the specified state data.
+ *
+ * @param mtime The cache file's modification time.
+ * @param cache_digest The cache file's digest.
+ * @param target_digest The target file's digest.
+ * @param base_digest The baseline digest.
+ */
+ public FileState(long mtime, byte[] cache_digest, byte[] target_digest, byte[]base_digest) {
+ this.cache_mtime = mtime;
+ this.cache_digest = cache_digest;
+ this.target_digest = target_digest;
+ this.base_digest = base_digest;
+ }
+
+ /**
+ * Set the file system node.
+ *
+ * @param node The file system node.
+ */
+ void setNode(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /**
+ * Get the node's target file digest.
+ *
+ * @return The target file digest.
+ */
+ public byte[] getTargetDigest() {
+ return target_digest;
+ }
+
+ /**
+ * Get the node's baseline digest.
+ *
+ * @return The baseline digest.
+ */
+ public byte[] getBaseDigest() {
+ return base_digest;
+ }
+
+ /**
+ * Get the node's cache file modification time.
+ *
+ * @return The cache file's modification time.
+ */
+ public long getCacheMTime() {
+ return cache_mtime;
+ }
+
+ /**
+ * Get the node's cache file digest.
+ *
+ * @return The cache file digest.
+ */
+ public byte[] getCacheDigest() {
+ return cache_digest;
+ }
+
+ /**
+ * Update the cache state of this file and invoke callback once the update is done.
+ * If the callback is null, then do not invoke any callback.
+ *
+ * @param callback Callback invoked after updating.
+ */
+ public synchronized void updateState(final ICallback callback) {
+ File file = CacheManager.getCacheFile(node);
+ if (file.exists()) {
+ long cache_mtime = file.lastModified();
+ if (!cache_digest_running && (cache_digest == null || this.cache_mtime != cache_mtime)) {
+ cache_digest_running = true;
+ this.cache_mtime = cache_mtime;
+ final OpCacheFileDigest op = new OpCacheFileDigest(node);
+ new JobExecutor(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status.isOK()) {
+ updateCacheDigest(op.getDigest());
+ }
+ cache_digest_running = false;
+ if (status.isOK()) {
+ updateState(callback);
+ }
+ else if(callback != null){
+ callback.done(this, status);
+ }
+ }
+ }).execute(op);
+ }
+ else if (!target_digest_running && target_digest == null) {
+ target_digest_running = true;
+ node.refresh(new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ target_digest_running = false;
+ if (status.isOK()) {
+ updateState(callback);
+ }
+ else if(callback != null){
+ callback.done(this, status);
+ }
+ }
+ });
+ }
+ else if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+ else if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+
+ /**
+ * Get this node's cache state using the current state data.
+ *
+ * @return The state expressed in a CacheState enum value.
+ */
+ public synchronized CacheState getCacheState() {
+ File file = CacheManager.getCacheFile(node);
+ if (!file.exists()) return CacheState.consistent;
+ updateState(null);
+ if (cache_digest == null || target_digest == null) return CacheState.consistent;
+ if(isUnchanged(target_digest, cache_digest)) {
+ base_digest = target_digest;
+ return CacheState.consistent;
+ }
+ if(isUnchanged(base_digest, cache_digest)){
+ return CacheState.outdated;
+ }
+ if (isUnchanged(target_digest, base_digest)) {
+ return CacheState.modified;
+ }
+ return CacheState.conflict;
+ }
+
+ /**
+ * Update the node's target digest and fire an event.
+ *
+ * @param target_digest The new target digest data.
+ */
+ public void updateTargetDigest(byte[] target_digest) {
+ this.target_digest = target_digest;
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "target_digest", null, target_digest); //$NON-NLS-1$
+ node.firePropertyChange(event);
+ }
+
+ /**
+ * Compare the two digests to see if they are equal to each other.
+ *
+ * @param digest1 The first digest.
+ * @param digest2 The second digest.
+ * @return true if they are equal.
+ */
+ private boolean isUnchanged(byte[] digest1, byte[] digest2){
+ if(digest1 != null && digest2 != null && digest1.length == digest2.length) {
+ for (int i = 0; i < digest1.length; i++) {
+ if(digest1[i] != digest2[i]) return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Update the cache file digest data and fire an event.
+ *
+ * @param cache_digest The new cache file digest data.
+ */
+ public void updateCacheDigest(byte[] cache_digest) {
+ byte[] old_digest = cache_digest;
+ this.cache_digest = cache_digest;
+ PropertyChangeEvent event = new PropertyChangeEvent(node, "cache_digest", old_digest, cache_digest); //$NON-NLS-1$
+ node.firePropertyChange(event);
+ }
+
+ /**
+ * Reset all of the node's digest data to a new digest data.
+ *
+ * @param digest The new digest data.
+ */
+ public void reset(byte[] digest) {
+ cache_digest = digest;
+ target_digest = digest;
+ base_digest = digest;
+ PropertyChangeEvent event = new PropertyChangeEvent(node, "reset_digest", null, digest); //$NON-NLS-1$
+ node.firePropertyChange(event);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManager.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManager.java
new file mode 100644
index 000000000..e28abd4a3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManager.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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:
+ * 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.core.internal.utils;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * A facility class to load and save persistent data such including resolved content types, file's
+ * properties, and time stamps etc.
+ */
+public class PersistenceManager {
+ // The singleton instance.
+ private static volatile PersistenceManager instance;
+
+ // The time stamp for each file.
+ Map<URI, FileState> digests;
+
+ // Already known resolved content type of file nodes specified by their URIs.
+ Map<URI, IContentType> resolved;
+
+ // Already known unresolvable file nodes specified by their URIs.
+ Map<URI, URI> unresolved;
+
+ // The persistent properties of the files.
+ Map<URI, Map<QualifiedName, String>> properties;
+
+ // The file used to store persistent properties of each file.
+ private static final String PERSISTENT_FILE = "persistent.ini"; //$NON-NLS-1$
+
+ /**
+ * Get the singleton cache manager.
+ *
+ * @return The singleton cache manager.
+ */
+ public static PersistenceManager getInstance() {
+ if (instance == null) {
+ instance = new PersistenceManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Create a Persistent Manager instance.
+ */
+ private PersistenceManager() {
+ digests = new HashMap<URI, FileState>();
+ resolved = new HashMap<URI, IContentType>();
+ unresolved = new HashMap<URI, URI>();
+ properties = new HashMap<URI, Map<QualifiedName, String>>();
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ @Override
+ public void run() throws Exception {
+ IURIPersistenceService service = ServiceManager.getInstance().getService(IURIPersistenceService.class);
+ File location = CacheManager.getCacheRoot();
+ File persistentFile = new File(location, PERSISTENT_FILE);
+ if (persistentFile.exists()) {
+ service.read(PersistenceManager.this, persistentFile.getAbsoluteFile().toURI());
+ }
+ }});
+ }
+
+ /**
+ * If the node is already considered unresolvable.
+ *
+ * @param node The file node.
+ * @return true if it is not resolvable or else false.
+ */
+ public boolean isUnresovled(FSTreeNode node) {
+ return unresolved.get(node.getLocationURI()) != null;
+ }
+
+ /**
+ * Get the resolved content type of the node.
+ *
+ * @param node The file node.
+ * @return the content type of the node if it is resolvable or null.
+ */
+ public IContentType getResolved(FSTreeNode node) {
+ return resolved.get(node.getLocationURI());
+ }
+
+ /**
+ * Add the node and its content type to the resolved list.
+ *
+ * @param node The file node.
+ * @param contentType Its content type.
+ */
+ public void addResovled(FSTreeNode node, IContentType contentType) {
+ resolved.put(node.getLocationURI(), contentType);
+ }
+
+ /**
+ * Add the node as an unresolvable node.
+ *
+ * @param node The file node.
+ */
+ public void addUnresolved(FSTreeNode node) {
+ unresolved.put(node.getLocationURI(), node.getLocationURI());
+ }
+
+ /**
+ * Set the time stamp of the FSTreeNode with the specified location.
+ *
+ * @param uri The FSTreeNode's location URI.
+ * @param digest The new base time stamp to be set.
+ */
+ public void setFileDigest(URI uri, FileState digest) {
+ digests.put(uri, digest);
+ }
+
+ /**
+ * Remove the time stamp entry with the specified URI.
+ *
+ * @param uri The URI key.
+ */
+ public void removeFileDigest(URI uri) {
+ digests.remove(uri);
+ }
+
+ /**
+ * Get the time stamp of the FSTreeNode with the specified location.
+ *
+ * @param uri The FSTreeNode's location URI.
+ * @return The FSTreeNode's base time stamp.
+ */
+ public FileState getFileDigest(FSTreeNode node) {
+ URI uri = node.getLocationURI();
+ FileState digest = digests.get(uri);
+ if(digest == null) {
+ digest = new FileState(node);
+ digests.put(uri, digest);
+ }
+ digest.setNode(node);
+ return digest;
+ }
+
+ /**
+ * Get the file properties of the specified node from the properties map.
+ *
+ * @param node The file node.
+ * @return The file properties object or empty properties object if it does not exist.
+ */
+ public Map<QualifiedName, String> getPersistentProperties(FSTreeNode node) {
+ Map<QualifiedName, String> nodeProperties = properties.get(node.getLocationURI());
+ if (nodeProperties == null) {
+ nodeProperties = Collections.synchronizedMap(new HashMap<QualifiedName, String>());
+ properties.put(node.getLocationURI(), nodeProperties);
+ }
+ return nodeProperties;
+ }
+
+ /**
+ * Dispose the cache manager so that it has a chance to save the digests and the persistent
+ * properties.
+ */
+ public void dispose() {
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose.
+ }
+ @Override
+ public void run() throws Exception {
+ IURIPersistenceService service = ServiceManager.getInstance().getService(IURIPersistenceService.class);
+ File location = CacheManager.getCacheRoot();
+ File persistentFile = new File(location, PERSISTENT_FILE);
+ service.write(PersistenceManager.this, persistentFile.getAbsoluteFile().toURI());
+ }});
+ }
+
+ /**
+ * Returns if or if not the persistence manager needs to be disposed.
+ *
+ * @return <code>True</code> if the persistence manager needs disposal, <code>false</code> otherwise.
+ */
+ public final static boolean needsDisposal() {
+ return instance != null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java
new file mode 100644
index 000000000..28fd5baa1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ * 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.core.internal.utils;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate;
+
+/**
+ * The persistence delegate to persist or restore a map whose keys are URIs.
+ */
+public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate {
+
+ private static final String MAP_KEY_MTIME = "mtime"; //$NON-NLS-1$
+ private static final String MAP_KEY_TARGET = "target"; //$NON-NLS-1$
+ private static final String MAP_KEY_CACHE = "cache"; //$NON-NLS-1$
+ private static final String MAP_KEY_BASE = "base"; //$NON-NLS-1$
+ private static final String MAP_KEY_UNRESOLVED = "unresolved"; //$NON-NLS-1$
+ private static final String MAP_KEY_RESOLVED = "resolved"; //$NON-NLS-1$
+ private static final String MAP_KEY_PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String MAP_KEY_DIGESTS = "digests"; //$NON-NLS-1$
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass(
+ * java.lang.Object)
+ */
+ @Override
+ public Class<?> getPersistedClass(Object context) {
+ return PersistenceManager.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.tcf.te.runtime.persistence.AbstractGsonMapPersistenceDelegate#toMap(java.lang
+ * .Object)
+ */
+ @Override
+ protected Map<String, Object> toMap(Object context) throws IOException {
+ PersistenceManager pMgr = (PersistenceManager) context;
+ Map<String, Object> result = new HashMap<String, Object>();
+ result.put(MAP_KEY_DIGESTS, persistDigests(pMgr.digests));
+ result.put(MAP_KEY_PROPERTIES, persistProperties(pMgr.properties));
+ result.put(MAP_KEY_RESOLVED, persistResolved(pMgr.resolved));
+ result.put(MAP_KEY_UNRESOLVED, persistUnresolved(pMgr.unresolved));
+ return result;
+ }
+
+ private Object persistProperties(Map<URI, Map<QualifiedName, String>> properties) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ if (properties != null) {
+ for (Entry<URI, Map<QualifiedName, String>> entry : properties.entrySet()) {
+ Map<QualifiedName, String> map = entry.getValue();
+ Map<String, Object> valueMap = qNames2Map(map);
+ result.put(entry.getKey().toString(), valueMap);
+ }
+ }
+ return result;
+ }
+
+ private Object persistResolved(Map<URI, IContentType> resolved) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ if (resolved != null) {
+ for (Entry<URI, IContentType> entry : resolved.entrySet()) {
+ IContentType object = entry.getValue();
+ String value = object.getId();
+ result.put(entry.getKey().toString(), value);
+ }
+ }
+ return result;
+ }
+
+ private Object persistUnresolved(Map<URI, URI> unresolved) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ if (unresolved != null) {
+ for (Entry<URI, URI> entry : unresolved.entrySet()) {
+ URI uri = entry.getValue();
+ String value = uri.toString();
+ result.put(entry.getKey().toString(), value);
+ }
+ }
+ return result;
+ }
+
+ private Object persistDigests(Map<URI, FileState> states) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ if (states != null) {
+ for (Entry<URI, FileState> entry : states.entrySet()) {
+ FileState fileState = entry.getValue();
+ Map<String, Object> value = digest2map(fileState);
+ result.put(entry.getKey().toString(), value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Translate the specified map whose keys are QualifiedNames to a map whose keys are strings.
+ *
+ * @param map The map to be translated.
+ * @return a map with string keys.
+ */
+ private Map<String, Object> qNames2Map(Map<QualifiedName, String> map) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ for (Entry<QualifiedName, String> entry : map.entrySet()) {
+ result.put(entry.getKey().toString(), entry.getValue());
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.tcf.te.runtime.persistence.AbstractGsonMapPersistenceDelegate#fromMap(java.util
+ * .Map, java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Object fromMap(Map<String, Object> map, Object context) throws IOException {
+ PersistenceManager result = (PersistenceManager) context;
+ Map<String, Map<String, Object>> digests = (Map<String, Map<String, Object>>) map.get(MAP_KEY_DIGESTS);
+ Map<String, Map<String, String>> properties = (Map<String, Map<String, String>>) map.get(MAP_KEY_PROPERTIES);
+ Map<String, String> resolved = (Map<String, String>) map.get(MAP_KEY_RESOLVED);
+ Map<String, String> unresolved = (Map<String, String>) map.get(MAP_KEY_UNRESOLVED);
+ restoreDigests(digests, result.digests);
+ restoreProperites(properties, result.properties);
+ restoreResolved(resolved, result.resolved);
+ restoreUnresolved(unresolved, result.unresolved);
+ return result;
+ }
+
+ private void restoreUnresolved(Map<String, String> map, Map<URI, URI> unresolved) {
+ for (Entry<String, String> entry : map.entrySet()) {
+ String value = entry.getValue();
+ URI uri = toURI(entry.getKey());
+ Assert.isNotNull(uri);
+ uri = toURI(value);
+ Assert.isNotNull(uri);
+ unresolved.put(uri, uri);
+ }
+ }
+
+ private void restoreResolved(Map<String, String> map, Map<URI, IContentType> contentTypes) {
+ for (Entry<String, String> entry : map.entrySet()) {
+ String value = entry.getValue();
+ URI uri = toURI(entry.getKey());
+ Assert.isNotNull(uri);
+ IContentType contentType = Platform.getContentTypeManager().getContentType(value);
+ contentTypes.put(uri, contentType);
+ }
+ }
+
+ private void restoreDigests(Map<String, Map<String, Object>> map, Map<URI, FileState> states) {
+ for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
+ Map<String, Object> value = entry.getValue();
+ URI uri = toURI(entry.getKey());
+ Assert.isNotNull(uri);
+ FileState digest = map2digest(value);
+ states.put(uri, digest);
+ }
+ }
+
+ private void restoreProperites(Map<String, Map<String, String>> map, Map<URI, Map<QualifiedName, String>> properties) {
+ for (Entry<String, Map<String, String>> entry : map.entrySet()) {
+ Map<String, String> value = entry.getValue();
+ URI uri = toURI(entry.getKey());
+ Assert.isNotNull(uri);
+ Map<QualifiedName, String> valueMap = toQNameMap(value);
+ properties.put(uri, valueMap);
+ }
+ }
+
+ private FileState map2digest(Map<String, Object> value) {
+ byte[] base_digest = string2digest((String) value.get(MAP_KEY_BASE));
+ byte[] cache_digest = string2digest((String) value.get(MAP_KEY_CACHE));
+ byte[] target_digest = string2digest((String) value.get(MAP_KEY_TARGET));
+ Number number = (Number) value.get(MAP_KEY_MTIME);
+ long mtime = number.longValue();
+ return new FileState(mtime, cache_digest, target_digest, base_digest);
+ }
+
+ private Map<String, Object> digest2map(FileState digest) {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put(MAP_KEY_BASE, digest2string(digest.getBaseDigest()));
+ map.put(MAP_KEY_CACHE, digest2string(digest.getCacheDigest()));
+ map.put(MAP_KEY_TARGET, digest2string(digest.getTargetDigest()));
+ map.put(MAP_KEY_MTIME, Long.valueOf(digest.getCacheMTime()));
+ return map;
+ }
+
+ private String digest2string(byte[] digest) {
+ if (digest != null && digest.length > 0) {
+ StringBuilder buffer = new StringBuilder();
+ for (byte element : digest) {
+ int d = element & 0xff;
+ String sByte = Integer.toHexString(d);
+ while (sByte.length() < 2)
+ {
+ sByte = "0" + sByte; //$NON-NLS-1$
+ }
+ buffer.append(sByte.toLowerCase());
+ }
+ return buffer.toString();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private byte[] string2digest(String string) {
+ if (string != null && string.length() > 0) {
+ int count = string.length() / 2;
+ byte[] digest = new byte[count];
+ for (int i = 0; i < count; i++) {
+ try {
+ String seg = string.substring(2 * i, 2 * (i + 1));
+ int d = Integer.parseInt(seg, 16);
+ digest[i] = (byte) d;
+ }
+ catch (Exception e) {
+ }
+ }
+ return digest;
+ }
+ return new byte[0];
+ }
+
+ /**
+ * Translate the specified map with string keys to a map whose keys are qualified names.
+ *
+ * @param strMap The map with string keys.
+ * @return A map with qualified names as keys.
+ */
+ private Map<QualifiedName, String> toQNameMap(Map<String, String> strMap) {
+ Map<QualifiedName, String> result = new HashMap<QualifiedName, String>();
+ for (Entry<String, String> entry : strMap.entrySet()) {
+ int dot = entry.getKey().lastIndexOf(":"); //$NON-NLS-1$
+ String qualifier = null;
+ String local = entry.getKey();
+ if (dot != -1) {
+ qualifier = entry.getKey().substring(0, dot);
+ local = entry.getKey().substring(dot + 1);
+ }
+ QualifiedName name = new QualifiedName(qualifier, local);
+ result.put(name, strMap.get(entry.getKey()));
+ }
+ return result;
+ }
+
+ /**
+ * Convert the string to a URI.
+ *
+ * @param string The string to be converted.
+ * @return the URI or null if there're issues when parsing.
+ */
+ private URI toURI(final String string) {
+ final AtomicReference<URI> ref = new AtomicReference<URI>();
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose.
+ }
+
+ @Override
+ public void run() throws Exception {
+ ref.set(new URI(string));
+ }
+ });
+ return ref.get();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java
new file mode 100644
index 000000000..103ef6293
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java
@@ -0,0 +1,342 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.model;
+
+import java.beans.PropertyChangeEvent;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
+import org.eclipse.tcf.te.core.interfaces.IViewerInput;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUser;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * The base class of FSTreeNode and ProcessTreeNode which provides base members and methods.
+ */
+public abstract class AbstractTreeNode extends PlatformObject {
+ // The unique id of this node.
+ protected final UUID uniqueId = UUID.randomUUID();
+
+ /**
+ * The tree node name.
+ */
+ public String name = null;
+
+ /**
+ * The tree node type.
+ */
+ public String type = null;
+
+ /**
+ * The peer node the file system tree node is associated with.
+ */
+ public IPeerNode peerNode = null;
+
+ /**
+ * Flag to mark once the children of the node got queried
+ */
+ public boolean childrenQueried = false;
+
+ /**
+ * Flag to mark once the children query is running
+ */
+ public boolean childrenQueryRunning = false;
+
+ /**
+ * The tree node parent.
+ */
+ protected AbstractTreeNode parent = null;
+
+ /**
+ * The tree node children.
+ */
+ protected List<AbstractTreeNode> children = Collections.synchronizedList(new ArrayList<AbstractTreeNode>());
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public final int hashCode() {
+ return uniqueId.hashCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public final boolean equals(Object obj) {
+ if(this == obj)
+ return true;
+ if (obj instanceof AbstractTreeNode) {
+ return uniqueId.equals(((AbstractTreeNode) obj).uniqueId);
+ }
+ return super.equals(obj);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder(getClass().getSimpleName());
+ buffer.append(": name=" + (name != null ? name : super.toString())); //$NON-NLS-1$
+ buffer.append(", UUID=" + uniqueId.toString()); //$NON-NLS-1$
+ return buffer.toString();
+ }
+
+ /**
+ * Called when the children query is done.
+ */
+ public void queryDone() {
+ childrenQueryRunning = false;
+ childrenQueried = true;
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "query_done", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Called when the children query is started.
+ */
+ public void queryStarted() {
+ childrenQueryRunning = true;
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "query_started", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Get the user account of the specified TCF peer.
+ *
+ * @param peerNode The peer node of the TCF agent.
+ * @return The user account that runs the agent.
+ */
+ protected UserAccount getUserAccount(IPeerNode peerNode) {
+ OpUser user = new OpUser(peerNode);
+ new NullOpExecutor().execute(user);
+ return user.getUserAccount();
+ }
+
+ /**
+ * Fire a property change event to notify one of the node's property has changed.
+ *
+ * @param event The property change event.
+ */
+ public void firePropertyChange(PropertyChangeEvent event) {
+ if(peerNode != null) {
+ IPropertyChangeProvider provider = (IPropertyChangeProvider) peerNode.getAdapter(IPropertyChangeProvider.class);
+ provider.firePropertyChange(event);
+ } else if(parent != null) {
+ parent.firePropertyChange(event);
+ }
+ }
+
+ /**
+ * Add the specified nodes to the children list.
+ *
+ * @param nodes The nodes to be added.
+ */
+ public void addChidren(List<? extends AbstractTreeNode> nodes) {
+ children.addAll(nodes);
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "addChildren", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Remove the specified nodes from the children list.
+ *
+ * @param nodes The nodes to be removed.
+ */
+ public void removeChildren(List<? extends AbstractTreeNode> nodes) {
+ children.removeAll(nodes);
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "removeChildren", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Add the specified the node to the children list.
+ *
+ * @param node The child node to be added.
+ */
+ public void addChild(AbstractTreeNode node) {
+ children.add(node);
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "addChild", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Remove the specified child node from its children list.
+ *
+ * @param node The child node to be removed.
+ */
+ public void removeChild(AbstractTreeNode node) {
+ children.remove(node);
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "removeChild", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * Clear the children of this folder.
+ */
+ public void clearChildren() {
+ children.clear();
+ PropertyChangeEvent event = new PropertyChangeEvent(this, "clearChildren", null, null); //$NON-NLS-1$
+ firePropertyChange(event);
+ }
+
+ /**
+ * If this node is ancestor of the specified node.
+ * @return true if it is.
+ */
+ public boolean isAncestorOf(AbstractTreeNode node) {
+ if (node == null) return false;
+ if (node.parent == this) return true;
+ return isAncestorOf(node.parent);
+ }
+
+ /**
+ * Get the parent node of this node.
+ *
+ * @return The parent node.
+ */
+ public AbstractTreeNode getParent() {
+ return parent;
+ }
+
+ /**
+ * Set the parent node of this node.
+ *
+ * @param parent The parent node.
+ */
+ public void setParent(AbstractTreeNode parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * Recursively refresh the children of the given process context.
+ *
+ * @param parentNode The process context node. Must not be <code>null</code>.
+ */
+ public void refresh() {
+ refresh(null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if(IViewerInput.class.equals(adapter)) {
+ return peerNode.getAdapter(IViewerInput.class);
+ }
+ if(IPropertyChangeProvider.class.equals(adapter)) {
+ return peerNode.getAdapter(adapter);
+ }
+ return super.getAdapter(adapter);
+ }
+
+ /**
+ * Recursively refresh the children of the given process context with a callback, which is
+ * called when whole process is finished.
+ *
+ * @param callback The callback object, or <code>null</code> when callback is not needed.
+ */
+ public void refresh(final ICallback callback) {
+ Map<String, Boolean> flags = new HashMap<String, Boolean>();
+ flags.put(IChannelManager.FLAG_NO_PATH_MAP, Boolean.TRUE);
+ Tcf.getChannelManager().openChannel(peerNode.getPeer(), flags, doCreateRefreshDoneOpenChannel(new Callback() {
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.callback.Callback#internalDone(java.lang.Object, org.eclipse.core.runtime.IStatus)
+ */
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ refreshChildren(callback);
+ }
+ }));
+ }
+
+ /**
+ * Create the callback object of opening channel for refreshing itself.
+ *
+ * @param callback The callback object.
+ * @return The callback object.
+ */
+ protected abstract DoneOpenChannel doCreateRefreshDoneOpenChannel(ICallback callback);
+
+ /**
+ * Query the children of this file system node.
+ */
+ public final void queryChildren() {
+ queryChildren(null);
+ }
+ /**
+ * Query the children of this file system node.
+ */
+ public void queryChildren(ICallback callback) {
+ queryStarted();
+ Map<String, Boolean> flags = new HashMap<String, Boolean>();
+ flags.put(IChannelManager.FLAG_NO_PATH_MAP, Boolean.TRUE);
+ Tcf.getChannelManager().openChannel(peerNode.getPeer(), flags, doCreateQueryDoneOpenChannel(callback));
+ }
+
+ /**
+ * Create the callback object of opening channel for querying children.
+ *
+ * @return The callback object.
+ */
+ protected abstract DoneOpenChannel doCreateQueryDoneOpenChannel(ICallback callback);
+
+ /**
+ * Return if this node is the system root.
+ *
+ * @return true if it is.
+ */
+ public abstract boolean isSystemRoot();
+
+ /**
+ * Get the children of this tree node.
+ *
+ * @return The list of the children.
+ */
+ public List<? extends AbstractTreeNode> getChildren() {
+ return new ArrayList<AbstractTreeNode>(children);
+ }
+
+ /**
+ * Refresh the children's children.
+ */
+ public final void refreshChildren() {
+ refreshChildren(null);
+ }
+
+ /**
+ * Refresh the children's children.
+ */
+ public abstract void refreshChildren(ICallback callback);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/CacheState.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/CacheState.java
new file mode 100644
index 000000000..7d24a187c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/CacheState.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.model;
+
+/**
+ * The enumeration that defines the states of a file's local cache, including "consistent", "modified",
+ * "outdated" and "conflict".
+ */
+public enum CacheState {
+ consistent, // Neither of the local file and the remote file has been changed since checking out.
+ modified, // The local file has changed while the remote file has not since checking out.
+ outdated, // The remote file has changed while the local file has not since checking out.
+ conflict // Both the local file and the remote file have changed since checking out.
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSTreeNode.java
new file mode 100644
index 000000000..9242a18cb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSTreeNode.java
@@ -0,0 +1,681 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River) - [345384] Provide property pages for remote file system nodes
+ * William Chen (Wind River) - [352302]Opening a file in an editor depending on
+ * the client's permissions.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.model;
+
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.te.core.interfaces.IFilterable;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.core.concurrent.CallbackMonitor;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IWindowsFileAttributes;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.callbacks.QueryDoneOpenChannel;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.callbacks.RefreshStateDoneOpenChannel;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpTargetFileDigest;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLStreamHandlerService;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * Representation of a file system tree node.
+ * <p>
+ * <b>Note:</b> Node construction and child list access is limited to the TCF
+ * event dispatch thread.
+ */
+public final class FSTreeNode extends AbstractTreeNode implements Cloneable, IFilterable {
+ // The constant to access the Windows Attributes.
+ private static final String KEY_WIN32_ATTRS = "Win32Attrs"; //$NON-NLS-1$
+
+ /**
+ * The tree node file system attributes
+ */
+ public IFileSystem.FileAttrs attr = null;
+
+ /**
+ * Create a folder node using the specified parent node, the directory entry
+ * and the flag to indicate if it is a root node.
+ *
+ * @param parentNode The parent node.
+ * @param entry The directory entry.
+ * @param entryIsRootNode If this folder is root folder.
+ */
+ public FSTreeNode(FSTreeNode parentNode, DirEntry entry, boolean entryIsRootNode) {
+ Assert.isNotNull(entry);
+ IFileSystem.FileAttrs attrs = entry.attrs;
+
+ this.attr = attrs;
+ this.name = entry.filename;
+ if (attrs == null || attrs.isDirectory()) {
+ this.type = entryIsRootNode ? "FSRootDirNode" : "FSDirNode"; //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (attrs.isFile()) {
+ this.type = "FSFileNode"; //$NON-NLS-1$
+ }
+ this.parent = parentNode;
+ this.peerNode = parentNode.peerNode;
+ Assert.isTrue(Protocol.isDispatchThread());
+ }
+
+ /**
+ * Constructor.
+ */
+ public FSTreeNode() {
+ Assert.isTrue(Protocol.isDispatchThread());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() {
+ if (Protocol.isDispatchThread()) {
+ FSTreeNode clone = new FSTreeNode();
+ clone.childrenQueried = childrenQueried;
+ clone.childrenQueryRunning = childrenQueryRunning;
+ clone.name = name;
+ clone.parent = parent;
+ clone.peerNode = peerNode;
+ clone.type = type;
+ if (attr != null) {
+ Map<String, Object> attributes = new HashMap<String, Object>(attr.attributes);
+ clone.attr = new IFileSystem.FileAttrs(attr.flags, attr.size, attr.uid, attr.gid, attr.permissions, attr.atime, attr.mtime, attributes);
+ } else {
+ clone.attr = null;
+ }
+ return clone;
+ }
+ final Object[] objects = new Object[1];
+ Protocol.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ objects[0] = FSTreeNode.this.clone();
+ }
+ });
+ return objects[0];
+ }
+
+ /**
+ * Change the file/folder's write permission.
+ * @param b true if the agent is granted with its write permission.
+ */
+ public void setWritable(boolean b) {
+ UserAccount account = getUserAccount(peerNode);
+ if (account != null && attr != null) {
+ int bit;
+ if (attr.uid == account.getEUID()) {
+ bit = IFileSystem.S_IWUSR;
+ } else if (attr.gid == account.getEGID()) {
+ bit = IFileSystem.S_IWGRP;
+ } else {
+ bit = IFileSystem.S_IWOTH;
+ }
+ int permissions = attr.permissions;
+ setPermissions(b ? (permissions | bit):(permissions & ~ bit));
+ }
+ }
+
+ /**
+ * Set the file's permissions.
+ * @param permissions The new permissions.
+ */
+ public void setPermissions(int permissions) {
+ attr = new IFileSystem.FileAttrs(attr.flags, attr.size, attr.uid, attr.gid, permissions, attr.atime, attr.mtime, attr.attributes);
+ }
+
+ /**
+ * Returns the children outside of TCF thread.
+ *
+ * @return The children list.
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<FSTreeNode> getChildren() {
+ return (List<FSTreeNode>) super.getChildren();
+ }
+
+ /**
+ * Return if the node is a Windows file/folder node.
+ *
+ * @return true if it is a Windows node, or else false.
+ */
+ public boolean isWindowsNode() {
+ if (attr != null && attr.attributes != null) {
+ return attr.attributes.containsKey(KEY_WIN32_ATTRS);
+ }
+ if (peerNode != null) {
+ String OSName = TargetPropertyTester.getOSName(peerNode);
+ if(OSName != null){
+ return OSName.startsWith("Windows"); //$NON-NLS-1$
+ }
+ }
+ synchronized (children) {
+ if (!children.isEmpty()) {
+ for (AbstractTreeNode treeNode : children) {
+ FSTreeNode node = (FSTreeNode) treeNode;
+ if(node.hasOSInfo()) {
+ return node.isWindowsNode();
+ }
+ }
+ }
+ }
+ if(parent != null) {
+ return ((FSTreeNode)parent).isWindowsNode();
+ }
+ return false;
+ }
+
+ /**
+ * If this node has OS information.
+ *
+ * @return true if it has.
+ */
+ private boolean hasOSInfo() {
+ return attr != null && attr.attributes != null ||
+ peerNode != null && TargetPropertyTester.getOSName(peerNode)!= null;
+ }
+
+ /**
+ * Return if the node is a file.
+ *
+ * @return true if it is a file, or else false.
+ */
+ public boolean isFile() {
+ if (attr != null) {
+ return attr.isFile();
+ }
+ if (type != null)
+ {
+ return type.equals("FSFileNode"); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ /**
+ * Return if the node is a directory.
+ *
+ * @return true if it is a directory, or else false.
+ */
+ public boolean isDirectory() {
+ if (attr != null) {
+ return attr.isDirectory();
+ }
+ if (type != null)
+ {
+ return type.endsWith("DirNode"); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ /**
+ * Return if the attribute specified by the mask bit is turned on.
+ *
+ * @param bit
+ * The attribute's mask bit.
+ * @return true if it is on, or else false.
+ */
+ public boolean isWin32AttrOn(int bit) {
+ if (attr != null && attr.attributes.get(KEY_WIN32_ATTRS) instanceof Integer) {
+ Integer win32Attrs = (Integer) attr.attributes.get(KEY_WIN32_ATTRS);
+ return (win32Attrs.intValue() & bit) != 0;
+ }
+ return false;
+ }
+
+ /**
+ * Set the attribute specified by the mask bit to on or off.
+ * @param bit The attribute's mask bit.
+ * @param on The flag if the bit should be turned on or off.
+ */
+ public void setWin32Attr(int bit, boolean on) {
+ if (attr != null && attr.attributes.get(KEY_WIN32_ATTRS) instanceof Integer) {
+ int win32attr = ((Integer) attr.attributes.get(KEY_WIN32_ATTRS)).intValue();
+ win32attr = on ? (win32attr | bit) : (win32attr & ~bit);
+ attr.attributes.put(KEY_WIN32_ATTRS, Integer.valueOf(win32attr));
+ }
+ }
+
+ /**
+ * Get the file's win32 attributes.
+ * @return The file's win32 attributes.
+ */
+ public int getWin32Attrs() {
+ if (attr != null && attr.attributes.get(KEY_WIN32_ATTRS) instanceof Integer) {
+ return ((Integer) attr.attributes.get(KEY_WIN32_ATTRS)).intValue();
+ }
+ return 0;
+ }
+
+ /**
+ * Return if this file/folder is hidden.
+ *
+ * @return true if it is hidden, or else false.
+ */
+ public boolean isHidden() {
+ return isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_HIDDEN);
+ }
+
+ /**
+ * Set the file/folder hidden attribute's value.
+ * @param hidden The new value.
+ */
+ public void setHidden(boolean hidden) {
+ setWin32Attr(IWindowsFileAttributes.FILE_ATTRIBUTE_HIDDEN, hidden);
+ }
+
+ /**
+ * Return if this file/folder is read-only.
+ *
+ * @return true if it is read-only, or else false.
+ */
+ public boolean isReadOnly() {
+ return isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_READONLY);
+ }
+
+ /**
+ * Set the file/folder read-only attribute's value.
+ * @param readOnly The new value.
+ */
+ public void setReadOnly(boolean readOnly) {
+ setWin32Attr(IWindowsFileAttributes.FILE_ATTRIBUTE_READONLY, readOnly);
+ }
+
+ /**
+ * Get the location of a file/folder node using the format of the file
+ * system's platform.
+ *
+ * @param parentNode
+ * The file/folder node.
+ * @return The location of the file/folder.
+ */
+ public String getLocation() {
+ return getLocation(false);
+ }
+
+ /**
+ * Get the location of a file/folder.
+ *
+ * @param cross
+ * If the format is cross-platform.
+ * @return The path to the file/folder.
+ */
+ public String getLocation(boolean cross) {
+ if(isRoot()) {
+ if(cross) {
+ if(isWindowsNode()) {
+ return name.substring(0, name.length() - 1) + "/"; //$NON-NLS-1$
+ }
+ }
+ return name;
+ }
+ String pLoc = getParent().getLocation(cross);
+ if(getParent().isRoot()) {
+ return pLoc + name;
+ }
+ String pathSep = (!cross && isWindowsNode()) ? "\\" : "/"; //$NON-NLS-1$ //$NON-NLS-2$
+ return pLoc + pathSep + name;
+ }
+
+ /**
+ * Get the URL of the file or folder. The URL's format is created in the
+ * following way: tcf:/<TCF_AGENT_ID>/remote/path/to/the/resource... See
+ * {@link TcfURLConnection#TcfURLConnection(URL)}
+ *
+ * @see TcfURLStreamHandlerService#parseURL(URL, String, int, int)
+ * @see #getLocationURI()
+ * @return The URL of the file/folder.
+ */
+ public URL getLocationURL() {
+ try {
+ String id = peerNode.getPeerId();
+ String path = getLocation(true);
+ String location = TcfURLConnection.PROTOCOL_SCHEMA + ":/" + id + (path.startsWith("/") ? path : "/" + path); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return new URL(location);
+ } catch (MalformedURLException e) {
+ assert false;
+ return null;
+ }
+ }
+
+ /**
+ * Get the URI of the file or folder. The URI's format is created in the
+ * following way: tcf:/<TCF_AGENT_ID>/remote/path/to/the/resource...
+ *
+ * @return The URI of the file/folder.
+ */
+ public URI getLocationURI() {
+ try {
+ String id = peerNode.getPeerId();
+ String path = getEncodedURIPath();
+ String location = TcfURLConnection.PROTOCOL_SCHEMA + ":/" + id + (path.startsWith("/") ? path : "/" + path); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return new URI(location);
+ }
+ catch (URISyntaxException e) {
+ assert false;
+ return null;
+ }
+ }
+
+ /**
+ * Encode each segment of the path to a URI compatible name,
+ * and get the URI encoded path.
+ *
+ * @return The encoded path which is URI compatible.
+ */
+ private String getEncodedURIPath() {
+ if(isRoot()) {
+ if(isWindowsNode()) {
+ return name.substring(0, name.length() - 1) + "/"; //$NON-NLS-1$
+ }
+ return name;
+ }
+ final AtomicReference<String> ref = new AtomicReference<String>();
+ SafeRunner.run(new ISafeRunnable(){
+ @Override
+ public void handleException(Throwable exception) {
+ // Ignore on purpose
+ }
+ @Override
+ public void run() throws Exception {
+ ref.set(URLEncoder.encode(name, "UTF-8")); //$NON-NLS-1$
+ }});
+ String segment = ref.get();
+ String pLoc = getParent().getEncodedURIPath();
+ if(getParent().isRoot()) {
+ return pLoc + segment;
+ }
+ return pLoc + "/" + segment; //$NON-NLS-1$
+ }
+
+ /**
+ * If this node is a root node.
+ *
+ * @return true if this node is a root node.
+ */
+ public boolean isRoot() {
+ return type != null && type.equals("FSRootDirNode"); //$NON-NLS-1$
+ }
+
+ /**
+ * If this node is the system root.
+ *
+ * @return true if this node is the system root.
+ */
+ @Override
+ public boolean isSystemRoot() {
+ return type != null && type.equals("FSRootNode"); //$NON-NLS-1$
+ }
+
+ /**
+ * If this file is readable.
+ *
+ * @return true if it is readable.
+ */
+ public boolean isReadable() {
+ UserAccount account = getUserAccount(peerNode);
+ if (account != null && attr != null) {
+ if (attr.uid == account.getEUID()) {
+ return (attr.permissions & IFileSystem.S_IRUSR) != 0;
+ } else if (attr.gid == account.getEGID()) {
+ return (attr.permissions & IFileSystem.S_IRGRP) != 0;
+ } else {
+ return (attr.permissions & IFileSystem.S_IROTH) != 0;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * If the agent is the owner of this file/folder.
+ *
+ * @return true if the agent is the owner of this file/folder.
+ */
+ public boolean isAgentOwner() {
+ UserAccount account = getUserAccount(peerNode);
+ if (account != null && attr != null) {
+ return attr.uid == account.getEUID();
+ }
+ return false;
+ }
+
+ /**
+ * If this file is writable.
+ *
+ * @return true if it is writable.
+ */
+ public boolean isWritable() {
+ UserAccount account = getUserAccount(peerNode);
+ if (account != null && attr != null) {
+ if (attr.uid == account.getEUID()) {
+ return (attr.permissions & IFileSystem.S_IWUSR) != 0;
+ } else if (attr.gid == account.getEGID()) {
+ return (attr.permissions & IFileSystem.S_IWGRP) != 0;
+ } else {
+ return (attr.permissions & IFileSystem.S_IWOTH) != 0;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * If this file is executable.
+ *
+ * @return true if it is executable.
+ */
+ public boolean isExecutable() {
+ UserAccount account = getUserAccount(peerNode);
+ if (account != null && attr != null) {
+ if (attr.uid == account.getEUID()) {
+ return (attr.permissions & IFileSystem.S_IXUSR) != 0;
+ } else if (attr.gid == account.getEGID()) {
+ return (attr.permissions & IFileSystem.S_IXGRP) != 0;
+ } else {
+ return (attr.permissions & IFileSystem.S_IXOTH) != 0;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if this file is a windows system file.
+ *
+ * @return true if it is a windows system file.
+ */
+ public boolean isSystem() {
+ return !isRoot() && isWindowsNode() && isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_SYSTEM);
+ }
+
+ /**
+ * Get the type label of the file for displaying purpose.
+ *
+ * @return The type label text.
+ */
+ public String getFileType() {
+ if (isRoot()) {
+ return Messages.FSTreeNode_TypeLocalDisk;
+ }
+ if (isDirectory()) {
+ return Messages.FSTreeNode_TypeFileFolder;
+ }
+ if (isSystem()) {
+ return Messages.FSTreeNode_TypeSystemFile;
+ }
+ IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(name);
+ if (contentType != null) {
+ return contentType.getName();
+ }
+ int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
+ if (lastDot == -1) {
+ return Messages.FSTreeNode_TypeUnknownFile;
+ }
+ return name.substring(lastDot + 1).toUpperCase() + " " + Messages.FSTreeNode_TypeFile; //$NON-NLS-1$
+ }
+
+ /**
+ * Set the file's attributes and trigger property change event.
+ *
+ * @param attrs The new attributes.
+ */
+ public void setAttributes(FileAttrs attrs) {
+ FileAttrs oldAttrs = this.attr;
+ this.attr = attrs;
+ if (attrs != oldAttrs) {
+ firePropertyChange(new PropertyChangeEvent(this, "attributes", oldAttrs, attrs)); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Get the local file's state of the specified tree node. The local file must exist
+ * before calling this method to get its state.
+ *
+ * @param node The tree node whose local file state is going to retrieved.
+ * @return The tree node's latest cache state.
+ */
+ public CacheState getCacheState() {
+ File file = CacheManager.getCacheFile(this);
+ if (!file.exists()) {
+ return CacheState.consistent;
+ }
+ FileState digest = PersistenceManager.getInstance().getFileDigest(this);
+ return digest.getCacheState();
+ }
+
+ /**
+ * Set the file's new name and trigger property change event.
+ *
+ * @param name The new name.
+ */
+ public void setName(String name) {
+ String oldName = this.name;
+ this.name = name;
+ if(name == null && oldName != null || name != null && !name.equals(oldName)) {
+ firePropertyChange(new PropertyChangeEvent(this, "name", oldName, name)); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#doCreateRefreshDoneOpenChannel(org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ protected DoneOpenChannel doCreateRefreshDoneOpenChannel(final ICallback callback) {
+ final FileState digest = PersistenceManager.getInstance().getFileDigest(this);
+ ICallback cb = new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status.isOK() && caller instanceof OpTargetFileDigest) {
+ digest.updateTargetDigest(((OpTargetFileDigest) caller).getDigest());
+ }
+ if (callback != null) {
+ callback.done(caller, status);
+ }
+ }
+ };
+ return new RefreshStateDoneOpenChannel(this, cb);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#doCreateQueryDoneOpenChannel()
+ */
+ @Override
+ protected DoneOpenChannel doCreateQueryDoneOpenChannel(ICallback callback) {
+ return new QueryDoneOpenChannel(this, callback);
+ }
+
+// /**
+// * Override the queryChildren to refresh the second level children upon expanding.
+// */
+// @Override
+// public void queryChildren() {
+// queryChildren(new Callback(){
+// @Override
+// protected void internalDone(Object caller, IStatus status) {
+// refreshChildren();
+// }
+// });
+// }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#getParent()
+ */
+ @Override
+ public FSTreeNode getParent() {
+ return (FSTreeNode) parent;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#refreshChildren()
+ */
+ @Override
+ public void refreshChildren(ICallback callback) {
+ List<FSTreeNode> children = getChildren();
+ if(!children.isEmpty()) {
+ ICallback proxy = new Callback(callback){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ queryDone();
+ }
+ };
+ final CallbackMonitor monitor = new CallbackMonitor(proxy);
+ for(FSTreeNode child : children) {
+ if((child.isRoot() || child.isDirectory()) && !child.childrenQueried && !child.childrenQueryRunning) {
+ monitor.lock(child.uniqueId);
+ }
+ }
+ for(FSTreeNode child : children) {
+ if((child.isRoot() || child.isDirectory()) && !child.childrenQueried && !child.childrenQueryRunning) {
+ final UUID uuid = child.uniqueId;
+ child.queryChildren(new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ monitor.unlock(uuid, status);
+ }
+ });
+ }
+ }
+ }
+ else {
+ if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java
new file mode 100644
index 000000000..cc0a5056e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * Filesystem service model manager implementation.
+ */
+public class ModelManager {
+ // Reference to the runtime models
+ /* default */ static final Map<String, IRuntimeModel> runtimeModels = new HashMap<String, IRuntimeModel>();
+
+ /**
+ * Returns the runtime model instance for the given peer model
+ * <p>
+ * If not yet initialized, a new runtime model will be initialized before returning.
+ *
+ * @param peerNode The peer model instance. Must not be <code>null</code>.
+ * @return The runtime model.
+ */
+ public static IRuntimeModel getRuntimeModel(final IPeerNode peerNode) {
+ Assert.isNotNull(peerNode);
+
+ // The result reference holder
+ final AtomicReference<IRuntimeModel> runtimeModel = new AtomicReference<IRuntimeModel>();
+
+ // Create the runnable to execute
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Assert.isTrue(Protocol.isDispatchThread());
+
+ // Get the peer id
+ String id = peerNode.getPeerId();
+ // Lookup the runtime model instance
+ IRuntimeModel candidate = runtimeModels.get(id);
+ // Initialize a new runtime model instance if necessary
+ if (candidate == null) {
+ candidate = initializeRuntimeModel(peerNode);
+ if (candidate != null) runtimeModels.put(id, candidate);
+ }
+ // Store to the result reference holder
+ runtimeModel.set(candidate);
+ }
+ };
+
+ // Execute the runnable
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return runtimeModel.get();
+ }
+
+ /**
+ * Initialize the runtime model.
+ * <p>
+ * Must be called within the TCF dispatch thread.
+ *
+ * @param peerNode The peer model instance. Must not be <code>null</code>.
+ * @return The runtime model.
+ */
+ protected static IRuntimeModel initializeRuntimeModel(IPeerNode peerNode) {
+ Assert.isTrue(Protocol.isDispatchThread());
+ IRuntimeModel runtimeModel = new RuntimeModel(peerNode);
+ return runtimeModel;
+ }
+
+ /**
+ * Dispose the runtime model.
+ *
+ * @param peerNode The peer model instance. Must not be <code>null</code>.
+ */
+ public static void disposeRuntimeModel(final IPeerNode peerNode) {
+ Assert.isNotNull(peerNode);
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Assert.isTrue(Protocol.isDispatchThread());
+
+ // Get the peer id
+ String id = peerNode.getPeerId();
+ // Lookup the runtime model instance
+ IRuntimeModel candidate = runtimeModels.remove(id);
+ // Dispose it
+ if (candidate != null) candidate.dispose();
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
new file mode 100644
index 000000000..359d8c413
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.core.model;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.factory.Factory;
+import org.eclipse.tcf.te.runtime.model.interfaces.factory.IFactory;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelService;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * The file system model implementation.
+ */
+public final class RuntimeModel extends ContainerModelNode implements IRuntimeModel {
+ // Flag to mark the model disposed
+ private boolean disposed;
+
+ // Reference to the model node factory
+ private IFactory factory = null;
+
+ // The root node of the peer model
+ private FSTreeNode root;
+ private IPeerNode peerNode;
+
+ /**
+ * Create a File System ModelManager.
+ */
+ public RuntimeModel(IPeerNode peerNode) {
+ disposed = false;
+ this.peerNode = peerNode;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.nodes.PropertiesContainer#checkThreadAccess()
+ */
+ @Override
+ protected boolean checkThreadAccess() {
+ return Protocol.isDispatchThread();
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#dispose()
+ */
+ @Override
+ public void dispose() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ disposed = true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#isDisposed()
+ */
+ @Override
+ public boolean isDisposed() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ return disposed;
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#getService(java.lang.Class)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public <V extends IModelService> V getService(Class<V> serviceInterface) {
+ Assert.isNotNull(serviceInterface);
+ return (V)getAdapter(serviceInterface);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (IPeerNode.class.isAssignableFrom(adapter) || IConnectable.class.isAssignableFrom(adapter)) {
+ final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ peerNode.set(getPeerNode());
+ }
+ });
+ return peerNode.get();
+ }
+
+ return super.getAdapter(adapter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#setFactory(com.windriver.te.tcf.core.model.interfaces.IModelNodeFactory)
+ */
+ @Override
+ public void setFactory(IFactory factory) {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ this.factory = factory;
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#getFactory()
+ */
+ @Override
+ public IFactory getFactory() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ return factory != null ? factory : Factory.getInstance();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider#getPeerModel()
+ */
+ @Override
+ public IPeerNode getPeerNode() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ return peerNode;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.model.ModelNode#toString()
+ */
+ @Override
+ public String toString() {
+ if (disposed) {
+ return "*DISPOSED* : " + super.toString(); //$NON-NLS-1$
+ }
+ return super.toString();
+ }
+
+ /**
+ * Get the root node of the peer model.
+ *
+ * @return The root node.
+ */
+ @Override
+ public FSTreeNode getRoot() {
+ if(root == null) {
+ root = createRoot();
+ }
+ return root;
+ }
+
+ /**
+ * Create a root node for the specified peer.
+ *
+ * @param peerNode The peer.
+ */
+ /* default */ FSTreeNode createRoot() {
+ if (Protocol.isDispatchThread()) {
+ return createRootNode(peerNode);
+ }
+ else {
+ final AtomicReference<FSTreeNode> ref = new AtomicReference<FSTreeNode>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ ref.set(createRoot());
+ }
+ });
+ return ref.get();
+ }
+ }
+
+ /**
+ * Create a root node for the peer.
+ *
+ * @param peerNode The peer.
+ * @return The root file system node.
+ */
+ public static FSTreeNode createRootNode(IPeerNode peerNode) {
+ FSTreeNode node = new FSTreeNode();
+ node.type = "FSRootNode"; //$NON-NLS-1$
+ node.peerNode = peerNode;
+ node.name = Messages.FSTreeNodeContentProvider_rootNode_label;
+ return node;
+ }
+
+ /**
+ * Create a file node under the folder specified folder using the new name.
+ *
+ * @param name The file's name.
+ * @param folder The parent folder.
+ * @return The file tree node.
+ */
+ public static FSTreeNode createFileNode(String name, FSTreeNode folder) {
+ return createTreeNode(name, "FSFileNode", folder); //$NON-NLS-1$
+ }
+
+ /**
+ * Create a folder node under the folder specified folder using the new name.
+ *
+ * @param name The folder's name.
+ * @param folder The parent folder.
+ * @return The folder tree node.
+ */
+ public static FSTreeNode createFolderNode(String name, FSTreeNode folder) {
+ return createTreeNode(name, "FSDirNode", folder); //$NON-NLS-1$
+ }
+
+ /**
+ * Create a tree node under the folder specified folder using the new name.
+ *
+ * @param name The tree node's name.
+ * @param type The new node's type.
+ * @param folder The parent folder.
+ * @return The tree node.
+ */
+ private static FSTreeNode createTreeNode(String name, String type, FSTreeNode folder) {
+ FSTreeNode node = new FSTreeNode();
+ node.name = name;
+ node.parent = folder;
+ node.peerNode = folder.peerNode;
+ node.type = type;
+ return node;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/UserAccount.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/UserAccount.java
new file mode 100644
index 000000000..d501473e8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/UserAccount.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River) - [352302]Opening a file in an editor depending on
+ * the client's permissions.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.model;
+
+/**
+ * The data model of a user account.
+ */
+public class UserAccount {
+ // The user's id.
+ private int uid;
+ // The user's group id.
+ private int gid;
+ // The user's effective id.
+ private int euid;
+ // The user's effective group id.
+ private int egid;
+ // The user's home directory.
+ private String home;
+
+ /**
+ * Create a user account with given data.
+ *
+ * @param uid
+ * The user's id
+ * @param gid
+ * The user's group id
+ * @param euid
+ * The user's effective id.
+ * @param egid
+ * The user's effective group id.
+ * @param home
+ * The user's home directory.
+ */
+ public UserAccount(int uid, int gid, int euid, int egid, String home) {
+ this.uid = uid;
+ this.gid = gid;
+ this.euid = euid;
+ this.egid = egid;
+ this.home = home;
+ }
+
+ /**
+ * Get the user's id.
+ *
+ * @return The user's id.
+ */
+ public int getUID() {
+ return uid;
+ }
+
+ /**
+ * Get the user's group id.
+ *
+ * @return The user's group id.
+ */
+ public int getGID() {
+ return gid;
+ }
+
+ /**
+ * Get the user's effective id.
+ *
+ * @return The user's effective id.
+ */
+ public int getEUID() {
+ return euid;
+ }
+
+ /**
+ * Get the user's effective group id.
+ *
+ * @return The user's effective group id.
+ */
+ public int getEGID() {
+ return egid;
+ }
+
+ /**
+ * Get the user's home directory.
+ *
+ * @return The user's home directory.
+ */
+ public String getHome() {
+ return home;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.java
new file mode 100644
index 000000000..b49b665e7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * William Chen (Wind River) - [345384] Provide property pages for remote file system nodes
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.nls;
+
+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.core.nls.Messages"; //$NON-NLS-1$
+
+ /**
+ * Static constructor.
+ */
+ static {
+ // Load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ // **** Declare externalized string id's down here *****
+
+ public static String FSTreeNodeContentProvider_rootNode_label;
+ public static String FSTreeNode_TypeFile;
+ public static String FSTreeNode_TypeFileFolder;
+ public static String FSTreeNode_TypeLocalDisk;
+ public static String FSTreeNode_TypeSystemFile;
+ public static String FSTreeNode_TypeUnknownFile;
+
+ public static String Operation_DeletingFileFailed;
+ public static String Operation_NotResponding;
+ public static String Operation_OpeningChannelFailureMessage;
+ public static String Operation_NoFileSystemError;
+ public static String Operation_CannotOpenDir;
+ public static String Operation_CopyNOfFile;
+ public static String Operation_CopyOfFile;
+ public static String Operation_CannotCreateDirectory;
+ public static String Operation_TimeoutOpeningChannel;
+
+ public static String OpCopy_Copying;
+ public static String OpCopy_CannotCopyFile;
+ public static String OpCopy_CopyingFile;
+
+ public static String OpCreate_TaskName;
+
+ public static String TcfURLConnection_NoFileHandleReturned;
+ public static String TcfURLConnection_NoPeerFound;
+ public static String TcfURLConnection_NoSuchTcfAgent;
+
+ public static String OpDelete_Deleting;
+ public static String OpDelete_PrepareToDelete;
+ public static String OpDelete_RemovingFileFolder;
+
+ public static String OpDownload_Downloading;
+ public static String OpDownload_DownloadingMultipleFiles;
+ public static String OpDownload_DownloadingSingleFile;
+
+ public static String OpMove_Moving;
+ public static String OpMove_FileExistsError;
+ public static String OpMove_FolderExistsError;
+ public static String OpMove_CannotMove;
+ public static String OpMove_MovingFile;
+
+ public static String OpOutStreamOp_DownloadingProgress;
+
+ public static String OpRefresh_RefreshJobTitle;
+
+ public static String OpRename_CannotRename;
+ public static String OpRename_TitleRename;
+
+ public static String OpStreamOp_SetReadOnlyFailed;
+ public static String OpStreamOp_Bytes;
+ public static String OpStreamOp_KBs;
+ public static String OpStreamOp_MBs;
+
+ public static String OpUpload_UploadingProgress;
+ public static String OpUpload_UploadNFiles;
+ public static String OpUpload_UploadSingleFile;
+
+ public static String TcfInputStream_NoDataAvailable;
+ public static String TcfInputStream_StreamClosed;
+ public static String TcfOutputStream_StreamClosed;
+ public static String TcfURLStreamHandlerService_ErrorURLFormat;
+ public static String TcfURLStreamHandlerService_IllegalCharacter;
+ public static String TcfURLStreamHandlerService_OnlyDiskPartError;
+
+ public static String CacheManager_MkdirFailed;
+
+ public static String FileTransferService_error_mkdirFailed;
+ public static String BlockingFileSystemProxy_TimeoutOpeningFile;
+ public static String BlockingFileSystemProxy_TimeoutClosingFile;
+ public static String BlockingFileSystemProxy_TimeoutReadingFile;
+ public static String BlockingFileSystemProxy_TimeoutWritingFile;
+ public static String BlockingFileSystemProxy_TimeoutStat;
+ public static String BlockingFileSystemProxy_TimeoutLstat;
+ public static String BlockingFileSystemProxy_TimeoutFstat;
+ public static String BlockingFileSystemProxy_TimeoutSetStat;
+ public static String BlockingFileSystemProxy_TimeoutFSetStat;
+ public static String BlockingFileSystemProxy_TimeoutOpeningDir;
+ public static String BlockingFileSystemProxy_TimeoutReadingDir;
+ public static String BlockingFileSystemProxy_TimeoutMakingDir;
+ public static String BlockingFileSystemProxy_TimeoutRemovingDir;
+ public static String BlockingFileSystemProxy_TimeoutListingRoots;
+ public static String BlockingFileSystemProxy_TimeoutRemovingFile;
+ public static String BlockingFileSystemProxy_TimeoutGettingRealPath;
+ public static String BlockingFileSystemProxy_TimeoutRenamingFile;
+ public static String BlockingFileSystemProxy_TimeoutReadingLink;
+ public static String BlockingFileSystemProxy_TimeoutSymLink;
+ public static String BlockingFileSystemProxy_TimeoutCopying;
+ public static String BlockingFileSystemProxy_TimeoutGettingUser;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.properties
new file mode 100644
index 000000000..ad4dd962c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/nls/Messages.properties
@@ -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
+###############################################################################
+
+BlockingFileSystemProxy_TimeoutOpeningFile=Timeout while opening the file ''{0}''.
+BlockingFileSystemProxy_TimeoutClosingFile=Timeout while closing the handle ''{0}''.
+BlockingFileSystemProxy_TimeoutReadingFile=Timeout while reading the handle ''{0}''.
+BlockingFileSystemProxy_TimeoutWritingFile=Timeout while writing the handle ''{0}''.
+BlockingFileSystemProxy_TimeoutStat=Timeout while getting the stat of ''{0}''.
+BlockingFileSystemProxy_TimeoutLstat=Timeout while getting the lstat of ''{0}''.
+BlockingFileSystemProxy_TimeoutFstat=Timeout while getting the fstat of ''{0}''.
+BlockingFileSystemProxy_TimeoutSetStat=Timeout while setting the stat of ''{0}''.
+BlockingFileSystemProxy_TimeoutFSetStat=Timeout while setting the fstat of ''{0}''.
+BlockingFileSystemProxy_TimeoutOpeningDir=Timeout while opening the directory ''{0}''.
+BlockingFileSystemProxy_TimeoutReadingDir=Timeout while reading the directory ''{0}''.
+BlockingFileSystemProxy_TimeoutMakingDir=Timeout while making the directory ''{0}''.
+BlockingFileSystemProxy_TimeoutRemovingDir=Timeout while removing the directory ''{0}''.
+BlockingFileSystemProxy_TimeoutListingRoots=Timeout while listing root directories.
+BlockingFileSystemProxy_TimeoutRemovingFile=Timeout while removing the file ''{0}''.
+BlockingFileSystemProxy_TimeoutGettingRealPath=Timeout while getting real path for ''{0}''.
+BlockingFileSystemProxy_TimeoutRenamingFile=Timeout while renaming the file from ''{0}'' to ''{1}''.
+BlockingFileSystemProxy_TimeoutReadingLink=Timeout while reading the link for ''{0}''.
+BlockingFileSystemProxy_TimeoutSymLink=Timeout while creating a link ''{0}'' for ''{1}''.
+BlockingFileSystemProxy_TimeoutCopying=Timeout while copying files from ''{0}'' to ''{1}''.
+BlockingFileSystemProxy_TimeoutGettingUser=Timeout while getting the user data.
+FSTreeNodeContentProvider_rootNode_label=File System
+FSTreeNode_TypeFile=File
+FSTreeNode_TypeFileFolder=File Folder
+FSTreeNode_TypeLocalDisk=Local Disk
+FSTreeNode_TypeSystemFile=System file
+FSTreeNode_TypeUnknownFile=Unknown File
+
+Operation_DeletingFileFailed=Deleting {0} failed\!
+Operation_NotResponding=The TCF agent on the target {0} is probably down. It is not responding.
+Operation_OpeningChannelFailureMessage=We cannot open a TCF channel to the target: {0}. It is caused by {1}.
+Operation_NoFileSystemError=This TCF agent, {0}, does not provide a file system service\!
+Operation_CannotOpenDir=Cannot open directory {0} because {1}
+Operation_CopyNOfFile=Copy ({0}) of {1}
+Operation_CopyOfFile=Copy of {0}
+Operation_CannotCreateDirectory=Cannot create the directory {0} because: {1}
+Operation_TimeoutOpeningChannel=Timeout while opening a channel\!
+
+OpCopy_Copying=Copying {0} ...
+OpCopy_CannotCopyFile=Cannot copy file {0} because: {1}
+OpCopy_CopyingFile=Copying files
+
+OpCreate_TaskName=Creating {0}...
+
+TcfURLConnection_NoFileHandleReturned=No file handle returned\!
+TcfURLConnection_NoPeerFound=Could not find the specified target with the ID {0}
+TcfURLConnection_NoSuchTcfAgent=TCF agent is already disconnected\!
+
+OpDelete_Deleting=Deleting files
+OpDelete_PrepareToDelete=Prepare to delete files ...
+OpDelete_RemovingFileFolder=Removing {0} ...
+
+OpDownload_Downloading=Downloading file {0}:{1}/{2}
+OpDownload_DownloadingMultipleFiles=Downloading {0} files...
+OpDownload_DownloadingSingleFile=Downloading file {0}...
+
+OpMove_Moving=Moving {0} ...
+OpMove_FileExistsError=Cannot replace {0}: There is already a file with the same name as the folder you are moving.
+OpMove_FolderExistsError=Cannot replace {0}: There is already a folder with the same name as the file you are moving.
+OpMove_CannotMove=Cannot move {0} because {1}
+OpMove_MovingFile=Moving files
+
+OpOutStreamOp_DownloadingProgress=Downloading {0}/{1}.
+
+OpRefresh_RefreshJobTitle=Refresh {0}
+
+OpRename_CannotRename=Cannot rename {0} because {1}
+OpRename_TitleRename=Rename
+
+OpStreamOp_SetReadOnlyFailed=Setting the read-only attribute of {0} failed\!
+OpStreamOp_Bytes=\ bytes
+OpStreamOp_KBs=\ KBs
+OpStreamOp_MBs=\ MBs
+
+OpUpload_UploadingProgress=Uploading file {0}: {1}/{2}
+OpUpload_UploadNFiles=Uploading {0} files...
+OpUpload_UploadSingleFile=Uploading file {0}...
+
+TcfInputStream_NoDataAvailable=No data available
+TcfInputStream_StreamClosed=Stream is already closed\!
+
+TcfOutputStream_StreamClosed=Stream is already closed\!
+
+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.
+
+CacheManager_MkdirFailed=Making directory {0} failed
+
+FileTransferService_error_mkdirFailed=Failed to create directory structure to {0}. \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
new file mode 100644
index 000000000..418991906
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
@@ -0,0 +1,523 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 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
+ * Anna Dushistova(Montavista) - [386484]Allow file transfer from target to host into existing directories
+ * Anna Dushistova(Montavista) - [387819]File Transfer stopped working
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.tcf.filesystem.core.services;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.services.IFileSystem.IFileHandle;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.runtime.utils.ProgressHelper;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.util.TCFFileInputStream;
+import org.eclipse.tcf.util.TCFFileOutputStream;
+
+/**
+ * TCF file transfer service.
+ */
+public class FileTransferService {
+
+ /**
+ * Returns the target path file attribute.
+ *
+ * @param peer The peer, must not be <code>null</code>.
+ * @param channel The channel or <code>null</code>.
+ * @param item The file transfer item, must not be <code>null</code>.
+ *
+ * @return The target path file attributes or <code>null</code>.
+ */
+ public static FileAttrs getRemoteFileAttrs(IPeer peer, IChannel channel, IFileTransferItem item) {
+
+ final AtomicReference<FileAttrs> attrs = new AtomicReference<FileAttrs>();
+
+ boolean ownChannel = false;
+ IFileSystem fileSystem;
+ try {
+ if (channel == null) {
+ ownChannel = true;
+ channel = Operation.openChannel(peer);
+ }
+ fileSystem = Operation.getBlockingFileSystem(channel);
+
+ Assert.isNotNull(fileSystem);
+
+ IPath targetPath = item.getTargetPath();
+ if (targetPath != null) {
+ final AtomicReference<FileSystemException> error = new AtomicReference<FileSystemException>();
+
+ fileSystem.stat(targetPath.toString(), new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error.set(e);
+ attrs.set(e == null ? a : null);
+ }
+ });
+ }
+ if (ownChannel) {
+ closeChannel(peer, channel);
+ }
+ }
+ catch (Exception e) {
+ attrs.set(null);
+ }
+
+ return attrs.get();
+ }
+
+ /**
+ * Transfer a file between host and target depending on the {@link IFileTransferItem} data.
+ *
+ * @param peer The peer, must not be <code>null</code>.
+ * @param channel The channel or <code>null</code>.
+ * @param item The file transfer item, must not be <code>null</code>.
+ * @param monitor The progress monitor or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ public static void transfer(IPeer peer, IChannel channel, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) {
+
+ boolean ownChannel = false;
+ IFileSystem fileSystem;
+ try {
+ if (channel == null) {
+ ownChannel = true;
+ channel = Operation.openChannel(peer);
+ }
+ fileSystem = Operation.getBlockingFileSystem(channel);
+
+ Assert.isNotNull(fileSystem);
+
+ // Check the direction of the transfer
+ if (item.getDirection() == IFileTransferItem.TARGET_TO_HOST) {
+ transferToHost(peer, fileSystem, item, monitor, callback);
+ }
+ else {
+ transferToTarget(peer, fileSystem, item, monitor, callback);
+ }
+ if (ownChannel) {
+ closeChannel(peer, channel);
+ }
+ }
+ catch (Exception e) {
+ if (callback != null) {
+ callback.done(peer, StatusHelper.getStatus(e));
+ }
+ }
+ }
+
+ /**
+ * Transfer a file between host and target depending on the {@link IFileTransferItem} data.
+ *
+ * @param peer The peer, must not be <code>null</code>.
+ * @param item The file transfer item, must not be <code>null</code>.
+ * @param monitor The progress monitor or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ protected static void transfer(IPeer peer, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) {
+
+ // Check if we can skip the transfer
+ if (!item.isEnabled()) {
+ if (callback != null) {
+ callback.done(peer, Status.OK_STATUS);
+ }
+ return;
+ }
+
+ try {
+ IChannel channel = Operation.openChannel(peer);
+ transfer(peer, channel, item, monitor, callback);
+ closeChannel(peer, channel);
+ }
+ catch (Exception e) {
+ if (callback != null) {
+ callback.done(peer, StatusHelper.getStatus(e));
+ }
+ }
+ }
+
+ protected static void transferToHost(IPeer peer, IFileSystem fileSystem, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) {
+
+ IStatus result = Status.OK_STATUS;
+
+ IPath hostPath = item.getHostPath();
+ IPath targetPath = item.getTargetPath();
+
+ BufferedOutputStream outStream = null;
+ TCFFileInputStream inStream = null;
+
+ final IFileSystem.IFileHandle[] handle = new IFileSystem.IFileHandle[1];
+ final FileSystemException[] error = new FileSystemException[1];
+ final IFileSystem.FileAttrs[] attrs = new IFileSystem.FileAttrs[1];
+
+ // Create necessary parent directory structure on host side
+ boolean rc = hostPath.removeLastSegments(1).toFile().exists();
+ if(!rc){
+ rc = hostPath.removeLastSegments(1).toFile().mkdirs();
+ if (!rc) {
+ IOException e = new IOException(NLS.bind(Messages.FileTransferService_error_mkdirFailed, hostPath.removeLastSegments(1).toOSString()));
+ result = StatusHelper.getStatus(e);
+ if (callback != null) callback.done(peer, result);
+ return;
+ }
+ }
+ // If the host file is a directory, append the remote file name
+ if (hostPath.toFile().isDirectory()) {
+ hostPath = item.getHostPath().append(targetPath.lastSegment());
+ }
+
+ // Remember the modification time of the remote file.
+ // We need this value to set the modification time of the host file
+ // _after_ the stream closed.
+ long mtime = -1;
+
+ try {
+ // Open the remote file
+ fileSystem.open(targetPath.toString(), IFileSystem.TCF_O_READ, null, new IFileSystem.DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException e, IFileHandle h) {
+ error[0] = e;
+ handle[0] = h;
+ }
+ });
+ if (error[0] != null) {
+ throw error[0];
+ }
+ // Get the remote file attributes
+ fileSystem.fstat(handle[0], new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error[0] = e;
+ attrs[0] = a;
+ }
+ });
+ if (error[0] != null) {
+ throw error[0];
+ }
+ // Remember the modification time
+ mtime = attrs[0].mtime;
+
+ // Open a output stream to the host file
+ outStream = new BufferedOutputStream(new FileOutputStream(hostPath.toFile()));
+ // And open the input stream to the target file handle
+ inStream = new TCFFileInputStream(handle[0]);
+
+ ProgressHelper.setSubTaskName(monitor, "Transfer '" + targetPath.toString() + "' to '" + hostPath.toOSString() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ long bytesTotal = attrs[0].size;
+ copy(inStream, outStream, bytesTotal, monitor);
+ }
+ catch (OperationCanceledException e) {
+ result = Status.CANCEL_STATUS;
+ }
+ catch (Exception e) {
+ result = StatusHelper.getStatus(e);
+ }
+ finally {
+ // Close all streams and cleanup
+ if (outStream != null) {
+ try {
+ outStream.close();
+ outStream = null;
+ }
+ catch (IOException e) {
+ }
+ }
+ if (inStream != null) {
+ try {
+ inStream.close();
+ inStream = null;
+ }
+ catch (IOException e) {
+ }
+ }
+
+ if (result.isOK()) {
+ if (mtime >= 0) {
+ rc = hostPath.toFile().setLastModified(mtime);
+ if (!rc && Platform.inDebugMode()) {
+ System.err.println("Failed to set mtime for " + hostPath.toOSString()); //$NON-NLS-1$
+ }
+ }
+ }
+ else if (result.getSeverity() == IStatus.ERROR || result.getSeverity() == IStatus.CANCEL) {
+ try {
+ rc = hostPath.toFile().delete();
+ if (!rc && Platform.inDebugMode()) {
+ System.err.println("Failed to delete host file " + hostPath.toOSString()); //$NON-NLS-1$
+ }
+ }
+ catch (Throwable e) {
+ }
+ }
+ }
+ if (callback != null) callback.done(peer, result);
+ }
+
+ protected static void transferToTarget(IPeer peer, IFileSystem fileSystem, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) {
+
+ IStatus result = Status.OK_STATUS;
+
+ IPath targetPath = item.getTargetPath();
+ IPath hostPath = item.getHostPath();
+
+ BufferedInputStream inStream = null;
+ TCFFileOutputStream outStream = null;
+
+ final IFileSystem.IFileHandle[] handle = new IFileSystem.IFileHandle[1];
+ final FileSystemException[] error = new FileSystemException[1];
+ final FileAttrs[] attrs = new FileAttrs[1];
+
+ // Check the target destination directory
+ for (int i = 0; i < targetPath.segmentCount(); i++) {
+ IPath tp = i + 1 < targetPath.segmentCount() ? targetPath.removeLastSegments(targetPath.segmentCount() - (i + 1)) : targetPath;
+
+ error[0] = null;
+ attrs[0] = null;
+
+ fileSystem.stat(tp.toString(), new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error[0] = e;
+ attrs[0] = a;
+ }
+ });
+
+ if (attrs[0] == null && i + 1 < targetPath.segmentCount()) {
+ error[0] = null;
+ attrs[0] = null;
+
+ fileSystem.mkdir(tp.toString(), null, new IFileSystem.DoneMkDir() {
+ @Override
+ public void doneMkDir(IToken token, FileSystemException e) {
+ error[0] = e;
+ }
+ });
+
+ if (error[0] != null) {
+ result = StatusHelper.getStatus(error[0]);
+ if (callback != null) callback.done(peer, result);
+ return;
+ }
+
+ // Read the attributes of the created directory
+ error[0] = null;
+ attrs[0] = null;
+
+ fileSystem.stat(tp.toString(), new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error[0] = e;
+ attrs[0] = a;
+ }
+ });
+ }
+ }
+
+ // If we get the attributes back, the name at least exist in the target file system
+ if (attrs[0] != null && attrs[0].isDirectory()) {
+ targetPath = targetPath.append(item.getHostPath().lastSegment());
+ }
+
+ try {
+ // Open the remote file
+ fileSystem.open(targetPath.toString(), IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_TRUNC, null, new IFileSystem.DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException e, IFileHandle h) {
+ error[0] = e;
+ handle[0] = h;
+ }
+ });
+ if (error[0] != null) {
+ throw error[0];
+ }
+
+ // Open a input stream from the host file
+ inStream = new BufferedInputStream(new FileInputStream(hostPath.toFile()));
+ // Open the output stream for the target file handle
+ outStream = new TCFFileOutputStream(handle[0]);
+
+ ProgressHelper.setSubTaskName(monitor, "Transfer '" + hostPath.toOSString() + "' to '" + targetPath.toString() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ copy(inStream, outStream, hostPath.toFile().length(), monitor);
+
+ // Get the remote file attributes
+ fileSystem.fstat(handle[0], new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error[0] = e;
+ attrs[0] = a;
+ }
+ });
+ // Update the remote file attributes
+ IFileSystem.FileAttrs newAttrs = new FileAttrs(attrs[0].flags, attrs[0].size, attrs[0].uid, attrs[0].gid, attrs[0].permissions,
+ attrs[0].atime, hostPath.toFile().lastModified(), attrs[0].attributes);
+ // Set the remote file attributes
+ fileSystem.fsetstat(handle[0], newAttrs, new IFileSystem.DoneSetStat() {
+ @Override
+ public void doneSetStat(IToken token, FileSystemException e) {
+ error[0] = e;
+ }
+ });
+ }
+ catch (OperationCanceledException e) {
+ result = Status.CANCEL_STATUS;
+ }
+ catch (Exception e) {
+ result = StatusHelper.getStatus(e);
+ }
+ finally {
+ // Close all streams and cleanup
+ if (outStream != null) {
+ try {
+ outStream.close();
+ outStream = null;
+ }
+ catch (IOException e) {
+ }
+ }
+ if (inStream != null) {
+ try {
+ inStream.close();
+ inStream = null;
+ }
+ catch (IOException e) {
+ }
+ }
+
+ if (result.getSeverity() == IStatus.ERROR || result.getSeverity() == IStatus.CANCEL) {
+ fileSystem.remove(targetPath.toString(), new IFileSystem.DoneRemove() {
+ @Override
+ public void doneRemove(IToken token, FileSystemException error) {
+ }
+ });
+ }
+ }
+ if (callback != null) callback.done(peer, result);
+ }
+
+ private static void copy(InputStream in, OutputStream out, long bytesTotal, IProgressMonitor monitor) throws IOException {
+ long bytesDone = 0;
+ long speed;
+ long startTimeStamp = System.currentTimeMillis();
+ byte[] dataBuffer = new byte[12 * 1024];
+
+ // Copy from the input stream to the output stream (always binary).
+ while (true) {
+ if (ProgressHelper.isCanceled(monitor)) {
+ throw new OperationCanceledException();
+ }
+ // Read the data from the remote file
+ int bytesRead = in.read(dataBuffer);
+ // If reached EOF, we are done and break the loop
+ if (bytesRead < 0) {
+ break;
+ }
+ if (ProgressHelper.isCanceled(monitor)) {
+ throw new OperationCanceledException();
+ }
+ // Write back to the host file
+ out.write(dataBuffer, 0, bytesRead);
+
+ bytesDone += bytesRead;
+ long timestamp = System.currentTimeMillis();
+ speed = ((bytesDone) * 1000) / Math.max(timestamp - startTimeStamp, 1);
+
+ ProgressHelper.worked(monitor, (int)((bytesRead/(bytesTotal > 0 ? bytesTotal : 1000)) * 1000));
+ ProgressHelper.setSubTaskName(monitor, getProgressMessage(bytesDone, bytesTotal, speed));
+ }
+ }
+
+ /**
+ * Close the channel for file transfer.
+ * @param peer
+ * @param channel
+ * @throws TCFChannelException
+ */
+ protected static void closeChannel(final IPeer peer, final IChannel channel) throws TCFChannelException {
+ if (channel != null) {
+ Tcf.getChannelManager().closeChannel(channel);
+ }
+ }
+
+ private static String getProgressMessage(long bytesDone, long bytesTotal, long bytesSpeed) {
+ String done = "B"; //$NON-NLS-1$
+ String total = "B"; //$NON-NLS-1$
+ String speed = "B/s"; //$NON-NLS-1$
+
+ if (bytesDone > 1024) {
+ bytesDone /= 1024;
+ done = "KB"; //$NON-NLS-1$
+ }
+ if (bytesDone > 1024) {
+ bytesDone /= 1024;
+ done = "MB"; //$NON-NLS-1$
+ }
+ if (bytesDone > 1024) {
+ bytesDone /= 1024;
+ done = "GB"; //$NON-NLS-1$
+ }
+
+ if (bytesTotal > 1024) {
+ bytesTotal /= 1024;
+ total = "KB"; //$NON-NLS-1$
+ }
+ if (bytesTotal > 1024) {
+ bytesTotal /= 1024;
+ total = "MB"; //$NON-NLS-1$
+ }
+ if (bytesTotal > 1024) {
+ bytesTotal /= 1024;
+ total = "GB"; //$NON-NLS-1$
+ }
+
+ if (bytesSpeed > 1024) {
+ bytesSpeed /= 1024;
+ speed = "KB/s"; //$NON-NLS-1$
+ }
+ if (bytesSpeed > 1024) {
+ bytesSpeed /= 1024;
+ speed = "MB/s"; //$NON-NLS-1$
+ }
+ if (bytesSpeed > 1024) {
+ bytesSpeed /= 1024;
+ speed = "GB/s"; //$NON-NLS-1$
+ }
+
+ return bytesDone + done + " of " + (bytesTotal > 0 ? Long.toString(bytesTotal) : "N/A") + total + " at " + bytesSpeed + speed; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java
new file mode 100644
index 000000000..2f03dde9a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.steps.AbstractPeerNodeStep;
+
+/**
+ * Dispose the filesytsem runtime model associated with the peer node.
+ */
+public class DisposeModelStep extends AbstractPeerNodeStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IPeerNode peerNode = getActivePeerModelContext(context, data, fullQualifiedId);
+ if (peerNode != null) ModelManager.disposeRuntimeModel(peerNode);
+ callback.done(this, Status.OK_STATUS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/FileTransferStep.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/FileTransferStep.java
new file mode 100644
index 000000000..f38b862d6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/FileTransferStep.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.core.steps;
+
+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.tcf.protocol.IChannel;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
+import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.steps.IFileSystemStepAttributes;
+import org.eclipse.tcf.te.tcf.filesystem.core.services.FileTransferService;
+
+/**
+ * Launch process step implementation.
+ */
+public class FileTransferStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public FileTransferStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ if (channel == null || channel.getState() != IChannel.STATE_OPEN) {
+ throw new CoreException(new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), "missing or closed channel")); //$NON-NLS-1$
+ }
+
+ Object item = StepperAttributeUtil.getProperty(IFileSystemStepAttributes.ATTR_FILE_TRANSFER_ITEM, fullQualifiedId, data);
+ if (!(item instanceof IFileTransferItem)) {
+ throw new CoreException(new Status(IStatus.ERROR, CorePlugin.getUniqueIdentifier(), "missing file transfer item")); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
+ final IFileTransferItem item = (IFileTransferItem)StepperAttributeUtil.getProperty(IFileSystemStepAttributes.ATTR_FILE_TRANSFER_ITEM, fullQualifiedId, data);
+
+ if (item.isEnabled()) {
+ FileTransferService.transfer(getActivePeerContext(context, data, fullQualifiedId), channel, item, monitor, callback);
+ }
+ else {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep#getTotalWork(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public int getTotalWork(IStepContext context, IPropertiesContainer data) {
+ return 1000;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java
new file mode 100644
index 000000000..fa5ea991d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelChannelService;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.steps.AbstractPeerNodeStep;
+
+/**
+ * Initialize the filesystem runtime model associated with the peer node.
+ */
+public class InitializeModelStep extends AbstractPeerNodeStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ IPeerNode peerNode = getActivePeerModelContext(context, data, fullQualifiedId);
+ if (peerNode != null) {
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerNode);
+ final IModelChannelService service = model != null ? model.getService(IModelChannelService.class) : null;
+ if (service != null) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ service.openChannel(new IModelChannelService.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(Throwable error, IChannel channel) {
+ callback.done(InitializeModelStep.this, StatusHelper.getStatus(error));
+ }
+ });
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ } else {
+ callback.done(InitializeModelStep.this, Status.OK_STATUS);
+ }
+ } else {
+ callback.done(InitializeModelStep.this, Status.OK_STATUS);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.classpath
index ad32c83a7..ad32c83a7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.classpath
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.classpath
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.project b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.project
index 6dbc964fb..a3e804ab0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.project
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals.rse</name>
+ <name>org.eclipse.tcf.te.filesystem.ui</name>
<comment></comment>
<projects>
</projects>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.jdt.core.prefs
index 24dad4464..a069dfcf5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.core.prefs
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue Oct 11 11:53:38 CEST 2011
+#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
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs
index 88bb9570e..88bb9570e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.jdt.ui.prefs
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.pde.prefs
index cf80c8bc5..cf80c8bc5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.pde.prefs
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/.settings/org.eclipse.pde.prefs
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..1f55305b5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,57 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.filesystem.ui;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.compare;bundle-version="3.5.300",
+ org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.core.filesystem;bundle-version="1.3.200",
+ org.eclipse.text;bundle-version="3.5.200",
+ org.eclipse.ui.ide;bundle-version="3.8.1",
+ org.eclipse.ui.navigator;bundle-version="3.5.200",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.8.0",
+ org.eclipse.tcf.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.ui;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui.forms;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui.swt;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui.views;bundle-version="1.3.0",
+ org.eclipse.tcf.te.ui.controls;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.3.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.pages;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.search;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.ui.terminals.process/about.html b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/about.html
index 0f07cf034..0f07cf034 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/about.html
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/about.html
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/build.properties
index 221a2d955..bf3f1e0fb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/build.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/build.properties
@@ -13,4 +13,5 @@ bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
+ icons/,\
about.html
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/error.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/error.gif
new file mode 100644
index 000000000..85ec26bb8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/error.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/folder.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/folder.gif
new file mode 100644
index 000000000..5ae555a34
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/folder.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/hidden_file_filter.png b/target_explorer/plugins/org.eclipse.tcf.te.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.filesystem.ui/icons/obj16/hidden_file_filter.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfile_wiz.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfile_wiz.gif
new file mode 100644
index 000000000..9d050885b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfile_wiz.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfolder_wiz.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfolder_wiz.gif
new file mode 100644
index 000000000..310eb18e3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/newfolder_wiz.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/refresh.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/refresh.gif
new file mode 100644
index 000000000..3ca04d06f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/refresh.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/root.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/root.gif
new file mode 100644
index 000000000..ba39f47f4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/root.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/rootdrive.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/rootdrive.gif
new file mode 100644
index 000000000..fd426343b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/rootdrive.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/synch_synch.gif b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/synch_synch.gif
new file mode 100644
index 000000000..ae7726345
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/synch_synch.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/system_file_filter.png b/target_explorer/plugins/org.eclipse.tcf.te.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.filesystem.ui/icons/obj16/system_file_filter.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win7_rootdrive.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win7_rootdrive.png
new file mode 100644
index 000000000..93e70989c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win7_rootdrive.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win8_rootdrive.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win8_rootdrive.png
new file mode 100644
index 000000000..93e70989c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/win8_rootdrive.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/xp_rootdrive.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/xp_rootdrive.png
new file mode 100644
index 000000000..881717ee0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj16/xp_rootdrive.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/banner.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/banner.png
new file mode 100644
index 000000000..aa7c955b7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/banner.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/delete_readonly.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/delete_readonly.png
new file mode 100644
index 000000000..4c8a7e3a8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/delete_readonly.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/replace_confirm.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/replace_confirm.png
new file mode 100644
index 000000000..455df2156
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/obj32/replace_confirm.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_conflict.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_conflict.png
new file mode 100644
index 000000000..eb22b4cce
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_conflict.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_modified.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_modified.png
new file mode 100644
index 000000000..66e3e4e24
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_modified.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_outdated.png b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_outdated.png
new file mode 100644
index 000000000..f662aac01
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/icons/ovr/ovr_outdated.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.properties
new file mode 100644
index 000000000..963ec274b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.properties
@@ -0,0 +1,119 @@
+##################################################################################
+# Copyright (c) 2011, 2014 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 - Target Explorer
+
+# ***** 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 *****
+
+NewWizards.category.filesystem.name=Remote File System
+
+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
+
+command.delete.label=Delete
+command.delete.description=Delete the selected node
+
+decorator.modified.label = Remote File System Modified Cache Decorator
+decorator.outdated.label = Remote File System Outdated Cache Decorator
+decorator.conflict.label = Remote File System Conflicting Cache Decorator
+decorator.label.cut = Remote File System Cut File Decorator
+decorator.hidden.label = Remote File System Hidden File Decorator
+
+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.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 nodes
+command.search.label = Find...
+
+command.cut.mnemonic = t
+command.copy.mnemonic = C
+command.paste.mnemonic = P
+command.delete.mnemonic = D
+command.rename.mnemonic = R
+command.move.mnemonic = M \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.xml
new file mode 100644
index 000000000..1a4a500f6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/plugin.xml
@@ -0,0 +1,1997 @@
+<?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/root.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.IPeerNode">
+ </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.tcf.filesystem.ui.internal.pages.FSExplorerEditorPage"
+ icon="icons/obj16/root.gif"
+ id="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"
+ name="%FSExplorerEditorPage.name">
+ </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"
+ insertBefore="org.eclipse.tcf.te.tcf.launch.ui.MemoryMapEditorPage,org.eclipse.tcf.te.tcf.launch.ui.PathMapEditorPage,org.eclipse.tcf.te.launch.ui.SourceLookupEditorPage,org.eclipse.tcf.te.launch.ui.LaunchEditorPage">
+ <enablement>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode">
+ <test property="org.eclipse.tcf.te.tcf.locator.hasOfflineService" value="FileSystem"/>
+ </adapt>
+ </with>
+ </enablement>
+ </editorPageBinding>
+ </extension>
+
+<!-- Menu contributions -->
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage?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>
+ <separator
+ name="group.openWith">
+ </separator>
+ <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="%command.cut.mnemonic"
+ 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="%command.copy.mnemonic"
+ 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="%command.paste.mnemonic"
+ 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">
+ </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="%command.delete.mnemonic"
+ style="push"
+ tooltip="%command.delete.description">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.refresh"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ label="%fsmenu.refresh.label"
+ style="push"
+ tooltip="%command.refresh.tooltip">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.syncop"
+ 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="%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.operations"
+ 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="%command.rename.mnemonic"
+ 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="%command.move.mnemonic"
+ 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.search"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.find"
+ label="%command.search.label"
+ style="push">
+ </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.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>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.openWith">
+ <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>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.edit">
+ <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="%command.cut.mnemonic"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <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.isSystemRoot">
+ </test>
+ </not>
+ </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="%command.copy.mnemonic"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <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.isSystemRoot">
+ </test>
+ </not>
+ </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="%command.paste.mnemonic"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <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.isSystemRoot">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.delete">
+ <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.delete.label"
+ mnemonic="%command.delete.mnemonic"
+ style="push"
+ tooltip="%command.delete.description">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="+"/>
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.refresh">
+ <command
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ label="%fsmenu.refresh.label"
+ style="push"
+ tooltip="%command.refresh.tooltip">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <instanceof
+ value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.syncop">
+ <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="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.operations">
+ <command
+ commandId="org.eclipse.ui.edit.rename"
+ helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Rename"
+ id="rename"
+ label="%command.label.rename"
+ mnemonic="%command.rename.mnemonic"
+ 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>
+ <not>
+ <test
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot">
+ </test>
+ </not>
+ </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="%command.move.mnemonic"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <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.isSystemRoot">
+ </test>
+ </not>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution
+ locationURI="toolbar:org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage?before=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 value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable"/>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile"/>
+ </not>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable"/>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isBinaryFile"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <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.getCacheState"
+ value="outdated"/>
+ </iterate>
+ </with>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <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.getCacheState"
+ value="modified"/>
+ </iterate>
+ </with>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <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.getCacheState"
+ value="conflict"/>
+ </iterate>
+ </with>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <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"/>
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="modified"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.getCacheState"
+ value="conflict"/>
+ </or>
+ </iterate>
+ </with>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.cache.isAutoSavingOn"/>
+ </not>
+ </and>
+ </enabledWhen>
+ </handler>
+
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.CutFilesHandler"
+ commandId="org.eclipse.ui.edit.cut">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot"/>
+ </not>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ </not>
+ <or>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly"/>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ </not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadable"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot"/>
+ </not>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ </not>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.PasteFilesHandler"
+ commandId="org.eclipse.ui.edit.paste">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ </not>
+ </iterate>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.clipboard.canPaste"/>
+ </with>
+ </and>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MoveFilesHandler"
+ commandId="org.eclipse.ui.edit.move">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ </not>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot"/>
+ </not>
+ <or>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly"/>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ </not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ </not>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot"/>
+ </not>
+ <or>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly"/>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ </not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <or>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable"/>
+ </and>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ <test args="isWritable"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent"/>
+ </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>
+ <and>
+ <with variable="activePartId">
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <or>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable"/>
+ </and>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ <test args="isWritable"
+ property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.testParent"/>
+ </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>
+
+ <handler
+ commandId="org.eclipse.ui.edit.delete"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.DeleteHandler">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ </not>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot"/>
+ </not>
+ <or>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isReadOnly"/>
+ </not>
+ </and>
+ <and>
+ <not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWindows"/>
+ </not>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isWritable"/>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.RefreshHandler"
+ commandId="org.eclipse.tcf.te.ui.command.refresh">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <iterate ifEmpty="false" operator="and">
+ <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isRoot"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isDirectory"/>
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isFile"/>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </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 type="org.eclipse.jface.viewers.ILabelProvider"/>
+ <adapter type="org.eclipse.ui.IPersistableElement"/>
+ <adapter type="org.eclipse.tcf.te.ui.interfaces.ILazyLoader"/>
+ <adapter type="org.eclipse.tcf.te.ui.interfaces.ISearchable"/>
+ <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider"/>
+ <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.ViewerInputAdapterFactory">
+ <adapter
+ type="org.eclipse.tcf.te.core.interfaces.IViewerInput">
+ </adapter>
+ <adapter
+ type="org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider">
+ </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 target wizard contributions -->
+ <extension point="org.eclipse.tcf.te.ui.newWizards">
+ <category
+ id="org.eclipse.tcf.te.tcf.filesystem.ui.newWizards.category"
+ name="%NewWizards.category.filesystem.name">
+ </category>
+ </extension>
+
+<!-- New wizard contributions -->
+ <extension point="org.eclipse.tcf.te.ui.newWizards">
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.tcf.te.tcf.filesystem.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.filesystem.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"
+ id="org.eclipse.tcf.te.ui.controls.viewer.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" />
+ <transferType
+ name="FileTransfer">
+ </transferType>
+ </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">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode">
+ <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.peer.isWindows" />
+ </adapt>
+ </with>
+ </activation>
+ </filter>
+ </filterContribution>
+ </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>
+ <extension
+ point="org.eclipse.ui.elementFactories">
+ <factory
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.FSTreeNodeFactory"
+ id="org.eclipse.tcf.te.tcf.filesystem.ui.nodeFactory">
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.ui.navigator.Open"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F3">
+ </key>
+ <key
+ commandId="org.eclipse.ui.navigator.Open"
+ contextId="org.eclipse.tcf.te.ui.views.Editor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F3">
+ </key>
+ </extension>
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/pom.xml
index 8b5e73f93..94a76a685 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/pom.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/pom.xml
@@ -12,6 +12,6 @@
</parent>
<version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals</artifactId>
+ <artifactId>org.eclipse.tcf.te.filesystem.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
new file mode 100644
index 000000000..5584c7375
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.interfaces.preferences.IPreferenceKeys;
+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.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 implements IPreferenceKeys {
+ // 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 "org.eclipse.tcf.te.tcf.filesystem.ui"; //$NON-NLS-1$
+ }
+
+ /* (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 + "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 + "refresh.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.REFRESH_IMAGE, 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(PREF_AUTOSAVING);
+ return autoSaving;
+ }
+
+ /**
+ * If the option of "expanded_persisted" is set to on.
+ *
+ * @return true if the expanded state should be persisted or else false.
+ */
+ public static boolean isExpandedPersisted() {
+ IPreferenceStore preferenceStore = getDefault().getPreferenceStore();
+ boolean persisted = preferenceStore.getBoolean(PREF_EXPANDED_PERSISTED);
+ return persisted;
+ }
+
+ /**
+ * 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(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(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(PREF_COPY_OWNERSHIP);
+ return copyOwnership;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
new file mode 100644
index 000000000..00e34dac5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+
+
+/**
+ * File system content provider for the common navigator of Target Explorer.
+ */
+public class FSNavigatorContentProvider extends NavigatorContentProvider {
+
+ /*
+ * (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) {
+ if (parentElement instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode)parentElement;
+ if (node.isFile()) return NO_ELEMENTS;
+ }
+ return super.getChildren(parentElement);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(final Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode)element;
+ if(node.isFile()) {
+ return false;
+ }
+ }
+ return super.hasChildren(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IUIConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java
index 7c733a0e6..bf4e5abac 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IUIConstants.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -7,15 +7,19 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.interfaces;
+package org.eclipse.tcf.te.tcf.filesystem.ui.controls;
/**
- * Terminals common UI constants.
+ * File system tree content provider implementation.
*/
-public interface IUIConstants {
- /**
- * The view id of the terminals view.
+public class FSTreeContentProvider extends FSNavigatorContentProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.controls.FSNavigatorContentProvider#isRootNodeVisible()
*/
- public static final String ID = "org.eclipse.tcf.te.ui.terminals.TerminalsView"; //$NON-NLS-1$
-
-}
+ @Override
+ protected boolean isRootNodeVisible() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java
new file mode 100644
index 000000000..2d53be057
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSTreeViewerSorter.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.Viewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementComparator;
+import org.eclipse.tcf.te.ui.trees.TreeViewerSorterCaseInsensitive;
+
+/**
+ * File system tree control viewer sorter implementation.
+ */
+public class FSTreeViewerSorter extends TreeViewerSorterCaseInsensitive {
+ 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(e1, e2);
+ }
+ return super.compare(viewer, e1, e2);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java
new file mode 100644
index 000000000..04416adba
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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 java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+
+/**
+ * The base navigator content provider for File System and Process Monitor
+ */
+public abstract class NavigatorContentProvider extends TreeContentProvider implements ITreeViewerListener {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof AbstractTreeNode) {
+ AbstractTreeNode node = (AbstractTreeNode) element;
+ AbstractTreeNode parent = node.getParent();
+ if (parent != null) {
+ if (parent.isSystemRoot()) {
+ if (isRootNodeVisible()) return parent;
+ return null;
+ }
+ return parent;
+ }
+ if (isRootNodeVisible()) return node.peerNode;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
+ */
+ @Override
+ public void treeCollapsed(TreeExpansionEvent event) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
+ */
+ @Override
+ public void treeExpanded(TreeExpansionEvent event) {
+ Object object = event.getElement();
+ if(object instanceof AbstractTreeNode) {
+ AbstractTreeNode parent = (AbstractTreeNode) object;
+ if (parent.childrenQueried && !parent.childrenQueryRunning) {
+ parent.refreshChildren();
+ }
+ }
+ }
+
+ /*
+ * (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(Viewer viewer, Object oldInput, Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ this.viewer.addTreeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ this.viewer.removeTreeListener(this);
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ super.getChildren(parentElement);
+
+ if (parentElement instanceof IPeerNode) {
+ final IPeerNode peerNode = (IPeerNode)parentElement;
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerNode);
+ if (isRootNodeVisible()) {
+ AbstractTreeNode root = model.getRoot();
+ if(!root.childrenQueried && !root.childrenQueryRunning) {
+ root.queryChildren();
+ }
+ return new Object[] { root };
+ }
+ return getChildren(model.getRoot());
+ } else if (parentElement instanceof AbstractTreeNode) {
+ AbstractTreeNode node = (AbstractTreeNode)parentElement;
+ List<Object> current = new ArrayList<Object>(node.getChildren());
+ if (!node.childrenQueried) {
+ current.add(getPending(node));
+ if (!node.childrenQueryRunning) {
+ node.queryChildren();
+ }
+ }
+ return current.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 AbstractTreeNode) {
+ AbstractTreeNode node = (AbstractTreeNode)element;
+ if(node.isSystemRoot()) {
+ hasChildren = true;
+ }
+ else {
+ hasChildren = !node.childrenQueried || super.hasChildren(element);
+ }
+ }
+ else if (element instanceof IPeerNode) {
+ IPeerNode peerNode = (IPeerNode) element;
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerNode);
+ AbstractTreeNode 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java
new file mode 100644
index 000000000..3aa693cad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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 java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+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.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
+import org.eclipse.tcf.te.runtime.model.MessageModelNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.ui.trees.CommonViewerListener;
+import org.eclipse.tcf.te.ui.trees.Pending;
+
+/**
+ * The base tree content provider that defines several default methods.
+ */
+public abstract class TreeContentProvider implements ITreeContentProvider, PropertyChangeListener {
+
+ /**
+ * Static reference to the return value representing no elements.
+ */
+ protected final static Object[] NO_ELEMENTS = new Object[0];
+
+ // The listener to refresh the common viewer when properties change.
+ protected CommonViewerListener commonViewerListener;
+ // The viewer inputs that have been added a property change listener.
+ private Set<IPropertyChangeProvider> providers = Collections.synchronizedSet(new HashSet<IPropertyChangeProvider>());
+ // The viewer
+ protected TreeViewer viewer;
+ // The pending nodes and their direct parents.
+ private Map<Object, Pending> pendings;
+
+ // The target's peer model.
+ private IPeerNode peerNode;
+
+ /**
+ * Create a tree content provider.
+ */
+ public TreeContentProvider() {
+ pendings = new HashMap<Object, Pending>();
+ }
+
+ /**
+ * Get the pending node for the specified parent.
+ * If it exists, then return it. If not, create one
+ * and save it and return it.
+ */
+ protected Pending getPending(Object parent) {
+ Pending pending = pendings.get(parent);
+ if(pending == null && viewer != null) {
+ pending = new Pending(viewer);
+ pendings.put(parent, pending);
+ }
+ return pending;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ for(IPropertyChangeProvider provider : providers) {
+ provider.removePropertyChangeListener(commonViewerListener);
+ provider.removePropertyChangeListener(this);
+ }
+ commonViewerListener.cancel();
+ providers.clear();
+ pendings.clear();
+ }
+
+ /**
+ * Get the filtered children of the parent using the
+ * filters registered in the viewer.
+ *
+ * @param parent The parent element.
+ * @return The children after filtering.
+ */
+ private Object[] getFilteredChildren(Object parent) {
+ Object[] result = getChildren(parent);
+ if (viewer != null) {
+ ViewerFilter[] filters = viewer.getFilters();
+ if (filters != null) {
+ for (ViewerFilter filter : filters) {
+ Object[] filteredResult = filter.filter(viewer, parent, result);
+ result = filteredResult;
+ }
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Assert.isNotNull(parentElement);
+
+ if (parentElement instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) parentElement;
+ IPropertyChangeProvider provider = (IPropertyChangeProvider) adaptable.getAdapter(IPropertyChangeProvider.class);
+ if (provider != null) {
+ installPropertyChangeListener(provider);
+ }
+ }
+
+ return NO_ELEMENTS;
+ }
+
+ /*
+ * (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) {
+ Assert.isTrue(viewer instanceof TreeViewer);
+ this.viewer = (TreeViewer) viewer;
+ this.commonViewerListener = new CommonViewerListener(this.viewer, this);
+ peerNode = getPeerNode(newInput);
+ }
+
+ protected IPeerNode getPeerNode(Object input) {
+ IPeerNode peerNode = input instanceof IPeerNode ? (IPeerNode)input : null;
+ if (peerNode == null && input instanceof IAdaptable) {
+ peerNode = (IPeerNode)((IAdaptable)input).getAdapter(IPeerNode.class);
+ }
+ return peerNode;
+ }
+
+ /**
+ * Install a property change listener to the specified element.
+ *
+ * @param provider The element node.
+ */
+ private void installPropertyChangeListener(IPropertyChangeProvider provider) {
+ if (provider != null && !providers.contains(provider)) {
+ if (commonViewerListener != null) {
+ provider.addPropertyChangeListener(commonViewerListener);
+ }
+ provider.addPropertyChangeListener(this);
+ providers.add(provider);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ Object[] children = getFilteredChildren(element);
+ return children != null && children.length > 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (peerNode != null && peerNode.getConnectState() == IConnectable.STATE_CONNECTED) {
+ return getChildren(inputElement);
+ }
+
+ String message = null;
+ if (peerNode != null) {
+ if (peerNode.getConnectState() == IConnectable.STATE_CONNECTION_LOST ||
+ peerNode.getConnectState() == IConnectable.STATE_CONNECTION_RECOVERING) {
+ message = Messages.getStringDelegated(peerNode, "FileSystem_ContentProvider_connectionLost"); //$NON-NLS-1$
+ }
+ if (message == null) {
+ message = Messages.getStringDelegated(peerNode, "FileSystem_ContentProvider_notConnected"); //$NON-NLS-1$
+ }
+ }
+
+ return new Object[] { new MessageModelNode(message != null ? message : Messages.ContentProvider_notConnected, IStatus.INFO, false) };
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
new file mode 100644
index 000000000..4ce589429
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+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.ImageConsts;
+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.tcf.locator.interfaces.nodes.IPeerNode;
+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;
+ private final int mode;
+
+ public static final int MODE_ALL = 0;
+ public static final int MODE_ALL_WARNING_NOT_WRITABLE = 1;
+ public static final int MODE_ONLY_WRITABLE = 2;
+
+ /**
+ * Create an FSFolderSelectionDialog using the specified shell as the parent.
+ *
+ * @param parentShell The parent shell.
+ */
+ public FSFolderSelectionDialog(Shell parentShell) {
+ this(parentShell, MODE_ONLY_WRITABLE);
+ }
+
+ /**
+ * Create an FSFolderSelectionDialog using the specified shell as the parent.
+ *
+ * @param parentShell The parent shell.
+ * @param mode The mode of this dialog.
+ */
+ public FSFolderSelectionDialog(Shell parentShell, int mode) {
+ this(parentShell, new FSTreeElementLabelProvider(), new FSTreeContentProvider(), mode);
+ }
+
+ /**
+ * 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.
+ * @param mode The mode of this dialog.
+ */
+ private FSFolderSelectionDialog(Shell parentShell, ILabelProvider labelProvider, ITreeContentProvider contentProvider, int mode) {
+ super(parentShell, createDecoratingLabelProvider(labelProvider), contentProvider);
+ this.mode = mode;
+ setTitle(Messages.FSFolderSelectionDialog_MoveDialogTitle);
+ setMessage(Messages.FSFolderSelectionDialog_MoveDialogMessage);
+ this.setAllowMultiple(false);
+ this.setComparator(new FSTreeViewerSorter());
+ this.addFilter(new DirectoryFilter());
+ this.setStatusLineAboveButtons(true);
+ this.setValidator(new ISelectionStatusValidator() {
+ @Override
+ public IStatus validate(final 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;
+ if(node.isFile()) return false;
+ }
+ return true;
+ }
+ }
+
+ /*
+ * (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);
+ Assert.isNotNull(filterDescriptors);
+ 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;
+ }
+
+ @Override
+ public TreeViewer getTreeViewer() {
+ return super.getTreeViewer();
+ }
+
+ /**
+ * 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);
+
+ Button refreshAll = new Button(parent, SWT.PUSH);
+ refreshAll.setText(Messages.FSFolderSelectionDialog_RefreshAll_menu);
+ refreshAll.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshModel();
+ }
+ });
+
+ viewer.getTree().addKeyListener(new KeyAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.F5) {
+ refresh();
+ }
+ }
+ });
+ viewer.getTree().setLinesVisible(false);
+
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ IAction action = new Action(Messages.FSFolderSelectionDialog_Refresh_menu, UIPlugin.getImageDescriptor(ImageConsts.REFRESH_IMAGE)) {
+ @Override
+ public void run() {
+ refresh();
+ }
+ };
+ action.setAccelerator(SWT.F5);
+ manager.add(action);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+
+ return viewer;
+ }
+
+ public void refresh() {
+ ISelection sel = getTreeViewer().getSelection();
+ if (sel instanceof IStructuredSelection && !sel.isEmpty()) {
+ Iterator<Object> it = ((IStructuredSelection)sel).iterator();
+ while (it.hasNext()) {
+ Object node = it.next();
+ if (node instanceof FSTreeNode) {
+ refreshNode((FSTreeNode)node);
+ }
+ else {
+ refreshModel();
+ return;
+ }
+ }
+ }
+ else {
+ refreshModel();
+ }
+ }
+
+ protected void refreshNode(final FSTreeNode treeNode) {
+ if (!treeNode.childrenQueryRunning) {
+ treeNode.childrenQueried = false;
+ treeNode.clearChildren();
+ treeNode.refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ getTreeViewer().refresh(treeNode, true);
+ getTreeViewer().setSelection(getTreeViewer().getSelection());
+ }
+ });
+ }
+ });
+ }
+ }
+
+ protected void refreshModel() {
+ Object input = getTreeViewer().getInput();
+ if (input instanceof IPeerNode) {
+ refreshNode(ModelManager.getRuntimeModel((IPeerNode)input).getRoot());
+ }
+ }
+
+
+ private final static IStatus ok = new Status(IStatus.OK, UIPlugin.getUniqueIdentifier(), null);
+ private final static IStatus error = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), null);
+ private final static IStatus errorNotWritable = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), Messages.FSFolderSelectionDialog_notWritable_error);
+ private final static IStatus warningNotWritable = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(), Messages.FSFolderSelectionDialog_notWritable_warning);
+
+ /**
+ * 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) {
+ 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(mode != MODE_ALL && !target.isWritable()) {
+ if (target.attr == null) {
+ refreshNode(target);
+ }
+ return mode == MODE_ONLY_WRITABLE ? errorNotWritable : warningNotWritable;
+ }
+ return ok;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
new file mode 100644
index 000000000..5b2629c27
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
@@ -0,0 +1,263 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+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.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+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.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+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.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.ui.trees.FilterDescriptor;
+import org.eclipse.tcf.te.ui.trees.Pending;
+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 {
+ private String filterPath = null;
+ /* default */ TreeViewer viewer = null;
+
+ /**
+ * 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);
+ }
+ });
+ }
+
+ /**
+ * Sets the filter path.
+ *
+ * @param filterPath The filter path or <code>null</code>.
+ */
+ public void setFilterPath(String filterPath) {
+ this.filterPath = filterPath;
+ }
+
+ /*
+ * (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);
+ Assert.isNotNull(filterDescriptors);
+ for (FilterDescriptor descriptor : filterDescriptors) {
+ if (descriptor.isEnabled()) {
+ addFilter(descriptor.getFilter());
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#create()
+ */
+ @Override
+ public void create() {
+ super.create();
+
+ if (filterPath != null && !"".equals(filterPath.trim())) { //$NON-NLS-1$
+ IPath path = new Path(filterPath);
+ if (viewer.getInput() instanceof IPeerNode) {
+ Object element = null;
+ IRuntimeModel model = ModelManager.getRuntimeModel((IPeerNode)viewer.getInput());
+ if (model != null) {
+ FSTreeNode root = model.getRoot();
+ ITreeContentProvider contentProvider = (ITreeContentProvider)viewer.getContentProvider();
+ Object[] elements = contentProvider.getElements(root);
+ String segment = path.getDevice() != null ? path.getDevice() : path.segmentCount() > 0 ? path.segment(0) : null;
+ if (segment != null) {
+ for (Object elem : elements) {
+ if (!(elem instanceof FSTreeNode)) break;
+ FSTreeNode child = (FSTreeNode)elem;
+ String name = child.name;
+ if (name.endsWith("\\") || name.endsWith("/")) name = name.substring(0, name.length() - 1); //$NON-NLS-1$ //$NON-NLS-2$
+ boolean matches = child.isWindowsNode() ? name.equalsIgnoreCase(segment) : name.equals(segment);
+ if (matches) {
+ if (path.segmentCount() > (path.getDevice() != null ? 0 : 1)) {
+ // Have to drill down a bit further
+ element = findRecursive(child, path, path.getDevice() != null ? 0 : 1);
+ if (element != null) break;
+ } else {
+ element = child;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (element != null) {
+ final ISelection selection = new StructuredSelection(element);
+ final AtomicInteger counter = new AtomicInteger();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ viewer.setSelection(selection, true);
+ if (!selection.equals(viewer.getSelection())) {
+ if (counter.incrementAndGet() <= 10) {
+ viewer.getControl().getDisplay().asyncExec(this);
+ }
+ }
+ }
+ };
+
+ viewer.getControl().getDisplay().asyncExec(runnable);
+ }
+ }
+ }
+ }
+
+ /**
+ * Finds the given path within the file system hierarchy.
+ *
+ * @param parent The parent file system node. Must not be <code>null</code>.
+ * @param path The path. Must not be <code>null</code>.
+ * @param index The segment index.
+ *
+ * @return The matching file system node or <code>null</code>.
+ */
+ private FSTreeNode findRecursive(FSTreeNode parent, IPath path, int index) {
+ Assert.isNotNull(parent);
+ Assert.isNotNull(path);
+
+ FSTreeNode node = null;
+
+ ITreeContentProvider contentProvider = (ITreeContentProvider)viewer.getContentProvider();
+ Object[] elements = contentProvider.getElements(parent);
+ while (elements.length == 1 && elements[0] instanceof Pending) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {}
+ elements = contentProvider.getElements(parent);
+ }
+
+ String segment = path.segment(index);
+
+ for (Object element : elements) {
+ if (!(element instanceof FSTreeNode)) break;
+ FSTreeNode child = (FSTreeNode)element;
+ String name = child.name;
+ if (name.endsWith("\\") || name.endsWith("/")) name = name.substring(0, name.length() - 1); //$NON-NLS-1$ //$NON-NLS-2$
+ boolean matches = child.isWindowsNode() ? name.equalsIgnoreCase(segment) : name.equals(segment);
+ if (matches) {
+ if (path.segmentCount() > index + 1) {
+ // Have to drill down a bit further
+ node = findRecursive(child, path, index + 1);
+ if (node != null) break;
+ } else {
+ node = child;
+ break;
+ }
+ }
+ }
+
+ return node;
+ }
+
+ /**
+ * 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) {
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java
new file mode 100644
index 000000000..232cc9c4b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/TimeTriggeredProgressMonitorDialog.java
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java
new file mode 100644
index 000000000..fcd306e6c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/HiddenFilesViewerFilter.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java
new file mode 100644
index 000000000..fe805de7e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/filters/SystemFilesViewerFilter.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java
index 650f83065..ed8151006 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/help/IContextHelpIds.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/help/IContextHelpIds.java
@@ -1,34 +1,33 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011, 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.ui.terminals.help;
-
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
+package org.eclipse.tcf.te.tcf.filesystem.ui.help;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
/**
- * UI Context help id definitions.
+ * Plugin context help id definitions.
*/
public interface IContextHelpIds {
/**
- * UI plug-in common context help id prefix.
+ * Target Explorer file system UI plug-in common context help id prefix.
*/
public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
/**
- * Launch terminal settings dialog.
+ * Target Explorer details editor page: File system explorer
*/
- public final static String LAUNCH_TERMINAL_SETTINGS_DIALOG = PREFIX + "LaunchTerminalSettingsDialog"; //$NON-NLS-1$
+ public final static String FS_EXPLORER_EDITOR_PAGE = PREFIX + "FSExplorerEditorPage"; //$NON-NLS-1$
/**
- * Terminal control encoding selection dialog.
+ * The wizard for creating a new file.
*/
- public final static String ENCODING_SELECTION_DIALOG = PREFIX + "EncodingSelectionDialog"; //$NON-NLS-1$
+ public final static String FS_NEW_FILE_WIZARD_PAGE = PREFIX + "FSNewFilePage"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java
new file mode 100644
index 000000000..6fd6d9542
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFSConstants.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFileSystemUIDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFileSystemUIDelegate.java
new file mode 100644
index 000000000..8676bfe7a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/IFileSystemUIDelegate.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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;
+
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.ui.interfaces.ISearchable;
+
+
+/**
+ * Filesystem UI delegate.
+ */
+public interface IFileSystemUIDelegate {
+
+ /**
+ * Returns the message for the given key.
+ *
+ * @param key The message key. Must not be <code>null</code>.
+ * @return The message or <code>null</code>.
+ */
+ public String getMessage(String key);
+
+ /**
+ * Returns the process monitor table column text for the given column
+ * based on the given original text.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param columnId The column id. Must not be <code>null</code>.
+ * @param text The original text to show in the column fetched from the label provider, or <code>null</code>.
+ *
+ * @return The new text to show in the column or <code>null</code>.
+ */
+ public String getText(Object context, String columnId, String text);
+
+ /**
+ * Returns if or if not the given column is active for the given context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param columnId The column id. Must not be <code>null</code>.
+ *
+ * @return <code>True</code> if the column is active for the given context, <code>false</code> otherwise.
+ */
+ public boolean isColumnActive(Object context, String columnId);
+
+ /**
+ * Returns if or if not the given filter is active for the given context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param filterId The filter id. Must not be <code>null</code>.
+ *
+ * @return <code>True</code> if the filter is active for the given context, <code>false</code> otherwise.
+ */
+ public boolean isFilterActive(Object context, String filterId);
+
+ /**
+ * Returns the list of searchables to use to find processes in the
+ * process monitor.
+ *
+ * @param node The peer model node context. Must not be <code>null</code>.
+ * @return The list of searchables to use or <code>null</code>.
+ */
+ public ISearchable[] getSearchables(IPeerNode node);
+
+ /**
+ * Returns the number of levels to auto expand.
+ * If the method returns <code>0</code>, no auto expansion will happen
+ *
+ * @return The number of levels to auto expand or <code>0</code>.
+ */
+ public int getAutoExpandLevel();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java
new file mode 100644
index 000000000..7bcc6d246
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/interfaces/preferences/IPreferenceKeys.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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 static final String PREF_FEATURE_ENABLE_EDITOR_CONTENT_CONTRIBUTION = PREFIX + "feature.editor.content.enable"; //$NON-NLS-1$
+ // The default value for editor content contribution
+ public static final boolean DEFAULT_FEATURE_ENABLE_EDITOR_CONTENT_CONTRIBUTION = true;
+ // 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;
+ // The preference key to access the option that if expanded nodes should be persisted
+ public static final String PREF_EXPANDED_PERSISTED = "PrefExpandedPersisted"; //$NON-NLS-1$
+ // The default value of the option that if expanded nodes should be persisted
+ public static final boolean DEFAULT_EXPANDED_PERSISTED = false;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
new file mode 100644
index 000000000..e46b3eaec
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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 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$
+
+ public static final String REFRESH_IMAGE = "RefreshImage"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
new file mode 100644
index 000000000..6f2cf59af
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.viewers.ILabelProvider;
+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.columns.FSTreeElementLabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.search.FSTreeNodeSearchable;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
+import org.eclipse.tcf.te.ui.interfaces.ISearchable;
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * The adapter factory of <code>FSTreeNode</code> over <code>IActionFilter</code>
+ */
+public class FSTreeNodeAdapterFactory implements IAdapterFactory {
+ private static ILabelProvider nodeLabelProvider = new FSTreeElementLabelProvider();
+ // The fFilters map caching fFilters for FS nodes.
+ private Map<FSTreeNode, NodeStateFilter> filters;
+
+ public static class FSTreeNodePeerNodeProvider extends PlatformObject implements IPeerNodeProvider {
+ private final FSTreeNode node;
+
+ /**
+ * Constructor
+ */
+ public FSTreeNodePeerNodeProvider(FSTreeNode node) {
+ Assert.isNotNull(node);
+ this.node = node;
+ }
+
+ /**
+ * Returns the associated file system tree node.
+ *
+ * @return The associated file system tree node.
+ */
+ public final FSTreeNode getFSTreeNode() {
+ return node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider#getPeerModel()
+ */
+ @Override
+ public final IPeerNode getPeerNode() {
+ return node.peerNode;
+ }
+ }
+
+ /**
+ * 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) {
+ FSTreeNode node = (FSTreeNode) adaptableObject;
+ if (adapterType == IActionFilter.class) {
+ 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 == IPersistableElement.class && UIPlugin.isExpandedPersisted()) {
+ return new PersistableNode(node);
+ }
+ else if (adapterType == ILazyLoader.class) {
+ return new FSTreeNodeLoader(node);
+ }
+ else if (adapterType == IPeerNodeProvider.class) {
+ return new FSTreeNodePeerNodeProvider(node);
+ }
+ else if (adapterType == IPeerNode.class) {
+ return new FSTreeNodePeerNodeProvider(node).getPeerNode();
+ }
+ else if (adapterType == ISearchable.class) {
+ return new FSTreeNodeSearchable(node);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { IActionFilter.class, ILabelProvider.class, IPersistableElement.class, ILazyLoader.class, ISearchable.class, IPeerNodeProvider.class };
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java
new file mode 100644
index 000000000..3b3a67e01
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 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.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+
+/**
+ * The element factory for FSTreeNode used to restore FSTreeNodes persisted
+ * for expanded states.
+ */
+public class FSTreeNodeFactory implements IElementFactory {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public IAdaptable createElement(IMemento memento) {
+ String peerId = memento.getString("peerId"); //$NON-NLS-1$
+ IPeerNode peerNode = ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId);
+ if(peerNode != null) {
+ String path = memento.getString("path"); //$NON-NLS-1$
+ if(path == null) {
+ return org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager.getRuntimeModel(peerNode).getRoot();
+ }
+ OpParsePath op = new OpParsePath(peerNode, path);
+ IOpExecutor executor = new NullOpExecutor();
+ IStatus status = executor.execute(op);
+ if(status.isOK()) {
+ return op.getResult();
+ }
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeLoader.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeLoader.java
new file mode 100644
index 000000000..e04fc7740
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeLoader.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefreshRoots;
+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.ui.interfaces.ILazyLoader;
+
+/**
+ * The implementation of ILazyLoader for FSTreeNode check its data availability
+ * and load its children if not ready.
+ */
+public class FSTreeNodeLoader implements ILazyLoader {
+ // The node to be checked.
+ private FSTreeNode node;
+ /**
+ * Constructor
+ *
+ * @param node The file/folder node.
+ */
+ public FSTreeNodeLoader(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#isDataLoaded()
+ */
+ @Override
+ public boolean isDataLoaded() {
+ return node.isFile() || (node.isSystemRoot() || node.isDirectory()) && node.childrenQueried;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#loadData(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void loadData(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ if(node.isFile()) return;
+ if (node.isSystemRoot()) {
+ new NullOpExecutor().execute(new OpRefreshRoots(node));
+ }
+ else {
+ new Operation().getChildren(node);
+ }
+ }
+ catch (TCFException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#isLeaf()
+ */
+ @Override
+ public boolean isLeaf() {
+ return node.isFile();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
new file mode 100644
index 000000000..1ca440246
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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 org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpClipboard;
+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 = node.getCacheState();
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerNodeViewerInput.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerNodeViewerInput.java
new file mode 100644
index 000000000..bdb3580c1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PeerNodeViewerInput.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.IPeerNode;
+
+/**
+ * The viewer input of an IPeerNode instance.
+ */
+public class PeerNodeViewerInput extends PropertyChangeProvider implements IViewerInput {
+ // The peer model.
+ private IPeerNode peerNode;
+
+ /**
+ * Create an instance with a peer model.
+ *
+ * @param peerNode The peer model.
+ */
+ public PeerNodeViewerInput(IPeerNode peerNode) {
+ this.peerNode = peerNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.IViewerInput#getInputId()
+ */
+ @Override
+ public String getInputId() {
+ return peerNode.getPeerId();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PersistableNode.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PersistableNode.java
new file mode 100644
index 000000000..8cc6698d4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/PersistableNode.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * The adapter class of FSTreeNode for IPersistableElement, used to
+ * persist an FSTreeNode.
+ */
+public class PersistableNode implements IPersistableElement {
+ // The node to be persisted.
+ private FSTreeNode node;
+ /**
+ * Create an instance.
+ *
+ * @param node The node to be persisted.
+ */
+ public PersistableNode(FSTreeNode node) {
+ this.node = node;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento memento) {
+ memento.putString("peerId", node.peerNode.getPeerId()); //$NON-NLS-1$
+ String path = null;
+ if (!node.isSystemRoot()) path = node.getLocation();
+ if (path != null) memento.putString("path", path); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IPersistableElement#getFactoryId()
+ */
+ @Override
+ public String getFactoryId() {
+ return "org.eclipse.tcf.te.tcf.filesystem.ui.nodeFactory"; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java
new file mode 100644
index 000000000..5107a78d1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/ViewerInputAdapterFactory.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.IPropertyChangeProvider;
+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.IPeerNode;
+
+/**
+ * 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 IPeerNode) {
+ if (IViewerInput.class.equals(adapterType)
+ || IPropertyChangeProvider.class.equals(adapterType)) {
+ IPeerNode peerNode = (IPeerNode) adaptableObject;
+ return getViewerInput(peerNode);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get a viewer input from the specified peer model.
+ *
+ * @param peerNode The peer model to get the viewer input from.
+ * @return The peer model's viewer input.
+ */
+ PeerNodeViewerInput getViewerInput(final IPeerNode peerNode) {
+ if (peerNode != null) {
+ if (Protocol.isDispatchThread()) {
+ PeerNodeViewerInput model = (PeerNodeViewerInput) peerNode.getProperty(VIEWER_INPUT_KEY);
+ if (model == null) {
+ model = new PeerNodeViewerInput(peerNode);
+ peerNode.setProperty(VIEWER_INPUT_KEY, model);
+ }
+ return model;
+ }
+ final AtomicReference<PeerNodeViewerInput> reference = new AtomicReference<PeerNodeViewerInput>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ reference.set(getViewerInput(peerNode));
+ }
+ });
+ return reference.get();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { IViewerInput.class, IPropertyChangeProvider.class };
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java
new file mode 100644
index 000000000..74ec4d7d8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveAllListener.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.NullProgressMonitor;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
+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.UiExecutor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IURIEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+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();
+ executor.execute(new OpUpload(nodes));
+ }
+ else {
+ SafeRunner.run(new SafeRunnable(){
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ for (FSTreeNode dirtyNode : fDirtyNodes) {
+ dirtyNode.refresh();
+ }
+ }});
+ }
+ }
+ }
+
+ /* (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();
+ // In Eclipse 4.x, the HandlerUtil.getActiveWorkbenchWindow(event) may return null
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window == null) window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ IEditorPart[] editors = page.getDirtyEditors();
+ for (IEditorPart editor : editors) {
+ IEditorInput input = editor.getEditorInput();
+ FSTreeNode node = null;
+ 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.
+ OpParsePath parser = new OpParsePath(localFile.getCanonicalPath());
+ new NullOpExecutor().execute(parser);
+ node = parser.getResult();
+ if (node != null) {
+ // If it is a modified node, add it to the dirty node list.
+ fDirtyNodes.add(node);
+ }
+ }
+ }catch(Exception 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java
new file mode 100644
index 000000000..670beb8fb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/autosave/SaveListener.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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:
+ * 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.NullProgressMonitor;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
+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.UiExecutor;
+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();
+ executor.execute(new OpUpload(dirtyNode));
+ }
+ else {
+ SafeRunner.run(new SafeRunnable(){
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ if (dirtyNode != null) dirtyNode.refresh();
+ }
+ });
+ }
+ }
+ }
+
+ /* (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) {
+ OpParsePath parser = new OpParsePath(localFile.getCanonicalPath());
+ new NullOpExecutor().execute(parser);
+ dirtyNode = parser.getResult();
+ }
+ }catch(Exception 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java
new file mode 100644
index 000000000..0f2cac475
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellListener.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java
new file mode 100644
index 000000000..b1da8c4ad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellModifier.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+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;
+
+/**
+ * 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(new RenameCallback());
+ executor.execute(new OpRename(node, newName));
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java
new file mode 100644
index 000000000..85b3de181
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSCellValidator.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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 (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.getParent().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;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java
new file mode 100644
index 000000000..59788be3f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/celleditor/FSViewerCellEditorFactory.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java
new file mode 100644
index 000000000..29374e19c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java
new file mode 100644
index 000000000..ab84b5d73
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/AccessTimeLabelProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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;
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/CacheFileImageUpdater.java
new file mode 100644
index 000000000..24f70fb77
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.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.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.getCacheFile(node);
+ File parentDir = cacheFile.getParentFile();
+ if (!parentDir.exists() && !parentDir.mkdirs()) {
+ parentDir = CacheManager.getCacheRoot();
+ }
+ return new File(parentDir, node.name + ".png"); //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java
new file mode 100644
index 000000000..2f3b78a81
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/DefaultImageProvider.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 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 simulator.
+ */
+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.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 simulator.
+ */
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java
new file mode 100644
index 000000000..5ad79dca1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementComparator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java
new file mode 100644
index 000000000..3ae7d9ae4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeElementLabelProvider.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.utils.Host;
+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.trees.PendingAwareLabelProvider;
+
+/**
+ * The label provider for the tree column "name".
+ */
+public class FSTreeElementLabelProvider extends PendingAwareLabelProvider {
+ // 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;
+ }
+ else if (element instanceof IModelNode) {
+ return ((IModelNode)element).getName();
+ }
+
+ 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);
+ }
+ else if (element instanceof IModelNode) {
+ return UIPlugin.getImage(((IModelNode)element).getImageId());
+ }
+
+ return super.getImage(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java
new file mode 100644
index 000000000..4aaad28d0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FSTreeNodeComparator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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<Object>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public final int compare(Object o1, Object o2) {
+ if (!(o1 instanceof FSTreeNode) || !(o2 instanceof FSTreeNode)) return 0;
+
+ FSTreeNode node1 = (FSTreeNode)o1;
+ FSTreeNode node2 = (FSTreeNode)o2;
+
+ // 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileExtBasedImageUpdater.java
new file mode 100644
index 000000000..90ca5dbe7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java
new file mode 100644
index 000000000..8b53a6bed
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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 "simulator".
+ */
+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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java
new file mode 100644
index 000000000..d97fa3d31
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/FileTypeLabelProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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 "simulator".
+ */
+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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageProvider.java
new file mode 100644
index 000000000..9ec98b0c8
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ImageUpdateAdapter.java
new file mode 100644
index 000000000..1457868ad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java
new file mode 100644
index 000000000..5f5e04860
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/LabelProviderUpdateDaemon.java
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ * 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.net.URL;
+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.IPropertyChangeProvider;
+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.ImageConsts;
+
+/**
+ * The background daemon that updates the images of the file system using
+ * images retrieved by FileSystemView from Swing.
+ */
+public class LabelProviderUpdateDaemon extends Thread {
+ private static String[][] os_drives = {
+ {"windows xp", "xp_rootdrive.png"}, //$NON-NLS-1$ //$NON-NLS-2$
+ {"windows 7", "win7_rootdrive.png"}, //$NON-NLS-1$//$NON-NLS-2$
+ {"windows 8", "win8_rootdrive.png"} //$NON-NLS-1$//$NON-NLS-2$
+ };
+ private static String root_drive = createRootImage(getOSEntry());
+
+ private static int getOSEntry() {
+ String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
+ for(int i = 0; i < os_drives.length;i++) {
+ if(os_drives[i][0].equals(osName)) return i;
+ }
+ return 0;
+ }
+
+ private static String createRootImage(int i) {
+ UIPlugin plugin = UIPlugin.getDefault();
+ URL url = plugin.getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + os_drives[i][1]);
+ plugin.getImageRegistry().put(os_drives[i][0], ImageDescriptor.createFromURL(url));
+ return os_drives[i][0];
+ }
+
+ // 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.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() {
+ return UIPlugin.getImage(root_drive);
+ }
+
+ /**
+ * 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.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) {
+ IPropertyChangeProvider viewerInput = (IPropertyChangeProvider) node.peerNode.getAdapter(IPropertyChangeProvider.class);
+ viewerInput.firePropertyChange(new PropertyChangeEvent(node, key, oldImg, newImg));
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java
new file mode 100644
index 000000000..6aad6951c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java
new file mode 100644
index 000000000..0cedfb5b9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/ModificationTimeLabelProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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;
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java
new file mode 100644
index 000000000..af9b227e6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeComparator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java
new file mode 100644
index 000000000..489ce7940
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/SizeLabelProvider.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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;
+ // 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/columns/WindowsImageProvider.java
new file mode 100644
index 000000000..de0529528
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.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 node.isWindowsNode() ? updateDaemon.getDiskImage() : super.getImage(node);
+ }
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java
new file mode 100644
index 000000000..ae087ace0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/EditableSharedDocumentAdapter.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2014 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 action of the typed element
+ * and supports call backs to the element when the adapter action 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 action 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java
new file mode 100644
index 000000000..db636b588
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalFileSaveable.java
@@ -0,0 +1,481 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
+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.UiExecutor;
+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();
+ executor.execute(new OpUpload(node));
+ }
+ }
+
+ /**
+ * 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 action.
+ *
+ * @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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java
new file mode 100644
index 000000000..825a66743
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/LocalTypedElement.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.osgi.util.NLS;
+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.getCachePath(node);
+ File cacheFile = cachePath.toFile();
+ return new BufferedInputStream(new FileInputStream(cacheFile));
+ } catch (FileNotFoundException e) {
+ IStatus error = new Status(IStatus.ERROR,
+ UIPlugin.getUniqueIdentifier(), e.getMessage(), 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 action.
+ *
+ * @param dirty
+ * The dirty action.
+ */
+ 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.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.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.getCacheFile(node);
+ monitor.beginTask(NLS.bind(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.getMessage(), 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java
new file mode 100644
index 000000000..65f8c5846
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeEditorInput.java
@@ -0,0 +1,419 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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 simulator
+ * <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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java
new file mode 100644
index 000000000..912b777ee
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeInput.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java
new file mode 100644
index 000000000..37e96269d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/MergeTypedElement.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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);
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java
new file mode 100644
index 000000000..b7e82c474
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/compare/RemoteTypedElement.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.getMessage(), 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.
+ * InterruptedException
+ * throws when the loading process is canceled.
+ */
+ public void cacheContents(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(NLS.bind(Messages.RemoteTypedElement_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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java
new file mode 100644
index 000000000..8247ef500
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomDecorator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java
new file mode 100644
index 000000000..1200daf7b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/decorators/PhantomImageDescriptor.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
new file mode 100644
index 000000000..2a3d832de
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
@@ -0,0 +1,409 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.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.DragSourceEvent;
+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.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+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.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+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.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(callback);
+ }
+ }
+ else if ((operations & DND.DROP_COPY) != 0) {
+ ICallback callback = getCopyCallback(viewer, files, target);
+ executor = new UiExecutor(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) {
+ if (status.isOK()) {
+ IOpExecutor executor = new JobExecutor(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) {
+ if (status.isOK()) {
+ boolean successful = true;
+ for (String path : files) {
+ File file = new File(path);
+ successful &= file.delete();
+ }
+ if (successful) {
+ IRuntimeModel model = ModelManager.getRuntimeModel(target.peerNode);
+ IOpExecutor executor = new JobExecutor(getSelectionCallback(viewer, files, target));
+ executor.execute(new OpRefresh(model.getRoot()));
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * 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) {
+ if(status.isOK()) {
+ List<FSTreeNode> nodes = new ArrayList<FSTreeNode>();
+ List<FSTreeNode> children = target.getChildren();
+ 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;
+ }
+ }
+ }
+ if (viewer != null) {
+ updateViewer(viewer, target, nodes);
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * Update the tree viewer after DnD and select the nodes that being dropped.
+ *
+ * @param viewer The tree viewer in which the DnD takes place.
+ * @param target The target node that the drop operation happens.
+ * @param nodes The nodes that are being dropped.
+ */
+ protected void updateViewer(final TreeViewer viewer, final FSTreeNode target, final List<FSTreeNode> nodes) {
+ if (Display.getCurrent() != null) {
+ viewer.refresh(target);
+ IStructuredSelection selection = new StructuredSelection(nodes.toArray());
+ viewer.setSelection(selection, true);
+ }
+ else {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
+ @Override
+ public void run() {
+ updateViewer(viewer, target, nodes);
+ }});
+ }
+ }
+
+ /**
+ * 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();
+ IOpExecutor executor = null;
+ IOperation operation = null;
+ if ((operations & DND.DROP_MOVE) != 0) {
+ operation = new OpMove(nodes, target, new MoveCopyCallback());
+ executor = new UiExecutor(new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ UIPlugin.getClipboard().clear();
+ }
+ });
+ }
+ 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();
+ }
+ if (operation != null && 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.getParent();
+ }
+ else if (hovered.isDirectory()) {
+ for (FSTreeNode node : nodes) {
+ if (node == hovered) {
+ return hovered.getParent();
+ }
+ }
+ }
+ 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 simulator.
+ * @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.getParent();
+ }
+ 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 simulator.
+ * @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.getParent();
+ 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];
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ public boolean setDragData(DragSourceEvent anEvent) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(anEvent.dataType)) {
+ anEvent.data = LocalSelectionTransfer.getTransfer().getSelection();
+ return true;
+ }
+ else if (FileTransfer.getInstance().isSupportedType(anEvent.dataType)) {
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ List<FSTreeNode> nodes = selection.toList();
+ List<String> paths = new ArrayList<String>();
+ for(FSTreeNode node : nodes) {
+ File file = CacheManager.getCacheFile(node);
+ if(file.exists()) {
+ paths.add(file.getAbsolutePath());
+ }
+ }
+ if (!paths.isEmpty()) anEvent.data = paths.toArray(new String[paths.size()]);
+ return !paths.isEmpty();
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java
new file mode 100644
index 000000000..aaffe7f23
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.dnd;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+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[] {FileTransfer.getInstance()};
+ }
+
+ /*
+ * (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 dnd.setDragData(anEvent);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java
new file mode 100644
index 000000000..e3854474b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragSourceListener.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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) {
+ event.doit = dnd.setDragData(event);
+ }
+
+ /*
+ * (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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java
new file mode 100644
index 000000000..d3ab481cb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropAdapterAssistant.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java
new file mode 100644
index 000000000..be8185fd0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDropTargetListener.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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) {
+ if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ // Force the operation of file transfer from external application to DROP_COPY
+ event.detail = DND.DROP_COPY;
+ }
+ super.dragEnter(event);
+ }
+
+ /*
+ * (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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java
new file mode 100644
index 000000000..924ba72f0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CommitHandler.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+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();
+ executor.execute(new OpUpload(node));
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java
new file mode 100644
index 000000000..663cf903d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CopyFilesHandler.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java
new file mode 100644
index 000000000..cbca9c47e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/CutFilesHandler.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DeleteHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DeleteHandler.java
new file mode 100644
index 000000000..2cf79b44c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DeleteHandler.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * 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 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.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+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.tcf.filesystem.core.interfaces.IConfirmCallback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+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.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Delete handler implementation.
+ */
+public class DeleteHandler extends AbstractHandler {
+ // The confirmation call for read only files.
+ private IConfirmCallback readonlyCallback = new ReadOnlyConfirmCallback();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ List<FSTreeNode> nodes = ((IStructuredSelection)selection).toList();
+ if(confirmDeletion(nodes)) {
+ IOpExecutor executor = new UiExecutor();
+ executor.execute(new OpDelete(nodes, readonlyCallback));
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Confirm the deletion of the specified nodes.
+ *
+ * @param nodes The nodes to be deleted.
+ * @return true if the user agrees to delete.
+ */
+ private boolean confirmDeletion(List<FSTreeNode> nodes) {
+ 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 true;
+ }
+ return false;
+ }
+
+ /**
+ * The callback implementation for the user to confirm the deletion of
+ * a read-only file/folder.
+ */
+ 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];
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java
new file mode 100644
index 000000000..47287db7e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MergeHandler.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java
new file mode 100644
index 000000000..004628fbb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * The confirmation callback implementation for operation "Move" and "Copy".
+ */
+public class MoveCopyCallback 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.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 = 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java
new file mode 100644
index 000000000..d62a1d6b1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveFilesHandler.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+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.dialogs.FSFolderSelectionDialog;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+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();
+ IPeerNode 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();
+ executor.execute(new OpMove(nodes, dest, new MoveCopyCallback()));
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/tracing/ITraceIds.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java
index 1ed32c06c..5a02014a1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/tracing/ITraceIds.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFileHandler.java
@@ -7,20 +7,22 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.interfaces.tracing;
+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;
/**
- * Core plug-in trace slot identifiers.
+ * The handler to create a new file node in the file system of Target Explorer.
*/
-public interface ITraceIds {
-
- /**
- * If activated, tracing information about the terminals output stream monitor is printed out.
- */
- public static final String TRACE_OUTPUT_STREAM_MONITOR = "trace/outputStreamMonitor"; //$NON-NLS-1$
+public class NewFileHandler extends NewNodeHandler {
- /**
- * If activated, tracing information about the launch terminal command handler is printed out.
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.handlers.NewNodeHandler#createWizard()
*/
- public static final String TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER = "trace/launchTerminalCommandHandler"; //$NON-NLS-1$
+ @Override
+ protected IWorkbenchWizard createWizard() {
+ return new NewFileWizard();
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java
new file mode 100644
index 000000000..d8302f5f9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewFolderHandler.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java
new file mode 100644
index 000000000..332f6dbbf
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/NewNodeHandler.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.PlatformUI;
+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 {
+ // In Eclipse 4.x, the HandlerUtil.getActiveWorkbenchWindow(event) may return null
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window == null) window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWizard wizard;
+ wizard = createWizard();
+ ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
+ if (selection instanceof IStructuredSelection) {
+ wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) selection);
+ }
+ else {
+ wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
+ }
+ Shell parent = window != null ? window.getShell() : null;
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java
new file mode 100644
index 000000000..cb046f899
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenFileHandler.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.runtime.callback.Callback;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+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.CacheState;
+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.UiExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.swt.DisplayUtil;
+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();
+ final IWorkbenchPage page = HandlerUtil.getActiveSite(event).getPage();
+ if (ContentTypeHelper.isBinaryFile(node)) {
+ // If the file is a binary file.
+ Shell parent = HandlerUtil.getActiveShell(event);
+ MessageDialog.openWarning(parent, Messages.OpenFileHandler_Warning,
+ Messages.OpenFileHandler_OpeningBinaryNotSupported);
+ } else {
+ if (UIPlugin.isAutoSaving()) {
+ // Refresh the node to determine the cache state correctly
+ node.refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ File file = CacheManager.getCacheFile(node);
+ if (node.getCacheState() == CacheState.outdated) {
+ file.delete();
+ }
+
+ DisplayUtil.safeAsyncExec(new Runnable() {
+ @Override
+ public void run() {
+ // Open the file node.
+ openFile(node, page);
+ }
+ });
+ }
+ });
+ } 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.
+ */
+ /* default */ void openFile(FSTreeNode node, IWorkbenchPage page) {
+ File file = CacheManager.getCacheFile(node);
+ if (!file.exists()) {
+ // If the file node's local cache does not exist yet, download it.
+ IOpExecutor executor = new UiExecutor();
+ 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java
new file mode 100644
index 000000000..aea1a5b3c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithContribution.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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:
+ * 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java
new file mode 100644
index 000000000..14c6679e1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/OpenWithMenu.java
@@ -0,0 +1,419 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.IOpExecutor;
+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.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-simulator
+ // editor bindings?
+ }
+ else {
+ imageDesc = editorDesc.getImageDescriptor();
+ }
+ if (imageDesc == null) {
+ if (editorDesc != null && 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.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.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.getCacheFile(node);
+ if (!file.exists()) {
+ // If the file node's local cache does not exist yet, download it.
+ IOpExecutor executor = new UiExecutor();
+ 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java
new file mode 100644
index 000000000..b7f62ac59
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/PasteFilesHandler.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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 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.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+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.UiExecutor;
+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();
+ if (!cb.isEmpty()) {
+ // Get the files/folders from the clip board.
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
+ List<FSTreeNode> nodes = cb.getFiles();
+ IOpExecutor executor = null;
+ IOperation operation = null;
+ if (cb.isCutOp()) {
+ FSTreeNode dest = (FSTreeNode) selection.getFirstElement();
+ operation = new OpMove(nodes, dest, new MoveCopyCallback());
+ executor = new UiExecutor(new Callback(){
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ UIPlugin.getClipboard().clear();
+ }
+ });
+ }
+ 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();
+ }
+ if (executor != null && operation != null) {
+ executor.execute(operation);
+ }
+ }
+ else {
+ 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);
+ }
+ }
+ 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.getParent();
+ }
+ else if (hovered.isDirectory()) {
+ for (FSTreeNode node : nodes) {
+ if (node == hovered) {
+ return hovered.getParent();
+ }
+ }
+ }
+ return hovered;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshHandler.java
new file mode 100644
index 000000000..1bedafff1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshHandler.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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 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.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Refresh handler implementation.
+ */
+public class RefreshHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ List<FSTreeNode> nodes = ((IStructuredSelection) selection).toList();
+ IOpExecutor executor = new JobExecutor();
+ executor.execute(new OpRefresh(nodes));
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
new file mode 100644
index 000000000..5cd226d37
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+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);
+ IPeerNode peer = (IPeerNode) editorInput.getAdapter(IPeerNode.class);
+ if (peer != null) {
+ FSTreeNode root = ModelManager.getRuntimeModel(peer).getRoot();
+ if (root != null) {
+ IOpExecutor executor = new JobExecutor();
+ executor.execute(new OpRefresh(root));
+ }
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.java
new file mode 100644
index 000000000..274442df0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameCallback.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.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;
+/**
+ * The callback implementation for Renaming.
+ */
+public class RenameCallback extends Callback implements Runnable {
+ // The message to be displayed.
+ private String message;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.callback.Callback#internalDone(java.lang.Object, org.eclipse.core.runtime.IStatus)
+ */
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (!status.isOK()) {
+ message = status.getMessage();
+ PlatformUI.getWorkbench().getDisplay().asyncExec(this);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ @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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java
new file mode 100644
index 000000000..69b7c52e5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RenameFilesHandler.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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 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.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+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.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(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, null, 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.getParent().getChildren();
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java
new file mode 100644
index 000000000..0fc8b1b0d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/UpdateHandler.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.IOpExecutor;
+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.UiExecutor;
+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();
+ executor.execute(new OpCacheUpdate(node));
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java
new file mode 100644
index 000000000..3b04debe1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/FsClipboard.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java
new file mode 100644
index 000000000..e93449524
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.core.internal.exceptions.TCFException;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
+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;
+
+ /**
+ * Create a UI executor with no callback.
+ */
+ public UiExecutor() {
+ this(null);
+ }
+
+ /**
+ * Create a UI executor with a callback that will be
+ * invoked after execution.
+ *
+ * @param callback The callback to be invoked after execution.
+ */
+ public UiExecutor(ICallback callback) {
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.IOpExecutor#execute(org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation)
+ */
+ @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 {
+ try {
+ monitor.setTaskName(operation.getName());
+ monitor.beginTask(operation.getName(), operation.getTotalWork());
+ operation.run(monitor);
+ }
+ finally {
+ monitor.done();
+ }
+ }};
+ 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();
+ if(throwable instanceof TCFException) {
+ int severity = ((TCFException)throwable).getSeverity();
+ status = new Status(severity, UIPlugin.getUniqueIdentifier(), throwable.getMessage(), throwable);
+ }
+ else {
+ status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), throwable.getMessage(), throwable);
+ }
+ MessageDialog.openError(parent, operation.getName(), throwable.getMessage());
+ }
+ catch (InterruptedException e) {
+ // It is canceled.
+ status = Status.OK_STATUS;
+ }
+ if (callback != null) callback.done(operation, status);
+ return status;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
new file mode 100644
index 000000000..60f12d207
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.pages;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.ui.editor.AbstractTreeViewerExplorerEditorPage;
+import org.eclipse.tcf.te.ui.trees.TreeControl;
+/**
+ * The editor page for the file system explorer.
+ */
+public class FSExplorerEditorPage extends AbstractTreeViewerExplorerEditorPage {
+
+ // The event listener instance
+ private FSExplorerEventListener listener = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractTreeViewerExplorerEditorPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (listener != null) {
+ EventManager.getInstance().removeEventListener(listener);
+ listener = null;
+ }
+ super.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractTreeViewerExplorerEditorPage#getDoubleClickCommandId()
+ */
+ @Override
+ protected String getDoubleClickCommandId() {
+ return "org.eclipse.ui.navigator.Open"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractTreeViewerExplorerEditorPage#getViewerId()
+ */
+ @Override
+ protected String getViewerId() {
+ return "org.eclipse.tcf.te.ui.controls.viewer.fs"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.FSExplorerEditorPage_PageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return "org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractTreeViewerExplorerEditorPage#getViewerInput()
+ */
+ @Override
+ protected Object getViewerInput() {
+ Object element = getEditorInputNode();
+ IPeerNode peerNode = element instanceof IPeerNode ? (IPeerNode)element : null;
+ if (peerNode == null && element instanceof IAdaptable) {
+ peerNode = (IPeerNode)((IAdaptable)element).getAdapter(IPeerNode.class);
+ }
+ return peerNode != null ? ModelManager.getRuntimeModel(peerNode).getRoot() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractTreeViewerExplorerEditorPage#doCreateTreeControl()
+ */
+ @Override
+ protected TreeControl doCreateTreeControl() {
+ TreeControl treeControl = super.doCreateTreeControl();
+ Assert.isNotNull(treeControl);
+
+ if (listener == null) {
+ listener = new FSExplorerEventListener(treeControl);
+ EventManager.getInstance().addEventListener(listener, ChangeEvent.class);
+ }
+
+ return treeControl;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java
new file mode 100644
index 000000000..909eb167e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.pages;
+
+import java.util.EventObject;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
+import org.eclipse.tcf.te.ui.events.AbstractEventListener;
+import org.eclipse.tcf.te.ui.trees.TreeControl;
+
+/**
+ * Filesystem page event listener implementation.
+ */
+public class FSExplorerEventListener extends AbstractEventListener {
+ // Reference to the parent tree control
+ /* default */ final TreeControl treeControl;
+
+ /**
+ * Constructor.
+ *
+ * @param treeControl The parent tree control. Must not be <code>null</code>.
+ */
+ public FSExplorerEventListener(TreeControl treeControl) {
+ Assert.isNotNull(treeControl);
+ this.treeControl = treeControl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof ChangeEvent) {
+ final ChangeEvent changeEvent = (ChangeEvent)event;
+ final Object source = changeEvent.getSource();
+
+ if (treeControl.getViewer() != null) {
+ if (treeControl.getViewer().getControl() == null || treeControl.getViewer().getControl().isDisposed()) {
+ EventManager.getInstance().removeEventListener(this);
+ return;
+ }
+ // Property changes for the runtime model refreshes the whole tree.
+ if (source instanceof IRuntimeModel) {
+ treeControl.getViewer().refresh();
+ }
+
+ // Property changes for individual context nodes refreshes the node only
+ else if (source instanceof FSTreeNode) {
+ if ("expanded".equals(changeEvent.getEventId())) { //$NON-NLS-1$
+ // Expansion state of the node changed.
+ boolean expanded = ((Boolean)changeEvent.getNewValue()).booleanValue();
+ // Update the nodes expansion state
+ ((TreeViewer)treeControl.getViewer()).setExpandedState(source, expanded);
+ } else {
+ ((TreeViewer)treeControl.getViewer()).refresh(source, true);
+ }
+ }
+
+ else if (source instanceof IPeerNode && source == getPeerNode()) {
+ if (IPeerNodeProperties.PROPERTY_CONNECT_STATE.equals(changeEvent.getEventId())) {
+ // Peer node connect state changed to connected
+ if (changeEvent.getNewValue().equals(Integer.valueOf(IConnectable.STATE_CONNECTED))) {
+ // Get the new runtime model
+ final IRuntimeModel model = ModelManager.getRuntimeModel(getPeerNode());
+ // Update the tree viewer input element
+ treeControl.getViewer().setInput(model.getRoot());
+ }
+ // Trigger a refresh on the whole viewer to show the "Please connect ..." text
+ treeControl.getViewer().refresh();
+ }
+ }
+ }
+ }
+ }
+
+ protected IPeerNode getPeerNode() {
+ Object element = treeControl.getViewer().getInput();
+ IPeerNode peerNode = element instanceof IPeerNode ? (IPeerNode)element : null;
+ if (peerNode == null && element instanceof IAdaptable) {
+ peerNode = (IPeerNode)((IAdaptable)element).getAdapter(IPeerNode.class);
+ }
+ return peerNode;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java
new file mode 100644
index 000000000..e3a22ad7d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencePage.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.interfaces.preferences.IPreferenceKeys;
+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, IPreferenceKeys {
+
+ /***
+ * 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);
+ BooleanFieldEditor persistExpanded = new BooleanFieldEditor(PREF_EXPANDED_PERSISTED, Messages.PreferencePage_PersistExpanded, getFieldEditorParent());
+ addField(persistExpanded);
+ }
+
+ /* (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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java
new file mode 100644
index 000000000..228af3ced
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/preferences/PreferencesInitializer.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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 implements IPreferenceKeys {
+
+ /**
+ * 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(PREF_FEATURE_ENABLE_EDITOR_CONTENT_CONTRIBUTION, DEFAULT_FEATURE_ENABLE_EDITOR_CONTENT_CONTRIBUTION);
+ }
+ IPreferenceStore preferenceStore = UIPlugin.getDefault().getPreferenceStore();
+ preferenceStore.setDefault(PREF_AUTOSAVING, DEFAULT_AUTOSAVING);
+ preferenceStore.setDefault(PREF_RENAMING_IN_PLACE_EDITOR, DEFAULT_RENAMING_IN_PLACE_EDITOR);
+ preferenceStore.setDefault(PREF_COPY_PERMISSION, DEFAULT_COPY_PERMISSION);
+ preferenceStore.setDefault(PREF_COPY_OWNERSHIP, DEFAULT_COPY_OWNERSHIP);
+ preferenceStore.setDefault(PREF_EXPANDED_PERSISTED, DEFAULT_EXPANDED_PERSISTED);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java
new file mode 100644
index 000000000..4731034d0
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/AdvancedAttributesDialog.java
@@ -0,0 +1,214 @@
+/*********************************************************************************************
+ * Copyright (c) 2011, 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:
+ * 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java
new file mode 100644
index 000000000..94624e244
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/properties/GeneralInformationPage.java
@@ -0,0 +1,405 @@
+/*********************************************************************************************
+ * Copyright (c) 2011, 2014 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.IStatus;
+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.operations.IOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCommitAttr;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
+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 times of retrying before failure.
+ private static final int RETRY_TIMES = 3;
+ // 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 != null && (clone.attr.permissions & bit) != 0;
+ boolean newOn = btnPermissions[index].getSelection();
+ if (newOn != on) {
+ int permissions = clone.attr != null ? clone.attr.permissions : 0;
+ 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 != null && (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()) {
+ IStatus status = commitAttr();
+ if(!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Commit the new attributes of the file and
+ * return a status. This operation will try
+ * several times before reporting failure.
+ *
+ * @return The committing status.
+ */
+ private IStatus commitAttr() {
+ OpCommitAttr op = new OpCommitAttr(node, clone.attr);
+ IOpExecutor executor = new NullOpExecutor();
+ IStatus status = null;
+ for (int i = 0; i < RETRY_TIMES; i++) {
+ status = executor.execute(op);
+ if (status.isOK()) {
+ if (!node.isRoot()) {
+ // Refresh the parent so that the filters work!
+ executor = new JobExecutor();
+ executor.execute(new OpRefresh(node.getParent()));
+ }
+ return status;
+ }
+ }
+ return status;
+ }
+
+ /**
+ * 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 != null && clone.attr != null && 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, clone.attr != null ? getSizeText(clone.attr.size) : "", page); //$NON-NLS-1$
+ }
+ // Field "Modified"
+ createField(Messages.GeneralInformationPage_Modified, clone.attr != null ? getDateText(clone.attr.mtime) : "", page); //$NON-NLS-1$
+ // Field "Accessed"
+ if (clone.isFile()) {
+ createField(Messages.GeneralInformationPage_Accessed, clone.attr != null ? getDateText(clone.attr.atime) : "", page); //$NON-NLS-1$
+ }
+ createSeparator(page);
+ if (clone.isWindowsNode()) {
+ createAttributesSection(page);
+ } else {
+ createPermissionsSection(page);
+ }
+ return page;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/DateValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/DateValidator.java
new file mode 100644
index 000000000..0ada406c5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/DateValidator.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.search;
+
+import java.util.Calendar;
+import java.util.StringTokenizer;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
+
+/**
+ * The validator used to validate the date entered in the search dialog.
+ */
+public class DateValidator extends RegexValidator {
+ // The regex that defines the format of the date, i.e., MM/DD/YYYY
+ private static final String DATE_REGEX = "\\d{1,2}/\\d{1,2}/\\d{4}"; //$NON-NLS-1$
+
+ /**
+ * Constructor
+ */
+ public DateValidator() {
+ super(ATTR_MANDATORY, DATE_REGEX);
+ setMessageText(INFO_MISSING_VALUE, Messages.DateValidator_InfoPrompt);
+ setMessageText(ERROR_INVALID_VALUE, Messages.DateValidator_InfoFormat);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.RegexValidator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ boolean valid = super.isValid(newText);
+ if(valid) {
+ try {
+ parseTimeInMillis(newText);
+ return true;
+ }
+ catch(IllegalArgumentException e) {
+ String error = e.getMessage();
+ setMessage(error, ERROR);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Parse a text string to a date expressed in milliseconds since 1/1/1970.
+ * If the format is not right, then throw an illegal argument exception containing
+ * the error message.
+ *
+ * @param newText The text string to be parsed.
+ * @return a number in milliseconds since 1/1/1970
+ * @throws IllegalArgumentException when the format is not right.
+ */
+ public static long parseTimeInMillis(String newText) throws IllegalArgumentException{
+ StringTokenizer tokenizer = new StringTokenizer(newText, "/"); //$NON-NLS-1$
+ String month_str = tokenizer.nextToken();
+ int month = 0;
+ try{
+ month = Integer.parseInt(month_str);
+ }
+ catch(NumberFormatException e){
+ throw new IllegalArgumentException(Messages.DateValidator_MonthInvalidNumber);
+ }
+ if(month <= 0 || month > 12) {
+ throw new IllegalArgumentException(Messages.DateValidator_MonthOutofRange);
+ }
+ String date_str = tokenizer.nextToken();
+ int date = 0;
+ try {
+ date = Integer.parseInt(date_str);
+ }
+ catch(NumberFormatException e) {
+ throw new IllegalArgumentException(Messages.DateValidator_DateInvalidNumber);
+ }
+ if(date <= 0 || date > 31) {
+ throw new IllegalArgumentException(Messages.DateValidator_DateOutofRange);
+ }
+ String year_str = tokenizer.nextToken();
+ int year = 0;
+ try {
+ year = Integer.parseInt(year_str);
+ }
+ catch(NumberFormatException e) {
+ throw new IllegalArgumentException(Messages.DateValidator_YearInvalidNumber);
+ }
+ if(year <= 0) {
+ throw new IllegalArgumentException(Messages.DateValidator_YearOutofRange);
+ }
+ Calendar calendar = Calendar.getInstance();
+ calendar.setLenient(false);
+ calendar.set(year, month-1, date);
+ try {
+ return calendar.getTimeInMillis();
+ }
+ catch(IllegalArgumentException e) {
+ throw new IllegalArgumentException(Messages.DateValidator_InvalidDate);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSBaseSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSBaseSearchable.java
new file mode 100644
index 000000000..c6576dcbf
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSBaseSearchable.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.search;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
+import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
+import org.eclipse.tcf.te.ui.utils.AbstractSearchable;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.IExpansionListener;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * The base searchable that provides common methods for its subclasses.
+ *
+ * @see FSModifiedSearchable
+ * @see FSSizeSearchable
+ */
+public abstract class FSBaseSearchable extends AbstractSearchable implements ISearchMatcher {
+
+ /**
+ * Create a collapseable section with the specified title and return the
+ * content composite.
+ *
+ * @param parent The parent where the section is to be created.
+ * @param title The title of the section.
+ * @return The content composite.
+ */
+ protected Composite createSection(Composite parent, String title) {
+ Section section = new Section(parent, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
+ section.setText(title);
+ section.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
+ section.setLayoutData(layoutData);
+
+ final Composite client = new Composite(section, SWT.NONE);
+ client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ client.setBackground(section.getBackground());
+ section.setClient(client);
+
+ section.addExpansionListener(new IExpansionListener(){
+ @Override
+ public void expansionStateChanging(ExpansionEvent e) {
+ }
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ Shell shell = client.getShell();
+ boolean state = e.getState();
+ int client_height = client.getSize().y;
+ Point p = shell.getSize();
+ p.y = state ? p.y + client_height : p.y - client_height;
+ shell.setSize(p.x, p.y);
+ }});
+ return client;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
+ */
+ @Override
+ public ISearchMatcher getMatcher() {
+ return this;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSGeneralSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSGeneralSearchable.java
new file mode 100644
index 000000000..e8c3976ce
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSGeneralSearchable.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.search;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+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.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
+import org.eclipse.tcf.te.ui.search.TreeViewerSearchDialog;
+import org.eclipse.tcf.te.ui.utils.AbstractSearchable;
+
+/**
+ * The searchable that provides a UI to collect and test
+ * the general operations of a file search.
+ */
+public class FSGeneralSearchable extends AbstractSearchable {
+ // The keys to access the options stored in the dialog settings.
+ private static final String INCLUDE_HIDDEN = "FS.IncludeHidden"; //$NON-NLS-1$
+ private static final String INCLUDE_SYSTEM = "FS.IncludeSystem"; //$NON-NLS-1$
+ private static final String TARGET_NAME = "FS.TargetName"; //$NON-NLS-1$
+ private static final String TARGET_TYPE = "FS.TargetType"; //$NON-NLS-1$
+ private static final String MATCH_PRECISE = "FS.MatchPrecise"; //$NON-NLS-1$
+ private static final String CASE_SENSITIVE = "FS.CaseSensitive"; //$NON-NLS-1$
+ // The check option to define if system files should be searched.
+ private Button fBtnSystem;
+ // The check option to define if hidden files should be searched.
+ private Button fBtnHidden;
+ // The case sensitive check box.
+ private Button fBtnCase;
+ // The matching rule check box.
+ private Button fBtnMatch;
+ // The input field for searching conditions.
+ private BaseEditBrowseTextControl fSearchField;
+ // The current target names.
+ private String fTargetName;
+ // Whether it is case sensitive
+ private boolean fCaseSensitive;
+ // Whether it is precise matching.
+ private boolean fMatchPrecise;
+ // The flag if system files should be searched, default to true.
+ private boolean fIncludeSystem = true;
+ // The flag if hidden files should be searched, default to true.
+ private boolean fIncludeHidden = true;
+ // The types of target files.
+ private Combo fCmbTypes;
+ // The current selected target type index.
+ private int fTargetType;
+ // The root directory node.
+ private FSTreeNode rootNode;
+
+ /**
+ * Constructor
+ *
+ * @param node the node whose sub tree will be searched.
+ */
+ public FSGeneralSearchable(FSTreeNode node) {
+ rootNode = node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createCommonPart(org.eclipse.tcf.te.ui.search.TreeViewerSearchDialog, org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createCommonPart(TreeViewerSearchDialog dialog, Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout glayout = new GridLayout(3, false);
+ glayout.marginHeight = 0;
+ glayout.marginWidth = 0;
+ composite.setLayout(glayout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Searching field.
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.FSGeneralSearchable_Find);
+
+ fSearchField = new BaseEditBrowseTextControl(null);
+ fSearchField.setIsGroup(false);
+ fSearchField.setHasHistory(false);
+ fSearchField.setHideBrowseButton(true);
+ fSearchField.setParentControlIsInnerPanel(true);
+ fSearchField.setupPanel(composite);
+ fSearchField.setEditFieldValidator(new NameValidator());
+ //fSearchField.setEditFieldValidator(new FolderValidator(this));
+ Text text = (Text) fSearchField.getEditFieldControl();
+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ searchTextModified();
+ }
+ });
+
+ SelectionListener l = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ optionChecked(e);
+ }
+ };
+
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(Messages.FSGeneralSearchable_GeneralOptionText);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite cmpType = new Composite(group, SWT.NONE);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ cmpType.setLayoutData(data);
+ cmpType.setLayout(new GridLayout(2, false));
+
+ label = new Label(cmpType, SWT.NONE);
+ label.setText(Messages.FSGeneralSearchable_FileType);
+
+ // Search files only
+ fCmbTypes = new Combo(cmpType, SWT.BORDER | SWT.READ_ONLY);
+ fCmbTypes.setItems(new String[]{Messages.FSTreeNodeSearchable_FilesAndFolders, Messages.FSTreeNodeSearchable_FilesOnly, Messages.FSTreeNodeSearchable_FoldersOnly});
+ fCmbTypes.setLayoutData(new GridData());
+ fCmbTypes.addSelectionListener(l);
+
+ Composite compOptions = new Composite(group, SWT.NONE);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ compOptions.setLayoutData(data);
+ compOptions.setLayout(new GridLayout(3, true));
+
+ // Case sensitive
+ fBtnCase = new Button(compOptions, SWT.CHECK);
+ fBtnCase.setText(Messages.TreeViewerSearchDialog_BtnCaseText);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fBtnCase.setLayoutData(data);
+ fBtnCase.addSelectionListener(l);
+
+ // Matching precisely
+ fBtnMatch = new Button(compOptions, SWT.CHECK);
+ fBtnMatch.setText(Messages.TreeViewerSearchDialog_BtnPreciseText);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fBtnMatch.setLayoutData(data);
+ fBtnMatch.addSelectionListener(l);
+
+ dialog.createSearchDirectionOptions(compOptions);
+
+ // If the target is Windows platform, then add system/hidden options.
+ if(rootNode.isWindowsNode()) {
+ fBtnSystem = new Button(compOptions, SWT.CHECK);
+ fBtnSystem.setText(Messages.FSGeneralSearchable_SearchSystemFiles);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fBtnSystem.setLayoutData(data);
+ fBtnSystem.addSelectionListener(l);
+
+ fBtnHidden = new Button(compOptions, SWT.CHECK);
+ fBtnHidden.setText(Messages.FSGeneralSearchable_SearchHiddenFiles);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fBtnHidden.setLayoutData(data);
+ fBtnHidden.addSelectionListener(l);
+ }
+ }
+
+ /**
+ * The text for searching is modified.
+ */
+ protected void searchTextModified() {
+ fireOptionChanged();
+ fTargetName = fSearchField.getEditFieldControlText().trim();
+ }
+
+ /**
+ * Handling the event that a button is selected and checked.
+ *
+ * @param e The selection event.
+ */
+ protected void optionChecked(SelectionEvent e) {
+ Object src = e.getSource();
+ if (src == fBtnCase) {
+ fCaseSensitive = fBtnCase.getSelection();
+ }
+ else if (src == fBtnMatch) {
+ fMatchPrecise = fBtnMatch.getSelection();
+ }
+ else if (src == fCmbTypes) {
+ fTargetType = fCmbTypes.getSelectionIndex();
+ }
+ else if (src == fBtnSystem) {
+ fIncludeSystem = fBtnSystem.getSelection();
+ }
+ else if (src == fBtnHidden) {
+ fIncludeHidden = fBtnHidden.getSelection();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#restoreValues(org.eclipse.jface.dialogs.IDialogSettings)
+ */
+ @Override
+ public void restoreValues(IDialogSettings settings) {
+ if(settings != null) {
+ fCaseSensitive = settings.getBoolean(CASE_SENSITIVE);
+ fBtnCase.setSelection(fCaseSensitive);
+ fMatchPrecise = settings.getBoolean(MATCH_PRECISE);
+ fBtnMatch.setSelection(fMatchPrecise);
+ try {
+ fTargetType = settings.getInt(TARGET_TYPE);
+ fCmbTypes.select(fTargetType);
+ }catch(NumberFormatException e) {
+ fTargetType = 0;
+ }
+ fTargetName = settings.get(TARGET_NAME);
+ if (fTargetName != null) {
+ fSearchField.setEditFieldControlText(fTargetName);
+ }
+ if (rootNode.isWindowsNode()) {
+ fIncludeSystem = settings.get(INCLUDE_SYSTEM) == null ? true : settings.getBoolean(INCLUDE_SYSTEM);
+ fIncludeHidden = settings.get(INCLUDE_HIDDEN) == null ? true : settings.getBoolean(INCLUDE_HIDDEN);
+ }
+ }
+ else {
+ fCaseSensitive = false;
+ fMatchPrecise = false;
+ fTargetType = 0;
+ fTargetName = null;
+ if(rootNode.isWindowsNode()) {
+ fIncludeHidden = true;
+ fIncludeSystem = true;
+ }
+ }
+ fBtnCase.setSelection(fCaseSensitive);
+ fBtnMatch.setSelection(fMatchPrecise);
+ fCmbTypes.select(fTargetType);
+ if (fTargetName != null) {
+ fSearchField.setEditFieldControlText(fTargetName);
+ }
+ if (rootNode.isWindowsNode()) {
+ fBtnSystem.setSelection(fIncludeSystem);
+ fBtnHidden.setSelection(fIncludeHidden);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#persistValues(org.eclipse.jface.dialogs.IDialogSettings)
+ */
+ @Override
+ public void persistValues(IDialogSettings settings) {
+ if(settings != null) {
+ settings.put(CASE_SENSITIVE, fCaseSensitive);
+ settings.put(MATCH_PRECISE, fMatchPrecise);
+ settings.put(TARGET_TYPE, fTargetType);
+ settings.put(TARGET_NAME, fTargetName);
+ if(rootNode.isWindowsNode()) {
+ settings.put(INCLUDE_SYSTEM, fIncludeSystem);
+ settings.put(INCLUDE_HIDDEN, fIncludeHidden);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
+ */
+ @Override
+ public ISearchMatcher getMatcher() {
+ return new FSTreeNodeMatcher(fCaseSensitive, fMatchPrecise, fTargetType, fTargetName, fIncludeSystem, fIncludeHidden);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ return fSearchField.isValid();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#getPreferredSize()
+ */
+ @Override
+ public Point getPreferredSize() {
+ return new Point(400, rootNode.isWindowsNode() ? 200 : 180);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSModifiedSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSModifiedSearchable.java
new file mode 100644
index 000000000..df7113707
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSModifiedSearchable.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.search;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+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.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.search.TreeViewerSearchDialog;
+
+/**
+ * The searchable that provides a UI to collect and test
+ * the last modified time of a file during searching.
+ */
+public class FSModifiedSearchable extends FSBaseSearchable {
+ // Constant values of last modified options
+ private static final int OPTION_NOT_REMEMBER = 0;
+ private static final int OPTION_LAST_WEEK = 1;
+ private static final int OPTION_LAST_MONTH = 2;
+ private static final int OPTION_LAST_YEAR = 3;
+ private static final int OPTION_SPECIFIED = 4;
+
+ // Constant values of different time unit, used for matching purpose.
+ private static final long SECOND = 1000L;
+ private static final long MINUTE = 60 * SECOND;
+ private static final long HOUR = 60 * MINUTE;
+ private static final long DAY = 24 * HOUR;
+ private static final long WEEK = 7 * DAY;
+ private static final long MONTH = 30 * DAY;
+ private static final long YEAR = 365 * DAY;
+
+ // The choice selected
+ private int choice;
+ // The specified "from" date
+ private long fromTime;
+ // The specified "to" date
+ private long toTime;
+
+ // UI elements for input
+ private Button fBtnLmNotRem;
+ private Button fBtnLmLastWeek;
+ private Button fBtnLmPastMonth;
+ private Button fBtnLmPastYear;
+ private Button fBtnLmSpecified;
+ private BaseEditBrowseTextControl txtLmFrom;
+ private BaseEditBrowseTextControl txtLmTo;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.tcf.te.ui.search.TreeViewerSearchDialog, org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createAdvancedPart(TreeViewerSearchDialog dialog, Composite parent) {
+ SelectionListener l = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ optionChecked(e);
+ }
+ };
+ Composite modifiedComp = createSection(parent, Messages.FSModifiedSearchable_WhenModified);
+ modifiedComp.setLayout(new GridLayout(4, false));
+
+ fBtnLmNotRem = new Button(modifiedComp, SWT.RADIO);
+ fBtnLmNotRem.setText(Messages.FSModifiedSearchable_DontRemember);
+ fBtnLmNotRem.setSelection(true);
+ GridData data = new GridData();
+ data.horizontalSpan = 4;
+ fBtnLmNotRem.setLayoutData(data);
+ fBtnLmNotRem.addSelectionListener(l);
+
+ fBtnLmLastWeek = new Button(modifiedComp, SWT.RADIO);
+ fBtnLmLastWeek.setText(Messages.FSModifiedSearchable_LastWeek);
+ data = new GridData();
+ data.horizontalSpan = 4;
+ fBtnLmLastWeek.setLayoutData(data);
+ fBtnLmLastWeek.addSelectionListener(l);
+
+ fBtnLmPastMonth = new Button(modifiedComp, SWT.RADIO);
+ fBtnLmPastMonth.setText(Messages.FSModifiedSearchable_PastMonth);
+ data = new GridData();
+ data.horizontalSpan = 4;
+ fBtnLmPastMonth.setLayoutData(data);
+ fBtnLmPastMonth.addSelectionListener(l);
+
+ fBtnLmPastYear = new Button(modifiedComp, SWT.RADIO);
+ fBtnLmPastYear.setText(Messages.FSModifiedSearchable_PastYear);
+ data = new GridData();
+ data.horizontalSpan = 4;
+ fBtnLmPastYear.setLayoutData(data);
+ fBtnLmPastYear.addSelectionListener(l);
+
+ fBtnLmSpecified = new Button(modifiedComp, SWT.RADIO);
+ fBtnLmSpecified.setText(Messages.FSModifiedSearchable_SpecifyDates);
+ data = new GridData();
+ fBtnLmSpecified.setLayoutData(data);
+ fBtnLmSpecified.addSelectionListener(l);
+
+ Composite cmpFrom = new Composite(modifiedComp, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpFrom.setLayout(layout);
+ data = new GridData();
+ cmpFrom.setLayoutData(data);
+
+ txtLmFrom = new BaseEditBrowseTextControl(null);
+ txtLmFrom.setIsGroup(false);
+ txtLmFrom.setHasHistory(false);
+ txtLmFrom.setHideBrowseButton(true);
+ txtLmFrom.setParentControlIsInnerPanel(true);
+ txtLmFrom.setupPanel(cmpFrom);
+ txtLmFrom.setEnabled(false);
+ txtLmFrom.setEditFieldValidator(new DateValidator());
+ Text text = (Text) txtLmFrom.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ datesModified();
+ }
+ });
+
+ Label label = new Label(modifiedComp, SWT.NONE);
+ label.setText(Messages.FSModifiedSearchable_ToDate);
+
+ Composite cmpTo = new Composite(modifiedComp, SWT.NONE);
+ layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpTo.setLayout(layout);
+ data = new GridData();
+ cmpTo.setLayoutData(data);
+
+ txtLmTo = new BaseEditBrowseTextControl(null);
+ txtLmTo.setIsGroup(false);
+ txtLmTo.setHasHistory(false);
+ txtLmTo.setHideBrowseButton(true);
+ txtLmTo.setParentControlIsInnerPanel(true);
+ txtLmTo.setupPanel(cmpTo);
+ txtLmTo.setEnabled(false);
+ txtLmTo.setEditFieldValidator(new DateValidator());
+ text = (Text) txtLmTo.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ datesModified();
+ }
+ });
+ }
+
+ /**
+ * The modified event of the date fields.
+ */
+ protected void datesModified() {
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ if(choice == OPTION_SPECIFIED && txtLmFrom != null && txtLmTo != null) {
+ boolean vFrom = txtLmFrom.isValid();
+ boolean vTo = txtLmTo.isValid();
+ if(vFrom) {
+ String fromText = txtLmFrom.getEditFieldControlText().trim();
+ this.fromTime = DateValidator.parseTimeInMillis(fromText);
+ }
+ if(vTo) {
+ String toText = txtLmTo.getEditFieldControlText().trim();
+ this.toTime = DateValidator.parseTimeInMillis(toText);
+ }
+ return vFrom && vTo;
+ }
+ return true;
+ }
+
+ /**
+ * The method handling the selection event.
+ *
+ * @param e The selection event.
+ */
+ protected void optionChecked(SelectionEvent e) {
+ Object src = e.getSource();
+ boolean specified = false;
+ if(src == fBtnLmNotRem) {
+ choice = OPTION_NOT_REMEMBER;
+ }
+ else if(src == fBtnLmLastWeek) {
+ choice = OPTION_LAST_WEEK;
+ }
+ else if(src == fBtnLmPastMonth) {
+ choice = OPTION_LAST_MONTH;
+ }
+ else if(src == fBtnLmPastYear) {
+ choice = OPTION_LAST_YEAR;
+ }
+ else if(src == fBtnLmSpecified) {
+ choice = OPTION_SPECIFIED;
+ specified = true;
+ }
+ if (txtLmFrom != null) txtLmFrom.setEnabled(specified);
+ if (txtLmTo != null) txtLmTo.setEnabled(specified);
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
+ @Override
+ public boolean match(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ long now = System.currentTimeMillis();
+ switch (choice) {
+ case OPTION_NOT_REMEMBER:
+ return true;
+ case OPTION_LAST_WEEK:
+ return node.attr.mtime > now - WEEK;
+ case OPTION_LAST_MONTH:
+ return node.attr.mtime > now - MONTH;
+ case OPTION_LAST_YEAR:
+ return node.attr.mtime > now - YEAR;
+ case OPTION_SPECIFIED:
+ return node.attr.mtime >= fromTime && node.attr.mtime < toTime;
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSSizeSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSSizeSearchable.java
new file mode 100644
index 000000000..fbd42c2ce
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSSizeSearchable.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.search;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+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.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tcf.te.ui.search.TreeViewerSearchDialog;
+
+/**
+ * The searchable that provides a UI to collect and test
+ * the size of a file during searching.
+ */
+public class FSSizeSearchable extends FSBaseSearchable {
+ // Constant values of size options
+ private static final int OPTION_NOT_REMEMBER = 0;
+ private static final int OPTION_SIZE_SMALL = 1;
+ private static final int OPTION_SIZE_MEDIUM = 2;
+ private static final int OPTION_SIZE_LARGE = 3;
+ private static final int OPTION_SIZE_SPECIFIED = 4;
+
+ // Constant values of different size unit, used for matching purpose.
+ private static final long KB = 1024;
+ private static final long MB = 1024 * KB;
+
+ private static final long SIZE_SMALL = 100 * KB;
+ private static final long SIZE_MEDIUM = 1*MB;
+
+ // The choice selected
+ private int choice;
+ // The lower bound of size
+ private int lowerSize;
+ // The upper bound of size
+ private int upperSize;
+
+ // UI elements for input
+ private Button fBtnSizeNotRem;
+ private Button fBtnSizeSmall;
+ private Button fBtnSizeMedium;
+ private Button fBtnSizeLarge;
+ private Button fBtnSizeSpecified;
+ private BaseEditBrowseTextControl txtSizeFrom;
+ private BaseEditBrowseTextControl txtSizeTo;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.tcf.te.ui.search.TreeViewerSearchDialog, org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createAdvancedPart(TreeViewerSearchDialog dialog, Composite parent) {
+ SelectionListener l = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ optionChecked(e);
+ }
+ };
+
+ Composite sizeComp = createSection(parent, Messages.FSSizeSearchable_WhatSize);
+ sizeComp.setLayout(new GridLayout(5, false));
+
+ fBtnSizeNotRem = new Button(sizeComp, SWT.RADIO);
+ fBtnSizeNotRem.setText(Messages.FSSizeSearchable_DontRemember);
+ fBtnSizeNotRem.setSelection(true);
+ GridData data = new GridData();
+ data.horizontalSpan = 5;
+ fBtnSizeNotRem.setLayoutData(data);
+ fBtnSizeNotRem.addSelectionListener(l);
+
+ fBtnSizeSmall = new Button(sizeComp, SWT.RADIO);
+ fBtnSizeSmall.setText(Messages.FSSizeSearchable_Small);
+ data = new GridData();
+ data.horizontalSpan = 5;
+ fBtnSizeSmall.setLayoutData(data);
+ fBtnSizeSmall.addSelectionListener(l);
+
+ fBtnSizeMedium = new Button(sizeComp, SWT.RADIO);
+ fBtnSizeMedium.setText(Messages.FSSizeSearchable_Medium);
+ data = new GridData();
+ data.horizontalSpan = 5;
+ fBtnSizeMedium.setLayoutData(data);
+ fBtnSizeMedium.addSelectionListener(l);
+
+ fBtnSizeLarge = new Button(sizeComp, SWT.RADIO);
+ fBtnSizeLarge.setText(Messages.FSSizeSearchable_Large);
+ data = new GridData();
+ data.horizontalSpan = 5;
+ fBtnSizeLarge.setLayoutData(data);
+ fBtnSizeLarge.addSelectionListener(l);
+
+ fBtnSizeSpecified = new Button(sizeComp, SWT.RADIO);
+ fBtnSizeSpecified.setText(Messages.FSSizeSearchable_SpecifySize);
+ data = new GridData();
+ fBtnSizeSpecified.setLayoutData(data);
+ fBtnSizeSpecified.addSelectionListener(l);
+
+ Composite cmpFrom = new Composite(sizeComp, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpFrom.setLayout(layout);
+ data = new GridData();
+ cmpFrom.setLayoutData(data);
+
+ txtSizeFrom = new BaseEditBrowseTextControl(null);
+ txtSizeFrom.setIsGroup(false);
+ txtSizeFrom.setHasHistory(false);
+ txtSizeFrom.setHideBrowseButton(true);
+ txtSizeFrom.setParentControlIsInnerPanel(true);
+ txtSizeFrom.setupPanel(cmpFrom);
+ txtSizeFrom.setEnabled(false);
+ txtSizeFrom.setEditFieldValidator(new SizeValidator());
+ Text text = (Text) txtSizeFrom.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ sizeModified();
+ }
+ });
+
+
+ Label label = new Label(sizeComp, SWT.NONE);
+ label.setText(Messages.FSSizeSearchable_ToText);
+
+ Composite cmpTo = new Composite(sizeComp, SWT.NONE);
+ layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpTo.setLayout(layout);
+ data = new GridData();
+ cmpTo.setLayoutData(data);
+
+ txtSizeTo = new BaseEditBrowseTextControl(null);
+ txtSizeTo.setIsGroup(false);
+ txtSizeTo.setHasHistory(false);
+ txtSizeTo.setHideBrowseButton(true);
+ txtSizeTo.setParentControlIsInnerPanel(true);
+ txtSizeTo.setupPanel(cmpTo);
+ txtSizeTo.setEnabled(false);
+ txtSizeTo.setEditFieldValidator(new SizeValidator());
+ text = (Text) txtSizeTo.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ sizeModified();
+ }
+ });
+
+ label = new Label(sizeComp, SWT.NONE);
+ label.setText(Messages.FSSizeSearchable_KBS);
+ }
+
+ /**
+ * The modified event of the size fields.
+ */
+ protected void sizeModified() {
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ if(choice == OPTION_SIZE_SPECIFIED && txtSizeFrom != null && txtSizeTo != null) {
+ boolean vFrom = txtSizeFrom.isValid();
+ boolean vTo = txtSizeTo.isValid();
+ if(vFrom) {
+ String fromText = txtSizeFrom.getEditFieldControlText();
+ this.lowerSize = Integer.parseInt(fromText);
+ }
+ if(vTo) {
+ String toText = txtSizeTo.getEditFieldControlText();
+ this.upperSize = Integer.parseInt(toText);
+ }
+ return vFrom && vTo;
+ }
+ return true;
+ }
+
+ /**
+ * The method handling the selection event.
+ *
+ * @param e The selection event.
+ */
+ protected void optionChecked(SelectionEvent e) {
+ Object src = e.getSource();
+ boolean specified = false;
+ if(src == fBtnSizeNotRem) {
+ choice = OPTION_NOT_REMEMBER;
+ }
+ else if(src == fBtnSizeSmall) {
+ choice = OPTION_SIZE_SMALL;
+ }
+ else if(src == fBtnSizeMedium) {
+ choice = OPTION_SIZE_MEDIUM;
+ }
+ else if(src == fBtnSizeLarge) {
+ choice = OPTION_SIZE_LARGE;
+ }
+ else if(src == fBtnSizeSpecified) {
+ choice = OPTION_SIZE_SPECIFIED;
+ specified = true;
+ }
+ if (txtSizeFrom != null) txtSizeFrom.setEnabled(specified);
+ if (txtSizeTo != null) txtSizeTo.setEnabled(specified);
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
+ @Override
+ public boolean match(Object element) {
+ if (element instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) element;
+ switch (choice) {
+ case OPTION_NOT_REMEMBER:
+ return true;
+ case OPTION_SIZE_SMALL:
+ return node.attr.size <= SIZE_SMALL;
+ case OPTION_SIZE_MEDIUM:
+ return node.attr.size <= SIZE_MEDIUM;
+ case OPTION_SIZE_LARGE:
+ return node.attr.size > SIZE_MEDIUM;
+ case OPTION_SIZE_SPECIFIED:
+ return node.attr.size >= lowerSize && node.attr.size < upperSize;
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeMatcher.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeMatcher.java
new file mode 100644
index 000000000..3d2c80d9a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeMatcher.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 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.search;
+
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
+import org.eclipse.tcf.te.ui.utils.StringMatcher;
+/**
+ * The ISearchMatcher implementation for FSTreeNode.
+ */
+public class FSTreeNodeMatcher implements ISearchMatcher {
+ // Whether it is case sensitive
+ private boolean fCaseSensitive;
+ // Whether it is precise matching.
+ private boolean fMatchPrecise;
+ // The string matcher used for matching.
+ private StringMatcher fStringMatcher;
+ // The current selected target simulator index.
+ private int fTargetType;
+ // The current target names.
+ private String fTargetName;
+ // The flag if system files should be included
+ private boolean fIncludeSystem;
+ // The flag if hidden files should be included
+ private boolean fIncludeHidden;
+
+ /**
+ * Constructor with different option parameters.
+ *
+ * @param caseSensitive Option of case sensitive
+ * @param matchPrecise Option of precise matching
+ * @param targetType Option of the target simulator
+ * @param targetName Option of the target name
+ * @param includeSystem Option if system files be included
+ * @param includeHidden Option if hidden files be included
+ */
+ public FSTreeNodeMatcher(boolean caseSensitive, boolean matchPrecise,
+ int targetType, String targetName, boolean includeSystem, boolean includeHidden) {
+ fCaseSensitive = caseSensitive;
+ fTargetName = targetName;
+ fMatchPrecise = matchPrecise;
+ if (!fMatchPrecise) {
+ fStringMatcher = new StringMatcher(fTargetName, !fCaseSensitive, false);
+ }
+ fTargetType = targetType;
+ fIncludeSystem = includeSystem;
+ fIncludeHidden = includeHidden;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
+ @Override
+ public boolean match(Object context) {
+ if (context == null) return false;
+ if (context instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) context;
+ if(fTargetType == 1 && !node.isFile() || fTargetType == 2 && !node.isDirectory()) return false;
+ if(!fIncludeSystem && node.isSystem()) return false;
+ if(!fIncludeHidden && node.isHidden()) return false;
+ String text = node.name;
+ if (text != null) {
+ if (fMatchPrecise) {
+ return fCaseSensitive ? text.equals(fTargetName) : text.equalsIgnoreCase(fTargetName);
+ }
+ return fStringMatcher.match(text);
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeSearchable.java
new file mode 100644
index 000000000..b75fb2e0c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeSearchable.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.search;
+
+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.utils.CompositeSearchable;
+
+/**
+ * The ISearchable adapter for a FSTreeNode which creates a UI for the user to
+ * input the matching condition and returns a matcher to do the matching.
+ */
+public class FSTreeNodeSearchable extends CompositeSearchable {
+
+ /**
+ * Create an instance with the specified node.
+ *
+ * @param node The directory node.
+ */
+ public FSTreeNodeSearchable(FSTreeNode node) {
+ super();
+ setSearchables(new FSGeneralSearchable(node), new FSModifiedSearchable(), new FSSizeSearchable());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchTitle(java.lang.Object)
+ */
+ @Override
+ public String getSearchTitle(Object rootElement) {
+ return Messages.FSTreeNodeSearchable_FindFilesAndFolders;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchMessage(java.lang.Object)
+ */
+ @Override
+ public String getSearchMessage(Object rootElement) {
+ String message = Messages.FSTreeNodeSearchable_FindMessage;
+ FSTreeNode rootNode = (FSTreeNode) rootElement;
+ String rootName = getElementName(rootElement);
+ if (rootNode != null && !rootNode.isSystemRoot()) rootName = "\"" + rootName + "\""; //$NON-NLS-1$//$NON-NLS-2$
+ message = NLS.bind(message, rootName);
+ return message;
+ }
+
+ /**
+ * Get a name representation for each file node.
+ *
+ * @param rootElement The root element whose name is being retrieved.
+ * @return The node's name or an expression for the file system.
+ */
+ private String getElementName(Object rootElement) {
+ if(rootElement == null) {
+ return Messages.FSTreeNodeSearchable_SelectedFileSystem;
+ }
+ FSTreeNode rootNode = (FSTreeNode) rootElement;
+ if(rootNode.isSystemRoot()) {
+ return Messages.FSTreeNodeSearchable_SelectedFileSystem;
+ }
+ return rootNode.name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getElementText(java.lang.Object)
+ */
+ @Override
+ public String getElementText(Object element) {
+ return getElementName(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getCustomMessage(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public String getCustomMessage(Object rootElement, String key) {
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/NameValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/NameValidator.java
new file mode 100644
index 000000000..821e2e2df
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/NameValidator.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.search;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator used to validate the name entered in the search dialog.
+ */
+public class NameValidator extends Validator {
+ /**
+ * Constructor
+ */
+ public NameValidator() {
+ super(ATTR_MANDATORY);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.Validator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ init();
+ boolean valid = newText != null && newText.trim().length() > 0;
+ if(!valid) {
+ if (isAttribute(ATTR_MANDATORY)) {
+ setMessage(Messages.NameValidator_InfoPrompt, INFORMATION);
+ }
+ }
+ return valid;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/SizeValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/SizeValidator.java
new file mode 100644
index 000000000..0877e3b4b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/SizeValidator.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.search;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.NumberValidator;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator used to validate the size entered in the search dialog.
+ */
+public class SizeValidator extends NumberValidator {
+ /**
+ * Constructor
+ */
+ public SizeValidator() {
+ super(Validator.ATTR_MANDATORY, 0, -1);
+ setMessageText(INFO_MISSING_VALUE, Messages.SizeValidator_InfoPrompt);
+ setMessageText(ERROR_INVALID_VALUE, Messages.SizeValidator_ErrorIncorrectFormat);
+ setMessageText(ERROR_INVALID_RANGE, Messages.SizeValidator_ErrorSizeOutofRange);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java
new file mode 100644
index 000000000..9a78d3b8c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFileSection.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.tcf.te.ui.swt.SWTControlUtil;
+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() {
+ SWTControlUtil.setText(sizeText, clone != null ? getSizeText(clone.attr.size) : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(accessedText, clone != null ? getDateText(clone.attr.atime) : ""); //$NON-NLS-1$
+ super.refresh();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
new file mode 100644
index 000000000..00748f2ec
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerNodeProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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(IPeerNodeProvider input) {
+ Assert.isTrue(input instanceof FSTreeNodePeerNodeProvider);
+ this.node = ((FSTreeNodePeerNodeProvider)input).getFSTreeNode();
+ this.clone = (FSTreeNode) node.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setText(nameText, clone != null ? clone.name : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(typeText, clone != null ? clone.getFileType() : ""); //$NON-NLS-1$
+ String location = clone == null || clone.isRoot() ? Messages.GeneralInformationPage_Computer : clone.getLocation();
+ SWTControlUtil.setText(locationText, location);
+ SWTControlUtil.setText(modifiedText, clone != null && clone.attr != null ? getDateText(clone.attr.mtime) : ""); //$NON-NLS-1$
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java
new file mode 100644
index 000000000..9ce004377
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FileFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.isSystemRoot() && node.isFile();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java
new file mode 100644
index 000000000..55b4b3e9c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/FolderFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.isSystemRoot() && node.isDirectory();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java
new file mode 100644
index 000000000..ffb5b6b78
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.isSystemRoot() && !node.isWindowsNode();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java
new file mode 100644
index 000000000..2178562eb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/LinuxPermissionsSection.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerNodeProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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(IPeerNodeProvider input) {
+ Assert.isTrue(input instanceof FSTreeNodePeerNodeProvider);
+ this.node = ((FSTreeNodePeerNodeProvider)input).getFSTreeNode();
+ 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 != null ? (clone.attr.permissions & bit) != 0 : false;
+ SWTControlUtil.setSelection(btnPermissions[i], 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java
new file mode 100644
index 000000000..1c73246b9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesCESection.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerNodeProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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(IPeerNodeProvider input) {
+ Assert.isTrue(input instanceof FSTreeNodePeerNodeProvider);
+ this.node = ((FSTreeNodePeerNodeProvider)input).getFSTreeNode();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ boolean on = node != null ? node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_COMPRESSED) : false;
+ SWTControlUtil.setSelection(compressButton, on);
+ on = node != null ? node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ENCRYPTED) : false;
+ SWTControlUtil.setSelection(encryptButton, 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java
new file mode 100644
index 000000000..dfc7a701c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsAttributesSection.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerNodeProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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(IPeerNodeProvider input) {
+ Assert.isTrue(input instanceof FSTreeNodePeerNodeProvider);
+ this.node = ((FSTreeNodePeerNodeProvider)input).getFSTreeNode();
+ this.clone = (FSTreeNode) node.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setSelection(readOnlyButton, clone != null ? clone.isReadOnly() : false);
+ SWTControlUtil.setSelection(hiddenButton, clone != null ? clone.isHidden(): false);
+ }
+
+ /*
+ * (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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java
new file mode 100644
index 000000000..6ac4eaa44
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileAISection.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java
new file mode 100644
index 000000000..d2694c893
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFileFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.isSystemRoot() && node.isWindowsNode() && node.isFile();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java
new file mode 100644
index 000000000..85b53dc36
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.isSystemRoot() && node.isWindowsNode() && (node.isFile() || node.isDirectory());
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java
new file mode 100644
index 000000000..703f33ed9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderAISection.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerNodeProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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(IPeerNodeProvider input) {
+ Assert.isTrue(input instanceof FSTreeNodePeerNodeProvider);
+ this.node = ((FSTreeNodePeerNodeProvider)input).getFSTreeNode();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ boolean on = node != null ? node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_ARCHIVE) : false;
+ SWTControlUtil.setSelection(archiveButton, on);
+ on = node != null ? !node.isWin32AttrOn(IWindowsFileAttributes.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) : false;
+ SWTControlUtil.setSelection(indexButton, 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java
new file mode 100644
index 000000000..84d8d1553
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/WindowsFolderFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.isSystemRoot() && node.isWindowsNode() && node.isDirectory();
+ }
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java
new file mode 100644
index 000000000..7c54c999d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/CachePropertyTester.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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
+ * 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java
new file mode 100644
index 000000000..b01558655
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/ClipboardPropertyTester.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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();
+ 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.getParent();
+ }
+ }
+ else {
+ for (FSTreeNode node : selection) {
+ if (hovered == null) hovered = node.getParent();
+ else if (hovered != node.getParent()) return false;
+ }
+ }
+ if (hovered != null && 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.getParent() == hovered || node.isAncestorOf(hovered)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ else {
+ 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.getParent();
+ }
+ else {
+ hovered = node;
+ }
+ }
+ else {
+ for (FSTreeNode node : selection) {
+ if (hovered == null) hovered = node.getParent();
+ else if (hovered != node.getParent()) return false;
+ }
+ }
+ if (hovered != null && hovered.isDirectory() && hovered.isWritable()) {
+ return true;
+ }
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java
new file mode 100644
index 000000000..0f4259f13
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/testers/EditorActivationEventPropertyTester.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
new file mode 100644
index 000000000..6ca8422bc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java
new file mode 100644
index 000000000..5329a4f7c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NameValidator.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.getChildren();
+ }
+ 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java
new file mode 100644
index 000000000..3ad1bfb76
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizard.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java
new file mode 100644
index 000000000..af1b95b01
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFileWizardPage.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java
new file mode 100644
index 000000000..84fb4adc9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizard.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java
new file mode 100644
index 000000000..79237ca4b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewFolderWizardPage.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java
new file mode 100644
index 000000000..ee743fcae
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizard.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
+import org.eclipse.tcf.te.ui.views.editor.pages.AbstractTreeViewerExplorerEditorPage;
+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 IPeerNode peer;
+ // The wizard page used to create the new node.
+ private NewNodeWizardPage newPage;
+
+ /**
+ * 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) {
+ super.init(workbench, selection);
+ // 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.getParent();
+ }
+ peer = folder.peerNode;
+ }
+ else if (element instanceof IPeerNode) {
+ if(hasFileSystem((IPeerNode) element)) {
+ peer = (IPeerNode) 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 IPeerNode peer) {
+ if(Protocol.isDispatchThread()) {
+ String services = null;
+ services = peer.getStringProperty(IPeerNodeProperties.PROPERTY_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.getMessage());
+ }
+ 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 = getWorkbench() != null ? getWorkbench().getActiveWorkbenchWindow() : null;
+ 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 AbstractTreeViewerExplorerEditorPage) {
+ AbstractTreeViewerExplorerEditorPage viewerPage = (AbstractTreeViewerExplorerEditorPage) 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 IPeerNode getPeer(){
+ return peer;
+ }
+
+ /**
+ * Set the currently selected target peer.
+ *
+ * @param peer The newly selected target peer.
+ */
+ public void setPeer(IPeerNode 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
new file mode 100644
index 000000000..7179beddc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
@@ -0,0 +1,359 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.internal.operations.NullOpExecutor;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
+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.IPeerNode;
+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 != null ? toolkit.createComposite(parent) : new Composite(parent, SWT.NONE);
+ 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.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());
+ IPeerNode 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.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;
+ if(node.isFile()) return false;
+ }
+ return true;
+ }
+ }
+
+ /**
+ * 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);
+ Assert.isNotNull(filterDescriptors);
+ 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(IPeerNode peer) {
+ if (peer != null) {
+ setInput(peer);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#doValidate()
+ */
+ @Override
+ protected ValidationResult doValidate() {
+ ValidationResult result = new ValidationResult();
+
+ boolean valid = true;
+
+ if (folderControl != null) {
+ valid &= folderControl.isValid();
+ result.setResult(folderControl);
+ }
+
+ if (nameControl != null) {
+ valid &= nameControl.isValid();
+ result.setResult(nameControl);
+ }
+
+ result.setValid(valid);
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (nameControl != null) { nameControl.dispose(); nameControl = null; }
+ if (toolkit != null) { toolkit.dispose(); toolkit = 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();
+ IPeerNode peer = wizard.getPeer();
+ if (peer == null) return null;
+ final String text = folderControl.getEditFieldControlText();
+ if (text != null) {
+ String path = text.trim();
+ OpParsePath parser = new OpParsePath(peer, path);
+ new NullOpExecutor().execute(parser);
+ return parser.getResult();
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java
new file mode 100644
index 000000000..82baf5e34
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetPatternFilter.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2014 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.wizards;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
+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>.
+ */
+public class TargetPatternFilter extends PatternFilter {
+ private DelegatingLabelProvider targetLabelProvider = new DelegatingLabelProvider();
+ /**
+ * 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 IPeerNode;
+ }
+
+ /*
+ * (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 IPeerNode) {
+ String text = targetLabelProvider.getText(element);
+ if (wordMatches(text)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
new file mode 100644
index 000000000..d3b268055
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+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.StyledString;
+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.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelQueryService;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+import org.eclipse.tcf.te.tcf.ui.navigator.ContentProvider;
+import org.eclipse.tcf.te.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.interfaces.IUIConstants;
+import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
+import org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage;
+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 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());
+ initialize();
+ }
+
+ /**
+ * Refresh the remote services in target peers.
+ */
+ private void initialize() {
+ // Refresh the information of remote services.
+ IPeerModel model = ModelManager.getPeerModel();
+ Assert.isNotNull(model);
+ IPeerNode[] peers = model.getPeerNodes();
+ if (peers != null) {
+ IPeerModelQueryService service = model.getService(IPeerModelQueryService.class);
+ for (IPeerNode peer : peers) {
+ service.queryRemoteServices(peer);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#getWizard()
+ */
+ @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;
+ }
+
+ /**
+ * A styled label provider for the target selection list.
+ */
+ static class TargetStyledLabelProvider extends DelegatingLabelProvider implements IStyledLabelProvider {
+ @Override
+ public StyledString getStyledText(Object element) {
+ return new StyledString(getText(element));
+ }
+ }
+
+ /*
+ * (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 ContentProvider());
+ IBaseLabelProvider labelProvider = new DecoratingStyledCellLabelProvider(new TargetStyledLabelProvider(), new DelegatingLabelProvider(), null);
+ treeViewer.setLabelProvider(labelProvider);
+ treeViewer.setComparator(new TargetViewerComparator());
+ ViewerFilter fsPeerFilter = new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IPeerNode) {
+ IPeerNode peer = (IPeerNode) 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 IPeerNode) {
+ // 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(ModelManager.getPeerModel());
+ NewNodeWizard wizard = getWizard();
+ IPeerNode 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#doValidate()
+ */
+ @Override
+ protected ValidationResult doValidate() {
+ ValidationResult result = new ValidationResult();
+
+ boolean valid = true;
+
+ ISelection selection = treeViewer.getSelection();
+ if (selection.isEmpty()) {
+ result.setResult(getDefaultDescription(), IMessageProvider.ERROR);
+ result.setValid(valid);
+ }
+
+ return result;
+ }
+
+ /**
+ * 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 IPeerNode) {
+ wizard.setPeer((IPeerNode) 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.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
new file mode 100644
index 000000000..8d68fec45
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 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;
+import org.eclipse.tcf.te.runtime.services.ServiceUtils;
+import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.IFileSystemUIDelegate;
+
+/**
+ * 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);
+ return (String)field.get(null);
+ } catch (Exception e) { /* ignored on purpose */ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the corresponding string for the given externalized strings key via
+ * the {@link IFileSystemUIDelegate}.
+ *
+ * @param context The context or <code>null</code>.
+ * @param key The externalized strings key or <code>null</code>.
+ *
+ * @return The corresponding string or <code>null</code>.
+ */
+ public static String getStringDelegated(Object context, String key) {
+ if (key != null) {
+ IFileSystemUIDelegate delegate = ServiceUtils.getUIServiceDelegate(context, context, IFileSystemUIDelegate.class);
+ return delegate != null ? delegate.getMessage(key) : null;
+ }
+
+ return null;
+ }
+
+ public static String FSFolderSelectionDialog_MoveDialogMessage;
+ public static String FSFolderSelectionDialog_MoveDialogTitle;
+ public static String FSFolderSelectionDialog_Refresh_menu;
+ public static String FSFolderSelectionDialog_RefreshAll_menu;
+ public static String FSFolderSelectionDialog_validate_message;
+ public static String FSFolderSelectionDialog_notWritable_error;
+ public static String FSFolderSelectionDialog_notWritable_warning;
+
+ public static String FSOpenFileDialog_message;
+ public static String FSOpenFileDialog_title;
+ public static String FSDelete_ConfirmDelete;
+ public static String FSDelete_ConfirmMessage;
+ public static String FSDelete_ButtonCancel;
+ public static String FSDelete_ButtonNo;
+ public static String FSDelete_ButtonYes;
+ public static String FSDelete_ButtonYes2All;
+ public static String DateValidator_DateInvalidNumber;
+ public static String DateValidator_DateOutofRange;
+ public static String DateValidator_InfoFormat;
+ public static String DateValidator_InfoPrompt;
+ public static String DateValidator_InvalidDate;
+ public static String DateValidator_MonthInvalidNumber;
+ public static String DateValidator_MonthOutofRange;
+ public static String DateValidator_YearInvalidNumber;
+ public static String DateValidator_YearOutofRange;
+ public static String DeleteFilesHandler_DeleteMultipleFilesConfirmation;
+ public static String DeleteFilesHandler_DeleteOneFileConfirmation;
+ public static String DeleteFilesHandler_ConfirmDialogTitle;
+ public static String FSRenamingAssistant_NameAlreadyExists;
+ public static String FSRenamingAssistant_SpecifyNonEmptyName;
+ public static String FSRenamingAssistant_UnixIllegalCharacters;
+ public static String FSRenamingAssistant_WinIllegalCharacters;
+ public static String LocalTypedElement_SavingFile;
+ public static String MergeEditorInput_LocalFile;
+ public static String MergeEditorInput_RemoteFile;
+ public static String MergeEditorInput_CompareLeftAndRight;
+ public static String MergeEditorInput_CompareWithLocalCache;
+ public static String MergeInput_CopyNotSupported;
+ public static String RemoteTypedElement_GettingRemoteContent;
+ public static String RemoteTypedElement_DowloadingFile;
+ public static String FSDropTargetListener_ConfirmMoveTitle;
+ public static String FSDropTargetListener_MovingWarningMultiple;
+ public static String FSDropTargetListener_MovingWarningSingle;
+ public static String FSExplorerEditorPage_PageTitle;
+ public static String FSGeneralSearchable_FileType;
+ public static String FSGeneralSearchable_Find;
+ public static String FSGeneralSearchable_GeneralOptionText;
+ public static String FSGeneralSearchable_SearchHiddenFiles;
+ public static String FSGeneralSearchable_SearchSystemFiles;
+ public static String FSModifiedSearchable_DontRemember;
+ public static String FSModifiedSearchable_LastWeek;
+ public static String FSModifiedSearchable_PastMonth;
+ public static String FSModifiedSearchable_PastYear;
+ public static String FSModifiedSearchable_SpecifyDates;
+ public static String FSModifiedSearchable_ToDate;
+ public static String FSModifiedSearchable_WhenModified;
+ public static String FSUpload_Cancel;
+ public static String FSUpload_No;
+ public static String FSUpload_OverwriteConfirmation;
+ public static String FSUpload_OverwriteTitle;
+ public static String FSUpload_Yes;
+ public static String FSUpload_YesToAll;
+ 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 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 FSRename_RenameFileFolderTitle;
+ public static String FSSizeSearchable_DontRemember;
+ public static String FSSizeSearchable_KBS;
+ public static String FSSizeSearchable_Large;
+ public static String FSSizeSearchable_Medium;
+ public static String FSSizeSearchable_Small;
+ public static String FSSizeSearchable_SpecifySize;
+ public static String FSSizeSearchable_ToText;
+ public static String FSSizeSearchable_WhatSize;
+ public static String FSTreeNodeSearchable_FilesAndFolders;
+ public static String FSTreeNodeSearchable_FilesOnly;
+ public static String FSTreeNodeSearchable_FindFilesAndFolders;
+ public static String FSTreeNodeSearchable_FindMessage;
+ public static String FSTreeNodeSearchable_FoldersOnly;
+ public static String FSTreeNodeSearchable_SearchingTargets;
+ public static String FSTreeNodeSearchable_SelectedFileSystem;
+ public static String RenameFilesHandler_TitleRename;
+ public static String RenameFilesHandler_TitleRenameFile;
+ public static String RenameFilesHandler_TitleRenameFolder;
+ public static String RenameFilesHandler_PromptNewName;
+ public static String RenameFilesHandler_RenamePromptMessage;
+ public static String PreferencePage_AutoSavingText;
+ public static String PreferencePage_CopyOwnershipText;
+ public static String PreferencePage_CopyPermissionText;
+ public static String PreferencePage_PersistExpanded;
+ public static String PreferencePage_RenamingOptionText;
+ public static String AdvancedAttributesDialog_FileBanner;
+ public static String AdvancedAttributesDialog_FolderBanner;
+ public static String AdvancedAttributesDialog_CompressEncrypt;
+ public static String AdvancedAttributesDialog_ArchiveIndex;
+ public static String AdvancedAttributesDialog_IndexFile;
+ public static String AdvancedAttributesDialog_IndexFolder;
+ public static String AdvancedAttributesDialog_FileArchive;
+ public static String AdvancedAttributesDialog_FolderArchive;
+ public static String AdvancedAttributesDialog_Encrypt;
+ public static String AdvancedAttributesDialog_Compress;
+ public static String AdvancedAttributesDialog_ShellTitle;
+ public static String GeneralInformationPage_Accessed;
+ public static String GeneralInformationPage_Advanced;
+ public static String GeneralInformationPage_Attributes;
+ public static String GeneralInformationPage_Computer;
+ public static String GeneralInformationPage_FileSizeInfo;
+ 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 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 BasicFolderSection_BasicInfoText;
+ public static String LinuxPermissionsSection_Permissions;
+ public static String WindowsAttributesSection_Attributes;
+ public static String FolderValidator_DirNotExist;
+ public static String FolderValidator_NotWritable;
+ public static String FolderValidator_SpecifyFolder;
+ public static String NameValidator_InfoPrompt;
+ 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_PromptFolderLabel;
+ public static String SizeValidator_ErrorIncorrectFormat;
+ public static String SizeValidator_ErrorSizeOutofRange;
+ public static String SizeValidator_InfoPrompt;
+ public static String TargetSelectionPage_Description;
+ public static String TargetSelectionPage_Targets;
+ public static String TargetSelectionPage_Title;
+ public static String TreeViewerSearchDialog_LblCancelText;
+ public static String TreeViewerSearchDialog_GrpOptionsText;
+ public static String TreeViewerSearchDialog_BtnCaseText;
+ public static String TreeViewerSearchDialog_BtnPreciseText;
+
+ public static String ContentProvider_notConnected;
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
new file mode 100644
index 000000000..17171148a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
@@ -0,0 +1,171 @@
+###############################################################################
+# Copyright (c) 2012, 2014 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
+###############################################################################
+FSFolderSelectionDialog_MoveDialogMessage=Choose destination for the files to be moved:
+FSFolderSelectionDialog_MoveDialogTitle=Move Files and Folders
+FSFolderSelectionDialog_Refresh_menu=Refresh
+FSFolderSelectionDialog_RefreshAll_menu=Refresh All
+FSFolderSelectionDialog_validate_message=Query folder attributes...
+FSFolderSelectionDialog_notWritable_error=The selected folder is not writable.
+FSFolderSelectionDialog_notWritable_warning=The selected folder is not writable.
+
+
+FSOpenFileDialog_message=Please select an image file for the process.
+FSOpenFileDialog_title=Select Process Image
+FSDelete_ConfirmDelete=Confirm Delete
+FSDelete_ConfirmMessage=Are you sure you want to remove the read-only file ''{0}''?
+FSDelete_ButtonCancel=Cancel
+FSDelete_ButtonNo=&No
+FSDelete_ButtonYes=&Yes
+FSDelete_ButtonYes2All=Yes to &All
+DateValidator_DateInvalidNumber=The date is not a valid number.
+DateValidator_DateOutofRange=The date is a number between 1 and 31.
+DateValidator_InfoFormat=The format of the date is MM/DD/YYYY
+DateValidator_InfoPrompt=Please enter a date.
+DateValidator_InvalidDate=The date entered is not a valid date\!
+DateValidator_MonthInvalidNumber=The month is not a valid number.
+DateValidator_MonthOutofRange=The month is a number between 1 and 12.
+DateValidator_YearInvalidNumber=The year is not a valid number.
+DateValidator_YearOutofRange=The year is a number which is bigger than zero.
+DeleteFilesHandler_ConfirmDialogTitle=Confirm Delete
+DeleteFilesHandler_DeleteMultipleFilesConfirmation=Are you sure you want to delete these {0} files/folders?
+DeleteFilesHandler_DeleteOneFileConfirmation=Are you sure you want to delete ''{0}''?
+FSRenamingAssistant_NameAlreadyExists=A file/folder with the name you specified already exists\! Specify a different name.
+FSRenamingAssistant_SpecifyNonEmptyName=Specify a non-empty name.
+FSRenamingAssistant_UnixIllegalCharacters=File or folder name cannot contain any of the following characters:\n/
+FSRenamingAssistant_WinIllegalCharacters=File or folder name cannot contain any of the following characters:\n\\/:*?<>|
+LocalTypedElement_SavingFile=Saving file: {0}
+MergeEditorInput_LocalFile=Local: {0}
+MergeEditorInput_RemoteFile=Remote: {0}
+MergeEditorInput_CompareLeftAndRight=Compare {0} and {1}
+MergeEditorInput_CompareWithLocalCache=Compare {0} with Local Cache
+MergeInput_CopyNotSupported=Copy is not support by this type of compare input
+RemoteTypedElement_GettingRemoteContent=Getting content from the remote file:
+RemoteTypedElement_DowloadingFile=Downloading file {0}...
+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}''?
+FSExplorerEditorPage_PageTitle=File System Explorer
+FSGeneralSearchable_FileType=Select type of file
+FSGeneralSearchable_Find=Find:
+FSGeneralSearchable_GeneralOptionText=General options
+FSGeneralSearchable_SearchHiddenFiles=Search hidden files/folders
+FSGeneralSearchable_SearchSystemFiles=Search system files/folders
+FSModifiedSearchable_DontRemember=Don't remember
+FSModifiedSearchable_LastWeek=Within the last week
+FSModifiedSearchable_PastMonth=Past month
+FSModifiedSearchable_PastYear=Within the past year
+FSModifiedSearchable_SpecifyDates=Specify dates, from
+FSModifiedSearchable_ToDate=to
+FSModifiedSearchable_WhenModified=When was it modified?
+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_Yes=Yes
+FSUpload_YesToAll=Yes to All
+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
+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
+FSRename_RenameFileFolderTitle=Error Renaming File or Folder
+FSSizeSearchable_DontRemember=Don't remember
+FSSizeSearchable_KBS=KB(s)
+FSSizeSearchable_Large=Large (more than 1 MB)
+FSSizeSearchable_Medium=Medium (less than 1 MB)
+FSSizeSearchable_Small=Small (less than 100 KB)
+FSSizeSearchable_SpecifySize=Specify size, from
+FSSizeSearchable_ToText=KB(s) to
+FSSizeSearchable_WhatSize=What size is it?
+FSTreeNodeSearchable_FilesAndFolders=both files and folders
+FSTreeNodeSearchable_FilesOnly=files only
+FSTreeNodeSearchable_FindFilesAndFolders=Find Files
+FSTreeNodeSearchable_FindMessage=Find files and folders under {0}.\nWarning: subsidiary files and folders will be loaded and searched.
+FSTreeNodeSearchable_FoldersOnly=folders only
+FSTreeNodeSearchable_SearchingTargets=Find in
+FSTreeNodeSearchable_SelectedFileSystem=the selected file system
+RenameFilesHandler_TitleRename=Rename
+RenameFilesHandler_TitleRenameFile=Rename File
+RenameFilesHandler_TitleRenameFolder=Rename Folder
+RenameFilesHandler_PromptNewName=New name:
+RenameFilesHandler_RenamePromptMessage=Please enter a new name
+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_PersistExpanded=Remember expanded directories
+PreferencePage_RenamingOptionText=Use In-place Editor when renaming a file/folder
+AdvancedAttributesDialog_FileBanner=Choose the options you want for this file.
+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_CompressEncrypt=Compress or Encrypt attributes
+AdvancedAttributesDialog_ArchiveIndex=Archive and Index attributes
+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_FileArchive=File is ready for archiving
+AdvancedAttributesDialog_FolderArchive=Folder is ready for archiving
+AdvancedAttributesDialog_Encrypt=Encrypt contents to secure data
+AdvancedAttributesDialog_Compress=Compress contents to save disk space
+AdvancedAttributesDialog_ShellTitle=Advanced Attributes
+GeneralInformationPage_Accessed=Accessed:
+GeneralInformationPage_Advanced=\ A&dvanced...
+GeneralInformationPage_Attributes=Attributes:
+GeneralInformationPage_FileSizeInfo={0} KB ({1} bytes)
+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:
+PermissionsGroup_Executable=Executable
+PermissionsGroup_GroupPermissions=Group:
+PermissionsGroup_OtherPermissions=Other:
+PermissionsGroup_Readable=Readable
+PermissionsGroup_UserPermissions=User:
+PermissionsGroup_Writable=Writable
+BasicFolderSection_BasicInfoText=Basic Information
+LinuxPermissionsSection_Permissions=Permissions
+WindowsAttributesSection_Attributes=Attributes
+FolderValidator_SpecifyFolder=Please specify the folder where the file or folder is going to be created.
+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.
+NameValidator_InfoPrompt=Please enter a name to search.
+NameValidator_SpecifyFolder=Please specify the folder where the file or 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_PromptFolderLabel=Enter or select the parent folder:
+SizeValidator_ErrorIncorrectFormat=The format of the size entered is not correct.
+SizeValidator_ErrorSizeOutofRange=The size entered is not in the expected range.
+SizeValidator_InfoPrompt=Please enter a size number.
+TargetSelectionPage_Description=Please select the target where the new file or folder is created.
+TargetSelectionPage_Targets=Targets:
+TargetSelectionPage_Title=Select the target.
+TreeViewerSearchDialog_LblCancelText=Find:
+TreeViewerSearchDialog_GrpOptionsText=Options
+TreeViewerSearchDialog_BtnCaseText=Case sensitive
+TreeViewerSearchDialog_BtnPreciseText=Precise matching
+
+ContentProvider_notConnected=Please connect to see the filesystem on the target.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.options
deleted file mode 100644
index b39673418..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.options
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.tcf.te.ui.terminals.local/debugmode = 0
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.project b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.project
deleted file mode 100644
index f86fbb751..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals.local</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.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 24dad4464..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,362 +0,0 @@
-#Tue Oct 11 11:53:38 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.ui.terminals.local/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
deleted file mode 100644
index a389bc2fc..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,29 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.local;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin
-Bundle-Vendor: %providerName
-Import-Package: org.eclipse.cdt.utils.pty;mandatory:=native
-Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional,
- org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional,
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals.process;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.forms;bundle-version="3.5.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.local.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.local.controls,
- org.eclipse.tcf.te.ui.terminals.local.help,
- org.eclipse.tcf.te.ui.terminals.local.launcher,
- org.eclipse.tcf.te.ui.terminals.local.nls;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.local.showin,
- org.eclipse.tcf.te.ui.terminals.local.showin.interfaces,
- org.eclipse.tcf.te.ui.terminals.local.showin.preferences
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf
deleted file mode 100644
index 9bd5194fa..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf
+++ /dev/null
@@ -1,82 +0,0 @@
-###############################################################################
-# Copyright (c) 2014 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
-###############################################################################
-
-# Most of the dependencies exposed here are actually covered in the feature.xml
-# This file ensures that the current bundle has all it needs, even if installed
-# without the enclosing org.eclipse.tcf.te.terminals.feature .
-# See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=435150 .
-
-# 1. Make the optional cdt.core dependency non-greedy: Use (or update to proper
-# version!) when installed, but do not install automatically since the newer
-# org.eclipse.cdt.core.native can satisfy the dependency better. We use this
-# trick since CDT 8.3 had no version on export-package yet but we do want
-# a version constraint.
-requires.0.namespace = org.eclipse.equinox.p2.iu
-requires.0.name = org.eclipse.cdt.core
-#requires.0.range = [5.6, 6.0)
-requires.0.greedy = false
-requires.0.optional = true
-
-#requires.1.namespace = org.eclipse.equinox.p2.iu
-#requires.1.name = org.eclipse.cdt.core.native
-#requires.1.range = [5.6, 6.0)
-#requires.1.greedy = true
-#requires.1.optional = true
-
-# 2. Add the required fragments for local terminal support with proper version.
-requires.2.namespace = org.eclipse.equinox.p2.iu
-requires.2.name = org.eclipse.cdt.core.aix
-#requires.2.range = [5.3, 6.0)
-requires.2.filter = (osgi.os=aix)
-
-requires.3.namespace = org.eclipse.equinox.p2.iu
-requires.3.name = org.eclipse.cdt.core.linux
-#requires.3.range = [5.2, 6.0)
-requires.3.filter = (osgi.os=linux)
-
-requires.4.namespace = org.eclipse.equinox.p2.iu
-requires.4.name = org.eclipse.cdt.core.linux.ppc64
-#requires.4.range = [5.1, 6.0)
-requires.4.filter = (&(osgi.os=linux)(osgi.arch=ppc64))
-
-requires.5.namespace = org.eclipse.equinox.p2.iu
-requires.5.name = org.eclipse.cdt.core.linux.x86
-#requires.5.range = [5.2, 6.0)
-requires.5.filter = (&(osgi.os=linux)(osgi.arch=x86))
-
-requires.6.namespace = org.eclipse.equinox.p2.iu
-requires.6.name = org.eclipse.cdt.core.linux.x86_64
-#requires.6.range = [5.2, 6.0)
-requires.6.filter = (&(osgi.os=linux)(osgi.arch=x86_64))
-
-requires.7.namespace = org.eclipse.equinox.p2.iu
-requires.7.name = org.eclipse.cdt.core.macosx
-#requires.7.range = [5.2, 6.0)
-requires.7.filter = (osgi.os=macosx)
-
-requires.8.namespace = org.eclipse.equinox.p2.iu
-requires.8.name = org.eclipse.cdt.core.solaris
-#requires.8.range = [5.2, 6.0)
-requires.8.filter = (&(osgi.os=solaris)(osgi.arch=sparc))
-
-requires.9.namespace = org.eclipse.equinox.p2.iu
-requires.9.name = org.eclipse.cdt.core.win32
-#requires.9.range = [5.3, 6.0)
-requires.9.filter = (osgi.os=win32)
-
-requires.10.namespace = org.eclipse.equinox.p2.iu
-requires.10.name = org.eclipse.cdt.core.win32.x86
-#requires.10.range = [5.2, 6.0)
-requires.10.filter = (&(osgi.os=win32)(osgi.arch=x86))
-
-requires.11.namespace = org.eclipse.equinox.p2.iu
-requires.11.name = org.eclipse.cdt.core.win32.x86_64
-#requires.11.range = [5.2, 6.0)
-requires.11.filter = (&(osgi.os=win32)(osgi.arch=x86_64))
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties
deleted file mode 100644
index a17f48f74..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2012, 2014 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
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- plugin.properties,\
- about.html,\
- icons/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml
deleted file mode 100644
index 2dbe1516c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<contexts>
- <context id="ExternalExecutablesDialog">
- <description>Add or modify an external executable added to the 'Show In' context menu.</description>
- </context>
-</contexts>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif
deleted file mode 100644
index bbb6a9e15..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
deleted file mode 100644
index 2219f89d7..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-##################################################################################
-# Copyright (c) 2011, 2015 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, Terminals Local Connector
-providerName = Eclipse.org - Target Explorer
-
-# ----- Commands and Menu contributions -----
-LocalLauncherDelegate.label=Local Terminal
-
-command.launch.name=Open Local Terminal on Selection
-
-menu.showIn.localterminal.label = Terminals
-
-# ----- Preference Pages -----
-
-preference.page.name=Terminals
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
deleted file mode 100644
index 22e2af1c2..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminal connector contributions -->
-<!-- uses process connector -->
- <extension point="org.eclipse.tm.terminal.terminalConnectors">
- <connector
- class="org.eclipse.tcf.te.ui.terminals.process.ProcessConnector"
- hidden="true"
- id="org.eclipse.tcf.te.ui.terminals.local.LocalConnector"
- name="%TerminalConnector.local"/>
- </extension>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.ui.terminals.local.launcher.LocalLauncherDelegate"
- id="org.eclipse.tcf.te.ui.terminals.local.launcher.local"
- label="%LocalLauncherDelegate.label">
- </delegate>
- </extension>
-
-<!-- Menu contributions -->
- <extension point="org.eclipse.ui.menus">
- <!-- Project Explorer "Show In" contribution -->
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.terminals.ProjectExplorer.menu.showIn?after=additions">
- <command
- commandId="org.eclipse.tcf.te.ui.terminals.local.command.launch"
- id="org.eclipse.tcf.te.ui.terminals.local.commands.showin.launch"
- label="%menu.showIn.localterminal.label"
- style="push">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.core.resources.IResource">
- <not>
- <!-- The JDT Project Explorer contributions are adding the "Navigate -> Show In" quick menu.
- See o.e.jdt.internal.ui.navigator.JavaNavigatorActionProvider -->
- <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature" />
- </not>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <dynamic
- class="org.eclipse.tcf.te.ui.terminals.local.showin.DynamicContributionItems"
- id="org.eclipse.tcf.te.ui.terminals.local.LocalLauncherDynamicContributionItems">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.core.resources.IResource">
- <not>
- <!-- The JDT Project Explorer contributions are adding the "Navigate -> Show In" quick menu.
- See o.e.jdt.internal.ui.navigator.JavaNavigatorActionProvider -->
- <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature" />
- </not>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </dynamic>
- </menuContribution>
- </extension>
-
-<!-- Command contributions -->
- <extension point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.terminals.local.command_Launch"
- id="org.eclipse.tcf.te.ui.terminals.local.command.launch"
- name="%command.launch.name">
- </command>
- </extension>
-
- <extension point="org.eclipse.ui.commandImages">
- <image
- commandId="org.eclipse.tcf.te.ui.terminals.local.command.launch"
- icon="icons/eview16/terminal_view.gif">
- </image>
- </extension>
-
-<!-- Key bindings -->
- <extension point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.tcf.te.ui.terminals.local.command.launch"
- contextId="org.eclipse.ui.contexts.window"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="CTRL+M3+T"/> <!-- Bug 435111: Don't use M1 since COMMAND+Option T already taken on Mac -->
- </extension>
-
-<!-- Handler contributions -->
- <extension point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.tcf.te.ui.terminals.local.launcher.LocalLauncherHandler"
- commandId="org.eclipse.tcf.te.ui.terminals.local.command.launch">
- </handler>
- </extension>
-
-<!-- Preference page contributions -->
- <extension point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.tcf.te.ui.preferences.general"
- class="org.eclipse.tcf.te.ui.terminals.local.showin.preferences.PreferencePage"
- id="org.eclipse.tcf.te.ui.terminals.local.showin.preferences"
- name="%preference.page.name">
- </page>
- </extension>
-
-<!-- Preferences contributions -->
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.tcf.te.ui.terminals.local.showin.preferences.PreferencesInitializer">
- </initializer>
- </extension>
-
-<!-- Startup contributions -->
- <extension point="org.eclipse.ui.startup">
- <startup class="org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesInitializer"/>
- </extension>
-
-<!-- Help Context contributions -->
- <extension point="org.eclipse.help.contexts">
- <contexts
- file="contexts.xml">
- </contexts>
- </extension>
-
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml
deleted file mode 100644
index 144c83e1f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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>org.eclipse.tcf.maven-build</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- <relativePath>../../../admin/pom-build.xml</relativePath>
- </parent>
-
- <version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals.local</artifactId>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
deleted file mode 100644
index 80de64f1c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 - 2015 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.ui.terminals.local.activator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-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
- private static UIPlugin plugin;
- // The scoped preferences instance
- private static volatile ScopedEclipsePreferences scopedPreferences;
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * 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 plug-in.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() != null && getDefault().getBundle() != null) {
- return getDefault().getBundle().getSymbolicName();
- }
- return "org.eclipse.tcf.te.ui.terminals.local"; //$NON-NLS-1$
- }
-
- /**
- * Return the scoped preferences for this plug-in.
- */
- public static ScopedEclipsePreferences getScopedPreferences() {
- if (scopedPreferences == null) {
- scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier());
- }
- return scopedPreferences;
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- scopedPreferences = null;
- traceHandler = null;
- super.stop(context);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
- */
- @Override
- protected void initializeImageRegistry(ImageRegistry registry) {
- super.initializeImageRegistry(registry);
- }
-
- /**
- * 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
deleted file mode 100644
index 37b0b12b2..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.local.controls;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-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.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.osgi.framework.Bundle;
-
-/**
- * Serial wizard configuration panel implementation.
- */
-public class LocalWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
-
- private Object resource;
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public LocalWizardConfigurationPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- // Create the encoding selection combo
- createEncodingUI(panel, false);
-
- // Set the default encoding:
- // Default UTF-8 on Mac or Windows for Local, Preferences:Platform encoding otherwise
- if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS())) {
- setEncoding("UTF-8"); //$NON-NLS-1$
- } else {
- String encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
- if (encoding != null && !"".equals(encoding)) setEncoding(encoding); //$NON-NLS-1$
- }
-
- // Fill the rest of the panel with a label to be able to
- // set a height and width hint for the dialog
- Label label = new Label(panel, SWT.HORIZONTAL);
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.widthHint = 300;
- layoutData.heightHint = 80;
- label.setLayoutData(layoutData);
-
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- resource = getSelectionResource();
- }
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
- */
- @Override
- public void setupData(Map<String, Object> data) {
- if (data == null) return;
-
- String value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
- if (value != null) setEncoding(value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
- */
- @Override
- public void extractData(Map<String, Object> data) {
- // set the terminal connector id for local terminal
- data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
-
- // Store the encoding
- data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
-
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- // if we have a IResource selection use the location for working directory
- if (resource instanceof org.eclipse.core.resources.IResource){
- String dir = ((org.eclipse.core.resources.IResource)resource).getProject().getLocation().toString();
- data.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
- */
- @Override
- protected void fillSettingsForHost(String host){
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
- */
- @Override
- protected void saveSettingsForHost(boolean add){
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid(){
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- // Save the encodings widget values
- doSaveEncodingsWidgetValues(settings, idPrefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- // Restore the encodings widget values
- doRestoreEncodingsWidgetValues(settings, idPrefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
- */
- @Override
- protected String getHostFromSettings() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isWithHostList()
- */
- @Override
- public boolean isWithHostList() {
- return false;
- }
-
- /**
- * Returns the IResource from the current selection
- *
- * @return the IResource, or <code>null</code>.
- */
- private org.eclipse.core.resources.IResource getSelectionResource() {
- ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
- ISelection selection = selectionService != null ? selectionService.getSelection() : StructuredSelection.EMPTY;
-
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof org.eclipse.core.resources.IResource){
- return ((org.eclipse.core.resources.IResource)element);
- }
- if (element instanceof IAdaptable) {
- return (org.eclipse.core.resources.IResource) ((IAdaptable) element).getAdapter(org.eclipse.core.resources.IResource.class);
- }
- }
- return null;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
deleted file mode 100644
index a6b30a607..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.local.launcher;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.local.controls.LocalWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
-import org.eclipse.tcf.te.ui.terminals.process.ProcessSettings;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.osgi.framework.Bundle;
-
-/**
- * Serial launcher delegate implementation.
- */
-@SuppressWarnings("restriction")
-public class LocalLauncherDelegate extends AbstractLauncherDelegate {
-
- private final IMementoHandler mementoHandler = new LocalMementoHandler();
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
- */
- @Override
- public boolean needsUserConfiguration() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
- */
- @Override
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
- return new LocalWizardConfigurationPanel(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void execute(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- // Set the terminal tab title
- String terminalTitle = getTerminalTitle(properties);
- if (terminalTitle != null) {
- properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
- }
-
- // If not configured, set the default encodings for the local terminal
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_ENCODING)) {
- String encoding = null;
- // Set the default encoding:
- // Default UTF-8 on Mac or Windows for Local, Preferences:Platform encoding otherwise
- if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS())) {
- encoding = "UTF-8"; //$NON-NLS-1$
- } else {
- encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
- }
- if (encoding != null && !"".equals(encoding)) properties.put(ITerminalsConnectorConstants.PROP_ENCODING, encoding); //$NON-NLS-1$
- }
-
- // For local terminals, force a new terminal tab each time it is launched,
- // if not set otherwise from outside
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) {
- properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
- }
-
- // Initialize the local terminal working directory.
- // By default, start the local terminal in the users home directory
- String initialCwd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD);
- String cwd = null;
- if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$
- cwd = System.getProperty("user.home"); //$NON-NLS-1$
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) {
- String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$
- if (eclipseHomeLocation != null) {
- try {
- URI uri = URIUtil.fromString(eclipseHomeLocation);
- File f = URIUtil.toFile(uri);
- cwd = f.getAbsolutePath();
- } catch (URISyntaxException ex) { /* ignored on purpose */ }
- }
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
- && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
- && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- cwd = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
- }
- }
- } else {
- IPath p = new Path(initialCwd);
- if (p.toFile().canRead() && p.toFile().isDirectory()) {
- cwd = p.toOSString();
- }
- }
-
- if (cwd != null && !"".equals(cwd)) { //$NON-NLS-1$
- properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, cwd);
- }
-
- // If the current selection resolved to an folder, default the working directory
- // to that folder and update the terminal title
- ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
- if ((service != null && service.getSelection() != null) || properties.containsKey(ITerminalsConnectorConstants.PROP_SELECTION)) {
- ISelection selection = (ISelection)properties.get(ITerminalsConnectorConstants.PROP_SELECTION);
- if (selection == null) selection = service.getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- String dir = null;
- Iterator<?> iter = ((IStructuredSelection)selection).iterator();
- while (iter.hasNext()) {
- Object element = iter.next();
-
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- // If the element is not an IResource, try to adapt to IResource
- if (!(element instanceof org.eclipse.core.resources.IResource)) {
- Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null;
- if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, org.eclipse.core.resources.IResource.class);
- if (adapted != null) element = adapted;
- }
-
- if (element instanceof org.eclipse.core.resources.IResource && ((org.eclipse.core.resources.IResource)element).exists()) {
- IPath location = ((org.eclipse.core.resources.IResource)element).getLocation();
- if (location == null) continue;
- if (location.toFile().isFile()) location = location.removeLastSegments(1);
- if (location.toFile().isDirectory() && location.toFile().canRead()) {
- dir = location.toFile().getAbsolutePath();
- break;
- }
- }
- }
- }
- if (dir != null) {
- properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
-
- String basename = new Path(dir).lastSegment();
- properties.put(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- // Get the terminal service
- ITerminalService terminal = TerminalServiceFactory.getService();
- // If not available, we cannot fulfill this request
- if (terminal != null) {
- terminal.openConsole(properties, done);
- }
- }
-
- /**
- * Returns the terminal title string.
- * <p>
- * The default implementation constructs a title like &quot;Serial &lt;port&gt; (Start time) &quot;.
- *
- * @return The terminal title string or <code>null</code>.
- */
- private String getTerminalTitle(Map<String, Object> properties) {
- try {
- String hostname = InetAddress.getLocalHost().getHostName();
- if (hostname != null && !"".equals(hostname.trim())) { //$NON-NLS-1$
- return hostname;
- }
- } catch (UnknownHostException e) { /* ignored on purpose */ }
- return "Local"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (IMementoHandler.class.equals(adapter)) {
- return mementoHandler;
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * Returns the default shell to launch. Looks at the environment
- * variable "SHELL" first before assuming some default default values.
- *
- * @return The default shell to launch.
- */
- private final File defaultShell() {
- String shell = null;
- if (Platform.OS_WIN32.equals(Platform.getOS())) {
- if (System.getenv("ComSpec") != null && !"".equals(System.getenv("ComSpec").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- shell = System.getenv("ComSpec").trim(); //$NON-NLS-1$
- } else {
- shell = "cmd.exe"; //$NON-NLS-1$
- }
- }
- if (shell == null) {
- if (System.getenv("SHELL") != null && !"".equals(System.getenv("SHELL").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- shell = System.getenv("SHELL").trim(); //$NON-NLS-1$
- } else {
- shell = "/bin/sh"; //$NON-NLS-1$
- }
- }
-
- return new File(shell);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
- */
- @Override
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"; //$NON-NLS-1$
-
- // Extract the process properties using defaults
- String image;
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_PATH)
- || properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) {
- File defaultShell = defaultShell();
- image = defaultShell.isAbsolute() ? defaultShell.getAbsolutePath() : defaultShell.getPath();
- } else {
- image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
- }
-
- // Determine if a PTY will be used
- boolean isUsingPTY = (properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ) == null && PTY.isSupported(PTY.Mode.TERMINAL))
- || properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ) instanceof PTY;
-
- boolean localEcho = false;
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)
- || !(properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) instanceof Boolean)) {
- // On Windows, turn on local echo by default if no PTY is used (bug 433645)
- if (Platform.OS_WIN32.equals(Platform.getOS())) {
- localEcho = !isUsingPTY;
- }
- } else {
- localEcho = ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)).booleanValue();
- }
-
- String lineSeparator = null;
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR)
- || !(properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) instanceof String)) {
- // No line separator will be set if a PTY is used
- if (!isUsingPTY) {
- lineSeparator = Platform.OS_WIN32.equals(Platform.getOS()) ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF;
- }
- } else {
- lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
- }
-
- String arguments = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
- Process process = (Process)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
- PTY pty = (PTY)properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
- String workingDir = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
-
- String[] envp = null;
- if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) &&
- properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
- properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
- envp = (String[])properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT);
- }
-
- // Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables
- List<String> envpList = new ArrayList<String>();
- if (envp != null) envpList.addAll(Arrays.asList(envp));
-
- // ECLIPSE_HOME
- String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$
- if (eclipseHomeLocation != null) {
- try {
- URI uri = URIUtil.fromString(eclipseHomeLocation);
- File f = URIUtil.toFile(uri);
- envpList.add("ECLIPSE_HOME=" + f.getAbsolutePath()); //$NON-NLS-1$
- } catch (URISyntaxException e) { /* ignored on purpose */ }
- }
-
- // ECLIPSE_WORKSPACE
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
- && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
- && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- envpList.add("ECLIPSE_WORKSPACE=" + org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$
- }
- }
-
- // Convert back into a string array
- envp = envpList.toArray(new String[envpList.size()]);
-
- Assert.isTrue(image != null || process != null);
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the process settings
- ProcessSettings processSettings = new ProcessSettings();
- processSettings.setImage(image);
- processSettings.setArguments(arguments);
- processSettings.setProcess(process);
- processSettings.setPTY(pty);
- processSettings.setLocalEcho(localEcho);
- processSettings.setLineSeparator(lineSeparator);
- processSettings.setStdOutListeners(stdoutListeners);
- processSettings.setStdErrListeners(stderrListeners);
- processSettings.setWorkingDir(workingDir);
- processSettings.setEnvironment(envp);
-
- if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) {
- Object value = properties.get(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT);
- processSettings.setMergeWithNativeEnvironment(value instanceof Boolean ? ((Boolean)value).booleanValue() : false);
- }
-
- // And save the settings to the store
- processSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
deleted file mode 100644
index 00525774d..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.local.launcher;
-
-import java.util.HashMap;
-import java.util.Map;
-
-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.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Local terminal launcher handler implementation.
- */
-public class LocalLauncherHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // Get the current selection
- ISelection selection = HandlerUtil.getCurrentSelection(event);
-
- // Get all applicable launcher delegates for the current selection
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
- // Find the local terminal launcher delegate
- ILauncherDelegate delegate = null;
- for (ILauncherDelegate candidate : delegates) {
- if ("org.eclipse.tcf.te.ui.terminals.local.launcher.local".equals(candidate.getId())) { //$NON-NLS-1$
- delegate = candidate;
- break;
- }
- }
-
- // Launch the local terminal
- if (delegate != null) {
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
-
- delegate.execute(properties, null);
- }
-
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
deleted file mode 100644
index f4cbb513e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.local.launcher;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.ui.IMemento;
-
-/**
- * SSH terminal connection memento handler implementation.
- */
-public class LocalMementoHandler implements IMementoHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void saveState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void restoreState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
deleted file mode 100644
index 5052f96cf..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2015 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.ui.terminals.local.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Process terminal connector 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.ui.terminals.local.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String ProcessConnector_error_creatingProcess;
-
- public static String PreferencePage_label;
- public static String PreferencePage_executables_label;
- public static String PreferencePage_executables_column_name_label;
- public static String PreferencePage_executables_column_path_label;
- public static String PreferencePage_executables_button_add_label;
- public static String PreferencePage_executables_button_edit_label;
- public static String PreferencePage_executables_button_remove_label;
- public static String PreferencePage_workingDir_label;
- public static String PreferencePage_workingDir_userhome_label;
- public static String PreferencePage_workingDir_eclipsehome_label;
- public static String PreferencePage_workingDir_eclipsews_label;
- public static String PreferencePage_workingDir_button_browse;
- public static String PreferencePage_workingDir_note_label;
- public static String PreferencePage_workingDir_note_text;
-
- public static String ExternalExecutablesDialog_title_add;
- public static String ExternalExecutablesDialog_title_edit;
- public static String ExternalExecutablesDialog_button_add;
- public static String ExternalExecutablesDialog_button_browse;
- public static String ExternalExecutablesDialog_field_path;
- public static String ExternalExecutablesDialog_field_name;
- public static String ExternalExecutablesDialog_field_args;
- public static String ExternalExecutablesDialog_field_icon;
- public static String ExternalExecutablesDialog_field_translate;
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
deleted file mode 100644
index 626196402..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-###############################################################################
-# Copyright (c) 2012 - 2015 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
-###############################################################################
-
-ProcessConnector_error_creatingProcess=Exception when creating process. Possibly caused by: {0}
-
-ExternalExecutablesDialog_title_add=Add External Executable
-ExternalExecutablesDialog_title_edit=Edit External Executable
-ExternalExecutablesDialog_button_add=Add
-ExternalExecutablesDialog_button_browse=Browse...
-ExternalExecutablesDialog_field_path=Path:
-ExternalExecutablesDialog_field_name=Name:
-ExternalExecutablesDialog_field_args=Arguments:
-ExternalExecutablesDialog_field_icon=Icon:
-ExternalExecutablesDialog_field_translate=Translate Backslashes on Paste
-
-# ***** Preference Pages *****
-
-PreferencePage_label=General settings for Terminals:
-PreferencePage_executables_label="Show In ..." Custom Entries
-PreferencePage_executables_column_name_label=Name
-PreferencePage_executables_column_path_label=Path
-PreferencePage_executables_button_add_label=Add...
-PreferencePage_executables_button_edit_label=Edit...
-PreferencePage_executables_button_remove_label=Remove
-PreferencePage_workingDir_label=Local Terminal Initial Working Directory
-PreferencePage_workingDir_userhome_label=User home
-PreferencePage_workingDir_eclipsehome_label=Eclipse home
-PreferencePage_workingDir_eclipsews_label=Eclipse workspace
-PreferencePage_workingDir_button_browse=Browse...
-PreferencePage_workingDir_note_label=Note:
-PreferencePage_workingDir_note_text=The chosen initial working directory might be overwritten by the current selection of the active view.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
deleted file mode 100644
index 6be5842e9..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.local.showin;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.menus.IWorkbenchContribution;
-import org.eclipse.ui.services.IServiceLocator;
-
-/**
- * Dynamic "Show In" contribution items implementation.
- */
-public class DynamicContributionItems extends CompoundContributionItem implements IWorkbenchContribution {
- // Service locator to located the handler service.
- protected IServiceLocator serviceLocator;
- // Reference to the local terminal launcher delegate
- /* default */ ILauncherDelegate delegate;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
- */
- @Override
- public void initialize(IServiceLocator serviceLocator) {
- this.serviceLocator = serviceLocator;
-
- // Get the local terminal launcher delegate
- delegate = LauncherDelegateManager.getInstance().getLauncherDelegate("org.eclipse.tcf.te.ui.terminals.local.launcher.local", false); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
- */
- @Override
- protected IContributionItem[] getContributionItems() {
- List<IContributionItem> items = new ArrayList<IContributionItem>();
-
- if (delegate != null) {
- List<Map<String, String>> l = ExternalExecutablesManager.load();
- if (l != null && !l.isEmpty()) {
- for (Map<String, String> executableData : l) {
- String name = executableData.get(IExternalExecutablesProperties.PROP_NAME);
- String path = executableData.get(IExternalExecutablesProperties.PROP_PATH);
- String args = executableData.get(IExternalExecutablesProperties.PROP_ARGS);
- String icon = executableData.get(IExternalExecutablesProperties.PROP_ICON);
-
- String strTranslate = executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
- boolean translate = strTranslate != null ? Boolean.parseBoolean(strTranslate) : false;
-
- if (name != null && !"".equals(name) && path != null && !"".equals(path)) { //$NON-NLS-1$ //$NON-NLS-2$
- IAction action = createAction(name, path, args, translate);
-
- ImageData id = icon != null ? ExternalExecutablesManager.loadImage(icon) : null;
- if (id != null) {
- ImageDescriptor desc = ImageDescriptor.createFromImageData(id);
- if (desc != null) action.setImageDescriptor(desc);
- }
-
- IContributionItem item = new ActionContributionItem(action);
- items.add(item);
- }
- }
- }
- }
-
- return items.toArray(new IContributionItem[items.size()]);
- }
-
- /**
- * Creates the action to execute.
- *
- * @param label The label. Must not be <code>null</code>.
- * @param path The executable path. Must not be <code>null</code>.
- * @param args The executable arguments or <code>null</code>.
- * @param translate Translate backslashes.
- *
- * @return The action to execute.
- */
- protected IAction createAction(final String label, final String path, final String args, final boolean translate) {
- Assert.isNotNull(label);
- Assert.isNotNull(path);
-
- IAction action = new Action(label) {
- @Override
- public void run() {
- Assert.isNotNull(delegate);
-
- ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
- ISelection selection = service != null ? service.getSelection() : null;
- if (selection != null && selection.isEmpty()) selection = null;
-
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- if (selection != null) properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
- properties.put(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path);
- if (args != null) properties.put(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args);
- properties.put(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, Boolean.valueOf(translate));
-
- delegate.execute(properties, null);
- }
- };
-
- return action;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
deleted file mode 100644
index 99aa5b100..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.local.showin;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.ui.terminals.local.help.IContextHelpIds;
-import org.eclipse.tcf.te.ui.terminals.local.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
-import org.eclipse.ui.PlatformUI;
-import org.osgi.framework.Bundle;
-
-/**
- * External executables dialog implementation.
- */
-public class ExternalExecutablesDialog extends TrayDialog {
- private String contextHelpId = null;
- private final boolean edit;
-
- private Text name;
- /* default */ Text path;
- private Text args;
- /* default */ Text icon;
- private Button translate;
-
- /* default */ String last_filter_path = null;
- /* default */ String last_filter_icon = null;
-
- private Map<String, String> executableData;
-
- /**
- * Constructor.
- *
- * @param shell The parent shell or <code>null</code>.
- */
- public ExternalExecutablesDialog(Shell shell, boolean edit) {
- super(shell);
- this.edit = edit;
-
- this.contextHelpId = IContextHelpIds.EXTERNAL_EXECUTABLES_DIALOG;
- setHelpAvailable(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected final Control createDialogArea(Composite parent) {
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId);
- }
-
- // Let the super implementation create the dialog area control
- Control control = super.createDialogArea(parent);
- // Setup the inner panel as scrollable composite
- if (control instanceof Composite) {
- ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL);
-
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0; layout.marginWidth = 0;
- layout.verticalSpacing = 0; layout.horizontalSpacing = 0;
-
- sc.setLayout(layout);
- sc.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- Composite composite = new Composite(sc, SWT.NONE);
- composite.setLayout(new GridLayout());
-
- // Setup the dialog area content
- createDialogAreaContent(composite);
-
- sc.setContent(composite);
- sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- // Return the scrolled composite as new dialog area control
- control = sc;
- }
-
- return control;
- }
-
- /**
- * Creates the dialog area content.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- */
- protected void createDialogAreaContent(Composite parent) {
- Assert.isNotNull(parent);
-
- setDialogTitle(edit ? Messages.ExternalExecutablesDialog_title_edit : Messages.ExternalExecutablesDialog_title_add);
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);
- layoutData.widthHint = convertWidthInCharsToPixels(50);
- panel.setLayoutData(layoutData);
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ExternalExecutablesDialog_field_name);
- layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- label.setLayoutData(layoutData);
-
- name = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = convertWidthInCharsToPixels(30);
- name.setLayoutData(layoutData);
- name.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
- }
- });
-
- label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ExternalExecutablesDialog_field_path);
- layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- label.setLayoutData(layoutData);
-
- Composite panel2 = new Composite(panel, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel2.setLayout(layout);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- panel2.setLayoutData(layoutData);
-
- path = new Text(panel2, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = convertWidthInCharsToPixels(30);
- path.setLayoutData(layoutData);
- path.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
- }
- });
-
- Button button = new Button(panel2, SWT.PUSH);
- button.setText(Messages.ExternalExecutablesDialog_button_browse);
- layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- layoutData.widthHint = convertWidthInCharsToPixels(10);
- button.setLayoutData(layoutData);
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
-
- String selectedFile = path.getText();
- if (selectedFile != null && selectedFile.trim().length() > 0) {
- IPath filePath = new Path(selectedFile);
- // If the selected file points to an directory, use the directory as is
- IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1);
- while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) {
- filterPath = filterPath.removeLastSegments(1);
- }
- String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment();
-
- if (filterPath != null && !filterPath.isEmpty()) dialog.setFilterPath(filterPath.toString());
- if (filterFileName != null) dialog.setFileName(filterFileName);
- } else {
- String workspace = null;
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
- }
-
- String filterPath = last_filter_path != null ? last_filter_path : workspace;
- dialog.setFilterPath(filterPath);
- }
-
- selectedFile = dialog.open();
- if (selectedFile != null) {
- last_filter_path = dialog.getFilterPath();
- path.setText(selectedFile);
- }
- }
- });
-
- label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ExternalExecutablesDialog_field_args);
- layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- label.setLayoutData(layoutData);
-
- args = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = convertWidthInCharsToPixels(30);
- args.setLayoutData(layoutData);
- args.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
- }
- });
-
- label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ExternalExecutablesDialog_field_icon);
- layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- label.setLayoutData(layoutData);
-
- panel2 = new Composite(panel, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel2.setLayout(layout);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- panel2.setLayoutData(layoutData);
-
- icon = new Text(panel2, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = convertWidthInCharsToPixels(30);
- icon.setLayoutData(layoutData);
- icon.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
- }
- });
-
- button = new Button(panel2, SWT.PUSH);
- button.setText(Messages.ExternalExecutablesDialog_button_browse);
- layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- layoutData.widthHint = convertWidthInCharsToPixels(10);
- button.setLayoutData(layoutData);
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
-
- String selectedFile = icon.getText();
- if (selectedFile != null && selectedFile.trim().length() > 0) {
- IPath filePath = new Path(selectedFile);
- // If the selected file points to an directory, use the directory as is
- IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1);
- while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) {
- filterPath = filterPath.removeLastSegments(1);
- }
- String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment();
-
- if (filterPath != null && !filterPath.isEmpty()) dialog.setFilterPath(filterPath.toString());
- if (filterFileName != null) dialog.setFileName(filterFileName);
- } else {
- String workspace = null;
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
- }
-
- String filterPath = last_filter_icon != null ? last_filter_icon : workspace;
- dialog.setFilterPath(filterPath);
- }
-
- selectedFile = dialog.open();
- if (selectedFile != null) {
- last_filter_icon = dialog.getFilterPath();
- icon.setText(selectedFile);
- }
- }
- });
-
- translate = new Button(panel, SWT.CHECK);
- translate.setText(Messages.ExternalExecutablesDialog_field_translate);
- layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
- layoutData.horizontalSpan = 2;
- translate.setLayoutData(layoutData);
- translate.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- validate();
- }
- });
-
- if (executableData != null) {
- String value = executableData.get(IExternalExecutablesProperties.PROP_NAME);
- name.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = executableData.get(IExternalExecutablesProperties.PROP_PATH);
- path.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = executableData.get(IExternalExecutablesProperties.PROP_ARGS);
- args.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = executableData.get(IExternalExecutablesProperties.PROP_ICON);
- icon.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
- translate.setSelection(value != null ? Boolean.parseBoolean(value) : false);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createButtonBar(Composite parent) {
- Control control = super.createButtonBar(parent);
- validate();
- return control;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean)
- */
- @Override
- protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
- if (IDialogConstants.OK_ID == id && !edit) {
- label = Messages.ExternalExecutablesDialog_button_add;
- }
- return super.createButton(parent, id, label, defaultButton);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#okPressed()
- */
- @Override
- protected void okPressed() {
- if (name != null && path != null) {
- // Extract the executable properties
- if (executableData == null) executableData = new HashMap<String, String>();
-
- String value = name.getText();
- if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
- executableData.put(IExternalExecutablesProperties.PROP_NAME, value);
- } else {
- executableData.remove(IExternalExecutablesProperties.PROP_NAME);
- }
-
- value = path.getText();
- if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
- executableData.put(IExternalExecutablesProperties.PROP_PATH, value);
- } else {
- executableData.remove(IExternalExecutablesProperties.PROP_PATH);
- }
-
- value = args.getText();
- if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
- executableData.put(IExternalExecutablesProperties.PROP_ARGS, value);
- } else {
- executableData.remove(IExternalExecutablesProperties.PROP_ARGS);
- }
-
- value = icon.getText();
- if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
- executableData.put(IExternalExecutablesProperties.PROP_ICON, value);
- } else {
- executableData.remove(IExternalExecutablesProperties.PROP_ICON);
- }
-
- if (translate.getSelection()) {
- executableData.put(IExternalExecutablesProperties.PROP_TRANSLATE, Boolean.TRUE.toString());
- } else {
- executableData.remove(IExternalExecutablesProperties.PROP_TRANSLATE);
- }
- } else {
- executableData = null;
- }
- super.okPressed();
- }
-
- @Override
- protected void cancelPressed() {
- // If the user pressed cancel, the dialog needs to return null
- executableData = null;
- super.cancelPressed();
- }
-
- /**
- * Returns the executable properties the user entered.
- *
- * @return The executable properties or <code>null</code>.
- */
- public Map<String, String> getExecutableData() {
- return executableData;
- }
-
- /**
- * Set or reset the executable properties. This method has effect
- * only if called before opening the dialog.
- *
- * @param data The executable properties or <code>null</code>.
- */
- public void setExecutableData(Map<String, String> data) {
- if (data == null) {
- executableData = data;
- } else {
- executableData = new HashMap<String, String>(data);
- }
- }
-
- /**
- * Validate the dialog.
- */
- public void validate() {
- boolean valid = true;
-
- if (name != null && !name.isDisposed()) {
- valid = !"".equals(name.getText()); //$NON-NLS-1$
- }
-
- if (path != null && !path.isDisposed()) {
- String value = path.getText();
- if (!"".equals(value)) { //$NON-NLS-1$
- File f = new File(value);
- valid |= f.isAbsolute() && f.canRead();
- } else {
- valid = false;
- }
- }
-
- if (icon != null && !icon.isDisposed()) {
- String value = icon.getText();
- if (!"".equals(value)) { //$NON-NLS-1$
- File f = new File(value);
- valid |= f.isAbsolute() && f.canRead();
- }
- }
-
- Button okButton = getButton(IDialogConstants.OK_ID);
- if (okButton != null) okButton.setEnabled(valid);
- }
-
- /**
- * Sets the title for this dialog.
- *
- * @param title The title.
- */
- public void setDialogTitle(String title) {
- if (getShell() != null && !getShell().isDisposed()) {
- getShell().setText(title);
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java
deleted file mode 100644
index 1bcca4a52..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.local.showin;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
-import org.eclipse.ui.IStartup;
-
-/**
- * External executables data initializer.
- */
-public class ExternalExecutablesInitializer implements IStartup {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IStartup#earlyStartup()
- */
- @Override
- public void earlyStartup() {
- // On Windows, initialize the "Git Bash" custom "Show In" menu entry
- if (Platform.OS_WIN32.equals(Platform.getOS())) {
- String gitPath = null;
- String iconPath = null;
-
- String path = System.getenv("PATH"); //$NON-NLS-1$
- if (path != null) {
- StringTokenizer tokenizer = new StringTokenizer(path, ";"); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- File f = new File(token, "git.exe"); //$NON-NLS-1$
- if (f.canRead()) {
- File f2 = new File(f.getParentFile().getParentFile(), "bin/sh.exe"); //$NON-NLS-1$
- if (f2.canExecute()) {
- gitPath = f2.getAbsolutePath();
- }
-
- f2 = new File(f.getParentFile().getParentFile(), "etc/git.ico"); //$NON-NLS-1$
- if (f2.canRead()) {
- iconPath = f2.getAbsolutePath();
- }
-
- break;
- }
- }
- }
-
- if (gitPath != null) {
- // Load the configured external executables
- List<Map<String, String>> l = ExternalExecutablesManager.load();
- if (l == null) l = new ArrayList<Map<String, String>>();
- // Find a entry labeled "Git Bash"
- Map<String, String> m = null;
- for (Map<String, String> candidate : l) {
- String name = candidate.get(IExternalExecutablesProperties.PROP_NAME);
- if ("Git Bash".equals(name)) { //$NON-NLS-1$
- m = candidate;
- break;
- }
- }
-
- if (m == null) {
- m = new HashMap<String, String>();
- m.put(IExternalExecutablesProperties.PROP_NAME, "Git Bash"); //$NON-NLS-1$
- m.put(IExternalExecutablesProperties.PROP_PATH, gitPath);
- m.put(IExternalExecutablesProperties.PROP_ARGS, "--login -i"); //$NON-NLS-1$
- if (iconPath != null) m.put(IExternalExecutablesProperties.PROP_ICON, iconPath);
- m.put(IExternalExecutablesProperties.PROP_TRANSLATE, Boolean.TRUE.toString());
-
- l.add(m);
- ExternalExecutablesManager.save(l);
- }
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
deleted file mode 100644
index 1e797d92f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.local.showin;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
-import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
-
-/**
- * External executables manager implementation.
- */
-public class ExternalExecutablesManager {
-
- /**
- * Loads the list of all saved external executables.
- *
- * @return The list of all saved external executables or <code>null</code>.
- */
- public static List<Map<String, String>> load() {
- List<Map<String, String>> l = new ArrayList<Map<String, String>>();
-
- IPath stateLocation = UIPlugin.getDefault().getStateLocation();
- if (stateLocation != null) {
- File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$
- if (f.canRead()) {
- FileReader r = null;
-
- try {
- Properties data = new Properties();
- r= new FileReader(f);
- data.load(r);
-
- Map<Integer, Map<String, String>> c = new HashMap<Integer, Map<String, String>>();
- for (String name : data.stringPropertyNames()) {
- if (name == null || name.indexOf('.') == -1) continue;
- int ix = name.indexOf('.');
- String n = name.substring(0, ix);
- String k = (ix + 1) < name.length() ? name.substring(ix + 1) : null;
- if (n == null || k == null) continue;
-
- Integer i = null;
- try { i = Integer.decode(n); } catch (NumberFormatException e) { /* ignored on purpose */ }
- if (i == null) continue;
-
- Map<String, String> m = c.get(i);
- if (m == null) {
- m = new HashMap<String, String>();
- c.put(i, m);
- }
- Assert.isNotNull(m);
-
- m.put(k, data.getProperty(name));
- }
-
- List<Integer> k = new ArrayList<Integer>(c.keySet());
- Collections.sort(k);
- for (Integer i : k) {
- Map<String, String> m = c.get(i);
- if (m != null && !m.isEmpty()) l.add(m);
- }
- } catch (Exception e) {
- if (Platform.inDebugMode()) {
- e.printStackTrace();
- }
- } finally {
- if (r != null) try { r.close(); } catch (IOException e) { /* ignored on purpose */ }
- }
- }
- }
-
- return l;
- }
-
- /**
- * Saves the list of external executables.
- *
- * @param l The list of external executables or <code>null</code>.
- */
- public static void save(List<Map<String, String>> l) {
- IPath stateLocation = UIPlugin.getDefault().getStateLocation();
- if (stateLocation != null) {
- File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$
- if (f.isFile() && (l == null || l.isEmpty())) {
- @SuppressWarnings("unused")
- boolean s = f.delete();
- } else {
- FileWriter w = null;
-
- try {
- Properties data = new Properties();
- for (int i = 0; i < l.size(); i++) {
- Map<String, String> m = l.get(i);
- for (Entry<String, String> e : m.entrySet()) {
- String key = Integer.toString(i) + "." + e.getKey(); //$NON-NLS-1$
- data.setProperty(key, e.getValue());
- }
- }
-
- if (!f.exists()) {
- @SuppressWarnings("unused")
- boolean s = f.getParentFile().mkdirs();
- s = f.createNewFile();
- }
- w = new FileWriter(f);
- data.store(w, null);
- } catch (Exception e) {
- if (Platform.inDebugMode()) {
- e.printStackTrace();
- }
- } finally {
- if (w != null) {
- try {
- w.flush();
- w.close();
- } catch (IOException e) {
- /* ignored on purpose */
- }
- }
- }
- }
- }
- }
-
- /**
- * Loads the image data suitable for showing an icon in a menu
- * (16 x 16, 8bit depth) from the given file.
- *
- * @param path The image file path. Must not be <code>null</code>.
- * @return The image data or <code>null</code>.
- */
- public static ImageData loadImage(String path) {
- Assert.isNotNull(path);
-
- ImageData id = null;
-
- ImageLoader loader = new ImageLoader();
- ImageData[] data = loader.load(path);
-
- if (data != null) {
- for (ImageData d : data) {
- if (d.height == 16 && d.width == 16) {
- if (id == null || id.height != 16 && id.width != 16) {
- id = d;
- } else if (d.depth < id.depth && d.depth >= 8){
- id = d;
- }
- } else {
- if (id == null) {
- id = d;
- } else if (id.height != 16 && d.height < id.height && id.width != 16 && d.width < id.width) {
- id = d;
- }
- }
- }
- }
-
- return id;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java
deleted file mode 100644
index daf625d04..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.ui.terminals.local.showin.interfaces;
-
-/**
- * External executables data property names.
- */
-public interface IExternalExecutablesProperties {
-
- /**
- * The name/label of the external executable.
- */
- public final String PROP_NAME = "Name"; //$NON-NLS-1$
-
- /**
- * The absolute path of the external executable.
- */
- public final String PROP_PATH = "Path"; //$NON-NLS-1$
-
- /**
- * The arguments to pass to the external executable.
- */
- public final String PROP_ARGS = "Args"; //$NON-NLS-1$
-
- /**
- * The absolute path to the icon representing the external executable.
- */
- public final String PROP_ICON = "Icon"; //$NON-NLS-1$
-
- /**
- * If set, backslashes are translated to forward slashes on paste.
- */
- public final String PROP_TRANSLATE = "Translate"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java
deleted file mode 100644
index 6bf6c3444..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.local.showin.interfaces;
-
-/**
- * Terminals plug-in preference key definitions.
- */
-public interface IPreferenceKeys {
- /**
- * Preference keys family prefix.
- */
- public final String PREF_TERMINAL = "terminals"; //$NON-NLS-1$
-
- /**
- * Preference key: Remove terminated terminals when a new terminal is created.
- */
- public final String PREF_LOCAL_TERMINAL_INITIAL_CWD = PREF_TERMINAL + ".localTerminalInitialCwd"; //$NON-NLS-1$
-
- /**
- * Preference value: Local terminal initial working directory is "User home"
- */
- public final String PREF_INITIAL_CWD_USER_HOME = "userhome"; //$NON-NLS-1$
-
- /**
- * Preference value: Local terminal initial working directory is "Eclipse home"
- */
- public final String PREF_INITIAL_CWD_ECLIPSE_HOME = "eclipsehome"; //$NON-NLS-1$
-
- /**
- * Preference value: Local terminal initial working directory is "Eclipse workspace"
- */
- public final String PREF_INITIAL_CWD_ECLIPSE_WS = "eclipsews"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
deleted file mode 100644
index 9b4470a86..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 - 2015 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.ui.terminals.local.showin.preferences;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.te.ui.terminals.controls.NoteCompositeHelper;
-import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.local.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesDialog;
-import org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesManager;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.osgi.framework.Bundle;
-
-/**
- * Terminals top preference page implementation.
- */
-public class PreferencePage extends org.eclipse.jface.preference.PreferencePage implements IWorkbenchPreferencePage {
- /* default */ TableViewer viewer;
- private Button addButton;
- private Button editButton;
- private Button removeButton;
- /* default */ Combo workingDir;
- private Button browseButton;
-
- /* default */ final List<Map<String, String>> executables = new ArrayList<Map<String, String>>();
- /* default */ final Map<String, Image> images = new HashMap<String, Image>();
-
- /* default */ static final Object[] NO_ELEMENTS = new Object[0];
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- @Override
- public void init(IWorkbench workbench) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(final Composite parent) {
- final GC gc = new GC(parent);
- gc.setFont(JFaceResources.getDialogFont());
-
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- panel.setLayoutData(layoutData);
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.PreferencePage_label);
- label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- Group group = new Group(panel, SWT.NONE);
- group.setText(Messages.PreferencePage_workingDir_label);
- group.setLayout(new GridLayout(2, false));
- group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
-
- workingDir = new Combo(group, SWT.DROP_DOWN);
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label, Messages.PreferencePage_workingDir_eclipsews_label });
- } else {
- workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label });
- }
- workingDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- workingDir.select(0);
-
- browseButton = new Button(group, SWT.PUSH);
- browseButton.setText(Messages.PreferencePage_workingDir_button_browse);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
- layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
- browseButton.setLayoutData(layoutData);
- browseButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPath uh = null;
- IPath eh = null;
- IPath ew = null;
-
- // HOME
- String home = System.getProperty("user.home"); //$NON-NLS-1$
- if (home != null && !"".equals(home)) uh = new Path(home); //$NON-NLS-1$
-
- // ECLIPSE_HOME
- String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$
- if (eclipseHomeLocation != null) {
- try {
- URI uri = URIUtil.fromString(eclipseHomeLocation);
- File f = URIUtil.toFile(uri);
- eh = new Path(f.getAbsolutePath());
- } catch (URISyntaxException ex) { /* ignored on purpose */ }
- }
-
- // ECLIPSE_WORKSPACE
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
- && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
- && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- ew = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
- }
-
- DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.OPEN);
-
- // Determine the filter path
- String text = workingDir.getText();
- if (Messages.PreferencePage_workingDir_userhome_label.equals(text)) {
- dialog.setFilterPath(uh.toOSString());
- } else if (Messages.PreferencePage_workingDir_eclipsehome_label.equals(text)) {
- dialog.setFilterPath(eh.toOSString());
- } else if (Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) {
- dialog.setFilterPath(ew.toOSString());
- } else if (text != null && !"".equals(text.trim())) { //$NON-NLS-1$
- dialog.setFilterPath(text.trim());
- }
-
- String selected = dialog.open();
- if (selected != null) {
- IPath sp = new Path(selected);
-
- if (uh.equals(sp)) {
- workingDir.select(0);
- } else if (eh.equals(sp)) {
- workingDir.select(1);
- } else if (ew.equals(sp)) {
- workingDir.select(2);
- } else {
- workingDir.setText(sp.toOSString());
- }
- }
- }
- });
-
- String initialCwd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD);
- if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$
- workingDir.select(0);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) {
- workingDir.select(1);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
- workingDir.select(2);
- } else {
- workingDir.setText(new Path(initialCwd).toOSString());
- }
-
- NoteCompositeHelper.createNoteComposite(group.getFont(), group, Messages.PreferencePage_workingDir_note_label, Messages.PreferencePage_workingDir_note_text);
-
- group = new Group(panel, SWT.NONE);
- group.setText(Messages.PreferencePage_executables_label);
- group.setLayout(new GridLayout(2, false));
- group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
-
- viewer = new TableViewer(group, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
-
- Table table = viewer.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- TableColumn column = new TableColumn(table, SWT.LEFT);
- column.setText(Messages.PreferencePage_executables_column_name_label);
- column = new TableColumn(table, SWT.LEFT);
- column.setText(Messages.PreferencePage_executables_column_path_label);
-
- ColumnViewerToolTipSupport.enableFor(viewer);
-
- TableLayout tableLayout = new TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(35));
- tableLayout.addColumnData(new ColumnWeightData(65));
- table.setLayout(tableLayout);
-
- layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 10);
- table.setLayoutData(layoutData);
-
- Composite buttonsPanel = new Composite(group, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0; layout.marginWidth = 0;
- buttonsPanel.setLayout(layout);
- buttonsPanel.setLayoutData(new GridData(SWT.LEAD, SWT.BEGINNING, false, false));
-
- addButton = new Button(buttonsPanel, SWT.PUSH);
- addButton.setText(Messages.PreferencePage_executables_button_add_label);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
- layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
- addButton.setLayoutData(layoutData);
- addButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ExternalExecutablesDialog dialog = new ExternalExecutablesDialog(PreferencePage.this.getShell(), false);
- if (dialog.open() == Window.OK) {
- // Get the executable properties and add it to the the list
- Map<String, String> executableData = dialog.getExecutableData();
- if (executableData != null && !executables.contains(executableData)) {
- executables.add(executableData);
- viewer.refresh();
- }
- }
- }
- });
-
- editButton = new Button(buttonsPanel, SWT.PUSH);
- editButton.setText(Messages.PreferencePage_executables_button_edit_label);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
- editButton.setLayoutData(layoutData);
- editButton.addSelectionListener(new SelectionAdapter() {
- @SuppressWarnings("unchecked")
- @Override
- public void widgetSelected(SelectionEvent e) {
- ISelection s = viewer.getSelection();
- if (s instanceof IStructuredSelection && !s.isEmpty()) {
- Object element = ((IStructuredSelection)s).getFirstElement();
- if (element instanceof Map) {
- final Map<String, String> m = (Map<String, String>)element;
- ExternalExecutablesDialog dialog = new ExternalExecutablesDialog(PreferencePage.this.getShell(), true);
- dialog.setExecutableData(m);
- if (dialog.open() == Window.OK) {
- Map<String, String> executableData = dialog.getExecutableData();
- if (executableData != null) {
- m.clear();
- m.putAll(executableData);
- viewer.refresh();
- }
- }
- }
- }
- }
- });
-
- removeButton = new Button(buttonsPanel, SWT.PUSH);
- removeButton.setText(Messages.PreferencePage_executables_button_remove_label);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
- removeButton.setLayoutData(layoutData);
- removeButton.addSelectionListener(new SelectionAdapter() {
- @SuppressWarnings("unchecked")
- @Override
- public void widgetSelected(SelectionEvent e) {
- ISelection s = viewer.getSelection();
- if (s instanceof IStructuredSelection && !s.isEmpty()) {
- Iterator<?> iterator = ((IStructuredSelection)s).iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (element instanceof Map) {
- Map<String, Object> m = (Map<String, Object>)element;
- executables.remove(m);
- }
- viewer.refresh();
- }
- }
- }
- });
-
- viewer.setContentProvider(new IStructuredContentProvider() {
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List && !((List<?>)inputElement).isEmpty()) {
- return ((List<?>)inputElement).toArray();
- }
- return NO_ELEMENTS;
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void dispose() {
- }
- });
-
- viewer.setLabelProvider(new ITableLabelProvider() {
- @SuppressWarnings("unchecked")
- @Override
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof Map) {
- Map<String, Object> m = (Map<String, Object>)element;
-
- switch (columnIndex) {
- case 0:
- return (String)m.get(IExternalExecutablesProperties.PROP_NAME);
- case 1:
- return (String)m.get(IExternalExecutablesProperties.PROP_PATH);
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- Image i = null;
-
- if (element instanceof Map) {
- switch (columnIndex) {
- case 0:
- Map<String, Object> m = (Map<String, Object>)element;
- String icon = (String) m.get(IExternalExecutablesProperties.PROP_ICON);
- if (icon != null) {
- i = images.get(icon);
- if (i == null) {
- ImageData id = ExternalExecutablesManager.loadImage(icon);
- if (id != null) {
- ImageDescriptor d = ImageDescriptor.createFromImageData(id);
- if (d != null) i = d.createImage();
- if (i != null) images.put(icon, i);
- }
- }
- }
- break;
- case 1:
- break;
- }
- }
-
- return i;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
- });
-
- List<Map<String, String>> l = ExternalExecutablesManager.load();
- if (l != null) executables.addAll(l);
-
- viewer.setInput(executables);
-
- viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateButtons();
- }
- });
-
- updateButtons();
-
- gc.dispose();
-
- return panel;
- }
-
- /**
- * Updates the button states.
- */
- protected void updateButtons() {
- if (viewer != null) {
- addButton.setEnabled(true);
-
- ISelection selection = viewer.getSelection();
-
- boolean hasSelection = selection != null && !selection.isEmpty();
- int count = selection instanceof IStructuredSelection ? ((IStructuredSelection)selection).size() : 0;
-
- editButton.setEnabled(hasSelection && count == 1);
- removeButton.setEnabled(hasSelection && count > 0);
- } else {
- addButton.setEnabled(false);
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- @Override
- protected void performDefaults() {
- String initialCwd = UIPlugin.getScopedPreferences().getDefaultString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD);
- if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$
- workingDir.select(0);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) {
- workingDir.select(1);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
- workingDir.select(2);
- } else {
- workingDir.setText(new Path(initialCwd).toOSString());
- }
-
- executables.clear();
- List<Map<String, String>> l = ExternalExecutablesManager.load();
- if (l != null) executables.addAll(l);
- viewer.refresh();
-
- super.performDefaults();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- String text = workingDir.getText();
- if (text == null || Messages.PreferencePage_workingDir_userhome_label.equals(text) || "".equals(text.trim())) { //$NON-NLS-1$
- UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, null);
- } else if (Messages.PreferencePage_workingDir_eclipsehome_label.equals(text)) {
- UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME);
- } else if (Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) {
- UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS);
- } else {
- IPath p = new Path(text.trim());
- UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, p.toFile().canRead() && p.toFile().isDirectory() ? p.toString() : null);
- }
-
- ExternalExecutablesManager.save(executables);
-
- return super.performOk();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- */
- @Override
- public void dispose() {
- for (Image i : images.values()) {
- i.dispose();
- }
- images.clear();
- super.dispose();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java
deleted file mode 100644
index 11d7d9d1b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.local.showin.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
-
-/**
- * Terminals default preferences initializer.
- */
-public class PreferencesInitializer extends AbstractPreferenceInitializer {
-
- /**
- * Constructor.
- */
- public PreferencesInitializer() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- @Override
- public void initializeDefaultPreferences() {
- ScopedEclipsePreferences prefs = UIPlugin.getScopedPreferences();
-
- prefs.putDefaultString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath
deleted file mode 100644
index 8a8f1668c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ui.terminals.process/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.options
deleted file mode 100644
index a9f0396bb..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.options
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.tcf.te.ui.terminals.process/debugmode = 0
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.project b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.project
deleted file mode 100644
index 15b8c949f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals.process</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>1329502082911</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.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 023bfc352..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,362 +0,0 @@
-#Tue Oct 11 11:53:38 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.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 88bb9570e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,56 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Target Explorer Java STD
-formatter_settings_version=12
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF
deleted file mode 100644
index d407d4827..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,24 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.process;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.process.activator.UIPlugin
-Bundle-Vendor: %providerName
-Import-Package: org.eclipse.cdt.utils.pty;mandatory:=native,
- org.eclipse.cdt.utils.spawner;mandatory:=native
-Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional,
- org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional,
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.ui;bundle-version="3.8.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.process,
- org.eclipse.tcf.te.ui.terminals.process.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.process.help,
- org.eclipse.tcf.te.ui.terminals.process.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf
deleted file mode 100644
index 9bd5194fa..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf
+++ /dev/null
@@ -1,82 +0,0 @@
-###############################################################################
-# Copyright (c) 2014 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
-###############################################################################
-
-# Most of the dependencies exposed here are actually covered in the feature.xml
-# This file ensures that the current bundle has all it needs, even if installed
-# without the enclosing org.eclipse.tcf.te.terminals.feature .
-# See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=435150 .
-
-# 1. Make the optional cdt.core dependency non-greedy: Use (or update to proper
-# version!) when installed, but do not install automatically since the newer
-# org.eclipse.cdt.core.native can satisfy the dependency better. We use this
-# trick since CDT 8.3 had no version on export-package yet but we do want
-# a version constraint.
-requires.0.namespace = org.eclipse.equinox.p2.iu
-requires.0.name = org.eclipse.cdt.core
-#requires.0.range = [5.6, 6.0)
-requires.0.greedy = false
-requires.0.optional = true
-
-#requires.1.namespace = org.eclipse.equinox.p2.iu
-#requires.1.name = org.eclipse.cdt.core.native
-#requires.1.range = [5.6, 6.0)
-#requires.1.greedy = true
-#requires.1.optional = true
-
-# 2. Add the required fragments for local terminal support with proper version.
-requires.2.namespace = org.eclipse.equinox.p2.iu
-requires.2.name = org.eclipse.cdt.core.aix
-#requires.2.range = [5.3, 6.0)
-requires.2.filter = (osgi.os=aix)
-
-requires.3.namespace = org.eclipse.equinox.p2.iu
-requires.3.name = org.eclipse.cdt.core.linux
-#requires.3.range = [5.2, 6.0)
-requires.3.filter = (osgi.os=linux)
-
-requires.4.namespace = org.eclipse.equinox.p2.iu
-requires.4.name = org.eclipse.cdt.core.linux.ppc64
-#requires.4.range = [5.1, 6.0)
-requires.4.filter = (&(osgi.os=linux)(osgi.arch=ppc64))
-
-requires.5.namespace = org.eclipse.equinox.p2.iu
-requires.5.name = org.eclipse.cdt.core.linux.x86
-#requires.5.range = [5.2, 6.0)
-requires.5.filter = (&(osgi.os=linux)(osgi.arch=x86))
-
-requires.6.namespace = org.eclipse.equinox.p2.iu
-requires.6.name = org.eclipse.cdt.core.linux.x86_64
-#requires.6.range = [5.2, 6.0)
-requires.6.filter = (&(osgi.os=linux)(osgi.arch=x86_64))
-
-requires.7.namespace = org.eclipse.equinox.p2.iu
-requires.7.name = org.eclipse.cdt.core.macosx
-#requires.7.range = [5.2, 6.0)
-requires.7.filter = (osgi.os=macosx)
-
-requires.8.namespace = org.eclipse.equinox.p2.iu
-requires.8.name = org.eclipse.cdt.core.solaris
-#requires.8.range = [5.2, 6.0)
-requires.8.filter = (&(osgi.os=solaris)(osgi.arch=sparc))
-
-requires.9.namespace = org.eclipse.equinox.p2.iu
-requires.9.name = org.eclipse.cdt.core.win32
-#requires.9.range = [5.3, 6.0)
-requires.9.filter = (osgi.os=win32)
-
-requires.10.namespace = org.eclipse.equinox.p2.iu
-requires.10.name = org.eclipse.cdt.core.win32.x86
-#requires.10.range = [5.2, 6.0)
-requires.10.filter = (&(osgi.os=win32)(osgi.arch=x86))
-
-requires.11.namespace = org.eclipse.equinox.p2.iu
-requires.11.name = org.eclipse.cdt.core.win32.x86_64
-#requires.11.range = [5.2, 6.0)
-requires.11.filter = (&(osgi.os=win32)(osgi.arch=x86_64))
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties
deleted file mode 100644
index 1d978e343..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# 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
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- plugin.properties,\
- about.html
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties
deleted file mode 100644
index 154dba87e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-##################################################################################
-# Copyright (c) 2011, 2015 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, Terminals Process Connector
-providerName = Eclipse.org - Target Explorer
-
-# ----- Terminal Connectors -----
-
-TerminalConnector.process=Process Connector (hidden)
-
-# ----- Terminal Launcher Delegates -----
-
-ProcessLauncherDelegate.label=Streams Terminal
-
-# ----- Commands and Menu contributions -----
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml
deleted file mode 100644
index 068e51399..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminal connector contributions -->
- <extension point="org.eclipse.tm.terminal.terminalConnectors">
- <connector
- class="org.eclipse.tcf.te.ui.terminals.process.ProcessConnector"
- hidden="true"
- id="org.eclipse.tcf.te.ui.terminals.ProcessConnector"
- name="%TerminalConnector.process"/>
- </extension>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.ui.terminals.process.ProcessLauncherDelegate"
- hidden="true"
- id="org.eclipse.tcf.te.ui.terminals.telnet.launcher.process"
- label="%ProcessLauncherDelegate.label">
- </delegate>
- </extension>
-
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml
deleted file mode 100644
index 859eb1932..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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>org.eclipse.tcf.maven-build</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- <relativePath>../../../admin/pom-build.xml</relativePath>
- </parent>
-
- <version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals.process</artifactId>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java
deleted file mode 100644
index 9a8c8fba1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2015 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.ui.terminals.process;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.StreamTokenizer;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.core.terminals.utils.Env;
-import org.eclipse.tcf.te.ui.terminals.manager.ConsoleManager;
-import org.eclipse.tcf.te.ui.terminals.process.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.streams.AbstractStreamsConnector;
-import org.eclipse.tm.internal.terminal.emulator.VT100Emulator;
-import org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-
-/**
- * Process connector implementation.
- */
-@SuppressWarnings("restriction")
-public class ProcessConnector extends AbstractStreamsConnector {
- // Reference to the process settings
- private final ProcessSettings settings;
-
- // Reference to the PTY instance.
- private PTY pty;
- // Reference to the launched process instance.
- private Process process;
- // Reference to the process monitor
- private ProcessMonitor monitor;
-
- // The terminal width and height. Initially unknown.
- private int width = -1;
- private int height = -1;
-
- /**
- * Constructor.
- */
- public ProcessConnector() {
- this(new ProcessSettings());
- }
-
- /**
- * Constructor.
- *
- * @param settings The process settings. Must not be <code>null</code>
- */
- public ProcessConnector(ProcessSettings settings) {
- super();
-
- Assert.isNotNull(settings);
- this.settings = settings;
- }
-
- /**
- * Returns the process object or <code>null</code> if the
- * connector is connector.
- *
- * @return The process object or <code>null</code>.
- */
- public Process getProcess() {
- return process;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#connect(org.eclipse.tcf.internal.terminal.provisional.api.ITerminalControl)
- */
- @Override
- public void connect(ITerminalControl control) {
- Assert.isNotNull(control);
- super.connect(control);
-
- pty = null;
- width = -1;
- height = -1;
-
- try {
- boolean isAnsiTerminal = false;
-
- // Try to determine process and PTY instance from the process settings
- process = settings.getProcess();
- pty = settings.getPTY();
-
- // No process -> create PTY on supported platforms and execute
- // process image.
- if (process == null) {
- if (PTY.isSupported(PTY.Mode.TERMINAL)) {
- try {
- pty = new PTY(PTY.Mode.TERMINAL);
-
- // Initialize the terminal size
- VT100Emulator text = ((VT100TerminalControl)control).getTerminalText();
- text.fontChanged();
- } catch (IOException e) {
- // PTY not supported
- }
- }
-
- // Build up the command
- StringBuilder command = new StringBuilder(settings.getImage());
- String arguments = settings.getArguments();
- if (arguments != null && !"".equals(arguments.trim())) { //$NON-NLS-1$
- // Append to the command now
- command.append(" "); //$NON-NLS-1$
- command.append(arguments.trim());
- }
-
- File workingDir =null;
- if (settings.getWorkingDir()!=null){
- workingDir = new File(settings.getWorkingDir());
- }
-
- String[] envp = null;
- if (settings.getEnvironment()!=null){
- envp = settings.getEnvironment();
- }
-
- if (settings.isMergeWithNativeEnvironment()) {
- envp = Env.getEnvironment(envp, true);
- }
-
- isAnsiTerminal = getTermVariable(envp).startsWith("ansi"); //$NON-NLS-1$
-
- if (pty != null) {
- // A PTY is available -> can use the ProcessFactory.
-
- // Tokenize the command (ProcessFactory takes an array)
- StreamTokenizer st = new StreamTokenizer(new StringReader(command.toString()));
- st.resetSyntax();
- st.whitespaceChars(0, 32);
- st.whitespaceChars(0xa0, 0xa0);
- st.wordChars(33, 255);
- st.quoteChar('"');
- st.quoteChar('\'');
-
- List<String> argv = new ArrayList<String>();
- int ttype = st.nextToken();
- while (ttype != StreamTokenizer.TT_EOF) {
- argv.add(st.sval);
- ttype = st.nextToken();
- }
-
- // Execute the process
- process = ProcessFactory.getFactory().exec(argv.toArray(new String[argv.size()]), envp, workingDir, pty);
- } else {
- // No PTY -> just execute via the standard Java Runtime implementation.
- process = Runtime.getRuntime().exec(command.toString(), envp, workingDir);
- }
- }
-
- String lineSeparator = settings.getLineSeparator();
- if (lineSeparator == null && pty == null) {
- lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
- if ("\r".equals(lineSeparator)) { //$NON-NLS-1$
- lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_CR;
- }
- else if ("\n".equals(lineSeparator)) { //$NON-NLS-1$
- lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_LF;
- }
- else {
- lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_CRLF;
- }
- }
-
- // Setup the listeners
- setStdoutListeners(settings.getStdOutListeners());
- setStderrListeners(settings.getStdErrListeners());
-
- // Enable VT100 line wrapping if we are connected via pty
- // And TERM is VT100 compatible
- if (pty != null && !isAnsiTerminal)
- control.setVT100LineWrapping(true);
-
- // connect the streams
- connectStreams(control, process.getOutputStream(), process.getInputStream(), (pty == null ? process.getErrorStream() : null), settings.isLocalEcho(), lineSeparator);
-
- // Set the terminal control state to CONNECTED
- control.setState(TerminalState.CONNECTED);
-
- // Create the process monitor
- monitor = new ProcessMonitor(this);
- monitor.startMonitoring();
- } catch (IOException e) {
- // Disconnect right away
- disconnect();
- // Lookup the tab item
- CTabItem item = ConsoleManager.getInstance().findConsole(control);
- if (item != null) item.dispose();
- // Get the error message from the exception
- String msg = e.getLocalizedMessage() != null ? e.getLocalizedMessage() : ""; //$NON-NLS-1$
- Assert.isNotNull(msg);
- // Strip away "Exec_tty error:"
- msg = msg.replace("Exec_tty error:", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- // Repackage into a more user friendly error
- msg = NLS.bind(Messages.ProcessConnector_error_creatingProcess, settings.getImage(), msg);
- // Open an error dialog
- MessageDialog.openError(control.getShell(), Messages.ProcessConnector_error_title, msg);
- }
- }
-
- private static String getTermVariable(String[] envp) {
- if (envp != null && !Platform.OS_WIN32.equals(Platform.getOS()))
- for (String var : envp)
- if (var.startsWith("TERM=")) //$NON-NLS-1$
- return var.substring(5);
- return "xterm"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#isLocalEcho()
- */
- @Override
- public boolean isLocalEcho() {
- return settings.isLocalEcho();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect()
- */
- @Override
- public void doDisconnect() {
- // Dispose the process
- if (process != null) { process.destroy(); process = null; }
-
- // Dispose the streams
- super.doDisconnect();
-
- // Set the terminal control state to CLOSED.
- fControl.setState(TerminalState.CLOSED);
- }
-
- // ***** Process Connector settings handling *****
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#makeSettingsPage()
- */
- @Override
- public ISettingsPage makeSettingsPage() {
- return new ProcessSettingsPage(settings);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getSettingsSummary()
- */
- @Override
- public String getSettingsSummary() {
- return settings.getImage() != null ? settings.getImage() : ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#load(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore)
- */
- @Override
- public void load(ISettingsStore store) {
- settings.load(store);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#save(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore)
- */
- @Override
- public void save(ISettingsStore store) {
- settings.save(store);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#setTerminalSize(int, int)
- */
- @Override
- public void setTerminalSize(int newWidth, int newHeight) {
- if (width != newWidth || height != newHeight) {
- width = newWidth;
- height = newHeight;
- if (pty != null) {
- pty.setTerminalSize(newWidth, newHeight);
- }
- }
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java
deleted file mode 100644
index fc78d60de..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.process;
-
-import java.util.Map;
-
-import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-
-/**
- * Process launcher delegate implementation.
- */
-@SuppressWarnings("restriction")
-public class ProcessLauncherDelegate extends AbstractLauncherDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
- */
- @Override
- public boolean needsUserConfiguration() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
- */
- @Override
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void execute(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- // Get the terminal service
- ITerminalService terminal = TerminalServiceFactory.getService();
- // If not available, we cannot fulfill this request
- if (terminal != null) {
- terminal.openConsole(properties, done);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
- */
- @Override
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.ProcessConnector"; //$NON-NLS-1$
-
- // Extract the process properties
- String image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
- String arguments = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
- Process process = (Process)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
- PTY pty = (PTY)properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ);
- Object value = properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
- boolean localEcho = value instanceof Boolean ? ((Boolean)value).booleanValue() : false;
- String lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
- String workingDir = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
-
- String[] envp = null;
- if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) &&
- properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
- properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
- envp = (String[])properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT);
- }
-
- Assert.isTrue(image != null || process != null);
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the process settings
- ProcessSettings processSettings = new ProcessSettings();
- processSettings.setImage(image);
- processSettings.setArguments(arguments);
- processSettings.setProcess(process);
- processSettings.setPTY(pty);
- processSettings.setLocalEcho(localEcho);
- processSettings.setLineSeparator(lineSeparator);
- processSettings.setStdOutListeners(stdoutListeners);
- processSettings.setStdErrListeners(stderrListeners);
- processSettings.setWorkingDir(workingDir);
- processSettings.setEnvironment(envp);
-
- if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) {
- value = properties.get(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT);
- processSettings.setMergeWithNativeEnvironment(value instanceof Boolean ? ((Boolean)value).booleanValue() : false);
- }
-
- // And save the settings to the store
- processSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java
deleted file mode 100644
index 2e3762aaf..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.ui.terminals.process;
-
-import org.eclipse.core.runtime.Assert;
-
-
-/**
- * Process monitor implementation.
- */
-public class ProcessMonitor {
- // Reference to the parent process connector
- private final ProcessConnector processConnector;
- // Reference to the monitored process
- private final Process process;
- // Reference to the monitor thread
- private Thread thread;
- // Flag to mark the monitor disposed
- private boolean disposed;
-
-
- /**
- * Constructor.
- *
- * @param processConnector The parent process connector. Must not be <code>null</code>.
- */
- public ProcessMonitor(ProcessConnector processConnector) {
- super();
-
- Assert.isNotNull(processConnector);
- this.processConnector = processConnector;
-
- // Query the monitored process for easier access
- this.process = processConnector.getProcess();
- }
-
- /**
- * Dispose the process monitor.
- */
- public void dispose() {
- // Set the disposed status
- disposed = true;
- // Not initialized -> return immediately
- if (thread == null) return;
-
- // Copy the reference
- final Thread oldThread = thread;
- // Unlink the monitor from the thread
- thread = null;
- // And interrupt the writer thread
- oldThread.interrupt();
- }
-
- /**
- * Starts the terminal output stream monitor.
- */
- public void startMonitoring() {
- // If already initialized -> return immediately
- if (thread != null) return;
-
- // Create a new runnable which is constantly reading from the stream
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- monitorProcess();
- }
- };
-
- // Create the monitor thread
- thread = new Thread(runnable, "Terminal Process Monitor Thread"); //$NON-NLS-1$
-
- // Configure the monitor thread
- thread.setDaemon(true);
-
- // Start the processing
- thread.start();
- }
-
- /**
- * Monitors the associated system process, waiting for it to terminate,
- * and notifies the associated process monitor's.
- */
- @SuppressWarnings("restriction")
- public void monitorProcess() {
- // If already disposed -> return immediately
- if (disposed) return;
-
- try {
- // Wait for the monitored process to terminate
- process.waitFor();
- } catch (InterruptedException ie) {
- // clear interrupted state
- Thread.interrupted();
- } finally {
- // Dispose the parent process connector
- processConnector.disconnect();
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java
deleted file mode 100644
index 4a306ddfb..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.process;
-
-import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-
-/**
- * Process connector settings implementation.
- */
-@SuppressWarnings("restriction")
-public class ProcessSettings {
- // Reference to the process image
- private String image;
- // Reference to the process arguments (space separated string)
- private String arguments;
- // Reference to the process object
- private Process process;
- // Reference to the pseudo terminal object
- private PTY pty;
- // Flag to control the local echo (defaults to true if
- // the PTY is not supported on the current host platform)
- private boolean localEcho = !PTY.isSupported();
- // The line separator setting
- private String lineSeparator = null;
- // The list of stdout output listeners
- private ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = null;
- // The list of stderr output listeners
- private ITerminalServiceOutputStreamMonitorListener[] stderrListeners = null;
- // working directory for process
- private String workingDir;
- // environment
- private String[] environment;
- // Flag to control if the provided environment is
- // automatically merged with the native process environment.
- // Defaults to "true".
- private boolean mergeWithNativeEnvironment = true;
-
- /**
- * Sets the process image.
- *
- * @param image The process image or <code>null</code>.
- */
- public void setImage(String image) {
- this.image = image;
- }
-
- /**
- * Returns the process image.
- *
- * @return The process image or <code>null</code>.
- */
- public String getImage() {
- return image;
- }
-
- /**
- * Sets the process arguments.
- * <p>
- * The arguments are space separated. The caller is responsible for
- * correct quoting.
- *
- * @param arguments The process arguments or <code>null</code>.
- */
- public void setArguments(String arguments) {
- this.arguments = arguments;
- }
-
- /**
- * Returns the process arguments.
- *
- * @return The process arguments as space separated list or <code>null</code>.
- */
- public String getArguments() {
- return arguments;
- }
-
- /**
- * Sets the process object.
- *
- * @param image The process object or <code>null</code>.
- */
- public void setProcess(Process process) {
- this.process = process;
- }
-
- /**
- * Returns the process object.
- *
- * @return The process object or <code>null</code>.
- */
- public Process getProcess() {
- return process;
- }
-
- /**
- * Sets the pseudo terminal object.
- *
- * @param pty The pseudo terminal or <code>null</code>.
- */
- public void setPTY(PTY pty) {
- this.pty = pty;
- // If the PTY is set to "null", the local echo will be set to "true"
- if (pty == null) setLocalEcho(true);
- }
-
- /**
- * Returns the pseudo terminal object.
- *
- * @return The pseudo terminal or <code>null</code>.
- */
- public PTY getPTY() {
- return pty;
- }
-
- /**
- * Sets if the process requires a local echo from the
- * terminal widget.
- *
- * @param value Specify <code>true</code> to enable the local echo, <code>false</code> otherwise.
- */
- public void setLocalEcho(boolean value) {
- this.localEcho = value;
- }
-
- /**
- * Returns <code>true</code> if the process requires a local echo
- * from the terminal widget.
- *
- * @return <code>True</code> if local echo is enabled, <code>false</code> otherwise.
- */
- public boolean isLocalEcho() {
- return localEcho;
- }
-
- /**
- * Sets the process line separator.
- *
- * @param separator The process line separator <code>null</code>.
- */
- public void setLineSeparator(String separator) {
- this.lineSeparator = separator;
- }
-
- /**
- * Returns the process line separator.
- *
- * @return The process line separator or <code>null</code>.
- */
- public String getLineSeparator() {
- return lineSeparator;
- }
-
- /**
- * Sets the list of stdout listeners.
- *
- * @param listeners The list of stdout listeners or <code>null</code>.
- */
- public void setStdOutListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) {
- this.stdoutListeners = listeners;
- }
-
- /**
- * Returns the list of stdout listeners.
- *
- * @return The list of stdout listeners or <code>null</code>.
- */
- public ITerminalServiceOutputStreamMonitorListener[] getStdOutListeners() {
- return stdoutListeners;
- }
-
- /**
- * Sets the list of stderr listeners.
- *
- * @param listeners The list of stderr listeners or <code>null</code>.
- */
- public void setStdErrListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) {
- this.stderrListeners = listeners;
- }
-
- /**
- * Returns the list of stderr listeners.
- *
- * @return The list of stderr listeners or <code>null</code>.
- */
- public ITerminalServiceOutputStreamMonitorListener[] getStdErrListeners() {
- return stderrListeners;
- }
-
- /**
- * Returns the working directory
- *
- * @return
- */
- public String getWorkingDir() {
- return this.workingDir;
- }
-
- /**
- * Sets the working directory of the process
- *
- * @param workingDir the absolute path of the working directory
- */
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- /**
- * Get the process environment
- *
- * @return
- */
- public String[] getEnvironment() {
- return environment;
- }
-
- /**
- * Sets the process environment
- *
- * @param environment - will be added to the "parent" environment of the process
- */
- public void setEnvironment(String[] environment) {
- this.environment = environment;
- }
-
- /**
- * Returns if or if not the provided environment is merged with
- * the native process environment.
- *
- * @return <code>True</code> if the provided environment is merged with the native process environment, <code>false</code> otherwise.
- */
- public boolean isMergeWithNativeEnvironment() {
- return mergeWithNativeEnvironment;
- }
-
- /**
- * Sets if or if not the provided environment is merged with the
- * native process environment.
- *
- * @param value <code>True</code> if the provided environment is merged with the native process environment, <code>false</code> otherwise.
- */
- public void setMergeWithNativeEnvironment(boolean value) {
- this.mergeWithNativeEnvironment = value;
- }
-
- /**
- * Loads the process settings from the given settings store.
- *
- * @param store The settings store. Must not be <code>null</code>.
- */
- public void load(ISettingsStore store) {
- Assert.isNotNull(store);
- image = store.get("Path", null);//$NON-NLS-1$
- arguments = store.get("Arguments", null); //$NON-NLS-1$
- localEcho = Boolean.parseBoolean(store.get("LocalEcho", Boolean.FALSE.toString())); //$NON-NLS-1$
- mergeWithNativeEnvironment = Boolean.parseBoolean(store.get("MergeWithNativeEnvironment", Boolean.FALSE.toString())); //$NON-NLS-1$
- lineSeparator = store.get("LineSeparator", null); //$NON-NLS-1$
- workingDir = store.get("WorkingDir", null); //$NON-NLS-1$
- if (store instanceof SettingsStore) {
- process = (Process)((SettingsStore)store).getSettings().get("Process"); //$NON-NLS-1$
- pty = (PTY)((SettingsStore)store).getSettings().get("PTY"); //$NON-NLS-1$
- stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdOutListeners"); //$NON-NLS-1$
- stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdErrListeners"); //$NON-NLS-1$
- environment = (String[])((SettingsStore)store).getSettings().get("Environment"); //$NON-NLS-1$
- }
- }
-
- /**
- * Saves the process settings to the given settings store.
- *
- * @param store The settings store. Must not be <code>null</code>.
- */
- public void save(ISettingsStore store) {
- Assert.isNotNull(store);
- store.put("Path", image);//$NON-NLS-1$
- store.put("Arguments", arguments); //$NON-NLS-1$
- store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$
- store.put("MergeWithNativeEnvironment", Boolean.toString(mergeWithNativeEnvironment)); //$NON-NLS-1$
- store.put("LineSeparator", lineSeparator); //$NON-NLS-1$
- store.put("WorkingDir", workingDir); //$NON-NLS-1$
- if (store instanceof SettingsStore) {
- ((SettingsStore)store).getSettings().put("Process", process); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("PTY", pty); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("StdOutListeners", stdoutListeners); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("StdErrListeners", stderrListeners); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("Environment", environment); //$NON-NLS-1$
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java
deleted file mode 100644
index 150f6c6cb..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.process;
-
-import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage;
-import org.eclipse.ui.PlatformUI;
-import org.osgi.framework.Bundle;
-
-/**
- * Process connector settings page implementation.
- */
-@SuppressWarnings("restriction")
-public class ProcessSettingsPage extends AbstractSettingsPage {
- private Text processImageSelectorControl;
- private Button processImageSelectorControlButton;
- private Text processArgumentsControl;
- private Button localEchoSelectorControl;
- private Text processWorkingDirControl;
-
- private final ProcessSettings settings;
-
- /**
- * Constructor.
- *
- * @param settings
- */
- public ProcessSettingsPage(ProcessSettings settings) {
- super();
-
- Assert.isNotNull(settings);
- this.settings = settings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#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));
-
- // The entry fields shall be properly aligned
- Composite panel = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0; layout.marginHeight = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Create the process image selector control
- Label label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ProcessSettingsPage_processImagePathSelectorControl_label);
-
- // Text field and browse button are aligned it their own panel
- Composite innerPanel = new Composite(panel, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0; layout.marginHeight = 0;
- innerPanel.setLayout(layout);
- innerPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- processImageSelectorControl = new Text(innerPanel, SWT.SINGLE | SWT.BORDER);
- processImageSelectorControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- processImageSelectorControlButton = new Button(innerPanel, SWT.PUSH);
- processImageSelectorControlButton.setText(Messages.ProcessSettingsPage_processImagePathSelectorControl_button);
- processImageSelectorControlButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- onBrowseButtonSelected(e);
- }
- });
-
- // Create the process arguments control
- label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ProcessSettingsPage_processArgumentsControl_label);
-
- processArgumentsControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
- processArgumentsControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Create the process arguments control
- label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.ProcessSettingsPage_processWorkingDirControl_label);
-
- processWorkingDirControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
- processWorkingDirControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Create the local echo check box
- localEchoSelectorControl = new Button(composite, SWT.CHECK);
- localEchoSelectorControl.setText(Messages.ProcessSettingsPage_localEchoSelectorControl_label);
- localEchoSelectorControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- localEchoSelectorControl.setSelection(!PTY.isSupported());
-
- // Initialize the control content
- loadSettings();
- }
-
- /**
- * Called once the user pressed the browse button.
- *
- * @param e The selection event or <code>null</code>.
- */
- protected void onBrowseButtonSelected(SelectionEvent e) {
- // Determine the shell
- Shell shell = e != null ? e.widget.getDisplay().getActiveShell() : PlatformUI.getWorkbench().getDisplay().getActiveShell();
-
- // create a standard file dialog
- FileDialog dialog = new FileDialog(shell, SWT.OPEN);
- dialog.setText(Messages.ProcessSettingsPage_dialogTitle);
-
- // the dialog should open within the directory of the currently selected
- // file. If no file has been currently selected, it should open within the
- // last browsed directory.
- String selectedFile = processImageSelectorControl.getText();
- if (selectedFile != null && selectedFile.trim().length() > 0) {
- IPath filePath = new Path(selectedFile);
- // If the selected file points to an directory, use the directory as is
- IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1);
- String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment();
-
- if (!filterPath.isEmpty()) {
- dialog.setFilterPath(filterPath.toString());
- }
- if (filterFileName != null) {
- dialog.setFileName(filterFileName);
- }
- } else {
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- dialog.setFilterPath(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
- }
- }
-
- // Open the dialog
- selectedFile = dialog.open();
- if (selectedFile != null) {
- processImageSelectorControl.setText(selectedFile);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#saveSettings()
- */
- @Override
- public void saveSettings() {
- settings.setImage(processImageSelectorControl.getText());
- settings.setArguments(processArgumentsControl.getText());
- settings.setLocalEcho(localEchoSelectorControl.getSelection());
- settings.setWorkingDir(processWorkingDirControl.getText());
- settings.setProcess(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#loadSettings()
- */
- @Override
- public void loadSettings() {
- processImageSelectorControl.setText(settings.getImage());
- processArgumentsControl.setText(settings.getArguments());
- localEchoSelectorControl.setSelection(settings.isLocalEcho());
- processWorkingDirControl.setText(settings.getWorkingDir());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#validateSettings()
- */
- @Override
- public boolean validateSettings() {
- // The settings are considered valid if the selected process image can be read.
- String selectedFile = processImageSelectorControl.getText();
- return selectedFile != null && !"".equals(selectedFile.trim()) && new Path(selectedFile).toFile().canRead(); //$NON-NLS-1$
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java
deleted file mode 100644
index 87d195c74..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.process.activator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-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
- private static UIPlugin plugin;
-
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * 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 "org.eclipse.tcf.te.ui.terminals.process"; //$NON-NLS-1$
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- 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) {
- super.initializeImageRegistry(registry);
- }
-
- /**
- * 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java
deleted file mode 100644
index 3fb81c57f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.ui.terminals.process.help;
-
-import org.eclipse.tcf.te.ui.terminals.process.activator.UIPlugin;
-
-
-/**
- * Context help id definitions.
- */
-public interface IContextHelpIds {
-
- /**
- * UI plug-in common context help id prefix.
- */
- public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
-
- // ***** Message dialog boxes *****
-
- /**
- * Process connector: Create process failed
- */
- public final static String MESSAGE_CREATE_PROCESS_FAILED = PREFIX + ".status.messageCreateProcessFailed"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java
deleted file mode 100644
index 60656fa69..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 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.ui.terminals.process.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Process terminal connector 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.ui.terminals.process.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String ProcessConnector_error_title;
- public static String ProcessConnector_error_creatingProcess;
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties
deleted file mode 100644
index a3755e8a0..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2012, 2014 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
-###############################################################################
-
-ProcessConnector_error_title=Error
-ProcessConnector_error_creatingProcess=Failed to execute ''{0}''.\n\nPossibly caused by:\n{1}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options
deleted file mode 100644
index b39673418..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.tcf.te.ui.terminals.local/debugmode = 0
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 88bb9570e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,56 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Target Explorer Java STD
-formatter_settings_version=12
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index cf80c8bc5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,32 +0,0 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=1
-compilers.p.missing-version-require-bundle=1
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF
deleted file mode 100644
index 2316f2fa2..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.rse;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.rse.activator.UIPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.rse.core;bundle-version="3.3.100",
- org.eclipse.rse.subsystems.files.core;bundle-version="3.3.1",
- org.eclipse.rse.ui;bundle-version="3.3.100",
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.forms;bundle-version="3.5.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.rse.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.rse.internal;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.rse.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html
deleted file mode 100644
index 0f07cf034..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 24, 2012</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties
deleted file mode 100644
index ea5450229..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2014 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
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- plugin.properties,\
- about.html,\
- icons/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gif
deleted file mode 100644
index bbb6a9e15..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties
deleted file mode 100644
index b6692c2f1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-##################################################################################
-# Copyright (c) 2014 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, Terminals RSE Add-on
-providerName = Eclipse.org - Target Explorer
-
-# ----- Commands and Menu contributions -----
-
-command.launch.name=Open Terminal
-command.launch.label=Open Terminal...
-command.launch.tooltip=Open a Terminal
-
-# ----- Terminal Launcher Delegates -----
-
-SshLauncherDelegate.label=SSH Terminal
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml
deleted file mode 100644
index 00c7cee50..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminal context properties provider contributions -->
- <extension point="org.eclipse.tcf.te.core.terminals.contextPropertiesProviders">
- <contextPropertiesProvider
- class="org.eclipse.tcf.te.ui.terminals.rse.internal.TerminalContextPropertiesProvider">
- <enablement>
- <instanceof value="org.eclipse.rse.core.model.IHost"/>
- </enablement>
- </contextPropertiesProvider>
- </extension>
-
-<!-- Perspective extension contributions -->
- <extension point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.eclipse.rse.ui.view.SystemPerspective">
- <!-- Register the view shortcuts -->
- <viewShortcut id="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- <!-- Place the Terminals view relative to the Task List view -->
- <view
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- minimized="false"
- relationship="stack"
- relative="org.eclipse.ui.views.TaskList"
- visible="false">
- </view>
- </perspectiveExtension>
- </extension>
-
-<!-- Eclipse core expressions property tester -->
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.tcf.te.ui.terminals.rse.internal.PropertyTester"
- id="org.eclipse.tcf.te.ui.terminals.rse.PropertyTester"
- namespace="org.eclipse.tcf.te.ui.terminals.rse"
- properties="isVisible"
- type="org.eclipse.rse.core.model.IRSEModelObject">
- </propertyTester>
-
- <propertyTester
- class="org.eclipse.tcf.te.ui.terminals.rse.internal.PropertyTester"
- id="org.eclipse.tcf.te.ui.terminals.rse.PropertyTester2"
- namespace="org.eclipse.tcf.te.ui.terminals.rse"
- properties="isVisible"
- type="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
- </propertyTester>
- </extension>
-
-<!-- Menu contributions -->
- <extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="popup:org.eclipse.rse.ui.view.systemView?after=additions">
- <command
- commandId="org.eclipse.tcf.te.ui.terminals.rse.command.launch"
- icon="icons/eview16/terminal_view.gif"
- id="org.eclipse.tcf.te.ui.terminals.rse.commands.launch"
- label="%command.launch.label"
- tooltip="%command.launch.tooltip">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <iterate operator="and" ifEmpty="false">
- <or>
- <adapt type="org.eclipse.rse.core.model.IRSEModelObject">
- <test property="org.eclipse.tcf.te.ui.terminals.rse.isVisible" value="true" forcePluginActivation="true"/>
- </adapt>
- <adapt type="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
- <test property="org.eclipse.tcf.te.ui.terminals.rse.isVisible" value="true" forcePluginActivation="true"/>
- </adapt>
- </or>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
-
-<!-- Command contributions -->
- <extension point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.terminals.rse.command_Launch"
- id="org.eclipse.tcf.te.ui.terminals.rse.command.launch"
- name="%command.launch.name">
- </command>
- </extension>
-
-<!-- Handler contributions -->
- <extension point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.tcf.te.ui.terminals.rse.internal.LaunchTerminalHandler"
- commandId="org.eclipse.tcf.te.ui.terminals.rse.command.launch">
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.rse.ui.view.systemView"/>
- </with>
- </activeWhen>
- <enabledWhen>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <or>
- <adapt type="org.eclipse.rse.core.model.IRSEModelObject"/>
- <adapt type="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/>
- </or>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
- </extension>
-
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java
deleted file mode 100644
index 614dbaaf8..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.rse.activator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-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
- private static UIPlugin plugin;
-
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * 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 "org.eclipse.tcf.te.ui.terminals.rse"; //$NON-NLS-1$
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- 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) {
- super.initializeImageRegistry(registry);
- }
-
- /**
- * 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java
deleted file mode 100644
index c70f82993..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.rse.internal;
-
-import java.util.Map;
-
-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.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IRSEModelObject;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Launch terminal handler implementation.
- */
-@SuppressWarnings("restriction")
-public class LaunchTerminalHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // Get the active shell
- Shell shell = HandlerUtil.getActiveShell(event);
- // Get the current selection
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- // The handler is enabled only if just one element is selected
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof IRSEModelObject || element instanceof IRemoteFile) {
- // Determine the host
- IHost host = null;
-
- if (element instanceof IHost) host = (IHost) element;
- if (host == null && element instanceof ISubSystem) host = ((ISubSystem) element).getHost();
- if (host == null && element instanceof ISystemFilterReference) host = ((ISystemFilterReference) element).getSubSystem().getHost();
- if (host == null && element instanceof IRemoteFile) host = ((IRemoteFile) element).getHost();
-
- if (host != null) {
- // Open the launch terminal settings dialog with the SSH panel only
- LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell) {
- @Override
- protected boolean isFiltered(ISelection selection, ILauncherDelegate delegate) {
- Assert.isNotNull(delegate);
- return !"org.eclipse.tcf.te.ui.terminals.ssh.launcher.ssh".equals(delegate.getId()); //$NON-NLS-1$
- }
- };
- dialog.setSelection(new StructuredSelection(host));
-
- if (dialog.open() == Window.OK) {
- // Get the terminal settings from the dialog
- Map<String, Object> properties = dialog.getSettings();
- if (properties != null) {
- String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
- Assert.isNotNull(delegateId);
- ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
- Assert.isNotNull(delegateId);
- delegate.execute(properties, null);
- }
- }
- }
- }
- }
-
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java
deleted file mode 100644
index 5aa6ea079..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.ui.terminals.rse.internal;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-
-
-/**
- * Terminals RSE add-on property tester implementation.
- */
-public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
- // Supported system type id's
- private final static String[] VALID_SYSTEM_TYPES = new String[] {
- "org.eclipse.rse.systemtype.linux", //$NON-NLS-1$
- "org.eclipse.rse.systemtype.unix", //$NON-NLS-1$
- "org.eclipse.rse.systemtype.aix", //$NON-NLS-1$
- "org.eclipse.rse.systemtype.ssh" //$NON-NLS-1$
- };
-
- private final static List<String> VALID_SYSTEM_TYPES_LIST = Arrays.asList(VALID_SYSTEM_TYPES);
-
- /* (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) {
- // Determine the host object
- IHost host = null;
-
- if (receiver instanceof IHost) host = (IHost) receiver;
- if (host == null && receiver instanceof ISubSystem) host = ((ISubSystem) receiver).getHost();
- if (host == null && receiver instanceof ISystemFilterReference) host = ((ISystemFilterReference) receiver).getSubSystem().getHost();
- if (host == null && receiver instanceof IRemoteFile) host = ((IRemoteFile) receiver).getHost();
-
- if (host != null) {
- if ("isVisible".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
- String systemTypeID = host.getSystemType().getId();
- boolean validID = systemTypeID != null ? VALID_SYSTEM_TYPES_LIST.contains(systemTypeID) : false;
- return ((Boolean)expectedValue).booleanValue() == validID;
- }
- }
-
- return false;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java
deleted file mode 100644
index 706379f6a..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.rse.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants;
-
-/**
- * Terminal context properties provider implementation.
- */
-public class TerminalContextPropertiesProvider implements ITerminalContextPropertiesProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider#getTargetAddress(java.lang.Object)
- */
- @Override
- public Map<String, String> getTargetAddress(Object context) {
- if (context instanceof IHost) {
- IHost host = (IHost) context;
-
- Map<String, String> props = new HashMap<String, String>();
- props.put(IContextPropertiesConstants.PROP_ADDRESS, host.getHostName());
- props.put(IContextPropertiesConstants.PROP_NAME, host.getName());
-
- return props;
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider#getProperty(java.lang.Object, java.lang.String)
- */
- @Override
- public Object getProperty(Object context, String key) {
- if (context instanceof IHost) {
- IHost host = (IHost) context;
-
- if (IContextPropertiesConstants.PROP_DEFAULT_USER.equals(key)) {
- String user = host.getDefaultUserId();
- if (user != null && !"".equals(user.trim())) { //$NON-NLS-1$
- return user;
- }
- }
-
- if (IContextPropertiesConstants.PROP_DEFAULT_ENCODING.equals(key)) {
- String encoding = host.getDefaultEncoding(true);
- if (encoding != null && !"".equals(encoding)) { //$NON-NLS-1$
- return encoding;
- }
- }
- }
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java
deleted file mode 100644
index 7732c2e71..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.ui.terminals.rse.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Externalized strings management.
- */
-public class Messages extends NLS {
-
- // The plug-in resource bundle name
- private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.rse.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties
deleted file mode 100644
index 2e332db1c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-###############################################################################
-# Copyright (c) 2014 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
-###############################################################################
-
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath
deleted file mode 100644
index 8a8f1668c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ui.terminals.serial/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options
deleted file mode 100644
index 9d8591b76..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options
+++ /dev/null
@@ -1,2 +0,0 @@
-org.eclipse.tcf.te.ui.terminals.serial/debugmode = 0
-org.eclipse.tcf.te.ui.terminals.serial/trace/serialLinePanel = false
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 4754bba05..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,362 +0,0 @@
-#Wed Oct 19 12:10:57 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.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 88bb9570e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,56 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Target Explorer Java STD
-formatter_settings_version=12
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index cf80c8bc5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,32 +0,0 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=1
-compilers.p.missing-version-require-bundle=1
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF
deleted file mode 100644
index 579f425ed..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.serial;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.equinox.security;bundle-version="1.1.100",
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.tm.terminal.serial;bundle-version="2.1.200",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.forms;bundle-version="3.5.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.serial.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.serial.controls,
- org.eclipse.tcf.te.ui.terminals.serial.interfaces,
- org.eclipse.tcf.te.ui.terminals.serial.launcher,
- org.eclipse.tcf.te.ui.terminals.serial.nls;x-internal:=true
-Import-Package: gnu.io;resolution:=optional
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html
deleted file mode 100644
index 0f07cf034..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 24, 2012</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties
deleted file mode 100644
index a471a57b6..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-##################################################################################
-# Copyright (c) 2011, 2015 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, Serial Terminals Extensions
-providerName = Eclipse.org - Target Explorer
-
-# ----- Terminal Launcher Delegates -----
-
-SerialLauncherDelegate.label=Serial Terminal \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml
deleted file mode 100644
index 31552a2a7..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.ui.terminals.serial.launcher.SerialLauncherDelegate"
- id="org.eclipse.tcf.te.ui.terminals.serial.launcher.serial"
- label="%SerialLauncherDelegate.label">
- <enablement>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <test
- forcePluginActivation="true"
- property="org.eclipse.tcf.te.runtime.services.hasService"
- value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
- </iterate>
- </with>
- </enablement>
- </delegate>
- </extension>
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml
deleted file mode 100644
index 5014b6d9f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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>org.eclipse.tcf.maven-build</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- <relativePath>../../../admin/pom-build.xml</relativePath>
- </parent>
-
- <version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals.serial</artifactId>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java
deleted file mode 100644
index 19ac52a26..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.activator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-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
- private static UIPlugin plugin;
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * 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 "org.eclipse.tcf.te.ui.terminals.serial"; //$NON-NLS-1$
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- 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) {
- }
-
- /**
- * 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java
deleted file mode 100644
index d5aac3b96..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.controls;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogSettings;
-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.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Serial wizard configuration panel implementation.
- */
-public class SerialConfigurationPanel extends AbstractExtendedConfigurationPanel {
-
- private SerialLinePanel serialSettingsPage;
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public SerialConfigurationPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- panel.setLayoutData(data);
-
- // Create the host selection combo
- if (isWithoutSelection()) createHostsUI(panel, true);
-
- serialSettingsPage = new SerialLinePanel(getContainer());
- serialSettingsPage.setupPanel(panel, toolkit);
-
- // Create the encoding selection combo
- createEncodingUI(panel, true);
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
- */
- @Override
- public void extractData(Map<String, Object> data) {
- // set the terminal connector id for serial
- data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.serial.SerialConnector"); //$NON-NLS-1$
-
- serialSettingsPage.extractData(data);
- data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#fillSettingsForHost(java.lang.String)
- */
- @Override
- protected void fillSettingsForHost(String host){
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#saveSettingsForHost(boolean)
- */
- @Override
- protected void saveSettingsForHost(boolean add){
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid(){
- return serialSettingsPage.isValid();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
- serialSettingsPage.doSaveWidgetValues(settings, idPrefix);
- // Save the encodings widget values
- doSaveEncodingsWidgetValues(settings, idPrefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
- serialSettingsPage.doRestoreWidgetValues(settings, idPrefix);
- // Restore the encodings widget values
- doRestoreEncodingsWidgetValues(settings, idPrefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#getHostFromSettings()
- */
- @Override
- protected String getHostFromSettings() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#isWithHostList()
- */
- @Override
- public boolean isWithHostList() {
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java
deleted file mode 100644
index b5009244c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java
+++ /dev/null
@@ -1,789 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.controls;
-
-import gnu.io.CommPortIdentifier;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.serial.interfaces.ITraceIds;
-import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Serial line terminal launcher configuration panel implementation.
- */
-public class SerialLinePanel extends AbstractConfigurationPanel {
- public static final String fcDefaultTTYSpeed = "9600"; //$NON-NLS-1$
- public static final String fcDefaultTTYDeviceWin32 = "COM1"; //$NON-NLS-1$
- public static final String fcDefaultTTYDeviceSolaris = "/dev/cua/a"; //$NON-NLS-1$
- public static final String fcDefaultTTYDeviceLinux = "/dev/ttyS0"; //$NON-NLS-1$
- public static final String fcDefaultTTYDatabits = "8"; //$NON-NLS-1$
- public static final String fcDefaultTTYParity = "None"; //$NON-NLS-1$
- public static final String fcDefaultTTYStopbits = "1"; //$NON-NLS-1$
- public static final String fcDefaultTTYFlowControl = "None"; //$NON-NLS-1$
- public static final String fcDefaultTTYTimeout = "5"; //$NON-NLS-1$
- public static final String fcEditableTTYOther = "Other..."; //$NON-NLS-1$
-
- private static final String[] fcTTYSpeedRates = { "600", //$NON-NLS-1$
- "1200", //$NON-NLS-1$
- "2400", //$NON-NLS-1$
- "4800", //$NON-NLS-1$
- "9600", //$NON-NLS-1$
- "14400", //$NON-NLS-1$
- "19200", //$NON-NLS-1$
- "38400", //$NON-NLS-1$
- "57600", //$NON-NLS-1$
- "115200" //$NON-NLS-1$
- };
-
- private static final String[] fcTTYDatabits = {
- "8", "7" //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- private static final String[] fcTTYParity = {
- "None", "Odd", "Even" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- };
-
- private static final String[] fcTTYStopbits = {
- "1", "2" //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- private static final String[] fcTTYFlowControl = {
- "None", "Hardware", "Software" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- };
-
- Label hostTTYDeviceLabel;
- Combo hostTTYDeviceCombo;
- Label hostTTYSpeedLabel;
- Combo hostTTYSpeedCombo;
- Label hostTTYBitsLabel;
- Combo hostTTYBitsCombo;
- Label hostTTYParityLabel;
- Combo hostTTYParityCombo;
- Label hostTTYStopbitsLabel;
- Combo hostTTYStopbitsCombo;
- Label hostTTYFlowControlLabel;
- Combo hostTTYFlowControlCombo;
- Label hostTTYTimeoutLabel;
- Text hostTTYTimeoutText;
-
- // Keep the fInputValidator protected!
- protected IInputValidator inputValidatorBaud;
-
- int lastSelected = -1;
- int lastSelectedBaud = -1;
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public SerialLinePanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- protected class CustomSerialBaudRateInputValidator implements IInputValidator {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
- */
- @Override
- public String isValid(String newText) {
- if (newText != null && newText.trim().length() > 0) {
- if (!newText.matches("[0-9]*")) { //$NON-NLS-1$
- return Messages.SerialLinePanel_error_invalidCharactesBaudRate;
- }
- } else if (newText != null) {
- // Empty string is an error without message (see interface)!
- return ""; //$NON-NLS-1$
- }
- return null;
- }
- }
-
- /**
- * Returns the input validator to be used for checking the custom serial
- * baud rate for basic plausibility.
- */
- protected IInputValidator getCustomSerialBaudRateInputValidator() {
- if (inputValidatorBaud == null) {
- inputValidatorBaud = new CustomSerialBaudRateInputValidator();
- }
- return inputValidatorBaud;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Assert.isNotNull(parent);
- Assert.isNotNull(toolkit);
-
- Composite panel = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- panel.setBackground(parent.getBackground());
-
- setControl(panel);
-
- final Composite client = toolkit.createComposite(panel);
- Assert.isNotNull(client);
- client.setLayout(new GridLayout(2, false));
- client.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- client.setBackground(panel.getBackground());
-
- // Host TTY settings
- hostTTYDeviceLabel = new Label(client, SWT.NONE);
- hostTTYDeviceLabel.setText(Messages.SerialLinePanel_hostTTYDevice_label);
-
- hostTTYDeviceCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYDeviceCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYDeviceCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- // if the user selected the special editable device, show a dialog asking for the device name
- if (fcEditableTTYOther.equals(hostTTYDeviceCombo.getText())) {
- List<String> tty = new ArrayList<String>();
- List<String> tcp = new ArrayList<String>();
- String selected = hostTTYDeviceCombo.getItem(lastSelected);
- for (String device : hostTTYDeviceCombo.getItems()) {
- if (!device.equalsIgnoreCase(fcEditableTTYOther)) {
- if (device.toUpperCase().startsWith("TCP:")) { //$NON-NLS-1$
- tcp.add(device);
- }
- else {
- tty.add(device);
- }
- }
- }
- SerialPortAddressDialog dialog = new SerialPortAddressDialog(client.getShell(), selected, tty, tcp);
- if (dialog.open() == Window.OK) {
- // retrieve the custom serial device name and set it to the combobox drop
- String device = dialog.getData();
- if (device != null && device.trim().length() > 0) {
- hostTTYDeviceCombo.add(device.trim());
- hostTTYDeviceCombo.setText(device.trim());
- } else if (lastSelected != -1) {
- hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(lastSelected));
- }
- } else if (lastSelected != -1){
- hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(lastSelected));
- }
- }
- lastSelected = hostTTYDeviceCombo.getSelectionIndex();
-
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
-
- hostTTYSpeedLabel = new Label(client, SWT.NONE);
- hostTTYSpeedLabel.setText(Messages.SerialLinePanel_hostTTYSpeed_label);
-
- hostTTYSpeedCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYSpeedCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYSpeedCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- // if the user selected the special editable baud rate, show a dialog asking for the baud rate
- if (fcEditableTTYOther.equals(hostTTYSpeedCombo.getText())) {
- InputDialog dialog = new InputDialog(getControl().getShell(),
- Messages.SerialLinePanel_customSerialBaudRate_title,
- Messages.SerialLinePanel_customSerialBaudRate_message,
- "", //$NON-NLS-1$
- getCustomSerialBaudRateInputValidator());
- if (dialog.open() == Window.OK) {
- // retrieve the custom serial device name and set it to the combobox drop
- String device = dialog.getValue();
- if (device != null && device.trim().length() > 0) {
- int index = hostTTYSpeedCombo.indexOf(fcEditableTTYOther);
- if (index != -1 && index == hostTTYSpeedCombo.getItemCount() - 1) {
- hostTTYSpeedCombo.add(device.trim());
- } else if (index != -1) {
- hostTTYSpeedCombo.setItem(index + 1, device.trim());
- }
- hostTTYSpeedCombo.setText(device.trim());
- } else if (lastSelectedBaud != -1) {
- hostTTYSpeedCombo.setText(hostTTYSpeedCombo.getItem(lastSelectedBaud));
- }
- } else if (lastSelectedBaud != -1){
- hostTTYSpeedCombo.setText(hostTTYSpeedCombo.getItem(lastSelectedBaud));
- }
- }
- lastSelectedBaud = hostTTYSpeedCombo.getSelectionIndex();
-
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
-
- // Query the list of available serial port interfaces.
- UIPlugin.getTraceHandler().trace("SerialLinePanel: Start quering the available comm ports.", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$
-
- // Query the serial devices now.
- BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- queryAvailableSerialDevices();
- }
- });
-
- // add a special device which is being the editable one if requested at the end of the list
- hostTTYDeviceCombo.add(fcEditableTTYOther);
-
- if (hostTTYDeviceCombo.indexOf(getDefaultHostTTYDevice()) != -1) {
- hostTTYDeviceCombo.setText(getDefaultHostTTYDevice());
- } else {
- if ("".equals(hostTTYDeviceCombo.getText()) && hostTTYDeviceCombo.getItemCount() > 0) { //$NON-NLS-1$
- // USI: For SWT-GTK we need the special empty entry as well. Otherwise we will have problems
- // getting the selection changed event!
- if (hostTTYDeviceCombo.getItemCount() == 1
- && fcEditableTTYOther.equals(hostTTYDeviceCombo.getItem(0))) {
- hostTTYDeviceCombo.add("", 0); //$NON-NLS-1$
- }
- hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(0));
- }
- }
-
- if (hostTTYDeviceCombo.getItemCount() > 0) {
- hostTTYDeviceCombo.setEnabled(true);
- } else {
- hostTTYDeviceCombo.setEnabled(false);
- }
- lastSelected = hostTTYDeviceCombo.getSelectionIndex();
-
- for (String fcTTYSpeedRate : fcTTYSpeedRates) {
- hostTTYSpeedCombo.add(fcTTYSpeedRate);
- }
- hostTTYSpeedCombo.add(fcEditableTTYOther);
-
- hostTTYSpeedCombo.setText(fcDefaultTTYSpeed);
- lastSelectedBaud = hostTTYSpeedCombo.getSelectionIndex();
-
- // add the advanced serial options
- hostTTYBitsLabel = new Label(client, SWT.NONE);
- hostTTYBitsLabel.setText(Messages.SerialLinePanel_hostTTYDatabits_label);
- hostTTYBitsCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYBitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYBitsCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
-
- for (String fcTTYDatabit : fcTTYDatabits) {
- hostTTYBitsCombo.add(fcTTYDatabit);
- }
- hostTTYBitsCombo.setText(fcDefaultTTYDatabits);
-
- hostTTYParityLabel = new Label(client, SWT.NONE);
- hostTTYParityLabel.setText(Messages.SerialLinePanel_hostTTYParity_label);
- hostTTYParityCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYParityCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYParityCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
-
- for (String element : fcTTYParity) {
- hostTTYParityCombo.add(element);
- }
- hostTTYParityCombo.setText(fcDefaultTTYParity);
-
- hostTTYStopbitsLabel = new Label(client, SWT.NONE);
- hostTTYStopbitsLabel.setText(Messages.SerialLinePanel_hostTTYStopbits_label);
- hostTTYStopbitsCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYStopbitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYStopbitsCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
-
- for (String fcTTYStopbit : fcTTYStopbits) {
- hostTTYStopbitsCombo.add(fcTTYStopbit);
- }
- hostTTYStopbitsCombo.setText(fcDefaultTTYStopbits);
-
- hostTTYFlowControlLabel = new Label(client, SWT.NONE);
- hostTTYFlowControlLabel.setText(Messages.SerialLinePanel_hostTTYFlowControl_label);
- hostTTYFlowControlCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYFlowControlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYFlowControlCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
-
- for (String element : fcTTYFlowControl) {
- hostTTYFlowControlCombo.add(element);
- }
- hostTTYFlowControlCombo.setText(fcDefaultTTYFlowControl);
-
- hostTTYTimeoutLabel = new Label(client, SWT.NONE);
- hostTTYTimeoutLabel.setText(Messages.SerialLinePanel_hostTTYTimeout_label);
- hostTTYTimeoutText = new Text(client, SWT.SINGLE | SWT.BORDER);
- hostTTYTimeoutText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYTimeoutText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- IConfigurationPanelContainer container = SerialLinePanel.this.getContainer();
- if (container != null) container.validate();
- }
- });
- hostTTYTimeoutText.setText(fcDefaultTTYTimeout);
- }
-
- /**
- * Query the list of serial devices.
- */
- protected void queryAvailableSerialDevices() {
- // Avoid printing the library version output to stdout if the platform
- // is not in debug mode.
- String prop = System.getProperty("gnu.io.rxtx.NoVersionOutput"); //$NON-NLS-1$
- if (prop == null && !Platform.inDebugMode()) {
- System.setProperty("gnu.io.rxtx.NoVersionOutput", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // java.lang.UnsatisfiedLinkError: ../plugins/gnu.io.rxtx.solaris.sparc_2.1.7.200702281917/os/solaris/sparc/librxtxSerial.so:
- // Can't load Sparc 32-bit .so on a Sparc 32-bit platform
- // May happen in CommPortIdentifier static constructor!
- try {
- Enumeration<CommPortIdentifier> ttyPortIds = CommPortIdentifier.getPortIdentifiers();
- if (!ttyPortIds.hasMoreElements()) {
- UIPlugin.getTraceHandler().trace("SerialLinePanel: NO comm ports available at all!", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$
- }
- final List<String> ports = new ArrayList<String>();
- while (ttyPortIds.hasMoreElements()) {
- CommPortIdentifier port = ttyPortIds.nextElement();
- String type = "unknown"; //$NON-NLS-1$
- if (port.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
- type = "parallel"; //$NON-NLS-1$
- }
- if (port.getPortType() == CommPortIdentifier.PORT_SERIAL) {
- type = "serial"; //$NON-NLS-1$
- }
- UIPlugin.getTraceHandler().trace("SerialLinePanel: Found comm port: name='" + port.getName() + "', type='" + type, ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ //$NON-NLS-2$
- // only add serial ports
- if (port.getPortType() == CommPortIdentifier.PORT_SERIAL) {
- UIPlugin.getTraceHandler().trace("SerialLinePanel: Adding found serial comm port to combo!", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$
- if (!ports.contains(port.getName())) {
- ports.add(port.getName());
- }
- }
- }
- if (!ports.isEmpty()) {
- Collections.sort(ports);
- // This method may executed in a separate thread. We must spawn back
- // into the UI thread to execute the adding of the ports to the control.
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- for (String port : ports) {
- hostTTYDeviceCombo.add(port);
- }
- }
- });
- }
- } catch (UnsatisfiedLinkError e) {
- IStatus status = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(),
- Messages.SerialLinePanel_warning_FailedToLoadSerialPorts, e);
- UIPlugin.getDefault().getLog().log(status);
- } catch (NoClassDefFoundError e) {
- // The NoClassDefFoundError happens the second time if the load of the library
- // failed once! We do ignore this error completely!
- }
- }
-
- /**
- * Enables or disables the configuration panels controls.
- *
- * @param enabled Specify <code>true</code> to enable the controls, <code>false</code> otherwise.
- */
- @Override
- public void setEnabled(boolean enabled) {
- hostTTYDeviceLabel.setEnabled(enabled);
- hostTTYDeviceCombo.setEnabled(enabled);
- hostTTYSpeedLabel.setEnabled(enabled);
- hostTTYSpeedCombo.setEnabled(enabled);
- hostTTYBitsLabel.setEnabled(enabled);
- hostTTYBitsCombo.setEnabled(enabled);
- hostTTYParityLabel.setEnabled(enabled);
- hostTTYParityCombo.setEnabled(enabled);
- hostTTYStopbitsLabel.setEnabled(enabled);
- hostTTYStopbitsCombo.setEnabled(enabled);
- hostTTYFlowControlLabel.setEnabled(enabled);
- hostTTYFlowControlCombo.setEnabled(enabled);
- }
-
- /**
- * The name of the serial ports differ between the host platforms, so we have to
- * detect the default host TTY device based on the host platform.
- */
- public String getDefaultHostTTYDevice() {
- String osName = System.getProperty("os.name"); //$NON-NLS-1$
- // Linux ?
- if (osName.equalsIgnoreCase("Linux")) { //$NON-NLS-1$
- return fcDefaultTTYDeviceLinux;
- }
- // Solaris ?
- if (osName.equalsIgnoreCase("SunOS")) { //$NON-NLS-1$
- return fcDefaultTTYDeviceSolaris;
- }
- // Windows ?
- if (osName.toLowerCase().startsWith("windows")) { //$NON-NLS-1$
- return fcDefaultTTYDeviceWin32;
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the default value for the serial port speed setting in bit/s
- */
- public String getDefaultHostTTYSpeed() {
- return fcDefaultTTYSpeed;
- }
-
- /**
- * Returns the default value for the serial port data bits setting
- */
- public String getDefaultHostTTYDatabits() {
- return fcDefaultTTYDatabits;
- }
-
- /**
- * Returns the default value for the serial port parity setting
- */
- public String getDefaultHostTTYParity() {
- return fcDefaultTTYParity;
- }
-
- /**
- * Returns the default value for the serial port stop bits setting
- */
- public String getDefaultHostTTYStopbits() {
- return fcDefaultTTYStopbits;
- }
-
- /**
- * Returns the default value for the serial port flow control setting
- */
- public String getDefaultHostTTYFlowControl() {
- return fcDefaultTTYFlowControl;
- }
-
- /**
- * Returns the default value for the serial port timeout setting.
- */
- public String getDefaultHostTTYTimeout() {
- return fcDefaultTTYTimeout;
- }
-
- /**
- * Set the text to the combo if available as selectable option.
- *
- * @param combo The combo box control. Must not be <code>null</code>.
- * @param value The value to set. Must not be <code>null</code>.
- */
- protected void doSetTextInCombo(Combo combo, String value) {
- Assert.isNotNull(combo);
- Assert.isNotNull(value);
- if (combo.indexOf(value) != 1) {
- combo.setText(value);
- }
- }
-
- /**
- * Select the given tty device if available.
- *
- * @param value The tty device to select. Must not be <code>null</code>.
- */
- public void setSelectedTTYDevice(String value) {
- doSetTextInCombo(hostTTYDeviceCombo, value);
- }
-
- /**
- * Select the given tty device if available. The method
- * will do nothing if the specified index is invalid.
- *
- * @param index The index of the tty device to select.
- */
- public void setSelectedTTYDevice(int index) {
- if (index >= 0 && index < hostTTYDeviceCombo.getItemCount()) {
- hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(index));
- }
- }
-
- /**
- * Select the given tty device speed if available.
- *
- * @param value The tty device speed to select. Must not be <code>null</code>.
- */
- public void setSelectedTTYSpeed(String value) {
- doSetTextInCombo(hostTTYSpeedCombo, value);
- }
-
- /**
- * Select the given tty device data bit configuration if available.
- *
- * @param value The tty device data bit configuration to select. Must not be <code>null</code>.
- */
- public void setSelectedTTYDatabits(String value) {
- doSetTextInCombo(hostTTYBitsCombo, value);
- }
-
- /**
- * Select the given tty device parity configuration if available.
- *
- * @param value The tty device parity configuration to select. Must not be <code>null</code>.
- */
- public void setSelectedTTYParity(String value) {
- doSetTextInCombo(hostTTYParityCombo, value);
- }
-
- /**
- * Select the given tty device stop bit configuration if available.
- *
- * @param value The tty device stop bit configuration to select. Must not be <code>null</code>.
- */
- public void setSelectedTTYStopbits(String value) {
- doSetTextInCombo(hostTTYStopbitsCombo, value);
- }
-
- /**
- * Select the given tty device flow control configuration if available.
- *
- * @param value The tty device flow control configuration to select. Must not be <code>null</code>.
- */
- public void setSelectedTTYFlowControl(String value) {
- doSetTextInCombo(hostTTYFlowControlCombo, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid() {
- String selectedTTYDevice = hostTTYDeviceCombo.getText();
- if (selectedTTYDevice == null || selectedTTYDevice.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYDevice, IMessageProvider.ERROR);
- return false;
- }
-
- if (fcEditableTTYOther.equals(selectedTTYDevice)) {
- setMessage(Messages.SerialLinePanel_info_editableTTYDeviceSelected, IMessageProvider.INFORMATION);
- return false;
- }
-
- String selectedTTYSpeedRate = hostTTYSpeedCombo.getText();
- if (selectedTTYSpeedRate == null || selectedTTYSpeedRate.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYSpeedRate, IMessageProvider.ERROR);
- return false;
- }
-
- if (fcEditableTTYOther.equals(selectedTTYSpeedRate)) {
- setMessage(Messages.SerialLinePanel_info_editableTTYBaudRateSelected, IMessageProvider.INFORMATION);
- return false;
- }
-
- String option = hostTTYBitsCombo.getText();
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYDatabits, IMessageProvider.ERROR);
- return false;
- }
-
- option = hostTTYParityCombo.getText();
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYParity, IMessageProvider.ERROR);
- return false;
- }
-
- option = hostTTYStopbitsCombo.getText();
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYStopbits, IMessageProvider.ERROR);
- return false;
- }
-
- option = hostTTYFlowControlCombo.getText();
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR);
- return false;
- }
-
- option = hostTTYTimeoutText.getText();
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR);
- return false;
- }
-
- return true;
- }
-
- private final String fcSelectedTTYDeviceSlotId = "SerialLinePanel.selectedTTYDevice." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
- private final String fcSelectedTTYSpeedRateSlotId = "SerialLinePanel.selectedTTYSpeedRate." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
- private final String fcSelectedTTYDatabitsSlotId = "SerialLinePanel.selectedTTYDatabits." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
- private final String fcSelectedTTYParitySlotId = "SerialLinePanel.selectedTTYParity." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
- private final String fcSelectedTTYStopbitsSlotId = "SerialLinePanel.selectedTTYStopbits." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
- private final String fcSelectedTTYFlowControlSlotId = "SerialLinePanel.selectedTTYFlowControl." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
- private final String fcSelectedTTYTimeoutSlotId = "SerialLinePanel.selectedTTYTimeout." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- String selectedTTYDevice = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix));
- if (selectedTTYDevice != null && selectedTTYDevice.trim().length() > 0) {
- if (hostTTYDeviceCombo.indexOf(selectedTTYDevice) != -1) {
- hostTTYDeviceCombo.setText(selectedTTYDevice);
- }
- }
-
- String selectedTTYSpeedRate = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix));
- if (selectedTTYSpeedRate != null && selectedTTYSpeedRate.trim().length() > 0) {
- if (hostTTYSpeedCombo.indexOf(selectedTTYSpeedRate) != -1) {
- hostTTYSpeedCombo.setText(selectedTTYSpeedRate);
- }
- }
-
- String option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && hostTTYBitsCombo.indexOf(option) != -1) {
- hostTTYBitsCombo.setText(option);
- }
-
- option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && hostTTYParityCombo.indexOf(option) != -1) {
- hostTTYParityCombo.setText(option);
- }
-
- option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && hostTTYStopbitsCombo.indexOf(option) != -1) {
- hostTTYStopbitsCombo.setText(option);
- }
-
- option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && hostTTYFlowControlCombo.indexOf(option) != -1) {
- hostTTYFlowControlCombo.setText(option);
- }
-
- option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && !option.equals(hostTTYTimeoutText.getText())) {
- hostTTYTimeoutText.setText(option);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix), hostTTYDeviceCombo.getText());
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix), hostTTYSpeedCombo.getText());
-
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix), hostTTYBitsCombo.getText());
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix), hostTTYParityCombo.getText());
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix), hostTTYStopbitsCombo.getText());
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix), hostTTYFlowControlCombo.getText());
- settings.put(prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix), hostTTYTimeoutText.getText());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
- */
- @Override
- public void setupData(Map<String, Object> data) {
- if (data == null) return;
-
- hostTTYDeviceCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE));
- hostTTYSpeedCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE));
-
- hostTTYBitsCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS));
- hostTTYParityCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY));
- hostTTYStopbitsCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS));
- hostTTYFlowControlCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL));
-
- Object value = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- if (value instanceof Integer) {
- hostTTYTimeoutText.setText(((Integer)value).toString());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
- */
- @Override
- public void extractData(Map<String, Object> data) {
- if (data == null) return;
-
- data.put(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, hostTTYDeviceCombo.getText());
- data.put(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, hostTTYSpeedCombo.getText());
-
- data.put(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, hostTTYBitsCombo.getText());
- data.put(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, hostTTYParityCombo.getText());
- data.put(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, hostTTYStopbitsCombo.getText());
- data.put(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, hostTTYFlowControlCombo.getText());
-
- if (hostTTYTimeoutText.getText() != null) {
- Integer timeout = null;
- try {
- timeout = Integer.decode(hostTTYTimeoutText.getText());
- } catch (NumberFormatException e) { /* ignored on purpose */ }
- if (timeout != null) data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, timeout);
- else data.remove(ITerminalsConnectorConstants.PROP_TIMEOUT);
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java
deleted file mode 100644
index 1e5632c42..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java
+++ /dev/null
@@ -1,689 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.controls;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Serial line port or address dialog.
- */
-public class SerialPortAddressDialog extends TitleAreaDialog implements IMessageProvider {
- private String contextHelpId = null;
-
- private String message;
- private int messageType;
- private String errorMessage;
- private String title;
-
- // The default message is shown to the user if no other message is set
- private String defaultMessage;
- private int defaultMessageType;
-
- Button ttyControlSelector;
- Combo ttyControl;
- Button tcpControlSelector;
- Combo addressControl;
- Combo portControl;
- Label portLabel;
-
- List<String> ttyHistory;
- List<String> tcpHistory;
-
- String data = null;
-
- // regular expressions for validator
- /* default */ static final String IP_CHARACTERS_REGEX = "[0-9][0-9\\.]*"; //$NON-NLS-1$
- /* default */ static final String IP_FRAGMENT_REGEX = "([0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])"; //$NON-NLS-1$
- /* default */ static final String IP_REGEX = IP_FRAGMENT_REGEX + "(\\." + IP_FRAGMENT_REGEX + "){3}[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$
-
- // RFC 1034 - ftp://ftp.rfc-editor.org/in-notes/std/std13.txt
- /* default */ static final String NAME_CHARACTERS_REGEX = "[a-zA-Z][0-9a-zA-Z\\-_\\.]*"; //$NON-NLS-1$
- // characters that can be set at the beginning
- /* default */ static final String NAME_START_REGEX = "[a-zA-Z]"; //$NON-NLS-1$
- // characters that can be set after the starting character
- /* default */ static final String NAME_FOLLOW_REGEX = "[a-zA-Z0-9-_]"; //$NON-NLS-1$
- // characters that can be set at the end
- /* default */ static final String NAME_END_REGEX = "[a-zA-Z0-9]"; //$NON-NLS-1$
- // single name fragment
- /* default */ static final String NAME_FRAGMENT_REGEX = "(" + NAME_START_REGEX + "(" + NAME_FOLLOW_REGEX + "*" + NAME_END_REGEX + ")?)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- /* default */ static final String NAME_REGEX = NAME_FRAGMENT_REGEX + "(\\." + NAME_FRAGMENT_REGEX + ")*[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Constructor.
- * @param parentShell
- */
- public SerialPortAddressDialog(Shell parentShell, String selected, List<String> ttyHistory, List<String> tcpHistory) {
- super(parentShell);
- this.ttyHistory = ttyHistory;
- this.tcpHistory = tcpHistory;
- this.data = selected;
-
- this.contextHelpId = UIPlugin.getUniqueIdentifier() + ".SerialPortAddressDialog"; //$NON-NLS-1$
- setHelpAvailable(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#isResizable()
- */
- @Override
- protected boolean isResizable() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#create()
- */
- @Override
- public void create() {
- super.create();
-
- // If the dialog got set a message, make sure the message is really shown
- // to the user from the beginning.
- if (isMessageSet()) {
- if (errorMessage != null) {
- super.setErrorMessage(errorMessage);
- }
- else {
- super.setMessage(message, messageType);
- }
- } else if (defaultMessage != null) {
- // Default message set
- super.setMessage(defaultMessage, defaultMessageType);
- }
-
- // If the dialog got set a title, make sure the title is shown
- if (title != null) {
- super.setTitle(title);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected final Control createDialogArea(Composite parent) {
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId);
- }
-
- // Let the super implementation create the dialog area control
- Control control = super.createDialogArea(parent);
- // Setup the inner panel as scrollable composite
- if (control instanceof Composite) {
- ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL);
-
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0; layout.marginWidth = 0;
- layout.verticalSpacing = 0; layout.horizontalSpacing = 0;
-
- sc.setLayout(layout);
- sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- Composite composite = new Composite(sc, SWT.NONE);
- composite.setLayout(new GridLayout());
-
- // Setup the dialog area content
- createDialogAreaContent(composite);
-
- sc.setContent(composite);
- sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- // Return the scrolled composite as new dialog area control
- control = sc;
- }
-
- return control;
- }
-
- /**
- * Creates the dialog area content.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- */
- protected void createDialogAreaContent(Composite parent) {
- Assert.isNotNull(parent);
-
- setDialogTitle(Messages.SerialPortAddressDialog_dialogtitle);
- setTitle(Messages.SerialPortAddressDialog_title);
-
- Composite ttyComp = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- ttyComp.setLayout(layout);
- GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = 250;
- ttyComp.setLayoutData(layoutData);
-
- Composite panel = new Composite(ttyComp, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- panel.setLayoutData(layoutData);
-
- ttyControlSelector = new Button(panel, SWT.RADIO);
- ttyControlSelector.setText(Messages.SerialLinePanel_hostTTYDevice_label);
- layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false);
- ttyControlSelector.setLayoutData(layoutData);
- ttyControlSelector.setSelection(true);
- ttyControlSelector.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean selected = ttyControlSelector.getSelection();
- setTTYControlEnabled(selected);
- setTCPControlEnabled(!selected);
- onModify();
- }
- });
-
- ttyControl = new Combo(panel, SWT.DROP_DOWN);
- layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- ttyControl.setLayoutData(layoutData);
- ttyControl.addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e) {
- onModify();
- }
- });
-
- parent.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- boolean enable = ttyHistory != null && ttyHistory.contains(data);
- setTTYControlEnabled(enable);
- setTCPControlEnabled(!enable);
- onModify();
- }
- });
-
- Composite tcpComp = new Composite(parent, SWT.NONE);
- layout = new GridLayout(2, true);
- tcpComp.setLayout(layout);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- tcpComp.setLayoutData(layoutData);
-
- Composite tcpAddrComp = new Composite(tcpComp, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0; layout.marginHeight = 0;
- tcpAddrComp.setLayout(layout);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- tcpAddrComp.setLayoutData(layoutData);
-
- tcpControlSelector = new Button(tcpAddrComp, SWT.RADIO);
- tcpControlSelector.setText(Messages.SerialPortAddressDialog_address);
- layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false);
- tcpControlSelector.setLayoutData(layoutData);
- tcpControlSelector.setSelection(false);
- tcpControlSelector.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean selected = tcpControlSelector.getSelection();
- setTTYControlEnabled(!selected);
- setTCPControlEnabled(selected);
- onModify();
- }
- });
-
- addressControl = new Combo(tcpAddrComp, SWT.DROP_DOWN);
- layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- addressControl.setLayoutData(layoutData);
- addressControl.addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e) {
- onModify();
- }
- });
-
- Composite tcpPortComp = new Composite(tcpComp, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0; layout.marginHeight = 0;
- tcpPortComp.setLayout(layout);
- layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- tcpPortComp.setLayoutData(layoutData);
-
- portLabel = new Label(tcpPortComp, SWT.HORIZONTAL);
- portLabel.setText(Messages.SerialPortAddressDialog_port);
- layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false);
- portLabel.setLayoutData(layoutData);
-
- portControl = new Combo(tcpPortComp, SWT.DROP_DOWN);
- layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- portControl.setLayoutData(layoutData);
- portControl.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- StringBuilder buffer = new StringBuilder(((Combo)e.widget).getText());
-
- try {
- if (e.end > e.start) {
- buffer.replace(e.start, e.end, e.text);
- } else if (e.end >= 0) {
- buffer.insert(e.end, e.text);
- }
- } catch (StringIndexOutOfBoundsException exc) { /* ignored on purpose */ }
-
- String fulltext = buffer.toString();
- e.doit = fulltext.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)"); //$NON-NLS-1$
-
- if (e.doit && fulltext.length() > 0 && !fulltext.equalsIgnoreCase("0x")) { //$NON-NLS-1$
- try {
- int value = Integer.decode(fulltext).intValue();
- if (value < 0 || value > 65535) {
- e.doit = false;
- }
- }
- catch (Exception ex) {
- e.doit = false;
- }
- }
- }
- });
- portControl.addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e) {
- onModify();
- }
- });
-
- // Trigger the runnable after having created all controls!
- parent.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- boolean enable = tcpHistory != null && tcpHistory.contains(data);
- setTTYControlEnabled(!enable);
- setTCPControlEnabled(enable);
- onModify();
- }
- });
-
- applyDialogFont(ttyComp);
- applyDialogFont(tcpComp);
-
- setupData();
- }
-
- private void setupData() {
- setTTYControlEnabled(true);
- setTCPControlEnabled(false);
- if (ttyHistory != null && !ttyHistory.isEmpty()) {
- for (String tty : ttyHistory) {
- if (tty != null && tty.trim().length() > 0 && ttyControl.indexOf(tty) == -1) {
- ttyControl.add(tty.trim());
- }
- if (tty != null && tty.equals(data)) {
- ttyControl.setText(tty.trim());
- }
- }
- }
- if (tcpHistory != null && !tcpHistory.isEmpty()) {
- for (String tcp : tcpHistory) {
- String[] data = tcp.split(":"); //$NON-NLS-1$
- if (data.length > 1) {
- if (data[1] != null && data[1].trim().length() > 0 && ttyControl.indexOf(data[1]) == -1) {
- addressControl.add(data[1].trim());
- }
- }
- if (data.length > 2) {
- if (data[2] != null && data[2].trim().length() > 0 && ttyControl.indexOf(data[2]) == -1) {
- addressControl.add(data[2].trim());
- }
- }
- if (tcp.equals(this.data)) {
- setTTYControlEnabled(false);
- setTCPControlEnabled(true);
- if (data.length > 1) {
- addressControl.setText(data[1]);
- }
- if (data.length > 2) {
- portControl.setText(data[2]);
- }
- }
- }
- }
- onModify();
- }
-
- void setTTYControlEnabled(boolean enable) {
- ttyControlSelector.setSelection(enable);
- ttyControl.setEnabled(enable);
- }
-
- void setTCPControlEnabled(boolean enable) {
- tcpControlSelector.setSelection(enable);
- addressControl.setEnabled(enable);
- portControl.setEnabled(enable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createButtonBar(Composite parent) {
- Control control = super.createButtonBar(parent);
- setButtonEnabled(OK, false);
- return control;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.dialogs.CustomTitleAreaDialog#okPressed()
- */
- @Override
- protected void okPressed() {
- if (ttyControlSelector.getSelection()) {
- data = ttyControl.getText();
- }
- else {
- data = "tcp:" + addressControl.getText() + ":" + portControl.getText(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- super.okPressed();
- }
-
- /**
- * Called from the single controls if the content of the controls changed.
- */
- protected void onModify() {
- setMessage(null);
-
- boolean valid = false;
-
- if (ttyControlSelector.getSelection()) {
- valid = isTtyControlValid();
- } else {
- valid = isAddressControlValid();
- valid &= isPortControlValid();
- }
-
- if (getMessage() == null) {
- setDefaultMessage(Messages.SerialPortAddressDialog_message, IMessageProvider.INFORMATION);
- }
-
- setButtonEnabled(OK, valid);
- }
-
- private static final Pattern validCharacters = Platform.OS_WIN32.equals(Platform.getOS()) ? Pattern.compile("[\\w]+") : Pattern.compile("[\\w/]+"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Validates the tty device control.
- *
- * @return <code>True</code> if the control is valid, <code>false</code> otherwise.
- */
- protected boolean isTtyControlValid() {
- if (ttyControl == null || ttyControl.isDisposed()) return false;
-
- boolean valid = true;
-
- String m = null;
- int mt = IMessageProvider.NONE;
-
- String newText = ttyControl.getText();
- Assert.isNotNull(newText);
- if (newText.trim().length() > 0) {
- Matcher matcher = validCharacters.matcher(newText);
- if (!matcher.matches()) {
- m = Messages.SerialLinePanel_error_invalidCharactes;
- mt = IMessageProvider.ERROR;
- }
- }
- else {
- m = Messages.SerialLinePanel_error_emptyHostTTYDevice;
- mt = IMessageProvider.INFORMATION;
- }
-
- valid = mt != IMessageProvider.ERROR;
- if (mt > getMessageType()) setMessage(m, mt);
-
- return valid;
- }
-
- /**
- * Validates the address control.
- *
- * @return <code>True</code> if the control is valid, <code>false</code> otherwise.
- */
- protected boolean isAddressControlValid() {
- if (addressControl == null || addressControl.isDisposed()) return false;
-
- boolean valid = true;
-
- String m = null;
- int mt = IMessageProvider.NONE;
-
- String ipOrHostName = addressControl.getText();
-
- // info message when value is empty
- if (ipOrHostName == null || ipOrHostName.trim().length() == 0) {
- m = Messages.SerialPortAddressDialog_Information_MissingTargetNameAddress;
- mt = IMessageProvider.INFORMATION;
- } else {
- ipOrHostName = ipOrHostName.trim();
- // check IP address when only numeric values and '.' are entered
- if (ipOrHostName.matches(IP_CHARACTERS_REGEX)) {
- if (!ipOrHostName.matches(IP_REGEX)) {
- m = Messages.SerialPortAddressDialog_Error_InvalidTargetIpAddress;
- mt = IMessageProvider.ERROR;
- }
- }
- else if (ipOrHostName.matches(NAME_CHARACTERS_REGEX)) {
- if (!ipOrHostName.matches(NAME_REGEX)) {
- m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress;
- mt = IMessageProvider.ERROR;
- }
- }
- else {
- m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress;
- mt = IMessageProvider.ERROR;
- }
- }
-
- valid = mt != IMessageProvider.ERROR;
- if (mt > getMessageType()) setMessage(m, mt);
-
- return valid;
- }
-
- /**
- * Validates the port control.
- *
- * @return <code>True</code> if the control is valid, <code>false</code> otherwise.
- */
- protected boolean isPortControlValid() {
- if (portControl == null || portControl.isDisposed()) return false;
-
- boolean valid = true;
-
- String m = null;
- int mt = IMessageProvider.NONE;
-
- String newText = portControl.getText();
- Assert.isNotNull(newText);
- if (newText.trim().length() > 0) {
- if (!newText.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)")) { //$NON-NLS-1$
- m = Messages.SerialPortAddressDialog_Error_InvalidPort;
- mt = IMessageProvider.ERROR;
- } else {
- try {
- int value = Integer.decode(newText).intValue();
- if (value < 0 || value > 65535) {
- m = Messages.SerialPortAddressDialog_Error_InvalidPortRange;
- mt = IMessageProvider.ERROR;
- }
- }
- catch (Exception ex) { /* ignored on purpose */ }
- }
- }
- else {
- m = Messages.SerialPortAddressDialog_Information_MissingPort;
- mt = IMessageProvider.INFORMATION;
- }
-
- valid = mt != IMessageProvider.ERROR;
- if (mt > getMessageType()) setMessage(m, mt);
-
- return valid;
- }
-
- /**
- * Return the new name after OK was pressed.
- * Unless OK was pressed, the old name is returned.
- */
- public String getData() {
- return data;
- }
-
- /**
- * Cleanup when dialog is closed.
- */
- protected void dispose() {
- message = null;
- messageType = IMessageProvider.NONE;
- errorMessage = null;
- title = null;
- defaultMessage = null;
- defaultMessageType = IMessageProvider.NONE;
- }
-
- /**
- * Cleanup the Dialog and close it.
- */
- @Override
- public boolean close() {
- dispose();
- return super.close();
- }
-
- /**
- * Set the enabled state of the dialog button specified by the given id (@see <code>IDialogConstants</code>)
- * to the given state.
- *
- * @param buttonId The button id for the button to change the enabled state for.
- * @param enabled The new enabled state to set for the button.
- */
- public void setButtonEnabled(int buttonId, boolean enabled) {
- Button button = getButton(buttonId);
- if (button != null) {
- button.setEnabled(enabled);
- }
- }
-
- /**
- * Sets the title for this dialog.
- *
- * @param title The title.
- */
- public void setDialogTitle(String title) {
- if (getShell() != null && !getShell().isDisposed()) {
- getShell().setText(title);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TitleAreaDialog#setTitle(java.lang.String)
- */
- @Override
- public void setTitle(String newTitle) {
- title = newTitle;
- super.setTitle(newTitle);
- }
-
- /**
- * Set the default message. The default message is shown within the
- * dialogs message area if no other message is set.
- *
- * @param message The default message or <code>null</code>.
- * @param type The default message type. See {@link IMessageProvider}.
- */
- public void setDefaultMessage(String message, int type) {
- defaultMessage = message;
- defaultMessageType = type;
- // Push the default message to the dialog if no other message is set
- if (!isMessageSet() && getContents() != null) {
- super.setMessage(defaultMessage, defaultMessageType);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TitleAreaDialog#setMessage(java.lang.String, int)
- */
- @Override
- public void setMessage(String newMessage, int newType) {
- // To be able to implement IMessageProvider, we have to remember the
- // set message ourselfs. There is no access to these information by the
- // base class.
- message = newMessage; messageType = newType;
- // Only pass on to super implementation if the control has been created yet
- if (getContents() != null) {
- super.setMessage(message != null ? message : defaultMessage, message != null ? messageType : defaultMessageType);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TitleAreaDialog#setErrorMessage(java.lang.String)
- */
- @Override
- public void setErrorMessage(String newErrorMessage) {
- // See setMessage(...)
- errorMessage = newErrorMessage;
- super.setErrorMessage(newErrorMessage);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
- */
- @Override
- public String getMessage() {
- return errorMessage != null ? errorMessage : message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
- */
- @Override
- public int getMessageType() {
- return errorMessage != null ? IMessageProvider.ERROR : messageType;
- }
-
- /**
- * Returns if or if not an message is set to the dialog.
- *
- * @return <code>True</code> if a message has been set, <code>false</code> otherwise.
- */
- public boolean isMessageSet() {
- return errorMessage != null || message != null;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java
deleted file mode 100644
index 9f0df469e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.serial.interfaces;
-
-/**
- * Trace slot identifiers.
- */
-public interface ITraceIds {
-
- /**
- * If activated, trace information about serial device discovery is printed out.
- */
- public static final String TRACE_SERIAL_LINE_PANEL = "trace/serialLinePanel"; //$NON-NLS-1$
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java
deleted file mode 100644
index a8da2a84f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.interfaces;
-
-/**
- * The properties specific to the wire type &quot;serial&quot;.
- */
-public interface IWireTypeSerial {
-
- /**
- * The data container.
- */
- public static String PROPERTY_CONTAINER_NAME = "serial"; //$NON-NLS-1$
-
- /**
- * The serial device name.
- */
- public static final String PROPERTY_SERIAL_DEVICE = "device"; //$NON-NLS-1$
-
- /**
- * The baud rate.
- */
- public static final String PROPERTY_SERIAL_BAUD_RATE = "baudrate"; //$NON-NLS-1$
-
- /**
- * The data bits
- */
- public static final String PROPERTY_SERIAL_DATA_BITS = "databits"; //$NON-NLS-1$
-
- /**
- * The parity
- */
- public static final String PROPERTY_SERIAL_PARITY = "parity"; //$NON-NLS-1$
-
- /**
- * The stop bits
- */
- public static final String PROPERTY_SERIAL_STOP_BITS = "stopbits"; //$NON-NLS-1$
-
- /**
- * The flow control
- */
- public static final String PROPERTY_SERIAL_FLOW_CONTROL = "flowcontrol"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java
deleted file mode 100644
index 6a8dd00a4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.launcher;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.serial.controls.SerialConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.tm.internal.terminal.serial.SerialSettings;
-
-/**
- * Serial launcher delegate implementation.
- */
-@SuppressWarnings("restriction")
-public class SerialLauncherDelegate extends AbstractLauncherDelegate {
- // The serial terminal connection memento handler
- private final IMementoHandler mementoHandler = new SerialMementoHandler();
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
- */
- @Override
- public boolean needsUserConfiguration() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
- */
- @Override
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
- return new SerialConfigurationPanel(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void execute(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- // Set the terminal tab title
- String terminalTitle = getTerminalTitle(properties);
- if (terminalTitle != null) {
- properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
- }
-
- // Serial terminals do have a disconnect button
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
- properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
- }
-
- // Get the terminal service
- ITerminalService terminal = TerminalServiceFactory.getService();
- // If not available, we cannot fulfill this request
- if (terminal != null) {
- terminal.openConsole(properties, done);
- }
- }
-
- /**
- * Returns the terminal title string.
- * <p>
- * The default implementation constructs a title like &quot;Serial &lt;port&gt; (Start time) &quot;.
- *
- * @return The terminal title string or <code>null</code>.
- */
- private String getTerminalTitle(Map<String, Object> properties) {
- String device = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE);
-
- if (device != null) {
- DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- String date = format.format(new Date(System.currentTimeMillis()));
- return NLS.bind(Messages.SerialLauncherDelegate_terminalTitle, new String[]{device, date});
- }
- return Messages.SerialLauncherDelegate_terminalTitle_default;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (IMementoHandler.class.equals(adapter)) {
- return mementoHandler;
- }
- return super.getAdapter(adapter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
- */
- @Override
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.serial.SerialConnector"; //$NON-NLS-1$
-
- String port = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE);
- String baud = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE);
- Object value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- String timeout = value instanceof Integer ? ((Integer)value).toString() : null;
- String databits = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS);
- String stopbits = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS);
- String parity = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY);
- String flowcontrol = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL);
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the serial settings
- SerialSettings serialSettings = new SerialSettings();
- serialSettings.setSerialPort(port);
- serialSettings.setBaudRate(baud);
- serialSettings.setTimeout(timeout);
- serialSettings.setDataBits(databits);
- serialSettings.setStopBits(stopbits);
- serialSettings.setParity(parity);
- serialSettings.setFlowControl(flowcontrol);
-
- // And save the settings to the store
- serialSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java
deleted file mode 100644
index 47615d288..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.launcher;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.ui.IMemento;
-
-/**
- * Serial terminal connection memento handler implementation.
- */
-public class SerialMementoHandler implements IMementoHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void saveState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
-
- // Do not write the terminal title to the memento -> needs to
- // be recreated at the time of restoration.
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL));
- Object value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1);
- memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void restoreState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
-
- // Restore the terminal properties from the memento
- properties.put(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE));
- properties.put(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE));
- properties.put(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS));
- properties.put(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY));
- properties.put(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS));
- properties.put(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL));
- Integer timeout = memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT);
- if (timeout != null && timeout.intValue() != -1) properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, timeout);
- properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java
deleted file mode 100644
index 530171509..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.serial.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Externalized strings management.
- */
-public class Messages extends NLS {
-
- // The plug-in resource bundle name
- private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.serial.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String SerialLauncherDelegate_terminalTitle;
- public static String SerialLauncherDelegate_terminalTitle_default;
-
- public static String SerialLinePanel_hostTTYDevice_label;
- public static String SerialLinePanel_hostTTYSpeed_label;
- public static String SerialLinePanel_hostTTYDatabits_label;
- public static String SerialLinePanel_hostTTYParity_label;
- public static String SerialLinePanel_hostTTYStopbits_label;
- public static String SerialLinePanel_hostTTYFlowControl_label;
- public static String SerialLinePanel_hostTTYTimeout_label;
- public static String SerialLinePanel_customSerialBaudRate_title;
- public static String SerialLinePanel_customSerialBaudRate_message;
- public static String SerialLinePanel_error_invalidCharactes;
- public static String SerialLinePanel_error_invalidCharactesBaudRate;
- public static String SerialLinePanel_error_emptyHostTTYDevice;
- public static String SerialLinePanel_error_emptyHostTTYSpeedRate;
- public static String SerialLinePanel_error_emptyHostTTYDatabits;
- public static String SerialLinePanel_error_emptyHostTTYParity;
- public static String SerialLinePanel_error_emptyHostTTYStopbits;
- public static String SerialLinePanel_error_emptyHostTTYFlowControl;
- public static String SerialLinePanel_error_emptyHostTTYTimeout;
- public static String SerialLinePanel_info_editableTTYDeviceSelected;
- public static String SerialLinePanel_info_editableTTYBaudRateSelected;
- public static String SerialLinePanel_warning_FailedToLoadSerialPorts;
-
- public static String SerialPortAddressDialog_dialogtitle;
- public static String SerialPortAddressDialog_title;
- public static String SerialPortAddressDialog_message;
- public static String SerialPortAddressDialog_address;
- public static String SerialPortAddressDialog_port;
- public static String SerialPortAddressDialog_Information_MissingTargetNameAddress;
- public static String SerialPortAddressDialog_Error_InvalidTargetNameAddress;
- public static String SerialPortAddressDialog_Error_InvalidTargetIpAddress;
- public static String SerialPortAddressDialog_Information_MissingPort;
- public static String SerialPortAddressDialog_Error_InvalidPort;
- public static String SerialPortAddressDialog_Error_InvalidPortRange;
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties
deleted file mode 100644
index 2b89c1009..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties
+++ /dev/null
@@ -1,46 +0,0 @@
-###############################################################################
-# Copyright (c) 2012, 2015 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
-###############################################################################
-
-SerialLauncherDelegate_terminalTitle=Serial {0} ({1})
-SerialLauncherDelegate_terminalTitle_default=Serial Terminal
-
-SerialLinePanel_hostTTYDevice_label=Port:
-SerialLinePanel_hostTTYSpeed_label=Baud Rate:
-SerialLinePanel_hostTTYDatabits_label=Data Bits:
-SerialLinePanel_hostTTYParity_label=Parity:
-SerialLinePanel_hostTTYStopbits_label=Stop Bits:
-SerialLinePanel_hostTTYFlowControl_label=Flow Control:
-SerialLinePanel_hostTTYTimeout_label=Timeout (sec):
-SerialLinePanel_customSerialBaudRate_title=Configure Custom Serial Baud Rate
-SerialLinePanel_customSerialBaudRate_message=Please enter the custom serial baud rate:
-SerialLinePanel_error_invalidCharactes=The device name you've entered contains invalid characters.
-SerialLinePanel_error_invalidCharactesBaudRate=The baud rate you've entered contains invalid characters.
-SerialLinePanel_error_emptyHostTTYDevice=Please select a valid host serial device.
-SerialLinePanel_error_emptyHostTTYSpeedRate=Please select a valid serial device speed.
-SerialLinePanel_error_emptyHostTTYDatabits=Please select a valid number of data bits.
-SerialLinePanel_error_emptyHostTTYParity=Please select a valid parity.
-SerialLinePanel_error_emptyHostTTYStopbits=Please select a valid number of stop bits.
-SerialLinePanel_error_emptyHostTTYFlowControl=Please select a valid flow control.
-SerialLinePanel_error_emptyHostTTYTimeout=Please select a valid timeout.
-SerialLinePanel_info_editableTTYDeviceSelected=Please re-select ''Other...'' again to activate the custom serial device input dialog.
-SerialLinePanel_info_editableTTYBaudRateSelected=Please re-select ''Other...'' again to activate the custom serial baud rate input dialog.
-SerialLinePanel_warning_FailedToLoadSerialPorts=Failed to enumerate the systems serial ports.
-
-SerialPortAddressDialog_dialogtitle=Other...
-SerialPortAddressDialog_title=Configure Custom Serial Device
-SerialPortAddressDialog_message=Select the type of the custom serial device and configure the device properties.
-SerialPortAddressDialog_address=Address:
-SerialPortAddressDialog_port=Port:
-SerialPortAddressDialog_Information_MissingTargetNameAddress=Please enter a valid target name or IP address.
-SerialPortAddressDialog_Error_InvalidTargetNameAddress=Target name or IP address is not valid.
-SerialPortAddressDialog_Error_InvalidTargetIpAddress=Target IP address is not valid.
-SerialPortAddressDialog_Information_MissingPort=Please enter a valid port number.
-SerialPortAddressDialog_Error_InvalidPort=Target port number must be a valid number in the range of 0 to 65535.
-SerialPortAddressDialog_Error_InvalidPortRange=Target port number must be in the range of 0 to 65535.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath
deleted file mode 100644
index 8a8f1668c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ui.terminals.ssh/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.options
deleted file mode 100644
index 910d2e57c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.options
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.tcf.te.ui.terminals.ssh/debugmode = 0
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project
deleted file mode 100644
index c21152326..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals.ssh</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>1329502091181</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.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 6094afbd6..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,362 +0,0 @@
-#Wed Oct 19 12:10:57 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.ui.terminals.ssh/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index cf80c8bc5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,32 +0,0 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=1
-compilers.p.missing-version-require-bundle=1
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF
deleted file mode 100644
index 8762d8cf6..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.ssh;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.ssh.activator.UIPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.equinox.security;bundle-version="1.1.100",
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.tm.terminal.ssh;bundle-version="2.1.300",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.forms;bundle-version="3.5.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.ssh.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.ssh.controls,
- org.eclipse.tcf.te.ui.terminals.ssh.launcher,
- org.eclipse.tcf.te.ui.terminals.ssh.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html
deleted file mode 100644
index 0f07cf034..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 24, 2012</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties
deleted file mode 100644
index 221a2d955..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# 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
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- plugin.xml,\
- about.html
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties
deleted file mode 100644
index 9c7fb35b4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-##################################################################################
-# Copyright (c) 2011, 2015 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, SSH Terminals Extensions
-providerName = Eclipse.org - Target Explorer
-
-# ----- Terminal Connector Types -----
-
-SshConnectorType.label=SSH Connector Type
-
-# ----- Terminal Launcher Delegates -----
-
-SshLauncherDelegate.label=SSH Terminal \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml
deleted file mode 100644
index ba7ac4af5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.ui.terminals.ssh.launcher.SshLauncherDelegate"
- id="org.eclipse.tcf.te.ui.terminals.ssh.launcher.ssh"
- label="%SshLauncherDelegate.label">
- <enablement>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <test
- forcePluginActivation="true"
- property="org.eclipse.tcf.te.runtime.services.hasService"
- value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
- </iterate>
- </with>
- </enablement>
- </delegate>
- </extension>
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml
deleted file mode 100644
index 4d8aa6061..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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>org.eclipse.tcf.maven-build</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- <relativePath>../../../admin/pom-build.xml</relativePath>
- </parent>
-
- <version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals.ssh</artifactId>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java
deleted file mode 100644
index 8349dae57..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.ssh.activator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-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
- private static UIPlugin plugin;
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * 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 "org.eclipse.tcf.te.ui.terminals.ssh"; //$NON-NLS-1$
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- 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) {
- }
-
- /**
- * 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
deleted file mode 100644
index 36f238e4d..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.ssh.controls;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.equinox.security.storage.ISecurePreferences;
-import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
-import org.eclipse.equinox.security.storage.StorageException;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-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.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
-import org.eclipse.tm.internal.terminal.ssh.SshConnector;
-import org.eclipse.tm.internal.terminal.ssh.SshSettings;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * SSH wizard configuration panel implementation.
- */
-@SuppressWarnings("restriction")
-public class SshWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
-
- private static final String SAVE_USER = "saveUser"; //$NON-NLS-1$
- private static final String SAVE_PASSWORD = "savePassword"; //$NON-NLS-1$
-
- private SshSettings sshSettings;
- private ISettingsPage sshSettingsPage;
- private Button userButton;
- private Button passwordButton;
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public SshWizardConfigurationPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- panel.setLayoutData(data);
-
- // Create the host selection combo
- if (isWithoutSelection()) createHostsUI(panel, true);
-
- SshConnector conn = new SshConnector();
- sshSettings = (SshSettings) conn.getSshSettings();
- sshSettings.setHost(getSelectionHost());
- sshSettings.setUser(getDefaultUser());
-
- sshSettingsPage = conn.makeSettingsPage();
- if (sshSettingsPage instanceof AbstractSettingsPage) {
- ((AbstractSettingsPage)sshSettingsPage).setHasControlDecoration(true);
- }
- sshSettingsPage.createControl(panel);
-
- // Add the listener to the settings page
- sshSettingsPage.addListener(new ISettingsPage.Listener() {
- @Override
- public void onSettingsPageChanged(Control control) {
- if (getContainer() != null) getContainer().validate();
- }
- });
-
- // Create the encoding selection combo
- createEncodingUI(panel, true);
-
- // if user and password for host should be saved or not
- createSaveButtonsUI(panel, true);
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
- */
- @Override
- public void setupData(Map<String, Object> data) {
- if (data == null || sshSettings == null || sshSettingsPage == null) return;
-
- String value = (String)data.get(ITerminalsConnectorConstants.PROP_IP_HOST);
- if (value != null) sshSettings.setHost(value);
-
- Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT);
- value = v != null ? v.toString() : null;
- if (value != null) sshSettings.setPort(value);
-
- v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- value = v != null ? v.toString() : null;
- if (value != null) sshSettings.setTimeout(value);
-
- v = data.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
- value = v != null ? v.toString() : null;
- if (value != null) sshSettings.setKeepalive(value);
-
- value = (String)data.get(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
- if (value != null) sshSettings.setPassword(value);
-
- value = (String)data.get(ITerminalsConnectorConstants.PROP_SSH_USER);
- if (value != null) sshSettings.setUser(value);
-
- value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
- if (value != null) setEncoding(value);
-
- sshSettingsPage.loadSettings();
- }
-
- /**
- * Returns the default user name.
- *
- * @return The default user name.
- */
- private String getDefaultUser() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element);
- if (provider != null) {
- Object user = provider.getProperty(element, IContextPropertiesConstants.PROP_DEFAULT_USER);
- if (user instanceof String) return ((String) user).trim();
- }
- }
-
- return System.getProperty("user.name"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
- */
- @Override
- public void extractData(Map<String, Object> data) {
- if (data == null) return;
-
- // set the terminal connector id for ssh
- data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.ssh.SshConnector"); //$NON-NLS-1$
-
- sshSettingsPage.saveSettings();
- data.put(ITerminalsConnectorConstants.PROP_IP_HOST,sshSettings.getHost());
- data.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.valueOf(sshSettings.getPort()));
- data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.valueOf(sshSettings.getTimeout()));
- data.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.valueOf(sshSettings.getKeepalive()));
- data.put(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, sshSettings.getPassword());
- data.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
- data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
- */
- @Override
- protected void fillSettingsForHost(String host) {
- boolean saveUser = true;
- boolean savePassword = false;
- if (host != null && host.length() != 0){
- if (hostSettingsMap.containsKey(host)){
- Map<String, String> hostSettings = hostSettingsMap.get(host);
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
- sshSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT) != null) {
- sshSettings.setPort(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) {
- sshSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE) != null) {
- sshSettings.setKeepalive(hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_USER) != null) {
- sshSettings.setUser(hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_USER));
- }
- if (hostSettings.get(SAVE_PASSWORD) != null) {
- savePassword = new Boolean(hostSettings.get(SAVE_PASSWORD)).booleanValue();
- }
- if (!savePassword){
- sshSettings.setPassword(""); //$NON-NLS-1$
- } else {
- String password = accessSecurePassword(sshSettings.getHost());
- if (password != null) {
- sshSettings.setPassword(password);
- }
- }
-
- String encoding = hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING);
- if (encoding == null || "null".equals(encoding)) { //$NON-NLS-1$
- String defaultEncoding = getSelectionEncoding();
- encoding = defaultEncoding != null && !"".equals(defaultEncoding.trim()) ? defaultEncoding.trim() : "ISO-8859-1"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- setEncoding(encoding);
- } else {
- sshSettings.setHost(getSelectionHost());
- sshSettings.setUser(getDefaultUser());
- saveUser = true;
- savePassword = false;
- }
- // set settings in page
- sshSettingsPage.loadSettings();
- userButton.setSelection(saveUser);
- passwordButton.setSelection(savePassword);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- saveSettingsForHost(true);
- super.doSaveWidgetValues(settings, idPrefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
- */
- @Override
- protected void saveSettingsForHost(boolean add) {
- boolean saveUser = userButton.getSelection();
- boolean savePassword = passwordButton.getSelection();
- String host = getHostFromSettings();
- if (host != null && host.length() != 0) {
- if (hostSettingsMap.containsKey(host)){
- Map<String, String> hostSettings = hostSettingsMap.get(host);
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(sshSettings.getPort()));
- hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(sshSettings.getTimeout()));
- hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.toString(sshSettings.getKeepalive()));
- if (saveUser) {
- String defaultUser = getDefaultUser();
- if (defaultUser == null || !defaultUser.equals(sshSettings.getUser())) {
- hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
- } else {
- hostSettings.remove(ITerminalsConnectorConstants.PROP_SSH_USER);
- }
- }
- else {
- hostSettings.remove(ITerminalsConnectorConstants.PROP_SSH_USER);
- }
-
- String encoding = getEncoding();
- if (encoding != null) {
- String defaultEncoding = getSelectionEncoding();
- if (defaultEncoding != null && defaultEncoding.trim().equals(encoding)) {
- encoding = null;
- }
- }
- hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, encoding);
- hostSettings.put(SAVE_USER, Boolean.toString(saveUser));
- hostSettings.put(SAVE_PASSWORD, Boolean.toString(savePassword));
-
- if (savePassword && sshSettings.getPassword() != null && sshSettings.getPassword().length() != 0){
- saveSecurePassword(host, sshSettings.getPassword());
- }
-
- // maybe unchecked the password button - so try to remove a saved password - if any
- if (!savePassword) removeSecurePassword(host);
- } else if (add) {
- Map<String, String> hostSettings = new HashMap<String, String>();
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost());
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(sshSettings.getPort()));
- hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(sshSettings.getTimeout()));
- hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.toString(sshSettings.getKeepalive()));
- if (saveUser) {
- String defaultUser = getDefaultUser();
- if (defaultUser == null || !defaultUser.equals(sshSettings.getUser())) {
- hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
- }
- }
- hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- hostSettings.put(SAVE_USER, Boolean.toString(saveUser));
- hostSettings.put(SAVE_PASSWORD, Boolean.toString(savePassword));
- hostSettingsMap.put(host, hostSettings);
-
- if (savePassword && sshSettings.getPassword() != null && sshSettings.getPassword().length() != 0){
- saveSecurePassword(host, sshSettings.getPassword());
- }
- }
- }
- }
-
- /**
- * Save the password to the secure storage.
- *
- * @param host The host. Must not be <code>null</code>.
- * @param password The password. Must not be <code>null</code>.
- */
- private void saveSecurePassword(String host, String password) {
- Assert.isNotNull(host);
- Assert.isNotNull(password);
-
- // To access the secure storage, we need the preference instance
- ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
- if (preferences != null) {
- // Construct the secure preferences node key
- String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$
- ISecurePreferences node = preferences.node(nodeKey);
- if (node != null) {
- try {
- node.put("password", password, true); //$NON-NLS-1$
- }
- catch (StorageException ex) { /* ignored on purpose */ }
- }
- }
- }
-
- /**
- * Reads the password from the secure storage.
- *
- * @param host The host. Must not be <code>null</code>.
- * @return The password or <code>null</code>.
- */
- private String accessSecurePassword(String host) {
- Assert.isNotNull(host);
-
- // To access the secure storage, we need the preference instance
- ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
- if (preferences != null) {
- // Construct the secure preferences node key
- String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$
- ISecurePreferences node = preferences.node(nodeKey);
- if (node != null) {
- String password = null;
- try {
- password = node.get("password", null); //$NON-NLS-1$
- }
- catch (StorageException ex) { /* ignored on purpose */ }
-
- return password;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#removeSecurePassword(java.lang.String)
- */
- @Override
- protected void removeSecurePassword(String host) {
- Assert.isNotNull(host);
-
- // To access the secure storage, we need the preference instance
- ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
- if (preferences != null) {
- // Construct the secure preferences node key
- String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$
- ISecurePreferences node = preferences.node(nodeKey);
- if (node != null) {
- node.remove("password"); //$NON-NLS-1$
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid(){
- return isEncodingValid() && sshSettingsPage.validateSettings();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
- */
- @Override
- protected String getHostFromSettings() {
- sshSettingsPage.saveSettings();
- return sshSettings.getHost();
- }
-
- private void createSaveButtonsUI(final Composite parent, boolean separator) {
- Assert.isNotNull(parent);
-
- if (separator) {
- Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- }
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- userButton = new Button(panel, SWT.CHECK);
- userButton.setLayoutData(new GridData(SWT.LEAD, SWT.CENTER, false, false));
- userButton.setText(Messages.SshWizardConfigurationPanel_saveUser);
-
- passwordButton = new Button(panel, SWT.CHECK);
- passwordButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- passwordButton.setText(Messages.SshWizardConfigurationPanel_savePassword);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
deleted file mode 100644
index 3fd55ba81..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.ssh.launcher;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.ssh.controls.SshWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.tm.internal.terminal.ssh.SshSettings;
-
-/**
- * SSH launcher delegate implementation.
- */
-@SuppressWarnings("restriction")
-public class SshLauncherDelegate extends AbstractLauncherDelegate {
- // The SSH terminal connection memento handler
- private final IMementoHandler mementoHandler = new SshMementoHandler();
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
- */
- @Override
- public boolean needsUserConfiguration() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
- */
- @Override
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
- return new SshWizardConfigurationPanel(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void execute(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- // Set the terminal tab title
- String terminalTitle = getTerminalTitle(properties);
- if (terminalTitle != null) {
- properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
- }
-
- // For SSH terminals, force a new terminal tab each time it is launched,
- // if not set otherwise from outside
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) {
- properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
- }
-
- // SSH terminals do have a disconnect button
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
- properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
- }
-
- // Get the terminal service
- ITerminalService terminal = TerminalServiceFactory.getService();
- // If not available, we cannot fulfill this request
- if (terminal != null) {
- terminal.openConsole(properties, done);
- }
- }
-
- /**
- * Returns the terminal title string.
- * <p>
- * The default implementation constructs a title like &quot;SSH @ host (Start time) &quot;.
- *
- * @return The terminal title string or <code>null</code>.
- */
- private String getTerminalTitle(Map<String, Object> properties) {
- String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
- String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER);
-
- if (host != null && user!= null) {
- DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- String date = format.format(new Date(System.currentTimeMillis()));
- return NLS.bind(Messages.SshLauncherDelegate_terminalTitle, new String[]{user, host, date});
- }
- return Messages.SshLauncherDelegate_terminalTitle_default;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (IMementoHandler.class.equals(adapter)) {
- return mementoHandler;
- }
- return super.getAdapter(adapter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
- */
- @Override
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.ssh.SshConnector"; //$NON-NLS-1$
-
- // Extract the ssh properties
- String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
- Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
- String port = value != null ? value.toString() : null;
- value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- String timeout = value != null ? value.toString() : null;
- value = properties.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
- String keepAlive = value != null ? value.toString() : null;
- String password = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
- String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER);
-
- int portOffset = 0;
- if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) {
- portOffset = ((Integer)properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET)).intValue();
- if (portOffset < 0) portOffset = 0;
- }
-
- // The real port to connect to is port + portOffset
- port = Integer.toString(Integer.decode(port).intValue() + portOffset);
-
- // Construct the ssh settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the telnet settings
- SshSettings sshSettings = new SshSettings();
- sshSettings.setHost(host);
- sshSettings.setPort(port);
- sshSettings.setTimeout(timeout);
- sshSettings.setKeepalive(keepAlive);
- sshSettings.setPassword(password);
- sshSettings.setUser(user);
-
- // And save the settings to the store
- sshSettings.save(store);
-
- // MWE TODO make sure this is NOT passed outside as this is plain text
- store.put("Password", password); //$NON-NLS-1$
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java
deleted file mode 100644
index f0ce4c2c0..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.ssh.launcher;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.equinox.security.storage.ISecurePreferences;
-import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
-import org.eclipse.equinox.security.storage.StorageException;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.ui.IMemento;
-
-/**
- * SSH terminal connection memento handler implementation.
- */
-public class SshMementoHandler implements IMementoHandler {
-
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void saveState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
-
- // Do not write the terminal title to the memento -> needs to
- // be recreated at the time of restoration.
- memento.putString(ITerminalsConnectorConstants.PROP_IP_HOST, (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST));
- Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
- memento.putInteger(ITerminalsConnectorConstants.PROP_IP_PORT, value instanceof Integer ? ((Integer)value).intValue() : -1);
- value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1);
- value = properties.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
- memento.putInteger(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, value instanceof Integer ? ((Integer)value).intValue() : -1);
- memento.putString(ITerminalsConnectorConstants.PROP_SSH_USER, (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER));
- memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING));
-
- // The password is stored within the Eclipse secure preferences -> no need to store it to the memento
- //
- // If ever needed, this is an example on how to encrypt the password using 3DES. Do not remove!
-
- /*
- String password = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
- if (password != null) {
- try {
- // Generate a temporary key. In practice, you would save this key.
- // See also Encrypting with DES Using a Pass Phrase.
- // SecretKey key = KeyGenerator.getInstance("DESede").generateKey();
-
- SecretKeyFactory factory = SecretKeyFactory.getInstance("DESede"); //$NON-NLS-1$
- SecretKey key = factory.generateSecret(new DESKeySpec((ITerminalsConnectorConstants.PROP_SSH_PASSWORD + ".SshMementoHandler").getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$
-
- Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); //$NON-NLS-1$
- cipher.init(Cipher.ENCRYPT_MODE, key);
-
- String encrypedPwd = new String(Base64.encode(cipher.doFinal(password.getBytes("UTF-8")))); //$NON-NLS-1$
- memento.putString(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, encrypedPwd);
- }
- catch (Exception e) {
- if (Platform.inDebugMode()) e.printStackTrace();
- }
- }
- */
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void restoreState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
-
- // Restore the terminal properties from the memento
- properties.put(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST));
- properties.put(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getInteger(ITerminalsConnectorConstants.PROP_IP_PORT));
- properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT));
- properties.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, memento.getInteger(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE));
- properties.put(ITerminalsConnectorConstants.PROP_SSH_USER, memento.getString(ITerminalsConnectorConstants.PROP_SSH_USER));
- properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
-
- // The password is stored within the Eclipse secure preferences -> restore it from there
- // To access the secure storage, we need the preference instance
- String password = null;
- ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
- if (preferences != null && (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
- // Construct the secure preferences node key
- String nodeKey = "/Target Explorer SSH Password/" + (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST); //$NON-NLS-1$
- ISecurePreferences node = preferences.node(nodeKey);
- if (node != null) {
- try {
- password = node.get("password", null); //$NON-NLS-1$
- }
- catch (StorageException ex) { /* ignored on purpose */ }
- }
- }
-
- // Example of restoring the password from an 3DES encrypted string. Do not remove!
- /*
- String encrypedPwd = memento.getString(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
- if (encrypedPwd != null) {
- try {
- SecretKeyFactory factory = SecretKeyFactory.getInstance("DESede"); //$NON-NLS-1$
- SecretKey key = factory.generateSecret(new DESKeySpec((ITerminalsConnectorConstants.PROP_SSH_PASSWORD + ".SshMementoHandler").getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$
-
- Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); //$NON-NLS-1$
- cipher.init(Cipher.DECRYPT_MODE, key);
-
- byte[] encBytes = Base64.decode(encrypedPwd.getBytes("UTF-8")); //$NON-NLS-1$
- byte[] decBytes = cipher.doFinal(encBytes);
-
- password = new String(decBytes);
- }
- catch (Exception e) {
- if (Platform.inDebugMode()) e.printStackTrace();
- }
- }
- */
-
- properties.put(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, password);
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java
deleted file mode 100644
index 265c2e0d0..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 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
- * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.ssh.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Target Explorer TCF terminals extensions UI 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.ui.terminals.ssh.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String SshLauncherDelegate_terminalTitle;
- public static String SshLauncherDelegate_terminalTitle_default;
- public static String SshWizardConfigurationPanel_saveUser;
- public static String SshWizardConfigurationPanel_savePassword;
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties
deleted file mode 100644
index ca27a39c1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2012, 2014 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
-###############################################################################
-
-SshLauncherDelegate_terminalTitle=SSH {0}@{1} ({2})
-SshLauncherDelegate_terminalTitle_default=SSH Terminal
-SshWizardConfigurationPanel_saveUser=Save user
-SshWizardConfigurationPanel_savePassword=Save password
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath
deleted file mode 100644
index 8a8f1668c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ui.terminals.telnet/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.options
deleted file mode 100644
index 47f69c8a6..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.options
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.tcf.te.ui.terminals.telnet/debugmode = 0
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project
deleted file mode 100644
index 16dbe5988..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals.telnet</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>1329502098231</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.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 6094afbd6..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,362 +0,0 @@
-#Wed Oct 19 12:10:57 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.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 88bb9570e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,56 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Target Explorer Java STD
-formatter_settings_version=12
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index cf80c8bc5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,32 +0,0 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=1
-compilers.p.missing-version-require-bundle=1
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF
deleted file mode 100644
index 94cb5e6f8..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.telnet;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.telnet.activator.UIPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.equinox.security;bundle-version="1.1.100",
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.tm.terminal.telnet;bundle-version="2.1.300",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.forms;bundle-version="3.5.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.telnet.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.telnet.controls,
- org.eclipse.tcf.te.ui.terminals.telnet.launcher,
- org.eclipse.tcf.te.ui.terminals.telnet.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html
deleted file mode 100644
index 0f07cf034..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 24, 2012</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml
deleted file mode 100644
index 68fac1b91..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.ui.terminals.telnet.launcher.TelnetLauncherDelegate"
- id="org.eclipse.tcf.te.ui.terminals.telnet.launcher.telnet"
- label="%TelnetLauncherDelegate.label">
- <enablement>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <test
- forcePluginActivation="true"
- property="org.eclipse.tcf.te.runtime.services.hasService"
- value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
- </iterate>
- </with>
- </enablement>
- </delegate>
- </extension>
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml
deleted file mode 100644
index f3694ee36..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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>org.eclipse.tcf.maven-build</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- <relativePath>../../../admin/pom-build.xml</relativePath>
- </parent>
-
- <version>1.3.0.qualifier</version>
- <artifactId>org.eclipse.tcf.te.ui.terminals.telnet</artifactId>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java
deleted file mode 100644
index a6ce8753c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.telnet.activator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-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
- private static UIPlugin plugin;
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * 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 "org.eclipse.tcf.te.ui.terminals.telnet"; //$NON-NLS-1$
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- 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) {
- }
-
- /**
- * 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
deleted file mode 100644
index 6a3e934e4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.telnet.controls;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-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.Control;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
-import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
-import org.eclipse.tm.internal.terminal.telnet.NetworkPortMap;
-import org.eclipse.tm.internal.terminal.telnet.TelnetConnector;
-import org.eclipse.tm.internal.terminal.telnet.TelnetSettings;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * telnet wizard configuration panel implementation.
- */
-@SuppressWarnings("restriction")
-public class TelnetWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
-
- public TelnetSettings telnetSettings;
- private ISettingsPage telnetSettingsPage;
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public TelnetWizardConfigurationPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- panel.setLayoutData(data);
-
- // Create the host selection combo
- if (isWithoutSelection()) createHostsUI(panel, true);
-
- TelnetConnector conn = new TelnetConnector();
- telnetSettings = (TelnetSettings) conn.getTelnetSettings();
- telnetSettings.setHost(getSelectionHost());
- // MWE otherwise we don't get a valid default selection of the combo
- telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET);
-
- telnetSettingsPage = conn.makeSettingsPage();
- if (telnetSettingsPage instanceof AbstractSettingsPage) {
- ((AbstractSettingsPage)telnetSettingsPage).setHasControlDecoration(true);
- }
- telnetSettingsPage.createControl(panel);
-
- // Add the listener to the settings page
- telnetSettingsPage.addListener(new ISettingsPage.Listener() {
-
- @Override
- public void onSettingsPageChanged(Control control) {
- if (getContainer() != null) getContainer().validate();
- }
- });
-
- // Create the encoding selection combo
- createEncodingUI(panel, true);
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
- */
- @Override
- public void setupData(Map<String, Object> data) {
- if (data == null || telnetSettings == null || telnetSettingsPage == null) return;
-
- String value = (String)data.get(ITerminalsConnectorConstants.PROP_IP_HOST);
- if (value != null) telnetSettings.setHost(value);
-
- Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT);
- value = v != null ? v.toString() : null;
- if (value != null) telnetSettings.setNetworkPort(value);
-
- v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- value = v != null ? v.toString() : null;
- if (value != null) telnetSettings.setTimeout(value);
-
- value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
- if (value != null) setEncoding(value);
-
- telnetSettingsPage.loadSettings();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
- */
- @Override
- public void extractData(Map<String, Object> data) {
- if (data == null) return;
-
- // set the terminal connector id for ssh
- data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"); //$NON-NLS-1$
-
- telnetSettingsPage.saveSettings();
- data.put(ITerminalsConnectorConstants.PROP_IP_HOST,telnetSettings.getHost());
- data.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.valueOf(telnetSettings.getNetworkPort()));
- data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.valueOf(telnetSettings.getTimeout()));
- data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
- */
- @Override
- protected void fillSettingsForHost(String host){
- if (host != null && host.length() != 0){
- if (hostSettingsMap.containsKey(host)){
- Map<String, String> hostSettings = hostSettingsMap.get(host);
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
- telnetSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT) != null) {
- telnetSettings.setNetworkPort(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) {
- telnetSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT));
- }
- if (hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
- setEncoding(hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING));
- }
- } else {
- telnetSettings.setHost(getSelectionHost());
- // MWE otherwise we don't get a valid default selection of the combo
- telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET);
- }
- // set settings in page
- telnetSettingsPage.loadSettings();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
- */
- @Override
- protected void saveSettingsForHost(boolean add){
- String host = getHostFromSettings();
- if(host != null && host.length() != 0) {
- if (hostSettingsMap.containsKey(host)) {
- Map<String, String> hostSettings=hostSettingsMap.get(host);
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
- hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
- if (getEncoding() != null) {
- hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- }
- } else if (add) {
- Map<String, String> hostSettings=new HashMap<String, String>();
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
- hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
- hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
- if (getEncoding() != null) {
- hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
- }
- hostSettingsMap.put(host, hostSettings);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid(){
- return isEncodingValid() && telnetSettingsPage.validateSettings();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- saveSettingsForHost(true);
- super.doSaveWidgetValues(settings, idPrefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
- */
- @Override
- protected String getHostFromSettings() {
- telnetSettingsPage.saveSettings();
- return telnetSettings.getHost();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java
deleted file mode 100644
index 6bb351c8f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.telnet.launcher;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.telnet.controls.TelnetWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.telnet.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.tm.internal.terminal.telnet.TelnetSettings;
-
-/**
- * Telnet launcher delegate implementation.
- */
-@SuppressWarnings("restriction")
-public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
- // The Telnet terminal connection memento handler
- private final IMementoHandler mementoHandler = new TelnetMementoHandler();
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
- */
- @Override
- public boolean needsUserConfiguration() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
- */
- @Override
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
- return new TelnetWizardConfigurationPanel(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void execute(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- // Set the terminal tab title
- String terminalTitle = getTerminalTitle(properties);
- if (terminalTitle != null) {
- properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
- }
-
- // For Telnet terminals, force a new terminal tab each time it is launched,
- // if not set otherwise from outside
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) {
- properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
- }
-
- // Telnet terminals do have a disconnect button
- if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
- properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
- }
-
- // Get the terminal service
- ITerminalService terminal = TerminalServiceFactory.getService();
- // If not available, we cannot fulfill this request
- if (terminal != null) {
- terminal.openConsole(properties, done);
- }
- }
-
- /**
- * Returns the terminal title string.
- * <p>
- * The default implementation constructs a title like &quot;SSH @ host (Start time) &quot;.
- *
- * @return The terminal title string or <code>null</code>.
- */
- private String getTerminalTitle(Map<String, Object> properties) {
- String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
-
- if (host != null) {
- DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- String date = format.format(new Date(System.currentTimeMillis()));
- return NLS.bind(Messages.TelnetLauncherDelegate_terminalTitle, new String[]{host, date});
- }
- return Messages.TelnetLauncherDelegate_terminalTitle_default;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (IMementoHandler.class.equals(adapter)) {
- return mementoHandler;
- }
- return super.getAdapter(adapter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
- */
- @Override
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"; //$NON-NLS-1$
-
- // Extract the telnet properties
- String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
- Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
- String port = value != null ? value.toString() : null;
- value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- String timeout = value != null ? value.toString() : null;
-
- int portOffset = 0;
- if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) {
- portOffset = ((Integer)properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET)).intValue();
- if (portOffset < 0) portOffset = 0;
- }
-
- // The real port to connect to is port + portOffset
- port = Integer.toString(Integer.decode(port).intValue() + portOffset);
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the telnet settings
- TelnetSettings telnetSettings = new TelnetSettings();
- telnetSettings.setHost(host);
- telnetSettings.setNetworkPort(port);
- if (timeout != null) {
- telnetSettings.setTimeout(timeout);
- }
- // And save the settings to the store
- telnetSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java
deleted file mode 100644
index eaa0c6bde..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.telnet.launcher;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.ui.IMemento;
-
-/**
- * Telnet terminal connection memento handler implementation.
- */
-public class TelnetMementoHandler implements IMementoHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void saveState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
-
- // Do not write the terminal title to the memento -> needs to
- // be recreated at the time of restoration.
- memento.putString(ITerminalsConnectorConstants.PROP_IP_HOST, (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST));
- Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
- memento.putInteger(ITerminalsConnectorConstants.PROP_IP_PORT, value instanceof Integer ? ((Integer)value).intValue() : -1);
- value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
- memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1);
- memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
- */
- @Override
- public void restoreState(IMemento memento, Map<String, Object> properties) {
- Assert.isNotNull(memento);
- Assert.isNotNull(properties);
-
- // Restore the terminal properties from the memento
- properties.put(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST));
- properties.put(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getInteger(ITerminalsConnectorConstants.PROP_IP_PORT));
- properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT));
- properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java
deleted file mode 100644
index b1f817b86..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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
- * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.telnet.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Target Explorer TCF terminals extensions UI 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.ui.terminals.telnet.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String TelnetLauncherDelegate_terminalTitle;
- public static String TelnetLauncherDelegate_terminalTitle_default;
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties
deleted file mode 100644
index f00e91243..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# 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
-###############################################################################
-
-TelnetLauncherDelegate_terminalTitle=Telnet {0} ({1})
-TelnetLauncherDelegate_terminalTitle_default=Telnet Terminal
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.classpath
deleted file mode 100644
index 8a8f1668c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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.ui.terminals/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.options
deleted file mode 100644
index cf7e9ecb7..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.options
+++ /dev/null
@@ -1,3 +0,0 @@
-org.eclipse.tcf.te.ui.terminals/debugmode = 0
-org.eclipse.tcf.te.ui.terminals/trace/outputStreamMonitor = false
-org.eclipse.tcf.te.ui.terminals/trace/launchTerminalCommandHandler = false
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.project b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.project
deleted file mode 100644
index c8b2c5881..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tcf.te.ui.terminals</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>1329502074611</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.ui.terminals/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index e18689090..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,362 +0,0 @@
-#Fri Oct 07 16:14:53 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.ui.terminals/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 88bb9570e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,56 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Target Explorer Java STD
-formatter_settings_version=12
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index cf80c8bc5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,32 +0,0 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=1
-compilers.p.missing-version-require-bundle=1
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF
deleted file mode 100644
index c0845fe21..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,35 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals;singleton:=true
-Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.ui.terminals.activator.UIPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional,
- org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
- org.eclipse.tm.terminal;bundle-version="3.2.300",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.forms;bundle-version="3.5.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.ui.terminals.actions,
- org.eclipse.tcf.te.ui.terminals.activator;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.controls,
- org.eclipse.tcf.te.ui.terminals.help,
- org.eclipse.tcf.te.ui.terminals.interfaces,
- org.eclipse.tcf.te.ui.terminals.interfaces.tracing;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.internal;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.internal.dialogs;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.internal.handler;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.launcher,
- org.eclipse.tcf.te.ui.terminals.listeners,
- org.eclipse.tcf.te.ui.terminals.manager,
- org.eclipse.tcf.te.ui.terminals.nls;x-internal:=true,
- org.eclipse.tcf.te.ui.terminals.panels,
- org.eclipse.tcf.te.ui.terminals.services,
- org.eclipse.tcf.te.ui.terminals.streams,
- org.eclipse.tcf.te.ui.terminals.tabs,
- org.eclipse.tcf.te.ui.terminals.view
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/about.html b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/about.html
deleted file mode 100644
index 0f07cf034..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 24, 2012</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/build.properties
deleted file mode 100644
index e4c5fea5c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# 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
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- icons/,\
- contexts.xml
-src.includes = schema/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml
deleted file mode 100644
index 612cd7c14..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<contexts>
- <context id="LaunchTerminalSettingsDialog">
- <description>Select the terminal type and specify the connections settings to connect a new terminal.</description>
- </context>
- <context id="EncodingSelectionDialog">
- <description>Select the new encoding for the active terminal.</description>
- </context>
-</contexts>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gif
deleted file mode 100644
index 9e3a547c1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gif
deleted file mode 100644
index f538ca707..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gif
deleted file mode 100644
index 1ca9213a4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gif
deleted file mode 100644
index f538ca707..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gif
deleted file mode 100644
index d61dd776e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gif
deleted file mode 100644
index bbb6a9e15..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties
deleted file mode 100644
index 509b0a050..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-##################################################################################
-# Copyright (c) 2011, 2015 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, Terminals
-providerName = Eclipse.org - Target Explorer
-
-# ----- Terminals View -----
-
-TerminalsView.name=Terminals
-TerminalsView.context.name=In Terminals View
-TerminalsView.context.description=Show modified keyboard shortcuts in context menu
-
-# ----- Terminal Connectors -----
-
-TerminalConnector.streams=Streams Connector (hidden)
-
-# ----- Terminal Launcher Delegates -----
-
-StreamsLauncherDelegate.label=Streams Terminal
-
-# ----- Commands and Menu contributions -----
-
-toolbar.terminal.label=Terminals
-
-command.launch.selection.name=Open Terminal on Selection
-command.launch.name=Open Terminal
-command.launch.label=Open Terminal...
-command.launch.tooltip=Open a Terminal
-
-command.disconnect.name=Disconnect Terminal
-command.disconnect.label=Disconnect
-command.disconnect.tooltip=Disconnect Terminal Connection
-
-menu.showIn.label = Show In
-
-# ***** Extension Points *****
-
-ExtensionPoint.launcherDelegates.name=Terminal Launcher Delegates
-
-# ***** Activity contributions *****
-
-activities.category.terminals.name=Terminal
-activities.category.terminals.description=Use the terminal to connect to remote hosts via telnet, ssh and others.
-
-activities.activity.terminals.views.name=Terminal Views
-activities.activity.terminals.views.description=Terminal related views.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
deleted file mode 100644
index 0fb5c9f74..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
+++ /dev/null
@@ -1,315 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Extension points -->
- <extension-point id="launcherDelegates" name="%ExtensionPoint.launcherDelegates.name" schema="schema/launcherDelegates.exsd"/>
-
-<!-- View contributions -->
- <extension point="org.eclipse.ui.views">
- <view
- allowMultiple="true"
- category="org.eclipse.tcf.te.ui.views.category"
- class="org.eclipse.tcf.te.ui.terminals.view.TerminalsView"
- icon="icons/eview16/terminal_view.gif"
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- name="%TerminalsView.name">
- </view>
- </extension>
-
-<!-- Perspective extension contributions -->
- <extension point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.eclipse.tcf.te.ui.perspective">
- <!-- Register the view shortcuts -->
- <viewShortcut id="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- <!-- Place the Terminals view relative to the Task List view -->
- <view
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- minimized="false"
- relationship="stack"
- relative="org.eclipse.ui.views.TaskList"
- visible="false">
- </view>
- </perspectiveExtension>
-
- <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
- <!-- Register the view shortcuts -->
- <viewShortcut id="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- <!-- Place the Terminals view relative to the Task List view -->
- <view
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- minimized="false"
- relationship="stack"
- relative="org.eclipse.ui.views.TaskList"
- visible="false">
- </view>
- </perspectiveExtension>
-
- <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
- <!-- Register the view shortcuts -->
- <viewShortcut id="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- <!-- Place the Terminals view relative to the Task List view -->
- <view
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- minimized="false"
- relationship="stack"
- relative="org.eclipse.ui.views.TaskList"
- visible="false">
- </view>
- </perspectiveExtension>
-
- <perspectiveExtension targetID="org.eclipse.cdt.ui.CPerspective">
- <!-- Register the view shortcuts -->
- <viewShortcut id="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- <!-- Place the Terminals view relative to the Task List view -->
- <view
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- minimized="false"
- relationship="stack"
- relative="org.eclipse.ui.views.TaskList"
- visible="false">
- </view>
- </perspectiveExtension>
-
- <perspectiveExtension targetID="*">
- <!-- Show In shortcut -->
- <showInPart id="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- </perspectiveExtension>
- </extension>
-
-<!-- Terminal connector contributions -->
- <extension point="org.eclipse.tm.terminal.terminalConnectors">
- <connector
- name="%TerminalConnector.streams"
- id="org.eclipse.tcf.te.ui.terminals.StreamsConnector"
- hidden="true"
- class="org.eclipse.tcf.te.ui.terminals.streams.StreamsConnector"/>
- </extension>
-
-<!-- Preferences contributions -->
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.eclipse.tcf.te.ui.terminals.internal.PreferencesInitializer"/>
- </extension>
-
-<!-- Eclipse core expressions property tester -->
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.tcf.te.ui.terminals.internal.PropertyTester"
- id="org.eclipse.tcf.te.ui.terminals.PropertyTester"
- namespace="org.eclipse.tcf.te.ui.terminals"
- properties="hasApplicableLauncherDelegates,hasDisconnectButton,canDisconnect"
- type="java.lang.Object">
- </propertyTester>
- </extension>
-
-<!-- Terminals launcher delegate contributions -->
- <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates">
- <delegate
- class="org.eclipse.tcf.te.ui.terminals.streams.StreamsLauncherDelegate"
- hidden="true"
- id="org.eclipse.tcf.te.ui.terminals.telnet.launcher.streams"
- label="%StreamsLauncherDelegate.label">
- </delegate>
- </extension>
-
-<!-- Menu contributions -->
- <extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
- <toolbar
- id="org.eclipse.tcf.te.ui.terminals.toolbar"
- label="%toolbar.terminal.label">
- <command
- commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
- icon="platform:/plugin/org.eclipse.ui.console/icons/full/eview16/console_view.gif"
- id="org.eclipse.tcf.te.ui.terminals.commands.launchToolbar"
- label="%command.launch.label"
- style="push"
- tooltip="%command.launch.tooltip">
- </command>
- </toolbar>
- </menuContribution>
- <menuContribution locationURI="toolbar:org.eclipse.tcf.te.ui.terminals.TerminalsView">
- <command
- commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
- icon="platform:/plugin/org.eclipse.ui.console/icons/full/eview16/console_view.gif"
- id="org.eclipse.tcf.te.ui.terminals.commands.launchToolbarTerminalsView"
- label="%command.launch.label"
- style="push"
- tooltip="%command.launch.tooltip">
- </command>
- <command
- commandId="org.eclipse.tcf.te.ui.terminals.command.disconnect"
- icon="icons/elcl16/disconnect.gif"
- id="org.eclipse.tcf.te.ui.terminals.commands.disconnect"
- label="%command.disconnect.label"
- style="push"
- tooltip="%command.disconnect.tooltip">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.swt.custom.CTabItem">
- <test property="org.eclipse.tcf.te.ui.terminals.hasDisconnectButton" value="true"/>
- </adapt>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.terminals.TerminalsView?after=additions">
- <command
- commandId="org.eclipse.tm.terminal.maximize"
- id="org.eclipse.tcf.te.ui.terminals.commands.maximizePart"
- label="Maximize View"
- style="push">
- </command>
- <command
- commandId="org.eclipse.tm.terminal.quickaccess"
- id="org.eclipse.tcf.te.ui.terminals.commands.quickAccess"
- label="Quick Access"
- style="push">
- </command>
- </menuContribution>
-
- <!-- Project Explorer "Show In" contribution -->
- <menuContribution locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?before=group.edit">
- <menu
- id="org.eclipse.tcf.te.ui.terminals.ProjectExplorer.menu.showIn"
- label="%menu.showIn.label">
- <separator name="additions" visible="false"/>
- </menu>
- </menuContribution>
-
- </extension>
-
-<!-- Command contributions -->
- <extension point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.terminals.command_Launch"
- id="org.eclipse.tcf.te.ui.terminals.command.launch"
- name="%command.launch.selection.name">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.terminals.command_Launch"
- id="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
- name="%command.launch.name">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.terminals.command_Disconnect"
- id="org.eclipse.tcf.te.ui.terminals.command.disconnect"
- name="%command.disconnect.name">
- </command>
- </extension>
-
-<!-- Key bindings -->
- <extension point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
- contextId="org.eclipse.ui.contexts.window"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="CTRL+SHIFT+M3+T"/> <!-- Bug 435111: Don't use M1 since COMMAND+Option T already taken on Mac -->
- </extension>
-
-<!-- Handler contributions -->
- <extension point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.tcf.te.ui.terminals.internal.handler.LaunchTerminalCommandHandler"
- commandId="org.eclipse.tcf.te.ui.terminals.command.launch">
- </handler>
- <handler
- class="org.eclipse.tcf.te.ui.terminals.internal.handler.LaunchTerminalCommandHandler"
- commandId="org.eclipse.tcf.te.ui.terminals.command.launchToolbar">
- </handler>
- <handler
- class="org.eclipse.tcf.te.ui.terminals.internal.handler.DisconnectTerminalCommandHandler"
- commandId="org.eclipse.tcf.te.ui.terminals.command.disconnect">
- <enabledWhen>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.swt.custom.CTabItem">
- <test property="org.eclipse.tcf.te.ui.terminals.canDisconnect" value="true"/>
- </adapt>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.ui.terminals.internal.handler.MaximizeViewHandler"
- commandId="org.eclipse.tm.terminal.maximize">
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- </with>
- </activeWhen>
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.ui.terminals.internal.handler.QuickAccessHandler"
- commandId="org.eclipse.tm.terminal.quickaccess">
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.terminals.TerminalsView"/>
- </with>
- </activeWhen>
- </handler>
-
- </extension>
-
-<!-- Help Context contributions -->
- <extension point="org.eclipse.help.contexts">
- <contexts
- file="contexts.xml">
- </contexts>
- </extension>
-
-<!-- Activity contributions -->
- <extension point="org.eclipse.ui.activities">
- <category
- description="%activities.category.terminals.description"
- id="com.windriver.te.tcf.ui.category.terminals"
- name="%activities.category.terminals.name">
- </category>
-
- <activity
- description="%activities.activity.terminals.views.description"
- id="com.windriver.te.tcf.ui.activity.terminals.views"
- name="%activities.activity.terminals.views.name">
- </activity>
-
- <activityPatternBinding
- activityId="com.windriver.te.tcf.ui.activity.terminals.views"
- pattern="org\.eclipse\.tcf\.te\.ui\.terminals/org\.eclipse\.tcf\.te\.ui\.terminals\.TerminalsView">
- </activityPatternBinding>
- <activityPatternBinding
- activityId="com.windriver.te.tcf.ui.activity.terminals.views"
- pattern="org\.eclipse\.tcf\.te\.ui\.terminals/org\.eclipse\.tcf\.te\.ui\.terminals\.toolbar">
- </activityPatternBinding>
- <activityPatternBinding
- activityId="com.windriver.te.tcf.ui.activity.terminals.views"
- pattern="org\.eclipse\.tcf\.te\.ui\.terminals/org\.eclipse\.tcf\.te\.ui\.terminals\.commands\..*">
- </activityPatternBinding>
-
- <categoryActivityBinding
- activityId="com.windriver.te.tcf.ui.activity.terminals.views"
- categoryId="com.windriver.te.tcf.ui.category.terminals">
- </categoryActivityBinding>
-
- <defaultEnablement
- id="com.windriver.te.tcf.ui.activity.terminals.views">
- </defaultEnablement>
- </extension>
-
- <extension point="org.eclipse.ui.contexts">
- <context
- id="org.eclipse.tcf.te.ui.terminals.TerminalsView"
- name="%TerminalsView.context.name"
- description="%TerminalsView.context.description"
- parentId="org.eclipse.ui.contexts.window">
- </context>
- </extension>
-</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd
deleted file mode 100644
index 49c11e6ee..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd
+++ /dev/null
@@ -1,215 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.tcf.te.ui.terminals" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.tcf.te.ui.terminals" id="launcherDelegates" name="Terminal Launcher Delegates"/>
- </appinfo>
- <documentation>
- This extension point is used to contribute terminal launcher delegates.
-&lt;p&gt;
-Terminal launcher delegates contributes terminal settings widget to the &lt;code&gt;LaunchTerminalSettingsDialog&lt;/code&gt; required to open a remote terminal through a specific communication channel, like TCF or SSH.
- </documentation>
- </annotation>
-
- <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="delegate" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="delegate">
- <annotation>
- <documentation>
- Declares a terminal launcher delegate contribution.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="class" minOccurs="0" maxOccurs="1"/>
- <element ref="description" minOccurs="0" maxOccurs="1"/>
- <element ref="enablement" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of the terminal launcher delegate contribution.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string">
- <annotation>
- <documentation>
- The label representing the terminal launcher delegate within the UI.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- The class that implements &lt;code&gt;org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate&lt;/code&gt; or extends &lt;code&gt;org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate&lt;/code&gt;.
-&lt;p&gt;
-The terminal launcher delegate implementation class must be specified either by the class attribute or the class child element!
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate:org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="hidden" type="boolean">
- <annotation>
- <documentation>
- If &lt;code&gt;true&lt;/code&gt;, than the terminal launcher delegate is not visible in the UI, even if a possible &lt;code&gt;enablement&lt;/code&gt; will evaluate to &lt;code&gt;true&lt;/code&gt;.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="description" type="string">
- <annotation>
- <documentation>
- A short description of the terminal connector type to be presented in the UI.
- </documentation>
- </annotation>
- </element>
-
- <element name="class">
- <annotation>
- <documentation>
- Used when creating an &lt;code&gt;IExecutableExtension&lt;/code&gt; with a named parameter, or more than one.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- The class that implements &lt;code&gt;org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate&lt;/code&gt; or extends &lt;code&gt;org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate&lt;/code&gt;.
-&lt;p&gt;
-The terminal launcher delegate implementation class must be specified either by the class attribute or the class child element!
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate:org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parameter">
- <annotation>
- <documentation>
- A parameter for an &lt;code&gt;IExecutableExtension&lt;/code&gt;.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- &lt;p&gt;The parameter name.&lt;/p&gt;
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- &lt;p&gt;The parameter value.&lt;/p&gt;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- Target Explorer 1.0.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- This is an example of the extension point usage:
-&lt;p&gt;
-&lt;pre&gt;&lt;code&gt;
- &lt;extension point=&quot;org.eclipse.tcf.te.ui.terminals.launcherDelegates&quot;&gt;
- &lt;delegate
- id=&quot;org.eclipse.tcf.te.ui.terminals.launcher.tcf&quot;
- class=&quot;org.eclipse.tcf.te.tcf.terminals.ui.internal.TerminalLauncherDelegate&quot;
- label=&quot;TCF Terminal&quot;&gt;
- &lt;enablement&gt;
- ...
- &lt;/enablement&gt;
- &lt;/delegate&gt;
- &lt;/extension&gt;
-&lt;/code&gt;&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- The provider of a launcher delegate must implement &lt;samp&gt;org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate&lt;/samp&gt;.
- </documentation>
- </annotation>
-
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- 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.
- </documentation>
- </annotation>
-
-</schema>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java
deleted file mode 100644
index 3ab4f8cef..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 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.ui.terminals.actions;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * Abstract terminal action wrapper implementation.
- */
-@SuppressWarnings("restriction")
-public abstract class AbstractAction extends AbstractTerminalAction {
- // Reference to the parent toolbar handler
- private final TabFolderToolbarHandler parent;
-
- /**
- * Constructor.
- *
- * @param parent
- * The parent toolbar handler instance. Must not be
- * <code>null</code>.
- * @param id
- * The terminal action id. Must not be <code>null</code>.
- */
- public AbstractAction(TabFolderToolbarHandler parent, String id) {
- super(id);
-
- Assert.isNotNull(parent);
- this.parent = parent;
- }
-
- /**
- * Returns the parent toolbar handler.
- *
- * @return The parent toolbar handler.
- */
- protected final TabFolderToolbarHandler getParent() {
- return parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getParent().getActiveTerminalViewControl();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#run()
- */
- @Override
- public void run() {
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParent().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- // And execute the command
- executeCommand(activeTabItem.getData("customData")); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Executes the command for the given data node as current and active menu selection.
- * <p>
- * <b>Node:</b> If the provided data node is <code>null</code>, the method will trigger
- * the command with an empty selection.
- *
- * @param data The terminal custom data node or <code>null</code>.
- */
- protected void executeCommand(Object data) {
- // Get the command service from the workbench
- ICommandService service = (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
- if (service != null && getCommandId() != null) {
- // Get the command
- final Command command = service.getCommand(getCommandId());
- if (command != null && command.isDefined()) {
- IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- Assert.isNotNull(handlerSvc);
-
- // Construct a selection element
- IStructuredSelection selection = data != null ? new StructuredSelection(data) : new StructuredSelection();
- // Construct the application context
- EvaluationContext context = new EvaluationContext(handlerSvc.getCurrentState(), selection);
- // Apply the selection to the "activeMenuSelection" and "selection" variable too
- context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- context.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
- // Allow plugin activation
- context.setAllowPluginActivation(true);
- // And execute the event
- try {
- ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
- Assert.isNotNull(pCmd);
-
- handlerSvc.executeCommandInContext(pCmd, null, context);
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.AbstractAction_error_commandExecutionFailed, getCommandId(), e.getLocalizedMessage()),
- e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
- }
-
- /**
- * Returns the command id of the command to execute.
- *
- * @return The command id. Must be never <code>null</code>.
- */
- protected abstract String getCommandId();
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- // Ignore the flag given from outside. We have to decide ourself
- // what the enabled state of the action is
- boolean enabled = getTarget() != null;
-
- // If a target terminal control is available, we need to find the corresponding
- // VLM target object which we need to trigger the handler
- if (enabled) {
- // The action will be enabled if we can determine the VLM target object
- enabled = false;
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParent().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- enabled = checkEnableAction(activeTabItem.getData("customData")); //$NON-NLS-1$
- }
- }
- }
-
- setEnabled(enabled);
- }
-
- /**
- * Checks if the action should be enabled based on the given terminal data object.
- *
- * @param data The terminal data node or <code>null</code>.
- * @return <code>True</code> to enable the action, <code>false</code> otherwise.
- */
- protected boolean checkEnableAction(Object data) {
- return data != null;
- }
-
- /**
- * Returns if the action is a separator. Returning <code>true</code> here
- * means that an additional separator toolbar element is added right or
- * above of the action.
- *
- * @return <code>True</code> if the action is separating the parent contribution manager, <code>false</code> otherwise.
- */
- public boolean isSeparator() {
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java
deleted file mode 100644
index f152023c5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 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.ui.terminals.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-
-/**
- * Pins the currently visible terminal view.
- */
-@SuppressWarnings("restriction")
-public class PinTerminalAction extends AbstractTerminalAction {
-
- private ITerminalsView view = null;
-
- /**
- * Constructor.
- */
- public PinTerminalAction(ITerminalsView view) {
- super(null, PinTerminalAction.class.getName(), IAction.AS_CHECK_BOX);
-
- this.view = view;
- setupAction(Messages.PinTerminalAction_menu, Messages.PinTerminalAction_toolTip,
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Hover),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Enabled),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Disabled), true);
- setChecked(view.isPinned());
- setEnabled(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- @Override
- public void run() {
- view.setPinned(isChecked());
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java
deleted file mode 100644
index d1d567211..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * 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.ui.terminals.actions;
-
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.tcf.te.ui.terminals.internal.dialogs.EncodingSelectionDialog;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-
-/**
- * Terminal control select encoding action implementation.
- */
-@SuppressWarnings("restriction")
-public class SelectEncodingAction extends AbstractTerminalAction {
- // Reference to the parent tab folder manager
- private final TabFolderManager tabFolderManager;
-
- /**
- * Constructor.
- *
- * @param tabFolderManager The parent tab folder manager. Must not be <code>null</code>.
- */
- public SelectEncodingAction(TabFolderManager tabFolderManager) {
- super(null, SelectEncodingAction.class.getName(), IAction.AS_PUSH_BUTTON);
-
- Assert.isNotNull(tabFolderManager);
- this.tabFolderManager = tabFolderManager;
-
- setupAction(Messages.SelectEncodingAction_menu,
- Messages.SelectEncodingAction_tooltip,
- (ImageDescriptor)null,
- (ImageDescriptor)null,
- (ImageDescriptor)null,
- true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#run()
- */
- @Override
- public void run() {
- ITerminalViewControl target = getTarget();
- if (target == null) return;
-
- EncodingSelectionDialog dialog = new EncodingSelectionDialog(null);
- dialog.setEncoding(target.getEncoding());
- if (dialog.open() == Window.OK) {
- try {
- target.setEncoding(dialog.getEncoding());
- tabFolderManager.updateStatusLine();
- }
- catch (UnsupportedEncodingException e) { e.printStackTrace(); }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- setEnabled(aboutToShow
- && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED);
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java
deleted file mode 100644
index 571eb8da3..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 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.ui.terminals.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-
-/**
- * Terminal console tab scroll lock action.
- */
-@SuppressWarnings("restriction")
-public class TabScrollLockAction extends AbstractTerminalAction {
-
- /**
- * Constructor.
- */
- public TabScrollLockAction() {
- super(null, TabScrollLockAction.class.getName(), IAction.AS_RADIO_BUTTON);
-
- setupAction(Messages.TabScrollLockAction_text,
- Messages.TabScrollLockAction_tooltip,
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Hover),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Enabled),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Disabled),
- true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#run()
- */
- @Override
- public void run() {
- ITerminalViewControl target = getTarget();
- if (target != null) {
- target.setScrollLock(!target.isScrollLock());
- setChecked(target.isScrollLock());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- setEnabled(aboutToShow && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java
deleted file mode 100644
index d2eb36b2c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * 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.ui.terminals.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabCommandFieldHandler;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-
-/**
- * Toggle command input field.
- */
-@SuppressWarnings("restriction")
-public class ToggleCommandFieldAction extends AbstractTerminalAction {
- private ITerminalsView view = null;
-
- /**
- * Constructor.
- */
- public ToggleCommandFieldAction(ITerminalsView view) {
- super(null, ToggleCommandFieldAction.class.getName(), IAction.AS_CHECK_BOX);
-
- this.view = view;
- setupAction(Messages.ToggleCommandFieldAction_menu, Messages.ToggleCommandFieldAction_toolTip,
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ToggleCommandField_Hover),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ToggleCommandField_Enabled),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ToggleCommandField_Disabled), true);
-
- TabCommandFieldHandler handler = getCommandFieldHandler();
- setChecked(handler != null && handler.hasCommandInputField());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- @Override
- public void run() {
- TabCommandFieldHandler handler = getCommandFieldHandler();
- if (handler != null) {
- handler.setCommandInputField(!handler.hasCommandInputField());
- }
- setChecked(handler != null && handler.hasCommandInputField());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- setEnabled(aboutToShow && getCommandFieldHandler() != null
- && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED);
- }
-
- /**
- * Returns the command input field handler for the active tab.
- *
- * @return The command input field handler or <code>null</code>.
- */
- protected TabCommandFieldHandler getCommandFieldHandler() {
- TabCommandFieldHandler handler = null;
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null && !activeTabItem.isDisposed()) {
- handler = manager.getTabCommandFieldHandler(activeTabItem);
- }
- }
- return handler;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java
deleted file mode 100644
index f12b8ee35..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.activator;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.terminals.listeners.WorkbenchWindowListener;
-import org.eclipse.tcf.te.ui.terminals.view.TerminalsView;
-import org.eclipse.tcf.te.ui.terminals.view.TerminalsViewMementoHandler;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchListener;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-@SuppressWarnings("restriction")
-public class UIPlugin extends AbstractUIPlugin {
- // The shared instance
- private static UIPlugin plugin;
- // The scoped preferences instance
- private static volatile ScopedEclipsePreferences scopedPreferences;
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
- // The workbench listener instance
- private IWorkbenchListener listener;
- // The global window listener instance
- private IWindowListener windowListener;
-
- /**
- * 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 plug-in.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() != null && getDefault().getBundle() != null) {
- return getDefault().getBundle().getSymbolicName();
- }
- return "org.eclipse.tcf.te.ui.terminals"; //$NON-NLS-1$
- }
-
- /**
- * Return the scoped preferences for this plug-in.
- */
- public static ScopedEclipsePreferences getScopedPreferences() {
- if (scopedPreferences == null) {
- scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier());
- }
- return scopedPreferences;
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (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;
-
- // Create and register the workbench listener instance
- listener = new IWorkbenchListener() {
-
- @Override
- public boolean preShutdown(IWorkbench workbench, boolean forced) {
- if (workbench != null && workbench.getActiveWorkbenchWindow() != null && workbench.getActiveWorkbenchWindow().getActivePage() != null) {
- // Find all "Terminals" views
- IViewReference[] refs = workbench.getActiveWorkbenchWindow().getActivePage().getViewReferences();
- for (IViewReference ref : refs) {
- IViewPart part = ref.getView(false);
- if (part instanceof TerminalsView) {
- /*
- * The terminal tabs to save to the views memento on shutdown can
- * be determined only _before_ the saveState(memento) method of the
- * view is called. Within saveState, it is already to late and the
- * terminals might be in CLOSED state already. This depends on the
- * terminal type and the corresponding connector implementation.
- *
- * To be safe, we determine the still opened terminals on shutdown
- * separately here in the preShutdown.
- */
- final List<CTabItem> saveables = new ArrayList<CTabItem>();
-
- // Get the tab folder
- CTabFolder tabFolder = (CTabFolder)((TerminalsView)part).getAdapter(CTabFolder.class);
- if (tabFolder != null && !tabFolder.isDisposed()) {
- // Get the list of tab items
- CTabItem[] items = tabFolder.getItems();
- // Loop the tab items and find the still connected ones
- for (CTabItem item : items) {
- // Ignore disposed items
- if (item.isDisposed()) continue;
- // Get the terminal view control
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- if (terminal == null || terminal.getState() != TerminalState.CONNECTED) {
- continue;
- }
- // Still connected -> Add to the list
- saveables.add(item);
- }
- }
-
- // Push the determined saveable items to the memento handler
- TerminalsViewMementoHandler mementoHandler = (TerminalsViewMementoHandler)((TerminalsView)part).getAdapter(TerminalsViewMementoHandler.class);
- if (mementoHandler != null) mementoHandler.setSaveables(saveables);
- }
- }
- }
-
- return true;
- }
-
- @Override
- public void postShutdown(IWorkbench workbench) {
- }
- };
- PlatformUI.getWorkbench().addWorkbenchListener(listener);
-
- if (windowListener == null && PlatformUI.getWorkbench() != null) {
- windowListener = new WorkbenchWindowListener();
- PlatformUI.getWorkbench().addWindowListener(windowListener);
- activateContexts();
- }
- }
-
- void activateContexts() {
- if (Display.getCurrent() != null) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null && windowListener != null) windowListener.windowOpened(window);
- }
- else {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
- @Override
- public void run() {
- activateContexts();
- }});
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- if (windowListener != null && PlatformUI.getWorkbench() != null) {
- PlatformUI.getWorkbench().removeWindowListener(windowListener);
- windowListener = null;
- }
-
- plugin = null;
- scopedPreferences = null;
- traceHandler = null;
- if (listener != null) { PlatformUI.getWorkbench().removeWorkbenchListener(listener); listener = null; }
- super.stop(context);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
- */
- @Override
- protected void initializeImageRegistry(ImageRegistry registry) {
- Bundle bundle = Platform.getBundle("org.eclipse.ui.console"); //$NON-NLS-1$
- if (bundle != null) {
- URL url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_EVIEW + "console_view.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.VIEW_Terminals, ImageDescriptor.createFromURL(url));
-
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_CLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_ScrollLock_Hover, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_ELCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_ScrollLock_Enabled, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_ScrollLock_Disabled, ImageDescriptor.createFromURL(url));
-
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_CLCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_PinTerminal_Hover, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_ELCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_PinTerminal_Enabled, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_PinTerminal_Disabled, ImageDescriptor.createFromURL(url));
- }
-
- bundle = getBundle();
- URL url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_CLCL + "command_input_field.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.ACTION_ToggleCommandField_Hover, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "command_input_field.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.ACTION_ToggleCommandField_Enabled, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_DLCL + "command_input_field.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.ACTION_ToggleCommandField_Disabled, 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);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java
deleted file mode 100644
index 118c4f12f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.controls;
-
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Base control to deal with wizard or property page controls
- * which should share the same UI space.
- */
-public class ConfigurationPanelControl implements IConfigurationPanelContainer, IMessageProvider {
- private final Map<String, IConfigurationPanel> configurationPanels = new Hashtable<String, IConfigurationPanel>();
-
- private String message = null;
- private int messageType = IMessageProvider.NONE;
-
- private boolean isGroup;
-
- private FormToolkit toolkit = null;
-
- private Composite panel;
- private StackLayout panelLayout;
-
- private String activeConfigurationPanelKey = null;
- private IConfigurationPanel activeConfigurationPanel = null;
-
- private final AbstractConfigurationPanel EMPTY_PANEL;
-
- /**
- * An empty configuration panel implementation.
- */
- private static final class EmptySettingsPanel extends AbstractConfigurationPanel {
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public EmptySettingsPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- panel.setBackground(parent.getBackground());
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid() {
- return false;
- }
- }
-
- /**
- * Cleanup all resources the control might have been created.
- */
- public void dispose() {
- EMPTY_PANEL.dispose();
- }
-
- /**
- * Constructor.
- */
- public ConfigurationPanelControl() {
- EMPTY_PANEL = new EmptySettingsPanel(this);
- clear();
- setPanelIsGroup(false);
- }
-
- /**
- * Sets if or if not the controls panel is a <code>Group</code>.
- *
- * @param isGroup <code>True</code> if the controls panel is a group, <code>false</code> otherwise.
- */
- public void setPanelIsGroup(boolean isGroup) {
- this.isGroup = isGroup;
- }
-
- /**
- * Returns if or if not the controls panel is a <code>Group</code>.
- *
- * @return <code>True</code> if the controls panel is a group, <code>false</code> otherwise.
- */
- public boolean isPanelIsGroup() {
- return isGroup;
- }
-
- /**
- * Returns the controls panel.
- *
- * @return The controls panel or <code>null</code>.
- */
- public Composite getPanel() {
- return panel;
- }
-
- /**
- * Returns the label text to set for the group (if the panel is a group).
- *
- * @return The label text to apply or <code>null</code>.
- */
- public String getGroupLabel() {
- return null;
- }
-
- /**
- * Sets the form toolkit to be used for creating the control widgets.
- *
- * @param toolkit The form toolkit instance or <code>null</code>.
- */
- public final void setFormToolkit(FormToolkit toolkit) {
- this.toolkit = toolkit;
- }
-
- /**
- * Returns the form toolkit used for creating the control widgets.
- *
- * @return The form toolkit instance or <code>null</code>.
- */
- public final FormToolkit getFormToolkit() {
- return toolkit;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer#validate()
- */
- @Override
- public void validate() {
- }
-
- /**
- * To be called from the embedding control to setup the controls UI elements.
- *
- * @param parent The parent control. Must not be <code>null</code>!
- * @param toolkit The form toolkit. Must not be <code>null</code>.
- */
- public void setupPanel(Composite parent, String[] configurationPanelKeys, FormToolkit toolkit) {
- Assert.isNotNull(parent);
- Assert.isNotNull(toolkit);
-
- setFormToolkit(toolkit);
-
- if (isPanelIsGroup()) {
- panel = new Group(parent, SWT.NONE);
- if (getGroupLabel() != null) ((Group)panel).setText(getGroupLabel());
- } else {
- panel = new Composite(parent, SWT.NONE);
- }
- Assert.isNotNull(panel);
- panel.setFont(parent.getFont());
- panel.setBackground(parent.getBackground());
-
- panelLayout = new StackLayout();
- panel.setLayout(panelLayout);
-
- setupConfigurationPanels(panel, configurationPanelKeys, toolkit);
- EMPTY_PANEL.setupPanel(panel, toolkit);
- }
-
- /**
- * Removes all configuration panels.
- */
- public void clear() {
- configurationPanels.clear();
- }
-
- /**
- * Returns a unsorted list of all registered configuration panel id's.
- *
- * @return A list of registered configuration panel id's.
- */
- public String[] getConfigurationPanelIds() {
- return configurationPanels.keySet().toArray(new String[configurationPanels.keySet().size()]);
- }
-
- /**
- * Returns the configuration panel instance registered for the given configuration panel key.
- *
- * @param key The key to get the configuration panel for. Must not be <code>null</code>!
- * @return The configuration panel instance or an empty configuration panel if the key is unknown.
- */
- public IConfigurationPanel getConfigurationPanel(String key) {
- IConfigurationPanel panel = key != null ? configurationPanels.get(key) : null;
- return panel != null ? panel : EMPTY_PANEL;
- }
-
- /**
- * Returns if or if not the given configuration panel is equal to the
- * empty configuration panel.
- *
- * @param panel The configuration panel or <code>null</code>.
- * @return <code>True</code> if the configuration panel is equal to the empty configuration panel.
- */
- public final boolean isEmptyConfigurationPanel(IConfigurationPanel panel) {
- return EMPTY_PANEL == panel;
- }
-
- /**
- * Adds the given configuration panel under the given configuration panel key to the
- * list of known panels. If the given configuration panel is <code>null</code>, any
- * configuration panel stored under the given key is removed from the list of known panels.
- *
- * @param key The key to get the configuration panel for. Must not be <code>null</code>!
- * @param panel The configuration panel instance or <code>null</code>.
- */
- public void addConfigurationPanel(String key, IConfigurationPanel panel) {
- if (key == null) return;
- if (panel != null) {
- configurationPanels.put(key, panel);
- } else {
- configurationPanels.remove(key);
- }
- }
-
- /**
- * Setup the configuration panels for being presented to the user. This method is called by the
- * controls <code>doSetupPanel(...)</code> and initialize all possible configuration panels to show.
- * The default implementation iterates over the given list of configuration panel keys and calls
- * <code>setupPanel(...)</code> for each of them.
- *
- * @param parent The parent composite to use for the configuration panels. Must not be <code>null</code>!
- * @param configurationPanelKeys The list of configuration panels to initialize. Might be <code>null</code> or empty!
- * @param toolkit The form toolkit. Must not be <code>null</code>.
- */
- public void setupConfigurationPanels(Composite parent, String[] configurationPanelKeys, FormToolkit toolkit) {
- Assert.isNotNull(parent);
- Assert.isNotNull(toolkit);
-
- if (configurationPanelKeys != null) {
- for (int i = 0; i < configurationPanelKeys.length; i++) {
- IConfigurationPanel configPanel = getConfigurationPanel(configurationPanelKeys[i]);
- Assert.isNotNull(configPanel);
- configPanel.setupPanel(parent, toolkit);
- }
- }
- }
-
- /**
- * Make the wizard configuration panel registered under the given configuration panel key the
- * most top configuration panel. If no configuration panel is registered under the given key,
- * nothing will happen.
- *
- * @param key The key to get the wizard configuration panel for. Must not be <code>null</code>!
- */
- public void showConfigurationPanel(String key) {
- String activeKey = getActiveConfigurationPanelKey();
- if (key != null && key.equals(activeKey) && activeConfigurationPanel != null) {
- return;
- }
- IConfigurationPanel configPanel = getActiveConfigurationPanel();
- Map<String, Object> data = new HashMap<String, Object>();
- if (configPanel != null) configPanel.extractData(data);
- configPanel = getConfigurationPanel(key);
- Assert.isNotNull(configPanel);
- if (configPanel.getControl() != null) {
- activeConfigurationPanel = configPanel;
- activeConfigurationPanelKey = key;
- panelLayout.topControl = configPanel.getControl();
- panel.layout();
- if (!data.isEmpty()) configPanel.updateData(data);
- configPanel.activate();
- }
- else {
- activeConfigurationPanelKey = key;
- }
- }
-
- /**
- * Returns the currently active configuration panel.
- *
- * @return The active configuration panel or <code>null</code>.
- */
- public IConfigurationPanel getActiveConfigurationPanel() {
- return activeConfigurationPanel;
- }
-
- /**
- * Returns the currently active configuration panel key.
- *
- * @return The active configuration panel key or <code>null</code>.
- */
- public String getActiveConfigurationPanelKey() {
- return activeConfigurationPanelKey;
- }
-
- /**
- * Returns the dialog settings to use to save and restore control specific
- * widget values.
- *
- * @param settings The parent dialog settings. Must not be <code>null</code>.
- * @return The dialog settings to use.
- */
- public final IDialogSettings getDialogSettings(IDialogSettings settings) {
- Assert.isNotNull(settings);
-
- // Store the settings of the control within it's own section.
- String sectionName = this.getClass().getSimpleName();
- Assert.isNotNull(sectionName);
-
- IDialogSettings section = settings.getSection(sectionName);
- if (section == null) {
- section = settings.addNewSection(sectionName);
- }
-
- return section;
- }
-
- /**
- * Restore the widget values from the dialog settings store to recreate the control history.
- * <p>
- * <b>Note:</b>
- * The control is saving the widget values into a section equal to the class name {@link Class#getName()}.
- * After the sections has been created, the method calls <code>doRestoreWidgetValues</code> for restoring
- * the single properties from the dialog settings. Subclasses may override <code>doRestoreWidgetValues</code>
- * only to deal with the single properties only or <code>restoreWidgetValues</code> when to override the
- * creation of the subsections.
- *
- * @param settings The dialog settings object instance to restore the widget values from. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public final void restoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- // now, call the hook for actually reading the single properties from the dialog settings.
- doRestoreWidgetValues(getDialogSettings(settings), idPrefix);
- }
-
- /**
- * Hook to restore the widget values finally plain from the given dialog settings. This method should
- * not fragment the given dialog settings any further.
- *
- * @param settings The dialog settings to restore the widget values from. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- for (String panelKey : configurationPanels.keySet()) {
- IConfigurationPanel configPanel = getConfigurationPanel(panelKey);
- if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) {
- IDialogSettings configPanelSettings = settings.getSection(panelKey);
- if (configPanelSettings == null) configPanelSettings = settings.addNewSection(panelKey);
- configPanel.doRestoreWidgetValues(configPanelSettings, idPrefix);
- }
- }
- }
-
- /**
- * Saves the widget values to the dialog settings store for remembering the history. The control might
- * be embedded within multiple pages multiple times handling different properties. Because the single
- * controls should not mix up the history, we create subsections within the given dialog settings if
- * they do not already exist. After the sections has been created, the method calls <code>doSaveWidgetValues</code>
- * for saving the single properties to the dialog settings. Subclasses may override <code>doSaveWidgetValues</code>
- * only to deal with the single properties only or <code>saveWidgetValues</code> when to override the
- * creation of the subsections.
- *
- * @param settings The dialog settings object instance to save the widget values to. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public final void saveWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- // now, call the hook for actually writing the single properties to the dialog settings.
- doSaveWidgetValues(getDialogSettings(settings), idPrefix);
- }
-
- /**
- * Hook to save the widget values finally plain to the given dialog settings. This method should
- * not fragment the given dialog settings any further.
- *
- * @param settings The dialog settings to save the widget values to. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- IConfigurationPanel configPanel = getActiveConfigurationPanel();
- if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) {
- String key = getActiveConfigurationPanelKey();
- IDialogSettings configPanelSettings = settings.getSection(key);
- if (configPanelSettings == null) configPanelSettings = settings.addNewSection(key);
- configPanel.doSaveWidgetValues(configPanelSettings, idPrefix);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
- */
- @Override
- public final String getMessage() {
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
- */
- @Override
- public final int getMessageType() {
- return messageType;
- }
-
- /**
- * Set the message and the message type to display.
- *
- * @param message The message or <code>null</code>.
- * @param messageType The message type or <code>IMessageProvider.NONE</code>.
- */
- @Override
- public final void setMessage(String message, int messageType) {
- this.message = message;
- this.messageType = messageType;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java
deleted file mode 100644
index eb998da27..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.controls;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-
-/**
- * A helper class to create a composite with a highlighted note
- * entry and a message text.
- */
-public class NoteCompositeHelper {
-
- /**
- * The common label text to show on a note. Defaults to &quot;Note:&quot;.
- */
- public static final String NOTE_LABEL = Messages.NoteCompositeHelper_note_label;
-
- private static class NoteComposite extends Composite {
-
- public NoteComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
- Control[] childs = getChildren();
- for (int iChild = 0; iChild < childs.length; iChild++) {
- Control child = childs[iChild];
- child.setEnabled(enabled);
- }
- }
- }
-
- /**
- * Creates a composite with a highlighted Note entry and a message text.
- * This is designed to take up the full width of the page.
- *
- * @see PreferencePage#createNoteComposite, this is a plain copy of that!
- * @param font
- * the font to use
- * @param composite
- * the parent composite
- * @param title
- * the title of the note
- * @param message
- * the message for the note
- *
- * @return the composite for the note
- */
- public static Composite createNoteComposite(Font font, Composite composite, String title, String message) {
- return createNoteComposite(font, composite, title, message, SWT.DEFAULT);
- }
-
- /**
- * Creates a composite with a highlighted Note entry and a message text.
- * This is designed to take up the full width of the page.
- *
- * @see PreferencePage#createNoteComposite, this is a plain copy of that!
- * @param font
- * the font to use
- * @param composite
- * the parent composite
- * @param title
- * the title of the note
- * @param message
- * the message for the note
- * @param minCharsPerLine
- * the minimum number of characters per line. Defaults to '65' if less than '20'.
- *
- * @return the composite for the note
- */
- public static Composite createNoteComposite(Font font, Composite composite, String title, String message, int minCharsPerLine) {
- final GC gc = new GC(composite);
- gc.setFont(font);
-
- Composite messageComposite = new NoteComposite(composite, SWT.NONE);
-
- GridLayout messageLayout = new GridLayout();
- messageLayout.numColumns = 2;
- messageLayout.marginWidth = 0;
- messageLayout.marginHeight = 0;
- messageComposite.setLayout(messageLayout);
-
- GridData layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- if (composite.getLayout() instanceof GridLayout) {
- layoutData.horizontalSpan = ((GridLayout) composite.getLayout()).numColumns;
- }
- messageComposite.setLayoutData(layoutData);
- messageComposite.setFont(font);
-
- final Label noteLabel = new Label(messageComposite, SWT.BOLD);
- noteLabel.setText(title);
- noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
- noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
-
- final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- // Note: This is actually wrong but the same as in platforms
- // PreferencePage
- if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
- noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
- }
- }
- };
- JFaceResources.getFontRegistry().addListener(fontListener);
- noteLabel.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent event) {
- JFaceResources.getFontRegistry().removeListener(fontListener);
- }
- });
-
- Label messageLabel = new Label(messageComposite, SWT.WRAP);
- messageLabel.setText(message);
- messageLabel.setFont(font);
-
- /**
- * Set the controls style to FILL_HORIZONTAL making it multi-line if
- * needed
- */
- layoutData = new GridData(GridData.FILL_HORIZONTAL);
- layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), minCharsPerLine >= 20 ? minCharsPerLine : 65);
- messageLabel.setLayoutData(layoutData);
-
- gc.dispose();
-
- return messageComposite;
- }
-
- /**
- * change the text of the second label
- *
- * @param messageComposite
- * the NoteComposite that gets returned from createNoteComposite
- * @param msg
- * the new text
- */
- public static void setMessage(Composite messageComposite, String msg) {
- if (messageComposite instanceof NoteComposite) {
- Control[] children = messageComposite.getChildren();
- if (children.length == 2) {
- Control c = children[1];
- if (c instanceof Label) {
- ((Label) c).setText(msg);
- messageComposite.pack();
- }
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java
deleted file mode 100644
index 60eb8d0d3..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.interfaces;
-
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Terminal launcher configuration panel.
- */
-public interface IConfigurationPanel extends IMessageProvider {
-
- /**
- * Returns the configuration panel container.
- *
- * @return The configuration panel container or <code>null</code>.
- */
- public IConfigurationPanelContainer getContainer();
-
- /**
- * Creates the terminal launcher configuration panel UI elements within the
- * given parent composite. Terminal launcher configuration panels should always
- * create another composite within the given composite, which is the panel top
- * control. The top control is queried later from the stack layout to show the
- * different panels if the selected terminal launcher changed.
- *
- * @param parent The parent composite to create the UI elements in. Must not be <code>null</code>.
- * @param toolkit The form toolkit. Must not be <code>null</code>.
- */
- public void setupPanel(Composite parent, FormToolkit toolkit);
-
- /**
- * Cleanup all resources the wizard configuration panel might have been created.
- */
- public void dispose();
-
- /**
- * Returns the terminal launcher configuration panels top control, typically a
- * composite control. This control is requested every time the stack layout is
- * required to set a new top control because the selected terminal launcher changed.
- *
- * @return The top control or <code>null</code> if the configuration panel has been not setup yet.
- */
- public Composite getControl();
-
- /**
- * Validates the control and sets the message text and type so the parent
- * page or control is able to display validation result informations.
- * The default implementation of this method does nothing.
- *
- * @return Result of validation.
- */
- public boolean isValid();
-
- /**
- * Restore the widget values plain from the given dialog settings. This method should
- * not fragment the given dialog settings any further.
- *
- * @param settings The dialog settings to restore the widget values from. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix);
-
- /**
- * Save the widget values plain to the given dialog settings. This method should
- * not fragment the given dialog settings any further.
- *
- * @param settings The dialog settings to save the widget values to. Must not be <code>null</code>!
- * @param idPrefix The prefix to use for every dialog settings slot keys. If <code>null</code>, the dialog settings slot keys are not to prefix.
- */
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix);
-
- /**
- * Enables or disables all UI elements belonging to the wizard configuration panel.
- *
- * @param enabled <code>True</code> to enable the UI elements, <code>false</code> otherwise.
- */
- public void setEnabled(boolean enabled);
-
- /**
- * Called when the panel gets the active panel.
- */
- public void activate();
-
- /**
- * Initialize the widgets based of the data from the given map.
- * <p>
- * This method may called multiple times during the lifetime of the panel and the given
- * map might be even <code>null</code>.
- *
- * @param data The map or <code>null</code>.
- */
- public void setupData(Map<String, Object> data);
-
- /**
- * Extract the data from the widgets and write it back to the given map.
- * <p>
- * This method may called multiple times during the lifetime of the panel and the given
- * map might be even <code>null</code>.
- *
- * @param data The map or <code>null</code>.
- */
- public void extractData(Map<String, Object> data);
-
- /**
- * Update the data from the given properties container which contains the current
- * working data.
- * <p>
- * This method may called multiple times during the lifetime of the panel and the given
- * map might be even <code>null</code>.
- *
- * @param data The map or <code>null</code>.
- */
- public void updateData(Map<String, Object> data);
-
- /**
- * Set the selection to the terminal launcher configuration panel.
- *
- * @param selection The selection or <code>null</code>.
- */
- public void setSelection(ISelection selection);
-
- /**
- * Returns the selection associated with the terminal launcher configuration panel.
- *
- * @return The selection or <code>null</code>.
- */
- public ISelection getSelection();
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java
deleted file mode 100644
index 03d3f41ee..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.interfaces;
-
-
-
-/**
- * A container to deal with configuration panels.
- */
-public interface IConfigurationPanelContainer {
-
- /**
- * Validates the container status.
- * <p>
- * If necessary, set the corresponding messages and message types to signal when some sub
- * elements of the container needs user attention.
- */
- public void validate();
-
- /**
- * Set the message and the message type to display.
- *
- * @param message The message or <code>null</code>.
- * @param messageType The message type or <code>IMessageProvider.NONE</code>.
- */
- public void setMessage(String message, int messageType);
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java
deleted file mode 100644
index bf3f717ef..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.interfaces;
-
-import java.util.Map;
-
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-
-/**
- * Terminal launcher delegate.
- */
-@SuppressWarnings("restriction")
-public interface ILauncherDelegate extends IExecutableExtension, IAdaptable {
-
- /**
- * Returns the unique id of the launcher delegate. The returned
- * id must be never <code>null</code> or an empty string.
- *
- * @return The unique id.
- */
- public String getId();
-
- /**
- * Returns the label or UI name of the launcher delegate.
- *
- * @return The label or UI name. An empty string if not set.
- */
- public String getLabel();
-
- /**
- * Returns if or if not the launcher delegate is hidden for the user.
- *
- * @return <code>True</code> if the launcher delegate is hidden, <code>false</code> otherwise.
- */
- public boolean isHidden();
-
- /**
- * Returns the enablement expression.
- *
- * @return The enablement expression or <code>null</code>.
- */
- public Expression getEnablement();
-
- /**
- * Returns if or if not the user needs to set configuration details for this launcher to work.
- * The settings to configure are provided to the user through the configuration panel returned
- * by {@link #getPanel(BaseDialogPageControl)}.
- *
- * @return <code>True</code> if a user configuration is required, <code>false</code> otherwise.
- */
- public boolean needsUserConfiguration();
-
- /**
- * Returns the configuration panel instance to present to the user. The instance must be always
- * the same on subsequent calls until disposed.
- * <p>
- * The method may return <code>null</code> if the launcher does not provide any user
- * configurable settings. In this case, {@link #needsUserConfiguration()} should return
- * <code>false</code>.
- *
- * @param container The configuration panel container or <code>null</code>.
- * @return The configuration panel instance or <code>null</code>
- */
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container);
-
- /**
- * Execute the terminal launch.
- *
- * @param properties The properties. Must not be <code>null</code>.
- * @param done The callback or <code>null</code>.
- */
- public void execute(Map<String, Object> properties, ITerminalService.Done done);
-
- /**
- * Creates the terminal connector for this launcher delegate based on
- * the given properties.
- *
- * @param properties The terminal properties. Must not be <code>null</code>.
- * @return The terminal connector or <code>null</code>.
- */
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties);
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java
deleted file mode 100644
index d6ae8e6d9..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.interfaces;
-
-import java.util.Map;
-
-import org.eclipse.ui.IMemento;
-
-/**
- * Terminal properties memento handler.
- */
-public interface IMementoHandler {
-
- /**
- * Saves the terminal properties in the given memento.
- *
- * @param memento The memento. Must not be <code>null</code>.
- * @param properties The map containing the terminal properties to save. Must not be <code>null</code>.
- */
- public void saveState(IMemento memento, Map<String, Object> properties);
-
- /**
- * Restore the terminal properties from the given memento.
- *
- * @param memento The memento. Must not be <code>null</code>.
- * @param properties The map receiving the restored terminal properties. Must not be <code>null</code>.
- */
- public void restoreState(IMemento memento, Map<String, Object> properties);
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java
deleted file mode 100644
index 905b568aa..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.ui.terminals.interfaces;
-
-/**
- * Terminals plug-in preference key definitions.
- */
-public interface IPreferenceKeys {
- /**
- * Preference keys family prefix.
- */
- public final String PREF_TERMINAL = "terminals"; //$NON-NLS-1$
-
- /**
- * Preference key: Remove terminated terminals when a new terminal is created.
- */
- public final String PREF_REMOVE_TERMINATED_TERMINALS = PREF_TERMINAL + ".removeTerminatedTerminals"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java
deleted file mode 100644
index fcad40175..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.interfaces;
-
-import org.eclipse.ui.IViewPart;
-
-/**
- * Terminals view public interface.
- */
-public interface ITerminalsView extends IViewPart {
-
- /**
- * Switch to the empty page control.
- */
- public void switchToEmptyPageControl();
-
- /**
- * Switch to the tab folder control.
- */
- public void switchToTabFolderControl();
-
- /**
- * Returns the context help id associated with the terminal
- * console view instance.
- *
- * @return The context help id or <code>null</code> if none is associated.
- */
- public String getContextHelpId();
-
- /**
- * Set the state of the view to be pinned, which means a new terminal tab will be created
- * in a new view instance.
- *
- * @param pin <code>True</code> to set the view state to pinned, <code>false</code> otherwise.
- */
- public void setPinned(boolean pin);
-
- /**
- * Return the pin state of the terminal view
- *
- * @return <code>True</code> if the view instance is pinned, <code>false</code> if not.
- */
- public boolean isPinned();
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java
deleted file mode 100644
index ec47afc86..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.interfaces;
-
-/**
- * Image registry constants.
- */
-public interface ImageConsts {
- /**
- * 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 colored local toolbar images from,
- * relative to the image root directory.
- */
- public final static String IMAGE_DIR_CLCL = "clcl16/"; //$NON-NLS-1$
-
- /**
- * The directory where to load disabled local toolbar images from,
- * relative to the image root directory.
- */
- public final static String IMAGE_DIR_DLCL = "dlcl16/"; //$NON-NLS-1$
-
- /**
- * The directory where to load enabled local toolbar images from,
- * relative to the image root directory.
- */
- public final static String IMAGE_DIR_ELCL = "elcl16/"; //$NON-NLS-1$
-
- /**
- * The directory where to load view related images from, relative to
- * the image root directory.
- */
- public final static String IMAGE_DIR_EVIEW = "eview16/"; //$NON-NLS-1$
-
- /**
- * The key to access the terminals console view image.
- */
- public static final String VIEW_Terminals = "TerminalsView"; //$NON-NLS-1$
-
- /**
- * The key to access the scroll lock action image (enabled).
- */
- public static final String ACTION_ScrollLock_Enabled = "ScrollLockAction_enabled"; //$NON-NLS-1$
-
- /**
- * The key to access the scroll lock action image (disabled).
- */
- public static final String ACTION_ScrollLock_Disabled = "ScrollLockAction_disabled"; //$NON-NLS-1$
-
- /**
- * The key to access the scroll lock action image (hover).
- */
- public static final String ACTION_ScrollLock_Hover = "ScrollLockAction_hover"; //$NON-NLS-1$
-
- /**
- * The key to access the pin terminal action image (enabled).
- */
- public static final String ACTION_PinTerminal_Enabled = "PinTerminalAction_enabled"; //$NON-NLS-1$
-
- /**
- * The key to access the pin terminal action image (disabled).
- */
- public static final String ACTION_PinTerminal_Disabled = "PinTerminalAction_disabled"; //$NON-NLS-1$
-
- /**
- * The key to access the pin terminal action image (hover).
- */
- public static final String ACTION_PinTerminal_Hover = "PinTerminalAction_hover"; //$NON-NLS-1$
-
- /**
- * The key to access the toggle command field action image (enabled).
- */
- public static final String ACTION_ToggleCommandField_Enabled = "ToggleCommandField_enabled"; //$NON-NLS-1$
-
- /**
- * The key to access the toggle command field action image (disabled).
- */
- public static final String ACTION_ToggleCommandField_Disabled = "ToggleCommandField_disabled"; //$NON-NLS-1$
-
- /**
- * The key to access the toggle command field action image (hover).
- */
- public static final String ACTION_ToggleCommandField_Hover = "ToggleCommandField_hover"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java
deleted file mode 100644
index b6b6a6fa4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.internal;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IPreferenceKeys;
-
-/**
- * Terminals default preferences initializer.
- */
-public class PreferencesInitializer extends AbstractPreferenceInitializer {
-
- /**
- * Constructor.
- */
- public PreferencesInitializer() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- @Override
- public void initializeDefaultPreferences() {
- ScopedEclipsePreferences prefs = UIPlugin.getScopedPreferences();
-
- prefs.putDefaultBoolean(IPreferenceKeys.PREF_REMOVE_TERMINATED_TERMINALS, true);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java
deleted file mode 100644
index cae006f42..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.internal;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-
-
-/**
- * Terminals property tester implementation.
- */
-@SuppressWarnings("restriction")
-public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
-
- /* (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 ("hasApplicableLauncherDelegates".equals(property)) { //$NON-NLS-1$
- ISelection selection = receiver instanceof ISelection ? (ISelection)receiver : new StructuredSelection(receiver);
- return expectedValue.equals(Boolean.valueOf(LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection).length > 0));
- }
-
- if ("hasDisconnectButton".equals(property) && receiver instanceof CTabItem) { //$NON-NLS-1$
- CTabItem tabItem = (CTabItem)receiver;
- if (!tabItem.isDisposed()) {
- Boolean hasDisconnectButton = (Boolean) tabItem.getData(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON);
- return expectedValue.equals(hasDisconnectButton);
- }
- return false;
- }
-
- if ("canDisconnect".equals(property) && receiver instanceof CTabItem) { //$NON-NLS-1$
- CTabItem tabItem = (CTabItem)receiver;
- if (!tabItem.isDisposed() && tabItem.getData() instanceof ITerminalViewControl) {
- ITerminalViewControl terminal = (ITerminalViewControl)tabItem.getData();
- TerminalState state = terminal.getState();
- return expectedValue.equals(Boolean.valueOf(state != TerminalState.CLOSED));
- }
- return false;
- }
-
- return false;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java
deleted file mode 100644
index 31635db6d..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-
-/**
- * Simple default Terminal settings store implementation keeping the settings
- * within memory.
- */
-@SuppressWarnings("restriction")
-public class SettingsStore implements ISettingsStore {
- private final Map<String, Object> settings = new HashMap<String, Object>();
-
- /**
- * Constructor.
- */
- public SettingsStore() {
- }
-
- /**
- * Returns the map containing the settings.
- *
- * @return The map containing the settings.
- */
- public final Map<String, Object> getSettings() {
- return settings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String, java.lang.String)
- */
- @Override
- public final String get(String key, String defaultValue) {
- Assert.isNotNull(key);
- String value = settings.get(key) instanceof String ? (String) settings.get(key) : null;
- return value != null ? value : defaultValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String)
- */
- @Override
- public final String get(String key) {
- Assert.isNotNull(key);
- return settings.get(key) instanceof String ? (String) settings.get(key) : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#put(java.lang.String, java.lang.String)
- */
- @Override
- public final void put(String key, String value) {
- Assert.isNotNull(key);
- if (value == null) settings.remove(key);
- else settings.put(key, value);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java
deleted file mode 100644
index 628d8902e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.internal.dialogs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Encoding selection dialog implementation.
- */
-public class EncodingSelectionDialog extends TrayDialog {
- private String contextHelpId = null;
-
- // The selected encoding or null
- /* default */ String encoding = null;
-
- // Reference to the encodings panel
- private EncodingPanel encodingPanel = null;
-
- /**
- * Encodings panel implementation
- */
- protected class EncodingPanel extends AbstractExtendedConfigurationPanel {
-
- /**
- * Constructor
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public EncodingPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
- */
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- panel.setLayoutData(data);
-
- // Create the encoding selection combo
- createEncodingUI(panel, false);
- if (EncodingSelectionDialog.this.encoding != null) {
- setEncoding(EncodingSelectionDialog.this.encoding);
- }
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
- */
- @Override
- protected void saveSettingsForHost(boolean add) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
- */
- @Override
- protected void fillSettingsForHost(String host) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
- */
- @Override
- protected String getHostFromSettings() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getEncoding()
- */
- @Override
- public String getEncoding() {
- return super.getEncoding();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setEncoding(java.lang.String)
- */
- @Override
- public void setEncoding(String encoding) {
- super.setEncoding(encoding);
- }
- }
-
- /**
- * Constructor.
- *
- * @param shell The parent shell or <code>null</code>.
- */
- public EncodingSelectionDialog(Shell shell) {
- super(shell);
-
- this.contextHelpId = IContextHelpIds.ENCODING_SELECTION_DIALOG;
- setHelpAvailable(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected final Control createDialogArea(Composite parent) {
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId);
- }
-
- // Let the super implementation create the dialog area control
- Control control = super.createDialogArea(parent);
- // Setup the inner panel as scrollable composite
- if (control instanceof Composite) {
- ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL);
-
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0; layout.marginWidth = 0;
- layout.verticalSpacing = 0; layout.horizontalSpacing = 0;
-
- sc.setLayout(layout);
- sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- Composite composite = new Composite(sc, SWT.NONE);
- composite.setLayout(new GridLayout());
-
- // Setup the dialog area content
- createDialogAreaContent(composite);
-
- sc.setContent(composite);
- sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- // Return the scrolled composite as new dialog area control
- control = sc;
- }
-
- return control;
- }
-
- /**
- * Creates the dialog area content.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- */
- protected void createDialogAreaContent(Composite parent) {
- Assert.isNotNull(parent);
-
- setDialogTitle(Messages.EncodingSelectionDialog_title);
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
-
- encodingPanel = new EncodingPanel(null);
- encodingPanel.setupPanel(panel, null);
-
- applyDialogFont(panel);
- }
-
- /**
- * Sets the title for this dialog.
- *
- * @param title The title.
- */
- public void setDialogTitle(String title) {
- if (getShell() != null && !getShell().isDisposed()) {
- getShell().setText(title);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#okPressed()
- */
- @Override
- protected void okPressed() {
- // Save the selected encoding
- if (encodingPanel != null) encoding = encodingPanel.getEncoding();
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
- */
- @Override
- protected void cancelPressed() {
- // Reset the encoding
- encoding = null;
- super.cancelPressed();
- }
-
- /**
- * Set the encoding to default to on creating the dialog.
- */
- public final void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- /**
- * Returns the selected encoding or <code>null</code>.
- */
- public final String getEncoding() {
- return encoding;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
deleted file mode 100644
index 6ba77106b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2015 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
- * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.internal.dialogs;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.controls.ConfigurationPanelControl;
-import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Launch terminal settings dialog implementation.
- */
-public class LaunchTerminalSettingsDialog extends TrayDialog {
- private String contextHelpId = null;
-
- // The parent selection
- private ISelection selection = null;
-
- // The sub controls
- /* default */ Combo terminals;
- /* default */ SettingsPanelControl settings;
-
- private FormToolkit toolkit = null;
-
- // Map the label added to the combo box to the corresponding launcher delegate.
- /* default */ final Map<String, ILauncherDelegate> label2delegate = new HashMap<String, ILauncherDelegate>();
-
- // The data object containing the currently selected settings
- private Map<String, Object> data = null;
-
- // The dialog settings storage
- private IDialogSettings dialogSettings;
-
- /**
- * The control managing the terminal setting panels.
- */
- protected class SettingsPanelControl extends ConfigurationPanelControl {
-
- /**
- * Constructor.
- */
- public SettingsPanelControl() {
- setPanelIsGroup(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl#getGroupLabel()
- */
- @Override
- public String getGroupLabel() {
- return Messages.LaunchTerminalSettingsDialog_group_label;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl#showConfigurationPanel(java.lang.String)
- */
- @Override
- public void showConfigurationPanel(String key) {
- // Check if we have to create the panel first
- IConfigurationPanel configPanel = getConfigurationPanel(key);
- if (isEmptyConfigurationPanel(configPanel)) {
- // Get the corresponding delegate
- ILauncherDelegate delegate = label2delegate.get(key);
- Assert.isNotNull(delegate);
- // Create the wizard configuration panel instance
- configPanel = delegate.getPanel(this);
- if (configPanel != null) {
- // Add it to the settings panel control
- settings.addConfigurationPanel(key, configPanel);
- // Push the selection to the configuration panel
- configPanel.setSelection(getSelection());
- // Create the panel controls
- configPanel.setupPanel(getPanel(), getFormToolkit());
- // Restore widget values
- IDialogSettings dialogSettings = LaunchTerminalSettingsDialog.this.settings.getDialogSettings(LaunchTerminalSettingsDialog.this.getDialogSettings());
- IDialogSettings configPanelSettings = dialogSettings != null ? dialogSettings.getSection(key) : null;
- if (configPanelSettings != null) configPanel.doRestoreWidgetValues(configPanelSettings, null);
- }
- }
-
- super.showConfigurationPanel(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer#validate()
- */
- @Override
- public void validate() {
- LaunchTerminalSettingsDialog.this.validate();
- }
- }
-
- /**
- * Constructor.
- *
- * @param shell The parent shell or <code>null</code>.
- */
- public LaunchTerminalSettingsDialog(Shell shell) {
- this(shell, 0);
- }
-
- private long start = 0;
-
- /**
- * Constructor.
- *
- * @param shell The parent shell or <code>null</code>.
- */
- public LaunchTerminalSettingsDialog(Shell shell, long start) {
- super(shell);
- this.start = start;
-
- initializeDialogSettings();
-
- this.contextHelpId = IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG;
- setHelpAvailable(true);
- }
-
- /**
- * Sets the parent selection.
- *
- * @param selection The parent selection or <code>null</code>.
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- /**
- * Returns the parent selection.
- *
- * @return The parent selection or <code>null</code>.
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#close()
- */
- @Override
- public boolean close() {
- dispose();
- return super.close();
- }
-
- /**
- * Dispose the dialog resources.
- */
- protected void dispose() {
- if (settings != null) { settings.dispose(); settings = null; }
- if (toolkit != null) { toolkit.dispose(); toolkit = null; }
- dialogSettings = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#isResizable()
- */
- @Override
- protected boolean isResizable() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- Control composite = super.createContents(parent);
-
- // Validate the dialog after having created all the content
- validate();
-
- return composite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected final Control createDialogArea(Composite parent) {
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId);
- }
-
- // Let the super implementation create the dialog area control
- Control control = super.createDialogArea(parent);
- // Setup the inner panel as scrollable composite
- if (control instanceof Composite) {
- ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL);
-
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0; layout.marginWidth = 0;
- layout.verticalSpacing = 0; layout.horizontalSpacing = 0;
-
- sc.setLayout(layout);
- sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- sc.setExpandHorizontal(true);
- sc.setExpandVertical(true);
-
- Composite composite = new Composite(sc, SWT.NONE);
- composite.setLayout(new GridLayout());
-
- // Setup the dialog area content
- createDialogAreaContent(composite);
-
- sc.setContent(composite);
- sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- // Return the scrolled composite as new dialog area control
- control = sc;
- }
-
- return control;
- }
-
- /**
- * Sets the title for this dialog.
- *
- * @param title The title.
- */
- public void setDialogTitle(String title) {
- if (getShell() != null && !getShell().isDisposed()) {
- getShell().setText(title);
- }
- }
-
- /**
- * Creates the dialog area content.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- */
- protected void createDialogAreaContent(Composite parent) {
- Assert.isNotNull(parent);
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Creating dialog area after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
-
- setDialogTitle(Messages.LaunchTerminalSettingsDialog_title);
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.LaunchTerminalSettingsDialog_combo_label);
-
- terminals = new Combo(panel, SWT.READ_ONLY);
- terminals.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- terminals.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- // Get the old panel
- IConfigurationPanel oldPanel = settings.getActiveConfigurationPanel();
- // Extract the current settings in an special properties container
- Map<String, Object> data = new HashMap<String, Object>();
- if (oldPanel != null) oldPanel.extractData(data);
- // Clean out settings which are never passed between the panels
- data.remove(ITerminalsConnectorConstants.PROP_IP_PORT);
- data.remove(ITerminalsConnectorConstants.PROP_TIMEOUT);
- data.remove(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- data.remove(ITerminalsConnectorConstants.PROP_ENCODING);
- // Switch to the new panel
- settings.showConfigurationPanel(terminals.getText());
- // Get the new panel
- IConfigurationPanel newPanel = settings.getActiveConfigurationPanel();
- // Re-setup the relevant data
- if (newPanel != null) newPanel.setupData(data);
-
- // resize the dialog if needed to show the complete panel
- getShell().pack();
- }
- });
-
- // fill the combo with content
- fillCombo(terminals);
-
- // Create the settings panel control
- settings = new SettingsPanelControl();
-
- // Create, initialize and add the first visible panel. All
- // other panels are created on demand only.
- String terminalLabel = terminals.getItem(0);
- if (terminalLabel != null) {
- // Get the corresponding delegate
- ILauncherDelegate delegate = label2delegate.get(terminalLabel);
- Assert.isNotNull(delegate);
- // Create the wizard configuration panel instance
- IConfigurationPanel configPanel = delegate.getPanel(settings);
- if (configPanel != null) {
- // Add it to the settings panel control
- settings.addConfigurationPanel(terminalLabel, configPanel);
- // Push the selection to the configuration panel
- configPanel.setSelection(getSelection());
- }
- }
-
- // Create the toolkit
- toolkit = new FormToolkit(panel.getDisplay());
- // Setup the panel control
- settings.setupPanel(panel, terminals.getItems(), toolkit);
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.horizontalSpan = 2;
- settings.getPanel().setLayoutData(layoutData);
-
- // Preselect the first terminal launcher
- terminals.select(0);
- settings.showConfigurationPanel(terminals.getText());
-
- terminals.setEnabled(terminals.getItemCount() > 1);
-
- restoreWidgetValues();
-
- applyDialogFont(panel);
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Created dialog area after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
- }
-
- /**
- * Fill the given combo with content. The content are the terminal
- * launcher delegate labels.
- *
- * @param combo The combo. Must not be <code>null</code>.
- */
- protected void fillCombo(Combo combo) {
- Assert.isNotNull(combo);
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Filling combo after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
-
- List<String> items = new ArrayList<String>();
-
- if(selection==null || selection.isEmpty()){
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Getting launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
-
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getLauncherDelegates(false);
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Got launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
-
- for (ILauncherDelegate delegate : delegates) {
- if (delegate.isHidden() || isFiltered(selection, delegate)) continue;
- String label = delegate.getLabel();
- if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$
- label2delegate.put(label, delegate);
- items.add(label);
- }
- } else {
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Getting applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
-
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Got applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this);
- }
-
- for (ILauncherDelegate delegate : delegates) {
- if (delegate.isHidden() || isFiltered(selection, delegate)) continue;
- String label = delegate.getLabel();
- if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$
- label2delegate.put(label, delegate);
- items.add(label);
- }
- }
- Collections.sort(items);
- combo.setItems(items.toArray(new String[items.size()]));
- }
-
- /**
- * Hook to allow additional filtering of the applicable launcher delegates.
- * <p>
- * <b>Note:</b> The default implementation always returns <code>false</code>.
- *
- * @param selection The selection or <code>null</code>.
- * @param delegate The launcher delegate. Must not be <code>null</code>.
- *
- * @return <code>True</code> if the launcher delegate is filtered based on the given selection, <code>false</code> otherwise.
- */
- protected boolean isFiltered(ISelection selection, ILauncherDelegate delegate) {
- return false;
- }
-
- /**
- * Validate the dialog.
- */
- public void validate() {
- IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
- Button okButton = getButton(IDialogConstants.OK_ID);
- if (okButton != null) okButton.setEnabled(panel.isValid());
- }
-
- /**
- * Set the given message and message type.
- *
- * @param message The message or <code>null</code>.
- * @param messageType The message type or <code>IMessageProvider.NONE</code>.
- */
- public void setMessage(String message, int messageType) {
- if (settings != null) {
- settings.setMessage(message, messageType);
- }
- }
-
- /**
- * Save the dialog's widget values.
- */
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null && terminals != null) {
- settings.put("terminalLabel", terminals.getText()); //$NON-NLS-1$
- this.settings.saveWidgetValues(settings, null);
- }
- }
-
- /**
- * Restore the dialog's widget values.
- */
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String terminalLabel = settings.get("terminalLabel"); //$NON-NLS-1$
- int index = terminalLabel != null ? Arrays.asList(terminals.getItems()).indexOf(terminalLabel) : -1;
- if (index != -1) {
- terminals.select(index);
- this.settings.showConfigurationPanel(terminals.getText());
- }
-
- this.settings.restoreWidgetValues(settings, null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- @Override
- protected void okPressed() {
- IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
- Assert.isNotNull(panel);
-
- if (!panel.isValid()) {
- MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
- mb.setText(Messages.LaunchTerminalSettingsDialog_error_title);
- mb.setMessage(NLS.bind(Messages.LaunchTerminalSettingsDialog_error_invalidSettings, panel.getMessage() != null ? panel.getMessage() : Messages.LaunchTerminalSettingsDialog_error_unknownReason));
- mb.open();
- return;
- }
- data = new HashMap<String, Object>();
-
- // Store the id of the selected delegate
- data.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, label2delegate.get(terminals.getText()).getId());
- // Store the selection
- data.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
-
- // Store the delegate specific settings
- panel.extractData(data);
-
- // Save the current widget values
- saveWidgetValues();
-
- super.okPressed();
- }
-
- /**
- * Returns the configured terminal launcher settings.
- * <p>
- * The settings are extracted from the UI widgets once
- * OK got pressed.
- *
- * @return The configured terminal launcher settings or <code>null</code>.
- */
- public Map<String, Object> getSettings() {
- return data;
- }
-
- /**
- * Initialize the dialog settings storage.
- */
- protected void initializeDialogSettings() {
- IDialogSettings settings = UIPlugin.getDefault().getDialogSettings();
- Assert.isNotNull(settings);
- IDialogSettings section = settings.getSection(getClass().getSimpleName());
- if (section == null) {
- section = settings.addNewSection(getClass().getSimpleName());
- }
- setDialogSettings(section);
- }
-
- /**
- * Returns the associated dialog settings storage.
- *
- * @return The dialog settings storage.
- */
- public IDialogSettings getDialogSettings() {
- // The dialog settings may not been initialized here. Initialize first in this case
- // to be sure that we do have always the correct dialog settings.
- if (dialogSettings == null) {
- initializeDialogSettings();
- }
- return dialogSettings;
- }
-
- /**
- * Sets the associated dialog settings storage.
- *
- * @return The dialog settings storage.
- */
- public void setDialogSettings(IDialogSettings dialogSettings) {
- this.dialogSettings = dialogSettings;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java
deleted file mode 100644
index da9dde56e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.internal.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * Abstract command handler triggering a command to be executed.
- */
-public abstract class AbstractTriggerCommandHandler extends AbstractHandler {
-
- /**
- * Trigger a command to be executed.
- *
- * @param commandId The command id. Must not be <code>null</code>.
- * @param selection The selection to pass on to the command or <code>null</code>.
- */
- protected void triggerCommand(String commandId, ISelection selection) {
- Assert.isNotNull(commandId);
-
- ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
- Command command = service != null ? service.getCommand(commandId) : null;
- if (command != null && command.isDefined() && command.isEnabled()) {
- try {
- ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
- Assert.isNotNull(pCmd);
- IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- Assert.isNotNull(handlerSvc);
- IEvaluationContext ctx = handlerSvc.getCurrentState();
- if (selection != null) {
- ctx = new EvaluationContext(ctx, selection);
- ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- }
- handlerSvc.executeCommandInContext(pCmd, null, ctx);
- } catch (Exception e) {
- // If the platform is in debug mode, we print the exception to the log view
- if (Platform.inDebugMode()) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- Messages.AbstractTriggerCommandHandler_error_executionFailed, e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java
deleted file mode 100644
index 7858bf9a7..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.ui.terminals.internal.handler;
-
-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.swt.custom.CTabItem;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Disconnect terminal connection command handler implementation.
- */
-@SuppressWarnings("restriction")
-public class DisconnectTerminalCommandHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- CTabItem item = null;
-
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
- if (element instanceof CTabItem && ((CTabItem)element).getData() instanceof ITerminalViewControl) {
- item = (CTabItem)element;
- }
- }
-
- if (item == null && HandlerUtil.getActivePart(event) instanceof ITerminalsView) {
- ITerminalsView view = (ITerminalsView)HandlerUtil.getActivePart(event);
- TabFolderManager mgr = (TabFolderManager)view.getAdapter(TabFolderManager.class);
- if (mgr != null && mgr.getActiveTabItem() != null) {
- item = mgr.getActiveTabItem();
- }
- }
-
- if (item != null && item.getData() instanceof ITerminalViewControl) {
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- if (terminal != null && !terminal.isDisposed()) {
- terminal.disconnectTerminal();
- }
- }
-
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
deleted file mode 100644
index e87f96ce0..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.internal.handler;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-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.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds;
-import org.eclipse.tcf.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Launch terminal command handler implementation.
- */
-public class LaunchTerminalCommandHandler extends AbstractHandler {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- String commandId = event.getCommand().getId();
- // "org.eclipse.tcf.te.ui.terminals.command.launchToolbar"
- // "org.eclipse.tcf.te.ui.terminals.command.launch"
-
- long start = System.currentTimeMillis();
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- String date = format.format(new Date(start));
-
- UIPlugin.getTraceHandler().trace("Started at " + date + " (" + start + ")", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this);
- }
-
- // Get the active shell
- Shell shell = HandlerUtil.getActiveShell(event);
- // Get the current selection
- ISelection selection = HandlerUtil.getCurrentSelection(event);
-
- if (commandId.equals("org.eclipse.tcf.te.ui.terminals.command.launchToolbar")) { //$NON-NLS-1$
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("(a) Attempt to open launch terminal settings dialog after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this);
- }
-
- LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell, start);
-
- if(isValidSelection(selection)){
- dialog.setSelection(selection);
- }
- if (dialog.open() == Window.OK) {
- // Get the terminal settings from the dialog
- Map<String, Object> properties = dialog.getSettings();
- if (properties != null) {
- String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
- Assert.isNotNull(delegateId);
- ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
- Assert.isNotNull(delegateId);
- delegate.execute(properties, null);
- }
- }
- }
- else {
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Getting applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this);
- }
-
- // Check if the dialog needs to be shown at all
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
-
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("Got applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this);
- }
-
- if (delegates.length > 1 || (delegates.length == 1 && delegates[0].needsUserConfiguration())) {
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) {
- UIPlugin.getTraceHandler().trace("(b) Attempt to open launch terminal settings dialog after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$
- ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this);
- }
-
- // Create the launch terminal settings dialog
- LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell, start);
- if(isValidSelection(selection)){
- dialog.setSelection(selection);
- }
- if (dialog.open() == Window.OK) {
- // Get the terminal settings from the dialog
- Map<String, Object> properties = dialog.getSettings();
- if (properties != null) {
- String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
- Assert.isNotNull(delegateId);
- ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
- Assert.isNotNull(delegateId);
- delegate.execute(properties, null);
- }
- }
- }
- else if (delegates.length == 1) {
- ILauncherDelegate delegate = delegates[0];
- Map<String, Object> properties = new HashMap<String, Object>();
-
- // Store the id of the selected delegate
- properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- // Store the selection
- properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
-
- // Execute
- delegate.execute(properties, null);
- }
- }
-
- return null;
- }
-
- private boolean isValidSelection(ISelection selection) {
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element);
- if (provider != null) {
- Map<String, String> props = provider.getTargetAddress(element);
- if (props != null && props.containsKey(IContextPropertiesConstants.PROP_ADDRESS)) {
- return true;
- }
- }
- }
-
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java
deleted file mode 100644
index a95424d37..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.internal.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-/**
- * Maximize view handler implementation.
- */
-public class MaximizeViewHandler extends AbstractTriggerCommandHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- triggerCommand("org.eclipse.ui.window.maximizePart", null); //$NON-NLS-1$
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java
deleted file mode 100644
index 24401827b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.internal.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-/**
- * Quick access handler implementation.
- */
-public class QuickAccessHandler extends AbstractTriggerCommandHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- triggerCommand("org.eclipse.ui.window.quickAccess", null); //$NON-NLS-1$
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java
deleted file mode 100644
index 1b868c438..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.launcher;
-
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-
-/**
- * Abstract launcher delegate implementation.
- */
-public abstract class AbstractLauncherDelegate extends PlatformObject implements ILauncherDelegate {
- // The mandatory id of the extension
- private String id = null;
- // The label of the extension
- private String label = null;
- // The converted expression
- private Expression expression;
- // The hidden attribute
- private boolean hidden;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- @Override
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- if (config == null) return;
-
- // Initialize the id field by reading the <id> extension attribute.
- // Throws an exception if the id is empty or null.
- id = config.getAttribute("id"); //$NON-NLS-1$
- if (id == null || "".equals(id.trim())) { //$NON-NLS-1$
- throw createMissingMandatoryAttributeException("id", config.getContributor().getName()); //$NON-NLS-1$
- }
-
- // Try the "label" attribute first
- label = config.getAttribute("label"); //$NON-NLS-1$
- // If "label" is not found or empty, try the "name" attribute as fallback
- if (label == null || "".equals(label.trim())) { //$NON-NLS-1$
- label = config.getAttribute("name"); //$NON-NLS-1$
- }
-
- // Read the sub elements of the extension
- IConfigurationElement[] children = config.getChildren();
- // The "enablement" element is the only expected one
- if (children != null && children.length > 0) {
- expression = ExpressionConverter.getDefault().perform(children[0]);
- }
-
- // Read "hidden" attribute
- String value = config.getAttribute("hidden"); //$NON-NLS-1$
- if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
- hidden = Boolean.parseBoolean(value);
- }
- }
-
- /**
- * Creates a new {@link CoreException} to be thrown if a mandatory extension attribute
- * is missing.
- *
- * @param attributeName The attribute name. Must not be <code>null</code>.
- * @param extensionId The extension id. Must not be <code>null</code>.
- *
- * @return The {@link CoreException} instance.
- */
- protected CoreException createMissingMandatoryAttributeException(String attributeName, String extensionId) {
- Assert.isNotNull(attributeName);
- Assert.isNotNull(extensionId);
-
- return new CoreException(new Status(IStatus.ERROR,
- UIPlugin.getUniqueIdentifier(),
- 0,
- NLS.bind(Messages.Extension_error_missingRequiredAttribute, attributeName, extensionId),
- null));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getId()
- */
- @Override
- public String getId() {
- return id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getLabel()
- */
- @Override
- public String getLabel() {
- return label != null ? label.trim() : ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getEnablement()
- */
- @Override
- public Expression getEnablement() {
- return expression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#isHidden()
- */
- @Override
- public boolean isHidden() {
- return hidden;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof AbstractLauncherDelegate) {
- return id.equals(((AbstractLauncherDelegate)obj).id);
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java
deleted file mode 100644
index 1b99f4389..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2015 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.ui.terminals.launcher;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * Terminal launcher delegate manager implementation.
- */
-public class LauncherDelegateManager {
- // Flag to mark the extension point manager initialized (extensions loaded).
- private boolean initialized = false;
-
- // The map containing all loaded contributions
- private final Map<String, Proxy> extensionsMap = new HashMap<String, Proxy>();
-
- // The extension point comparator
- private ExtensionPointComparator comparator = null;
-
- /**
- * Executable extension proxy implementation.
- */
- /* default */ static class Proxy {
- // The extension instance. Created on first access
- private ILauncherDelegate instance;
- // The configuration element
- private final IConfigurationElement element;
- // The unique id of the extension.
- private String id;
-
- /**
- * Constructor.
- *
- * @param element The configuration element. Must not be <code>null</code>.
- * @throws CoreException In case the configuration element attribute <i>id</i> is <code>null</code> or empty.
- */
- public Proxy(IConfigurationElement element) throws CoreException {
- Assert.isNotNull(element);
- this.element = element;
-
- // Extract the extension attributes
- id = element.getAttribute("id"); //$NON-NLS-1$
- if (id == null || id.trim().length() == 0) {
- throw new CoreException(new Status(IStatus.ERROR,
- UIPlugin.getUniqueIdentifier(),
- 0,
- NLS.bind(Messages.Extension_error_missingRequiredAttribute, "id", element.getContributor().getName()), //$NON-NLS-1$
- null));
- }
-
- instance = null;
- }
-
- /**
- * Returns the extensions unique id.
- *
- * @return The unique id.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the configuration element for this extension.
- *
- * @return The configuration element.
- */
- public IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the extension class instance. The contributing
- * plug-in will be activated if not yet activated anyway.
- *
- * @return The extension class instance or <code>null</code> if the instantiation fails.
- */
- public ILauncherDelegate getInstance() {
- if (instance == null) instance = newInstance();
- return instance;
- }
-
- /**
- * Returns always a new extension class instance which is different
- * to what {@link #getInstance()} would return.
- *
- * @return A new extension class instance or <code>null</code> if the instantiation fails.
- */
- public ILauncherDelegate newInstance() {
- IConfigurationElement element = getConfigurationElement();
- Assert.isNotNull(element);
-
- // The "class" to load can be specified either as attribute or as child element
- if (element.getAttribute("class") != null || element.getChildren("class").length > 0) { //$NON-NLS-1$ //$NON-NLS-2$
- try {
- return (ILauncherDelegate)element.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (Exception e) {
- // Possible exceptions: CoreException, ClassCastException.
- Platform.getLog(UIPlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR,
- UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.Extension_error_invalidExtensionPoint, element.getDeclaringExtension().getUniqueIdentifier()), e));
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- // Proxies are equal if they have encapsulate an element
- // with the same unique id
- if (obj instanceof Proxy) {
- return getId().equals(((Proxy)obj).getId());
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- // The hash code of a proxy is the one from the id
- return getId().hashCode();
- }
- }
-
- /**
- * Extension point comparator implementation.
- * <p>
- * The comparator assure that extension are read in a predictable order.
- * <p>
- * The order of the extensions is defined as following:<br>
- * <ul><li>Extensions contributed by our own plug-ins (<code>org.eclipse.tcf.te.*</code>)
- * in ascending alphabetic order and</li>
- * <li>Extensions contributed by any other plug-in in ascending alphabetic order.</li>
- * <li>Extensions contributed by the same plug-in in ascending alphabetic order by the
- * extensions unique id</li>
- */
- /* default */ static class ExtensionPointComparator implements Comparator<IExtension> {
- private final static String OWN_PLUGINS_PATTERN = "org.eclipse.tcf.te."; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(IExtension o1, IExtension o2) {
- // We ignore any comparisation with null and
- if (o1 == null || o2 == null) return 0;
- // Check if it is the exact same element
- if (o1 == o2) return 0;
-
- // The extensions are compared by the unique id of the contributing plug-in first
- String contributor1 = o1.getContributor().getName();
- String contributor2 = o2.getContributor().getName();
-
- // Contributions from our own plug-ins comes before 3rdParty plug-ins
- if (contributor1.startsWith(OWN_PLUGINS_PATTERN) && !contributor2.startsWith(OWN_PLUGINS_PATTERN))
- return -1;
- if (!contributor1.startsWith(OWN_PLUGINS_PATTERN) && contributor2.startsWith(OWN_PLUGINS_PATTERN))
- return 1;
- if (contributor1.startsWith(OWN_PLUGINS_PATTERN) && contributor2.startsWith(OWN_PLUGINS_PATTERN)) {
- int value = contributor1.compareTo(contributor2);
- // Within the same plug-in, the extension are sorted by their unique id (if available)
- if (value == 0 && o1.getUniqueIdentifier() != null && o2.getUniqueIdentifier() != null)
- return o1.getUniqueIdentifier().compareTo(o2.getUniqueIdentifier());
- // Otherwise, just return the comparisation result from the contributors
- return value;
- }
-
- // Contributions from all other plug-ins are sorted alphabetical
- int value = contributor1.compareTo(contributor2);
- // Within the same plug-in, the extension are sorted by their unique id (if available)
- if (value == 0 && o1.getUniqueIdentifier() != null && o2.getUniqueIdentifier() != null)
- return o1.getUniqueIdentifier().compareTo(o2.getUniqueIdentifier());
- // Otherwise, just return the comparisation result from the contributors
- return value;
- }
-
- }
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static LauncherDelegateManager instance = new LauncherDelegateManager();
- }
-
- /**
- * Returns the singleton instance.
- */
- public static LauncherDelegateManager getInstance() {
- return LazyInstanceHolder.instance;
- }
-
- /**
- * Constructor.
- */
- LauncherDelegateManager() {
- super();
- }
-
- /**
- * Returns the list of all contributed terminal launcher delegates.
- *
- * @param unique If <code>true</code>, the method returns new instances for each
- * contributed terminal launcher delegate.
- *
- * @return The list of contributed terminal launcher delegates, or an empty array.
- */
- public ILauncherDelegate[] getLauncherDelegates(boolean unique) {
- List<ILauncherDelegate> contributions = new ArrayList<ILauncherDelegate>();
- for (Proxy launcherDelegate : getExtensions().values()) {
- ILauncherDelegate instance = unique ? launcherDelegate.newInstance() : launcherDelegate.getInstance();
- if (instance != null && !contributions.contains(instance)) {
- contributions.add(instance);
- }
- }
-
- return contributions.toArray(new ILauncherDelegate[contributions.size()]);
- }
-
- /**
- * Returns the terminal launcher delegate identified by its unique id. If no terminal
- * launcher delegate with the specified id is registered, <code>null</code> is returned.
- *
- * @param id The unique id of the terminal launcher delegate or <code>null</code>
- * @param unique If <code>true</code>, the method returns new instances of the terminal launcher delegate contribution.
- *
- * @return The terminal launcher delegate instance or <code>null</code>.
- */
- public ILauncherDelegate getLauncherDelegate(String id, boolean unique) {
- ILauncherDelegate contribution = null;
- Map<String, Proxy> extensions = getExtensions();
- if (extensions.containsKey(id)) {
- Proxy proxy = extensions.get(id);
- // Get the extension instance
- contribution = unique ? proxy.newInstance() : proxy.getInstance();
- }
-
- return contribution;
- }
-
- /**
- * Returns the applicable terminal launcher delegates for the given selection.
- *
- * @param selection The selection or <code>null</code>.
- * @return The list of applicable terminal launcher delegates or an empty array.
- */
- public ILauncherDelegate[] getApplicableLauncherDelegates(ISelection selection) {
- List<ILauncherDelegate> applicable = new ArrayList<ILauncherDelegate>();
-
- for (ILauncherDelegate delegate : getLauncherDelegates(false)) {
- Expression enablement = delegate.getEnablement();
-
- // The launcher delegate is applicable by default if
- // no expression is specified.
- boolean isApplicable = enablement == null;
-
- if (enablement != null) {
- if (selection != null) {
- // Set the default variable to selection.
- IEvaluationContext currentState = ((IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class)).getCurrentState();
- EvaluationContext context = new EvaluationContext(currentState, selection);
- // Set the "selection" variable to the selection.
- context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- // Allow plug-in activation
- context.setAllowPluginActivation(true);
- // Evaluate the expression
- try {
- isApplicable = enablement.evaluate(context).equals(EvaluationResult.TRUE);
- } catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- } else {
- // The enablement is false by definition if
- // there is no selection.
- isApplicable = false;
- }
- }
-
- // Add the page if applicable
- if (isApplicable) applicable.add(delegate);
- }
-
- return applicable.toArray(new ILauncherDelegate[applicable.size()]);
- }
-
- /**
- * Returns the map of managed extensions. If not loaded before,
- * this methods trigger the loading of the extensions to the managed
- * extension point.
- *
- * @return The map of extensions.
- */
- protected Map<String, Proxy> getExtensions() {
- // Load and store the extensions thread-safe!
- synchronized (extensionsMap) {
- if (!initialized) { loadExtensions(); initialized = true; }
- }
- return extensionsMap;
- }
-
- /**
- * Returns the extension point comparator instance. If not available,
- * {@link #doCreateExtensionPointComparator()} is called to create a new instance.
- *
- * @return The extension point comparator or <code>null</code> if the instance creation fails.
- */
- protected final ExtensionPointComparator getExtensionPointComparator() {
- if (comparator == null) {
- comparator = new ExtensionPointComparator();
- }
- return comparator;
- }
-
- /**
- * Returns the extensions of the specified extension point sorted.
- * <p>
- * For the order of the extensions, see {@link ExtensionPointComparator}.
- *
- * @param point The extension point. Must not be <code>null</code>.
- * @return The extensions in sorted order or an empty array if the extension point has no extensions.
- */
- protected IExtension[] getExtensionsSorted(IExtensionPoint point) {
- Assert.isNotNull(point);
-
- List<IExtension> extensions = new ArrayList<IExtension>(Arrays.asList(point.getExtensions()));
- if (extensions.size() > 0) {
- Collections.sort(extensions, getExtensionPointComparator());
- }
-
- return extensions.toArray(new IExtension[extensions.size()]);
- }
-
- /**
- * Loads the extensions for the managed extension point.
- */
- protected void loadExtensions() {
- // If already initialized, this method will do nothing.
- if (initialized) return;
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint point = registry.getExtensionPoint("org.eclipse.tcf.te.ui.terminals.launcherDelegates"); //$NON-NLS-1$
- if (point != null) {
- IExtension[] extensions = getExtensionsSorted(point);
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if ("delegate".equals(element.getName())) { //$NON-NLS-1$
- try {
- Proxy candidate = new Proxy(element);
- if (candidate.getId() != null) {
- // If no extension with this id had been registered before, register now.
- if (!extensionsMap.containsKey(candidate.getId())) {
- extensionsMap.put(candidate.getId(), candidate);
- }
- else {
- throw new CoreException(new Status(IStatus.ERROR,
- UIPlugin.getUniqueIdentifier(),
- 0,
- NLS.bind(Messages.Extension_error_duplicateExtension, candidate.getId(), element.getContributor().getName()),
- null));
- }
- } else {
- throw new CoreException(new Status(IStatus.ERROR,
- UIPlugin.getUniqueIdentifier(),
- 0,
- NLS.bind(Messages.Extension_error_missingRequiredAttribute, "id", element.getAttribute("label")), //$NON-NLS-1$ //$NON-NLS-2$
- null));
- }
- } catch (CoreException e) {
- Platform.getLog(UIPlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR,
- UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.Extension_error_invalidExtensionPoint, element.getDeclaringExtension().getUniqueIdentifier()), e));
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java
deleted file mode 100644
index d5752bf4e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 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.ui.terminals.listeners;
-
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * Abstract window listener implementation.
- */
-public abstract class AbstractWindowListener implements IWindowListener {
- // The part listener instance
- protected final IPartListener2 partListener;
- // The perspective listener instance
- protected final IPerspectiveListener perspectiveListener;
-
- // Flag to remember if the initialization is done or not
- private boolean initialized = false;
-
- /**
- * Constructor
- */
- public AbstractWindowListener() {
- // Create the part listener instance
- partListener = createPartListener();
- // Create the perspective listener instance
- perspectiveListener = createPerspectiveListener();
- }
-
- /**
- * Creates a new part listener instance.
- * <p>
- * <b>Note:</b> The default implementation returns <code>null</code>.
- *
- * @return The part listener instance or <code>null</code>.
- */
- protected IPartListener2 createPartListener() {
- return null;
- }
-
- /**
- * Creates a new perspective listener instance.
- * <p>
- * <b>Note:</b> The default implementation returns <code>null</code>.
- *
- * @return The perspective listener instance or <code>null</code>.
- */
- protected IPerspectiveListener createPerspectiveListener() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowActivated(IWorkbenchWindow window) {
- if (!initialized && window != null) {
- windowOpened(window);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowDeactivated(IWorkbenchWindow window) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowClosed(IWorkbenchWindow window) {
- // On close, remove the listeners from the window
- if (window != null) {
- if (window.getPartService() != null && partListener != null) {
- window.getPartService().removePartListener(partListener);
- }
-
- if (perspectiveListener != null) window.removePerspectiveListener(perspectiveListener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowOpened(IWorkbenchWindow window) {
- if (window != null) {
- // On open, register the part listener to the window
- if (window.getPartService() != null && partListener != null) {
- // Get the part service
- IPartService service = window.getPartService();
- // Unregister the part listener, just in case
- service.removePartListener(partListener);
- // Register the part listener
- service.addPartListener(partListener);
- // Signal the active part to the part listener after registration
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IWorkbenchPartReference partRef = page.getActivePartReference();
- if (partRef != null) partListener.partActivated(partRef);
- }
- }
-
- // Register the perspective listener
- if (perspectiveListener != null) {
- window.addPerspectiveListener(perspectiveListener);
- // Signal the active perspective to the perspective listener after registration
- if (window.getActivePage() != null) {
- perspectiveListener.perspectiveActivated(window.getActivePage(), window.getActivePage().getPerspective());
- }
- }
-
- initialized = true;
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java
deleted file mode 100644
index 017b19271..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 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.ui.terminals.listeners;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-
-/**
- * The part listener implementation. Takes care of
- * activation and deactivation of key binding contexts.
- */
-public class WorkbenchPartListener implements IPartListener2 {
-
- // The context activations per workbench part reference
- private final Map<IWorkbenchPartReference, IContextActivation> activations = new HashMap<IWorkbenchPartReference, IContextActivation>();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partOpened(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partClosed(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partVisible(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partHidden(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partActivated(IWorkbenchPartReference partRef) {
- if ("org.eclipse.tcf.te.ui.terminals.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null && part.getSite() != null) {
- IContextService service = (IContextService)part.getSite().getService(IContextService.class);
- if (service != null) {
- IContextActivation activation = service.activateContext(partRef.getId());
- if (activation != null) {
- activations.put(partRef, activation);
- } else {
- activations.remove(partRef);
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partDeactivated(IWorkbenchPartReference partRef) {
- if ("org.eclipse.tcf.te.ui.terminals.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null && part.getSite() != null) {
- IContextService service = (IContextService)part.getSite().getService(IContextService.class);
- if (service != null) {
- IContextActivation activation = activations.remove(partRef);
- if (activation != null) {
- service.deactivateContext(activation);
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
- */
- @Override
- public void partInputChanged(IWorkbenchPartReference partRef) {
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java
deleted file mode 100644
index 21349a954..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.ui.terminals.listeners;
-
-import org.eclipse.ui.IPartListener2;
-
-/**
- * The window listener implementation. Takes care of the
- * management of the global listeners per workbench window.
- */
-public class WorkbenchWindowListener extends AbstractWindowListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.listeners.AbstractWindowListener#createPartListener()
- */
- @Override
- protected IPartListener2 createPartListener() {
- return new WorkbenchPartListener();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
deleted file mode 100644
index e716c6237..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
+++ /dev/null
@@ -1,641 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.manager;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IPreferenceKeys;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IUIConstants;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tcf.te.ui.terminals.view.TerminalsView;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PerspectiveAdapter;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Terminals console manager.
- */
-@SuppressWarnings("restriction")
-public class ConsoleManager {
-
- // Constant to indicate any secondary id is acceptable
- private final static String ANY_SECONDARY_ID = new String("*"); //$NON-NLS-1$
-
- // Reference to the perspective listener instance
- private final IPerspectiveListener perspectiveListener;
-
- // Internal perspective listener implementation
- static class ConsoleManagerPerspectiveListener extends PerspectiveAdapter {
- private final List<IViewReference> references = new ArrayList<IViewReference>();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.PerspectiveAdapter#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- @Override
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- // If the old references list is empty, just return
- if (references.isEmpty()) return;
- // Create a copy of the old view references list
- List<IViewReference> oldReferences = new ArrayList<IViewReference>(references);
-
- // Get the current list of view references
- List<IViewReference> references = new ArrayList<IViewReference>(Arrays.asList(page.getViewReferences()));
- for (IViewReference reference : oldReferences) {
- if (references.contains(reference)) continue;
- // Previous visible terminals console view reference, make visible again
- try {
- page.showView(reference.getId(), reference.getSecondaryId(), IWorkbenchPage.VIEW_VISIBLE);
- } catch (PartInitException e) { /* Failure on part instantiation is ignored */ }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.PerspectiveAdapter#perspectivePreDeactivate(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- @Override
- public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- references.clear();
- for (IViewReference reference : page.getViewReferences()) {
- IViewPart part = reference.getView(false);
- if (part instanceof TerminalsView && !references.contains(reference)) {
- references.add(reference);
- }
- }
- }
- }
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static ConsoleManager fInstance = new ConsoleManager();
- }
-
- /**
- * Returns the singleton instance for the console manager.
- */
- public static ConsoleManager getInstance() {
- return LazyInstanceHolder.fInstance;
- }
-
- /**
- * Constructor.
- */
- ConsoleManager() {
- super();
-
- // Attach the perspective listener
- perspectiveListener = new ConsoleManagerPerspectiveListener();
- if (PlatformUI.isWorkbenchRunning() && PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(perspectiveListener);
- }
- }
-
- /**
- * Returns the active workbench window page if the workbench is still running.
- *
- * @return The active workbench window page or <code>null</code>
- */
- private final IWorkbenchPage getActiveWorkbenchPage() {
- // To lookup the console view, the workbench must be still running
- if (PlatformUI.isWorkbenchRunning() && PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- }
- return null;
- }
-
- /**
- * Returns the console view if available within the active workbench window page.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- * @param secondaryId The terminals console view secondary id or <code>null</code>.
- *
- * @return The console view instance if available or <code>null</code> otherwise.
- */
- public ITerminalsView findConsoleView(String id, String secondaryId) {
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- ITerminalsView view = null;
-
- // Get the active workbench page
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- // Look for the view
- IViewPart part = getTerminalsViewWithSecondaryId(id != null ? id : IUIConstants.ID, secondaryId);
- // Check the interface
- if (part instanceof ITerminalsView) {
- view = (ITerminalsView)part;
- }
- }
-
- return view;
- }
-
- /**
- * Search and return a terminal view with a specific secondary id
- *
- * @param id The terminals console view id. Must not be <code>null</code>.
- * @param secondaryId The terminals console view secondary id or <code>null</code>.
- *
- * @return The terminals console view instance or <code>null</code> if not found.
- */
- private IViewPart getTerminalsViewWithSecondaryId(String id, String secondaryId) {
- Assert.isNotNull(id);
-
- IWorkbenchPage page = getActiveWorkbenchPage();
-
- IViewReference[] refs = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- if (ref.getId().equals(id)) {
- IViewPart part = ref.getView(true);
- if (part instanceof ITerminalsView) {
- String secId = ((IViewSite) part.getSite()).getSecondaryId();
- if (secId != null && secId.equals(secondaryId) || secId == null && secondaryId == null) {
- return part;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Search and return a terminal view that is NOT pinned
- *
- * @param id The terminals console view id. Must not be <code>null</code>.
- * @return The terminals console view instance or <code>null</code> if not found.
- */
- private IViewPart getFirstNotPinnedTerminalsView(String id) {
- Assert.isNotNull(id);
-
- IWorkbenchPage page = getActiveWorkbenchPage();
-
- IViewReference[] refs = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- if (ref.getId().equals(id)) {
- IViewPart part = ref.getView(true);
- if (part instanceof ITerminalsView) {
- if (!((ITerminalsView) part).isPinned()) {
- return part;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Search and return the first available terminal view.
- *
- * @param id The terminals console view id. Must not be <code>null</code>.
- * @param secondaryId The terminals console view secondary id or <code>null</code>.
- * @param useActive - return only an active terminal view.
- *
- * @return The terminals console view instance or <code>null</code> if not found.
- */
- private IViewPart getFirstTerminalsView(String id, String secondaryId, boolean useActive) {
- Assert.isNotNull(id);
-
- IWorkbenchPage page = getActiveWorkbenchPage();
-
- IViewReference[] refs = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- if (ref.getId().equals(id)) {
- if (secondaryId == ANY_SECONDARY_ID
- || secondaryId == null && ref.getSecondaryId() == null
- || secondaryId != null && secondaryId.equals(ref.getSecondaryId())) {
- IViewPart part = ref.getView(true);
- if (useActive) {
- if (page.isPartVisible(part)) {
- return part;
- }
- }
- else {
- return part;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Return a new secondary id to use, based on the number of open terminal views.
- *
- * @param id The terminals console view id. Must not be <code>null</code>.
- * @return The next secondary id, or <code>null</code> if it is the first one
- */
- private String getNextTerminalSecondaryId(String id) {
- Assert.isNotNull(id);
-
- IWorkbenchPage page = getActiveWorkbenchPage();
- Map<String, IViewReference> terminalViews = new HashMap<String, IViewReference>();
-
- int maxNumber = 0;
- IViewReference[] refs = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- if (ref.getId().equals(id)) {
- if (ref.getSecondaryId() != null) {
- terminalViews.put(ref.getSecondaryId(), ref);
- int scondaryIdInt = Integer.parseInt(ref.getSecondaryId());
- if (scondaryIdInt > maxNumber) {
- maxNumber = scondaryIdInt;
- }
- }
- else {
- // add the one with secondaryId == null with 0 by default
- terminalViews.put(Integer.toString(0), ref);
- }
- }
- }
- if (terminalViews.size() == 0) {
- return null;
- }
-
- int i = 0;
- for (; i < maxNumber; i++) {
- String secondaryIdStr = Integer.toString(i);
- if (!terminalViews.keySet().contains(secondaryIdStr)) {
- // found a free slot
- if (i == 0)
- return null;
- return Integer.toString(i);
- }
- }
- // add a new one
- return Integer.toString(i + 1);
- }
-
- /**
- * Show the terminals console view specified by the given id.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- */
- public IViewPart showConsoleView(String id, String secondaryId) {
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Get the active workbench page
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- try {
- // show the view
- IViewPart part = page.showView(id != null ? id : IUIConstants.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
- // and force the view to the foreground
- page.bringToTop(part);
- return part;
- }
- catch (PartInitException e) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- return null;
- }
-
- /**
- * Bring the terminals console view, specified by the given id, to the top of the view stack.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- * @param secondaryId The terminals console view secondary id or <code>null</code>.
- * @param activate If <code>true</code> activate the console view.
- */
- private IViewPart bringToTop(String id, String secondaryId, boolean activate) {
- // Get the active workbench page
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- // Look for any terminal view
- IViewPart anyTerminal = getFirstTerminalsView(id != null ? id : IUIConstants.ID, secondaryId, false);
- // there is at least one terminal available
- if (anyTerminal != null) {
- // is there an active terminal view
- IViewPart activePart = getFirstTerminalsView(id != null ? id : IUIConstants.ID, secondaryId, true);
- // no terminal view active
- if (activePart == null) {
- // use the first not pinned
- IViewPart notPinnedPart = getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID);
- if (notPinnedPart != null) {
- if (activate) {
- page.activate(notPinnedPart);
- }
- else {
- page.bringToTop(notPinnedPart);
- }
- return notPinnedPart;
- }
- // else we need to create a new one
- IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID));
- return newPart;
- }
- // we found a active terminal page
- // if it is pinned search for a non pinned (not active)
- if (((ITerminalsView) activePart).isPinned() && secondaryId == ANY_SECONDARY_ID) {
- // we found one so use it
- IViewPart notPinnedPart = getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID);
- if (notPinnedPart != null) {
- if (activate) {
- page.activate(notPinnedPart);
- }
- else {
- page.bringToTop(notPinnedPart);
- }
- return notPinnedPart;
- }
- // else we need to create a new one
- IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID));
- return newPart;
- }
- // else return the active one
- return activePart;
- }
- // create first new terminal
- if (activate) {
- IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID));
- return newPart;
- }
- }
- return null;
- }
-
- /**
- * Opens the console with the given title and connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- * @param title The console title. Must not be <code>null</code>.
- * @param encoding The terminal encoding or <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- * @param flags The flags controlling how the console is opened or <code>null</code> to use defaults.
- */
- public CTabItem openConsole(String id, String title, String encoding, ITerminalConnector connector, Object data, Map<String, Boolean> flags) {
- return openConsole(id, ANY_SECONDARY_ID, title, encoding, connector, data, flags);
- }
-
- /**
- * Opens the console with the given title and connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- * @param secondaryId The terminals console view secondary id or <code>null</code>.
- * @param title The console title. Must not be <code>null</code>.
- * @param encoding The terminal encoding or <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- * @param flags The flags controlling how the console is opened or <code>null</code> to use defaults.
- */
- public CTabItem openConsole(String id, String secondaryId, String title, String encoding, ITerminalConnector connector, Object data, Map<String, Boolean> flags) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Get the flags handled by the openConsole method itself
- boolean activate = flags != null && flags.containsKey("activate") ? flags.get("activate").booleanValue() : false; //$NON-NLS-1$ //$NON-NLS-2$
- boolean forceNew = flags != null && flags.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW) ? flags.get(ITerminalsConnectorConstants.PROP_FORCE_NEW).booleanValue() : false;
-
- // Make the consoles view visible
- IViewPart part = bringToTop(id, secondaryId, activate);
- if (!(part instanceof ITerminalsView)) return null;
- // Cast to the correct type
- ITerminalsView view = (ITerminalsView)part;
-
- // Get the tab folder manager associated with the view
- TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class);
- if (manager == null) return null;
-
- // Lookup an existing console first
- String secId = ((IViewSite)part.getSite()).getSecondaryId();
- CTabItem item = findConsole(id, secId, title, connector, data);
-
- // Switch to the tab folder page _before_ calling TabFolderManager#createItem(...).
- // The createItem(...) method invokes the corresponding connect and this may take
- // a while if connecting to a remote host. To allow a "Connecting..." decoration,
- // the tab folder page needs to be visible.
- view.switchToTabFolderControl();
-
- // If no existing console exist or forced -> Create the tab item
- if (item == null || forceNew) {
- // If configured, check all existing tab items if they are associated
- // with terminated consoles
- if (UIPlugin.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_REMOVE_TERMINATED_TERMINALS)) {
- // Remote all terminated tab items. This will invoke the
- // tab's dispose listener.
- manager.removeTerminatedItems();
- // Switch back to the tab folder control as removeTerminatedItems()
- // may have triggered the switch to the empty space control.
- view.switchToTabFolderControl();
- }
-
- // Create a new tab item
- item = manager.createTabItem(title, encoding, connector, data, flags);
- }
- // If still null, something went wrong
- if (item == null) return null;
-
- // Make the item the active console
- manager.bringToTop(item);
-
- // Make sure the terminals view has the focus after opening a new terminal
- view.setFocus();
-
- // Return the tab item of the opened console
- return item;
- }
-
- /**
- * Lookup a console with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- * <b>Note:</b> The method will handle unified console titles itself.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- * @param secondaryId The terminals console view secondary id or <code>null</code>.
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The corresponding console tab item or <code>null</code>.
- */
- public CTabItem findConsole(String id, String secondaryId, String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Get the console view
- ITerminalsView view = findConsoleView(id, secondaryId);
- if (view == null) return null;
-
- // Get the tab folder manager associated with the view
- TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class);
- if (manager == null) return null;
-
- return manager.findTabItem(title, connector, data);
- }
-
- /**
- * Lookup a console which is assigned with the given terminal control.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param control The terminal control. Must not be <code>null</code>.
- * @return The corresponding console tab item or <code>null</code>.
- */
- public CTabItem findConsole(ITerminalControl control) {
- Assert.isNotNull(control);
-
- CTabItem item = null;
-
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- IViewReference[] refs = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- IViewPart part = ref != null ? ref.getView(false) : null;
- if (part instanceof ITerminalsView) {
- CTabFolder tabFolder = (CTabFolder) part.getAdapter(CTabFolder.class);
- if (tabFolder == null) continue;
- CTabItem[] candidates = tabFolder.getItems();
- for (CTabItem candidate : candidates) {
- Object data = candidate.getData();
- if (data instanceof ITerminalControl && control.equals(data)) {
- item = candidate;
- break;
- }
- }
- }
- if (item != null) break;
- }
- }
-
- return item;
- }
-
- /**
- * Search all console views for the one that contains a specific connector.
- * <p>
- * <b>Note:</b> The method will handle unified console titles itself.
- *
- * @param id The terminals console view id or <code>null</code> to show the default terminals console view.
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The corresponding console tab item or <code>null</code>.
- */
- private CTabItem findConsoleForTerminalConnector(String id, String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
-
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- IViewReference[] refs = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- if (ref.getId().equals(id)) {
- IViewPart part = ref.getView(true);
- if (part instanceof ITerminalsView) {
- // Get the tab folder manager associated with the view
- TabFolderManager manager = (TabFolderManager) part.getAdapter(TabFolderManager.class);
- if (manager == null) {
- continue;
- }
- CTabItem item = manager.findTabItem(title, connector, data);
- if (item != null) {
- return item;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Close the console with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- * <b>Note:</b> The method will handle unified console titles itself.
- *
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- */
- public void closeConsole(String id, String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Lookup the console with this connector
- CTabItem console = findConsoleForTerminalConnector(id, title, connector, data);
- // If found, dispose the console
- if (console != null) {
- console.dispose();
- }
- }
-
- /**
- * Terminate (disconnect) the console with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- * <b>Note:</b> The method will handle unified console titles itself.
- *
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- */
- public void terminateConsole(String id, String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Lookup the console
- CTabItem console = findConsoleForTerminalConnector(id, title, connector, data);
- // If found, disconnect the console
- if (console != null && !console.isDisposed()) {
- ITerminalViewControl terminal = (ITerminalViewControl)console.getData();
- if (terminal != null && !terminal.isDisposed()) {
- terminal.disconnectTerminal();
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
deleted file mode 100644
index 0d47192eb..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2015 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.nls;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Terminals 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.ui.terminals.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * 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);
- return (String)field.get(null);
- } catch (Exception e) { /* ignored on purpose */ }
- }
-
- return null;
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String Extension_error_missingRequiredAttribute;
- public static String Extension_error_duplicateExtension;
- public static String Extension_error_invalidExtensionPoint;
-
- public static String AbstractTriggerCommandHandler_error_executionFailed;
-
- public static String AbstractAction_error_commandExecutionFailed;
-
- public static String AbstractConfigurationPanel_delete;
- public static String AbstractConfigurationPanel_deleteButtonTooltip;
- public static String AbstractConfigurationPanel_hosts;
- public static String AbstractConfigurationPanel_encoding;
- public static String AbstractConfigurationPanel_encoding_custom;
- public static String AbstractConfigurationPanel_encoding_custom_title;
- public static String AbstractConfigurationPanel_encoding_custom_message;
- public static String AbstractConfigurationPanel_encoding_custom_error;
-
- public static String TabTerminalListener_consoleClosed;
- public static String TabTerminalListener_consoleConnecting;
-
- public static String PinTerminalAction_menu;
- public static String PinTerminalAction_toolTip;
-
- public static String ToggleCommandFieldAction_menu;
- public static String ToggleCommandFieldAction_toolTip;
-
- public static String SelectEncodingAction_menu;
- public static String SelectEncodingAction_tooltip;
-
- public static String ProcessSettingsPage_dialogTitle;
- public static String ProcessSettingsPage_processImagePathSelectorControl_label;
- public static String ProcessSettingsPage_processImagePathSelectorControl_button;
- public static String ProcessSettingsPage_processArgumentsControl_label;
- public static String ProcessSettingsPage_processWorkingDirControl_label;
- public static String ProcessSettingsPage_localEchoSelectorControl_label;
-
- public static String OutputStreamMonitor_error_readingFromStream;
-
- public static String InputStreamMonitor_error_writingToStream;
-
- public static String TerminalService_error_cannotCreateConnector;
- public static String TerminalService_defaultTitle;
-
- public static String LaunchTerminalSettingsDialog_title;
- public static String LaunchTerminalSettingsDialog_combo_label;
- public static String LaunchTerminalSettingsDialog_group_label;
-
- public static String TabScrollLockAction_text;
- public static String TabScrollLockAction_tooltip;
-
- public static String LaunchTerminalSettingsDialog_error_title;
- public static String LaunchTerminalSettingsDialog_error_invalidSettings;
- public static String LaunchTerminalSettingsDialog_error_unknownReason;
-
- public static String EncodingSelectionDialog_title;
-
- public static String TabFolderManager_encoding;
- public static String TabFolderManager_state_connected;
- public static String TabFolderManager_state_connecting;
- public static String TabFolderManager_state_closed;
-
- public static String NoteCompositeHelper_note_label;
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
deleted file mode 100644
index f7a77a435..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
+++ /dev/null
@@ -1,75 +0,0 @@
-###############################################################################
-# Copyright (c) 2012 - 2015 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
-###############################################################################
-
-Extension_error_missingRequiredAttribute=Required attribute "{0}" missing for extension "{1}"!
-Extension_error_duplicateExtension=Duplicate extension with id ''{0}''. Ignoring duplicated contribution from contributor ''{1}''!
-Extension_error_invalidExtensionPoint=Failed to instantiate the executable extension from extension point ''{0}''.
-
-AbstractTriggerCommandHandler_error_executionFailed=Failed to execute command {0}.
-
-AbstractAction_error_commandExecutionFailed="Failed to execute command (id = {0}). Possibly caused by: {1}
-
-AbstractConfigurationPanel_delete=Delete
-AbstractConfigurationPanel_deleteButtonTooltip=Delete terminal settings for host
-AbstractConfigurationPanel_hosts=Hosts:
-AbstractConfigurationPanel_encoding=Encoding:
-AbstractConfigurationPanel_encoding_custom=Other...
-AbstractConfigurationPanel_encoding_custom_title=Other...
-AbstractConfigurationPanel_encoding_custom_message=Please enter the name of the encoding to use for the terminal.
-AbstractConfigurationPanel_encoding_custom_error=Unsupported encoding. Please enter the name of a supported encoding.
-
-TabTerminalListener_consoleClosed=<{1}> {0}
-TabTerminalListener_consoleConnecting={0} : {1}...
-
-PinTerminalAction_menu=Pin
-PinTerminalAction_toolTip=Pin the Terminal View
-
-ToggleCommandFieldAction_menu=Toggle Command Input Field
-ToggleCommandFieldAction_toolTip=Toggle Command Input Field
-
-SelectEncodingAction_menu=Switch Encoding...
-SelectEncodingAction_tooltip=Switch the Encoding of the active Terminal
-
-ProcessSettingsPage_dialogTitle=Select Process Image
-ProcessSettingsPage_processImagePathSelectorControl_label=Image Path:
-ProcessSettingsPage_processImagePathSelectorControl_button=Browse
-ProcessSettingsPage_processArgumentsControl_label=Arguments:
-ProcessSettingsPage_processWorkingDirControl_label=Working Dir:
-ProcessSettingsPage_localEchoSelectorControl_label=Local Echo
-
-OutputStreamMonitor_error_readingFromStream=Exception when reading from stream. Possibly caused by: {0}
-
-InputStreamMonitor_error_writingToStream=Exception when writing to stream. Possibly caused by: {0}
-
-TerminalService_error_cannotCreateConnector=Cannot create a valid terminal connector instance from the provided terminal properties.
-TerminalService_defaultTitle=Console
-
-LaunchTerminalSettingsDialog_title=Launch Terminal
-LaunchTerminalSettingsDialog_combo_label=Choose terminal:
-LaunchTerminalSettingsDialog_group_label=Settings
-
-TabScrollLockAction_text=Scroll &Lock
-TabScrollLockAction_tooltip=Scroll Lock
-
-LaunchTerminalSettingsDialog_error_title=Terminal Settings
-LaunchTerminalSettingsDialog_error_invalidSettings=The specified settings are invalid\n\n\
-{0}\n\n\
-Please review and specify valid settings. Or cancel the settings dialog to abort.
-LaunchTerminalSettingsDialog_error_unknownReason=Cannot determine specifically which setting is invalid.
-
-EncodingSelectionDialog_title=Encoding
-
-TabFolderManager_encoding=Encoding: {0}
-TabFolderManager_state_connected=Connected
-TabFolderManager_state_connecting=Connecting
-TabFolderManager_state_closed=Closed
-
-NoteCompositeHelper_note_label=Note:
-
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
deleted file mode 100644
index 8ee9b2506..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.panels;
-
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-
-/**
- * Abstract terminal launcher configuration panel implementation.
- */
-public abstract class AbstractConfigurationPanel implements IConfigurationPanel {
- private final IConfigurationPanelContainer container;
-
- private Composite topControl = null;
-
- // The selection
- private ISelection selection;
-
- private String message = null;
- private int messageType = IMessageProvider.NONE;
-
- private boolean enabled = true;
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public AbstractConfigurationPanel(IConfigurationPanelContainer container) {
- super();
- this.container = container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getContainer()
- */
- @Override
- public IConfigurationPanelContainer getContainer() {
- return container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
- */
- @Override
- public final String getMessage() {
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
- */
- @Override
- public final int getMessageType() {
- return messageType;
- }
-
- /**
- * Set the message and the message type to display.
- *
- * @param message The message or <code>null</code>.
- * @param messageType The message type or <code>IMessageProvider.NONE</code>.
- */
- protected final void setMessage(String message, int messageType) {
- this.message = message;
- this.messageType = messageType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#dispose()
- */
- @Override
- public void dispose() {
- }
-
- /**
- * Sets the top control.
- *
- * @param topControl The top control or <code>null</code>.
- */
- protected void setControl(Composite topControl) {
- this.topControl = topControl;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getControl()
- */
- @Override
- public Composite getControl() {
- return topControl;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getSelection()
- */
- @Override
- public ISelection getSelection() {
- return selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- }
-
- /**
- * Returns the correctly prefixed dialog settings slot id. In case the given id
- * suffix is <code>null</code> or empty, <code>id</code> is returned as is.
- *
- * @param settingsSlotId The dialog settings slot id to prefix.
- * @param prefix The prefix.
- * @return The correctly prefixed dialog settings slot id.
- */
- public final String prefixDialogSettingsSlotId(String settingsSlotId, String prefix) {
- if (settingsSlotId != null && prefix != null && prefix.trim().length() > 0) {
- settingsSlotId = prefix + "." + settingsSlotId; //$NON-NLS-1$
- }
- return settingsSlotId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setEnabled(boolean)
- */
- @Override
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * @return Returns the enabled state.
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#isValid()
- */
- @Override
- public boolean isValid() {
- setMessage(null, NONE);
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#activate()
- */
- @Override
- public void activate() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#extractData(java.util.Map)
- */
- @Override
- public void extractData(Map<String, Object> data) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupData(java.util.Map)
- */
- @Override
- public void setupData(Map<String, Object> data) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#updateData(java.util.Map)
- */
- @Override
- public void updateData(Map<String, Object> data) {
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java
deleted file mode 100644
index 63cd09311..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java
+++ /dev/null
@@ -1,615 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 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.ui.terminals.panels;
-
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.osgi.framework.Bundle;
-
-/**
- * Abstract terminal configuration panel implementation.
- */
-public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigurationPanel {
- private static final String LAST_HOST_TAG = "lastHost";//$NON-NLS-1$
- private static final String HOSTS_TAG = "hosts";//$NON-NLS-1$
- private static final String ENCODINGS_TAG = "encodings"; //$NON-NLS-1$
-
- // The sub-controls
- /* default */ Combo hostCombo;
- private Button deleteHostButton;
- /* default */ Combo encodingCombo;
-
- // The last selected encoding
- /* default */ String lastSelectedEncoding;
- // The last entered custom encodings
- /* default */ final List<String> encodingHistory = new ArrayList<String>();
-
- // A map containing the settings per host
- protected final Map<String, Map<String, String>> hostSettingsMap = new HashMap<String, Map<String, String>>();
-
- /**
- * Constructor.
- *
- * @param container The configuration panel container or <code>null</code>.
- */
- public AbstractExtendedConfigurationPanel(IConfigurationPanelContainer container) {
- super(container);
- }
-
- /**
- * Returns the host name or IP from the current selection.
- *
- * @return The host name or IP, or <code>null</code>.
- */
- public String getSelectionHost() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element);
- if (provider != null) {
- Map<String, String> props = provider.getTargetAddress(element);
- if (props != null && props.containsKey(IContextPropertiesConstants.PROP_ADDRESS)) {
- return props.get(IContextPropertiesConstants.PROP_ADDRESS);
- }
- }
- }
-
- return null;
- }
-
- /**
- * Returns the default encoding based on the current selection.
- *
- * @return The default encoding or <code>null</code>.
- */
- public String getSelectionEncoding() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element);
- if (provider != null) {
- Object encoding = provider.getProperty(element, IContextPropertiesConstants.PROP_DEFAULT_ENCODING);
- if (encoding instanceof String) return ((String) encoding).trim();
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- String[] hosts = settings.getArray(HOSTS_TAG);
- if (hosts != null) {
- for (int i = 0; i < hosts.length; i++) {
- String hostEntry = hosts[i];
- String[] hostString = hostEntry.split("\\|");//$NON-NLS-1$
- String hostName = hostString[0];
- if (hostString.length == 2) {
- HashMap<String, String> attr = deSerialize(hostString[1]);
- hostSettingsMap.put(hostName, attr);
- }
- else {
- hostSettingsMap.put(hostName, new HashMap<String, String>());
- }
- }
- }
-
- if (!isWithoutSelection()) {
- String host = getSelectionHost();
- if (host != null) {
- fillSettingsForHost(host);
- }
- }
- else {
- if (hostCombo != null) {
- fillHostCombo();
- String lastHost = settings.get(LAST_HOST_TAG);
- if (lastHost != null) {
- int index = hostCombo.indexOf(lastHost);
- if (index != -1) {
- hostCombo.select(index);
- }
- else {
- hostCombo.select(0);
- }
- }
- else {
- hostCombo.select(0);
- }
- fillSettingsForHost(hostCombo.getText());
- }
- }
-
- encodingHistory.clear();
- String[] encodings = settings.getArray(ENCODINGS_TAG);
- if (encodings != null && encodings.length > 0) {
- encodingHistory.addAll(Arrays.asList(encodings));
- for (String encoding : encodingHistory) {
- encodingCombo.add(encoding, encodingCombo.getItemCount() - 1);
- }
- }
- }
-
- /**
- * Restore the encodings widget values.
- *
- * @param settings The dialog settings. Must not be <code>null</code>.
- * @param idPrefix The prefix or <code>null</code>.
- */
- protected void doRestoreEncodingsWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- String encoding = settings.get(prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix));
- if (encoding != null && encoding.trim().length() > 0) {
- setEncoding(encoding);
- }
- }
-
- /**
- * Decode the host settings from the given string.
- *
- * @param hostString The encoded host settings. Must not be <code>null</code>.
- * @return The decoded host settings.
- */
- private HashMap<String, String> deSerialize(String hostString) {
- Assert.isNotNull(hostString);
- HashMap<String, String> attr = new HashMap<String, String>();
-
- if (hostString.length() != 0) {
- String[] hostAttrs = hostString.split("\\:");//$NON-NLS-1$
- for (int j = 0; j < hostAttrs.length-1; j = j + 2) {
- String key = hostAttrs[j];
- String value = hostAttrs[j + 1];
- attr.put(key, value);
- }
- }
- return attr;
- }
-
- /**
- * Encode the host settings to a string.
- *
- * @param hostEntry The host settings. Must not be <code>null</code>.
- * @param hostString The host string to encode to. Must not be <code>null</code>.
- */
- private void serialize(Map<String, String> hostEntry, StringBuilder hostString) {
- Assert.isNotNull(hostEntry);
- Assert.isNotNull(hostString);
-
- if (hostEntry.keySet().size() != 0) {
- Iterator<Entry<String, String>> nextHostAttr = hostEntry.entrySet().iterator();
- while (nextHostAttr.hasNext()) {
- Entry<String, String> entry = nextHostAttr.next();
- String attrKey = entry.getKey();
- String attrValue = entry.getValue();
- hostString.append(attrKey + ":" + attrValue + ":");//$NON-NLS-1$ //$NON-NLS-2$
- }
- hostString.deleteCharAt(hostString.length() - 1);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- Iterator<String> nextHost = hostSettingsMap.keySet().iterator();
- String[] hosts = new String[hostSettingsMap.keySet().size()];
- int i = 0;
- while (nextHost.hasNext()) {
- StringBuilder hostString = new StringBuilder();
- String host = nextHost.next();
- hostString.append(host + "|");//$NON-NLS-1$
- Map<String, String> hostEntry = hostSettingsMap.get(host);
- serialize(hostEntry, hostString);
- hosts[i] = hostString.toString();
- i = i + 1;
- }
- settings.put(HOSTS_TAG, hosts);
- if (isWithoutSelection()) {
- if (hostCombo != null) {
- String host = getHostFromSettings();
- if (host != null) settings.put(LAST_HOST_TAG, host);
- }
- }
-
- if (!encodingHistory.isEmpty()) {
- settings.put(ENCODINGS_TAG, encodingHistory.toArray(new String[encodingHistory.size()]));
- }
- }
-
- /**
- * Save the encodings widget values.
- *
- * @param settings The dialog settings. Must not be <code>null</code>.
- * @param idPrefix The prefix or <code>null</code>.
- */
- protected void doSaveEncodingsWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- String encoding = getEncoding();
- if (encoding != null) {
- settings.put(prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix), encoding);
- }
- }
-
- protected abstract void saveSettingsForHost(boolean add);
-
- protected abstract void fillSettingsForHost(String host);
-
- protected abstract String getHostFromSettings();
-
- protected void removeSecurePassword(String host) {
- // noop by default
- }
-
- /**
- * Returns the selected host from the hosts combo widget.
- *
- * @return The selected host or <code>null</code>.
- */
- protected final String getHostFromCombo() {
- return hostCombo != null && !hostCombo.isDisposed() ? hostCombo.getText() : null;
- }
-
- protected void removeSettingsForHost(String host) {
- if (hostSettingsMap.containsKey(host)) {
- hostSettingsMap.remove(host);
- }
- }
-
- /**
- * Returns the list of host names of the persisted hosts.
- *
- * @return The list of host names.
- */
- private List<String> getHostList() {
- List<String> hostList = new ArrayList<String>();
- hostList.addAll(hostSettingsMap.keySet());
- return hostList;
- }
-
- /**
- * Fill the host combo with the stored per host setting names.
- */
- protected void fillHostCombo() {
- if (hostCombo != null) {
- hostCombo.removeAll();
- List<String> hostList = getHostList();
- Collections.sort(hostList);
- Iterator<String> nextHost = hostList.iterator();
- while (nextHost.hasNext()) {
- String host = nextHost.next();
- hostCombo.add(host);
- }
- if (hostList.size() <= 1) {
- hostCombo.setEnabled(false);
- }
- else {
- hostCombo.setEnabled(true);
-
- }
- if (deleteHostButton != null) {
- if (hostList.size() == 0) {
- deleteHostButton.setEnabled(false);
- }
- else {
- deleteHostButton.setEnabled(true);
- }
- }
- }
- }
-
- public boolean isWithoutSelection() {
- ISelection selection = getSelection();
- if (selection == null) {
- return true;
- }
- if (selection instanceof IStructuredSelection && selection.isEmpty()) {
- return true;
- }
- return false;
- }
-
- public boolean isWithHostList() {
- return true;
- }
-
- /**
- * Create the host selection combo.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @param separator If <code>true</code>, a separator will be added after the controls.
- */
- protected void createHostsUI(Composite parent, boolean separator) {
- Assert.isNotNull(parent);
-
- if (isWithoutSelection() && isWithHostList()) {
- Composite comboComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- comboComposite.setLayout(layout);
- comboComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- Label label = new Label(comboComposite, SWT.HORIZONTAL);
- label.setText(Messages.AbstractConfigurationPanel_hosts);
-
- hostCombo = new Combo(comboComposite, SWT.READ_ONLY);
- hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- hostCombo.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String host = hostCombo.getText();
- fillSettingsForHost(host);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- deleteHostButton = new Button(comboComposite, SWT.NONE);
- // deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete);
-
- ISharedImages workbenchImages = UIPlugin.getDefault().getWorkbench().getSharedImages();
- deleteHostButton.setImage(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
-
- deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
- deleteHostButton.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String host = getHostFromCombo();
- if (host != null && host.length() != 0) {
- removeSettingsForHost(host);
- removeSecurePassword(host);
- fillHostCombo();
- hostCombo.select(0);
- host = getHostFromCombo();
- if (host != null && host.length() != 0) {
- fillSettingsForHost(host);
- }
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- if (separator) {
- Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- }
- }
- }
-
- /**
- * Create the encoding selection combo.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @param separator If <code>true</code>, a separator will be added before the controls.
- */
- protected void createEncodingUI(final Composite parent, boolean separator) {
- Assert.isNotNull(parent);
-
- if (separator) {
- Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- }
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.AbstractConfigurationPanel_encoding);
-
- encodingCombo = new Combo(panel, SWT.READ_ONLY);
- encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- encodingCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (Messages.AbstractConfigurationPanel_encoding_custom.equals(encodingCombo.getText())) {
- InputDialog dialog = new InputDialog(parent.getShell(),
- Messages.AbstractConfigurationPanel_encoding_custom_title,
- Messages.AbstractConfigurationPanel_encoding_custom_message,
- null,
- new IInputValidator() {
- @Override
- public String isValid(String newText) {
- boolean valid = false;
- try {
- if (newText != null && !"".equals(newText)) { //$NON-NLS-1$
- valid = Charset.isSupported(newText);
- }
- } catch (IllegalCharsetNameException e) { /* ignored on purpose */ }
-
- if (!valid) {
- return newText != null && !"".equals(newText) ? Messages.AbstractConfigurationPanel_encoding_custom_error : ""; //$NON-NLS-1$ //$NON-NLS-2$
- }
- return null;
- }
- });
- if (dialog.open() == Window.OK) {
- String encoding = dialog.getValue();
- encodingCombo.add(encoding, encodingCombo.getItemCount() - 1);
- encodingCombo.select(encodingCombo.indexOf(encoding));
- lastSelectedEncoding = encodingCombo.getText();
-
- // Remember the last 5 custom encodings entered
- if (!encodingHistory.contains(encoding)) {
- if (encodingHistory.size() == 5) encodingHistory.remove(4);
- encodingHistory.add(encoding);
- }
-
- } else {
- encodingCombo.select(encodingCombo.indexOf(lastSelectedEncoding));
- }
- }
- }
- });
-
- fillEncodingCombo();
-
- // Apply any default encoding derived from the current selection
- String defaultEncoding = getSelectionEncoding();
- if (defaultEncoding != null && !"".equals(defaultEncoding)) { //$NON-NLS-1$
- setEncoding(defaultEncoding);
- }
- }
-
- /**
- * Fill the encoding combo.
- */
- protected void fillEncodingCombo() {
- if (encodingCombo != null) {
- List<String> encodings = new ArrayList<String>();
-
- // Some hard-coded encodings
- encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$
- encodings.add("UTF-8"); //$NON-NLS-1$
-
- // The currently selected IDE encoding from the preferences
- String ideEncoding = getResourceEncoding();
- if (ideEncoding != null && !encodings.contains(ideEncoding)) encodings.add(ideEncoding);
-
- // The default Eclipse Workbench encoding (configured in the preferences)
- String eclipseEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
- if (eclipseEncoding != null && !encodings.contains(eclipseEncoding)) encodings.add(eclipseEncoding);
-
- // The default host (Java VM) encoding
- //
- // Note: We do not use Charset.defaultCharset().displayName() here as it returns the bit
- // unusual name "windows-1252" on Windows. As there is no access to the "historical"
- // name "Cp1252" stored in MS1252.class, stick to the older way of retrieving an encoding.
- String hostEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding();
- if (!encodings.contains(hostEncoding)) encodings.add(hostEncoding);
-
- // The "Other..." encoding
- encodings.add(Messages.AbstractConfigurationPanel_encoding_custom);
-
- encodingCombo.setItems(encodings.toArray(new String[encodings.size()]));
- encodingCombo.select(0);
-
- lastSelectedEncoding = encodingCombo.getText();
- }
- }
-
- /**
- * Get the current value of the encoding preference. If the value is not set
- * return <code>null</code>.
- * <p>
- * <b>Note:</b> Copied from <code>org.eclipse.ui.ide.IDEEncoding</code>.
- *
- * @return String
- */
- @SuppressWarnings("deprecation")
- private String getResourceEncoding() {
- String preference = null;
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- preference = org.eclipse.core.resources.ResourcesPlugin.getPlugin().getPluginPreferences().getString(org.eclipse.core.resources.ResourcesPlugin.PREF_ENCODING);
- }
-
- return preference != null && preference.length() > 0 ? preference : null;
- }
-
- /**
- * Select the encoding.
- *
- * @param encoding The encoding. Must not be <code>null</code>.
- */
- protected void setEncoding(String encoding) {
- Assert.isNotNull(encoding);
-
- if (encodingCombo != null && !encodingCombo.isDisposed()) {
- int index = encodingCombo.indexOf("ISO-8859-1".equals(encoding) ? "Default (ISO-8859-1)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$
- if (index != -1) encodingCombo.select(index);
- else {
- encodingCombo.add(encoding, encodingCombo.getItemCount() - 1);
- encodingCombo.select(encodingCombo.indexOf(encoding));
- }
-
- lastSelectedEncoding = encodingCombo.getText();
- }
- }
-
- /**
- * Returns the selected encoding.
- *
- * @return The selected encoding or <code>null</code>.
- */
- protected String getEncoding() {
- String encoding = encodingCombo != null && !encodingCombo.isDisposed() ? encodingCombo.getText() : null;
- return encoding != null && encoding.startsWith("Default") ? null : encoding; //$NON-NLS-1$
- }
-
- /**
- * Returns if or if not the selected encoding is supported.
- *
- * @return <code>True</code> if the selected encoding is supported.
- */
- protected boolean isEncodingValid() {
- try {
- String encoding = getEncoding();
- return Charset.isSupported(encoding != null ? encoding : "ISO-8859-1"); //$NON-NLS-1$
- } catch (IllegalCharsetNameException e) {
- return false;
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java
deleted file mode 100644
index 08398fcf4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.services;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IUIConstants;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tcf.te.ui.terminals.manager.ConsoleManager;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Terminal service implementation.
- */
-@SuppressWarnings("restriction")
-public class TerminalService implements ITerminalService {
- /**
- * The registered terminal tab dispose listeners.
- */
- private final ListenerList terminalTabListeners = new ListenerList();
-
- // Flag to remember if the terminal view has been restored or not.
- private boolean fRestoringView;
-
- // Terminal tab events
-
- /**
- * A terminal tab got disposed.
- */
- public static final int TAB_DISPOSED = 1;
-
- /**
- * Common terminal service runnable implementation.
- */
- protected static abstract class TerminalServiceRunnable {
-
- /**
- * Invoked to execute the terminal service runnable.
- *
- * @param id The terminals view id or <code>null</code>.
- * @param secondaryId The terminals view secondary id or <code>null</code>.
- * @param title The terminal tab title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- * @param done The callback to invoke if the operation finished or <code>null</code>.
- */
- public abstract void run(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done);
-
- /**
- * Returns if or if not to execute the runnable asynchronously.
- * <p>
- * The method returns per default <code>true</code>. Overwrite to
- * modify the behavior.
- *
- * @return <code>True</code> to execute the runnable asynchronously, <code>false</code> otherwise.
- */
- public boolean isExecuteAsync() { return true; }
- }
-
- /**
- * Constructor
- */
- public TerminalService() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#addTerminalTabListener(org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener)
- */
- @Override
- public final void addTerminalTabListener(ITerminalTabListener listener) {
- Assert.isNotNull(listener);
- terminalTabListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#removeTerminalTabListener(org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener)
- */
- @Override
- public final void removeTerminalTabListener(ITerminalTabListener listener) {
- Assert.isNotNull(listener);
- terminalTabListeners.remove(listener);
- }
-
- /**
- * Convenience method for notifying the registered terminal tab listeners.
- *
- * @param event The terminal tab event.
- * @param source The disposed tab item. Must not be <code>null</code>.
- * @param data The custom data object associated with the disposed tab item or <code>null</code>.
- */
- public final void fireTerminalTabEvent(final int event, final Object source, final Object data) {
- Assert.isNotNull(source);
-
- // If no listener is registered, we are done here
- if (terminalTabListeners.isEmpty()) return;
-
- // Get the list or currently registered listeners
- Object[] l = terminalTabListeners.getListeners();
- // Loop the registered terminal tab listeners and invoke the proper method
- for (int i = 0; i < l.length; i++) {
- final ITerminalTabListener listener = (ITerminalTabListener) l[i];
- ISafeRunnable job = new ISafeRunnable() {
- @Override
- public void handleException(Throwable exception) {
- // already logged in Platform#run()
- }
-
- @Override
- public void run() throws Exception {
- switch (event) {
- case TAB_DISPOSED:
- listener.terminalTabDisposed(source, data);
- break;
- default:
- }
- }
- };
- SafeRunner.run(job);
- }
- }
-
- /**
- * Executes the given runnable operation and invokes the given callback, if any,
- * after the operation finished.
- *
- * @param properties The terminal properties. Must not be <code>null</code>.
- * @param runnable The terminal service runnable. Must not be <code>null</code>.
- * @param done The callback to invoke if the operation has been finished or <code>null</code>.
- */
- protected final void executeServiceOperation(final Map<String, Object> properties, final TerminalServiceRunnable runnable, final Done done) {
- Assert.isNotNull(properties);
- Assert.isNotNull(runnable);
-
- // Extract the properties
- String id = (String)properties.get(ITerminalsConnectorConstants.PROP_ID);
- String secondaryId = (String)properties.get(ITerminalsConnectorConstants.PROP_SECONDARY_ID);
- String title = (String)properties.get(ITerminalsConnectorConstants.PROP_TITLE);
- Object data = properties.get(ITerminalsConnectorConstants.PROP_DATA);
-
- // Normalize the terminals console view id
- id = normalizeId(id, data);
- // Normalize the terminal console tab title
- title = normalizeTitle(title, data);
-
- // Create the terminal connector instance
- final ITerminalConnector connector = createTerminalConnector(properties);
- if (connector == null) {
- // Properties contain invalid connector arguments
- if (done != null) {
- Exception e = new IllegalArgumentException(Messages.TerminalService_error_cannotCreateConnector);
- done.done(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), e.getLocalizedMessage(), e));
- }
- return;
- }
-
- // Finalize the used variables
- final String finId = id;
- final String finSecondaryId = secondaryId;
- final String finTitle = title;
- final Object finData = data;
-
- // Execute the operation
- if (!runnable.isExecuteAsync()) {
- runnable.run(finId, finSecondaryId, finTitle, connector, finData, done);
- }
- else {
- try {
- Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- runnable.run(finId, finSecondaryId, finTitle, connector, finData, done);
- }
- });
- }
- catch (Exception e) {
- // if display is disposed, silently ignore.
- }
- }
- }
-
- /**
- * Normalize the terminals view id.
- *
- * @param id The terminals view id or <code>null</code>.
- * @param data The custom data object or <code>null</code>.
- *
- * @return The normalized terminals console view id.
- */
- protected String normalizeId(String id, Object data) {
- return id != null ? id : IUIConstants.ID;
- }
-
- /**
- * Normalize the terminal tab title.
- *
- * @param title The terminal tab title or <code>null</code>.
- * @param data The custom data object or <code>null</code>.
- *
- * @return The normalized terminal tab title.
- */
- protected String normalizeTitle(String title, Object data) {
- // If the title is explicitly specified, return as is
- if (title != null) return title;
-
- // Return the default console title in all other cases
- return Messages.TerminalService_defaultTitle;
- }
-
- /**
- * Creates the terminal connector configured within the given properties.
- *
- * @param properties The terminal console properties. Must not be <code>null</code>.
- * @return The terminal connector or <code>null</code>.
- */
- protected ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // The terminal connector result object
- ITerminalConnector connector = null;
-
- // Get the launcher delegate id from the properties
- String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
- if (delegateId != null) {
- // Get the launcher delegate
- ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
- if (delegate != null) {
- // Create the terminal connector
- connector = delegate.createTerminalConnector(properties);
- }
- }
-
- return connector;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#openConsole(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void openConsole(final Map<String, Object> properties, final Done done) {
- Assert.isNotNull(properties);
- final boolean restoringView = fRestoringView;
-
- executeServiceOperation(properties, new TerminalServiceRunnable() {
- @Override
- @SuppressWarnings("synthetic-access")
- public void run(final String id, final String secondaryId, final String title,
- final ITerminalConnector connector, final Object data, final Done done) {
- if (restoringView) {
- doRun(id, secondaryId, title, connector, data, done);
- } else {
- // First, restore the view. This opens consoles from the memento
- fRestoringView = true;
- ConsoleManager.getInstance().showConsoleView(id, secondaryId);
- fRestoringView = false;
-
- // After that schedule opening the requested console
- try {
- Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- doRun(id, secondaryId, title, connector, data, done);
- }
- });
- }
- catch (Exception e) {
- // if display is disposed, silently ignore.
- }
- }
- }
-
- public void doRun(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) {
- // Determine the terminal encoding
- String encoding = (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING);
- // Create the flags to pass on to openConsole
- Map<String, Boolean> flags = new HashMap<String, Boolean>();
- flags.put("activate", Boolean.TRUE); //$NON-NLS-1$
- if (properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW) instanceof Boolean) {
- flags.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, (Boolean)properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW));
- }
- if (properties.get(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON) instanceof Boolean) {
- flags.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, (Boolean)properties.get(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON));
- }
- // Open the new console
- CTabItem item;
- if (secondaryId != null)
- item = ConsoleManager.getInstance().openConsole(id, secondaryId, title, encoding, connector, data, flags);
- else
- item = ConsoleManager.getInstance().openConsole(id, title, encoding, connector, data, flags);
- // Associate the original terminal properties with the tab item.
- // This makes it easier to persist the connection data within the memento handler
- if (item != null && !item.isDisposed()) item.setData("properties", properties); //$NON-NLS-1$
-
- // Invoke the callback
- if (done != null) done.done(Status.OK_STATUS);
- }
- }, done);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#closeConsole(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void closeConsole(final Map<String, Object> properties, final Done done) {
- Assert.isNotNull(properties);
-
- executeServiceOperation(properties, new TerminalServiceRunnable() {
- @Override
- public void run(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) {
- // Close the console
- ConsoleManager.getInstance().closeConsole(id, title, connector, data);
- // Invoke the callback
- if (done != null) done.done(Status.OK_STATUS);
- }
- }, done);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#terminateConsole(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void terminateConsole(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- executeServiceOperation(properties, new TerminalServiceRunnable() {
- @Override
- public void run(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) {
- // Close the console
- ConsoleManager.getInstance().terminateConsole(id, title, connector, data);
- // Invoke the callback
- if (done != null) done.done(Status.OK_STATUS);
- }
- }, done);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java
deleted file mode 100644
index 51496bcbf..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.streams;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Streams connector implementation.
- */
-@SuppressWarnings("restriction")
-public abstract class AbstractStreamsConnector extends TerminalConnectorImpl {
- // Reference to the stdin monitor
- private InputStreamMonitor stdInMonitor;
- // Reference to the stdout monitor
- private OutputStreamMonitor stdOutMonitor;
- // Reference to the stderr monitor
- private OutputStreamMonitor stdErrMonitor;
-
- // Reference to the list of stdout output listeners
- private ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = null;
- // Reference to the list of stderr output listeners
- private ITerminalServiceOutputStreamMonitorListener[] stderrListeners = null;
-
- /**
- * Set the list of stdout listeners.
- *
- * @param listeners The list of stdout listeners or <code>null</code>.
- */
- protected final void setStdoutListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) {
- this.stdoutListeners = listeners;
- }
-
- /**
- * Set the list of stderr listeners.
- *
- * @param listeners The list of stderr listeners or <code>null</code>.
- */
- protected final void setStderrListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) {
- this.stderrListeners = listeners;
- }
-
- /**
- * Connect the given streams. The streams connector will wrap each stream
- * with a corresponding terminal stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stdin The stdin stream or <code>null</code>.
- * @param stdout The stdout stream or <code>null</code>.
- * @param stderr The stderr stream or <code>null</code>.
- * @param localEcho Local echo on or off.
- * @param lineSeparator The line separator used by the stream.
- */
- protected void connectStreams(ITerminalControl terminalControl, OutputStream stdin, InputStream stdout, InputStream stderr, boolean localEcho, String lineSeparator) {
- Assert.isNotNull(terminalControl);
-
- // Create the input stream monitor
- if (stdin != null) {
- stdInMonitor = createStdInMonitor(terminalControl, stdin, localEcho, lineSeparator);
- // Register the connector if it implements IDisposable and stdout/stderr are not monitored
- if (stdout == null && stderr == null && this instanceof IDisposable) stdInMonitor.addDisposable((IDisposable)this);
- // Start the monitoring
- stdInMonitor.startMonitoring();
- }
-
- // Create the output stream monitor
- if (stdout != null) {
- stdOutMonitor = createStdOutMonitor(terminalControl, stdout, lineSeparator);
- // Register the connector if it implements IDisposable
- if (this instanceof IDisposable) stdOutMonitor.addDisposable((IDisposable)this);
- // Register the listeners
- if (stdoutListeners != null) {
- for (ITerminalServiceOutputStreamMonitorListener l : stdoutListeners) {
- stdOutMonitor.addListener(l);
- }
- }
- // Start the monitoring
- stdOutMonitor.startMonitoring();
- }
-
- // Create the error stream monitor
- if (stderr != null) {
- stdErrMonitor = createStdErrMonitor(terminalControl, stderr, lineSeparator);
- // Register the connector if it implements IDisposable and stdout is not monitored
- if (stdout == null && this instanceof IDisposable) stdErrMonitor.addDisposable((IDisposable)this);
- // Register the listeners
- if (stderrListeners != null) {
- for (ITerminalServiceOutputStreamMonitorListener l : stderrListeners) {
- stdErrMonitor.addListener(l);
- }
- }
- // Start the monitoring
- stdErrMonitor.startMonitoring();
- }
- }
-
- /**
- * Creates an stdin monitor for the given terminal control and stdin stream.
- * Subclasses may override to create a specialized stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stdin The stdin stream or <code>null</code>.
- * @param localEcho Local echo on or off.
- * @param lineSeparator The line separator used by the stream.
- *
- * @return input stream monitor
- */
- protected InputStreamMonitor createStdInMonitor(ITerminalControl terminalControl, OutputStream stdin, boolean localEcho, String lineSeparator) {
- return new InputStreamMonitor(terminalControl, stdin, localEcho, lineSeparator);
- }
-
- /**
- * Creates an stdout monitor for the given terminal control and stdout stream.
- * Subclasses may override to create a specialized stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stdout The stdout stream or <code>null</code>.
- * @param lineSeparator The line separator used by the stream.
- *
- * @return output stream monitor
- */
- protected OutputStreamMonitor createStdOutMonitor(ITerminalControl terminalControl, InputStream stdout, String lineSeparator) {
- return new OutputStreamMonitor(terminalControl, stdout, lineSeparator);
- }
-
- /**
- * Creates an stderr monitor for the given terminal control and stderr stream.
- * Subclasses may override to create a specialized stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stderr The stderr stream or <code>null</code>.
- * @param lineSeparator The line separator used by the stream.
- *
- * @return output stream monitor
- */
- protected OutputStreamMonitor createStdErrMonitor(ITerminalControl terminalControl, InputStream stderr, String lineSeparator) {
- return new OutputStreamMonitor(terminalControl, stderr, lineSeparator);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect()
- */
- @Override
- protected void doDisconnect() {
- // Dispose the streams
- if (stdInMonitor != null) { stdInMonitor.dispose(); stdInMonitor = null; }
- if (stdOutMonitor != null) { stdOutMonitor.dispose(); stdOutMonitor = null; }
- if (stdErrMonitor != null) { stdErrMonitor.dispose(); stdErrMonitor = null; }
-
- super.doDisconnect();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getTerminalToRemoteStream()
- */
- @Override
- public OutputStream getTerminalToRemoteStream() {
- return stdInMonitor;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
deleted file mode 100644
index 928e0179c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.streams;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-
-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.core.terminals.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Input stream monitor implementation.
- * <p>
- * <b>Note:</b> The input is coming <i>from</i> the terminal. Therefore, the input
- * stream monitor is attached to the stdin stream of the monitored (remote) process.
- */
-@SuppressWarnings("restriction")
-public class InputStreamMonitor extends OutputStream implements IDisposable {
- // Reference to the parent terminal control
- private final ITerminalControl terminalControl;
-
- // Reference to the monitored (output) stream
- private final OutputStream stream;
-
- // Reference to the thread writing the stream
- private volatile Thread thread;
-
- // Flag to mark the monitor disposed. When disposed,
- // no further data is written from the monitored stream.
- private volatile boolean disposed;
-
- // A list of object to dispose if this monitor is disposed
- private final List<IDisposable> disposables = new ArrayList<IDisposable>();
-
- // Queue to buffer the data to write to the output stream
- private final Queue<byte[]> queue = new LinkedList<byte[]>();
-
- // ***** Line separator replacement logic *****
- // ***** Adapted from org.eclipse.tcf.internal.terminal.local.LocalTerminalOutputStream *****
-
- private final static int TERMINAL_SENDS_CR = 0;
- private final static int TERMINAL_SENDS_CRLF = 1;
- private final static int PROGRAM_EXPECTS_LF = 0;
- private final static int PROGRAM_EXPECTS_CRLF = 1;
- private final static int PROGRAM_EXPECTS_CR = 2;
- private final static int NO_CHANGE = 0;
- private final static int CHANGE_CR_TO_LF = 1;
- private final static int INSERT_LF_AFTER_CR = 2;
- private final static int REMOVE_CR = 3;
- private final static int REMOVE_LF = 4;
-
- // CRLF conversion table:
- //
- // Expected line separator --> | LF | CRLF | CR |
- // ------------------------------------+-----------------+--------------------+----------------+
- // Local echo off - control sends CR | change CR to LF | insert LF after CR | no change |
- // ------------------------------------+-----------------+--------------------+----------------+
- // Local echo on - control sends CRLF | remove CR | no change | remove LF |
- //
- private final static int[][] CRLF_REPLACEMENT = {
-
- {CHANGE_CR_TO_LF, INSERT_LF_AFTER_CR, NO_CHANGE},
- {REMOVE_CR, NO_CHANGE, REMOVE_LF}
- };
-
- private int replacement;
-
- /**
- * Constructor.
- *
- * @param terminalControl The parent terminal control. Must not be <code>null</code>.
- * @param stream The stream. Must not be <code>null</code>.
- * @param localEcho Local echo on or off.
- * @param lineSeparator The line separator used by the stream.
- */
- public InputStreamMonitor(ITerminalControl terminalControl, OutputStream stream, boolean localEcho, String lineSeparator) {
- super();
-
- Assert.isNotNull(terminalControl);
- this.terminalControl = terminalControl;
- Assert.isNotNull(stream);
- this.stream = stream;
-
- // Determine the line separator replacement setting
- int terminalSends = localEcho ? TERMINAL_SENDS_CRLF : TERMINAL_SENDS_CR;
- if (lineSeparator == null) {
- replacement = NO_CHANGE;
- } else {
- int programExpects;
- if (lineSeparator.equals(ILineSeparatorConstants.LINE_SEPARATOR_LF)) {
- programExpects = PROGRAM_EXPECTS_LF;
- }
- else if (lineSeparator.equals(ILineSeparatorConstants.LINE_SEPARATOR_CR)) {
- programExpects = PROGRAM_EXPECTS_CR;
- }
- else {
- programExpects = PROGRAM_EXPECTS_CRLF;
- }
- replacement = CRLF_REPLACEMENT[terminalSends][programExpects];
- }
-
- }
-
- /**
- * Returns the associated terminal control.
- *
- * @return The associated terminal control.
- */
- protected final ITerminalControl getTerminalControl() {
- return terminalControl;
- }
-
- /**
- * Adds the given disposable object to the list. The method will do nothing
- * if either the disposable object is already part of the list or the monitor
- * is disposed.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void addDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- if (!disposed && !disposables.contains(disposable)) disposables.add(disposable);
- }
-
- /**
- * Removes the disposable object from the list.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void removeDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- disposables.remove(disposable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- // If already disposed --> return immediately
- if (disposed) return;
-
- // Mark the monitor disposed
- disposed = true;
-
- // Close the stream (ignore exceptions on close)
- try { stream.close(); } catch (IOException e) { /* ignored on purpose */ }
- // And interrupt the thread
- close();
-
- // Dispose all registered disposable objects
- for (IDisposable disposable : disposables) disposable.dispose();
- // Clear the list
- disposables.clear();
- }
-
- /**
- * Close the terminal input stream monitor.
- */
- @Override
- public void close() {
- // Not initialized -> return immediately
- if (thread == null) return;
-
- // Copy the reference
- final Thread oldThread = thread;
- // Unlink the monitor from the thread
- thread = null;
- // And interrupt the writer thread
- oldThread.interrupt();
- }
-
- /**
- * Starts the terminal output stream monitor.
- */
- public void startMonitoring() {
- // If already initialized -> return immediately
- if (thread != null) return;
-
- // Create a new runnable which is constantly reading from the stream
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- writeStream();
- }
- };
-
- // Create the writer thread
- thread = new Thread(runnable, "Terminal Input Stream Monitor Thread"); //$NON-NLS-1$
-
- // Configure the writer thread
- thread.setDaemon(true);
-
- // Start the processing
- thread.start();
- }
-
-
- /**
- * Reads from the queue and writes the read content to the stream.
- */
- protected void writeStream() {
- // Read from the queue and write to the stream until disposed
- outer: while (thread != null && !disposed) {
- byte[] data;
- // If the queue is empty, wait until notified
- synchronized(queue) {
- while (queue.isEmpty()) {
- if (disposed) break outer;
- try {
- queue.wait();
- } catch (InterruptedException e) {
- break outer;
- }
- }
- // Retrieves the queue head (is null if queue is empty (should never happen))
- data = queue.poll();
- }
- if (data != null) {
- try {
- // Break up writes into max 1000 byte junks to avoid console input buffer overflows on Windows
- int written = 0;
- byte[] buf = new byte[1000];
- while (written < data.length) {
- int len = Math.min(buf.length, data.length - written);
- System.arraycopy(data, written, buf, 0, len);
- // Write the data to the stream
- stream.write(buf, 0, len);
- written += len;
- // Flush the stream immediately
- stream.flush();
- // Wait a little between writes to allow input being processed
- if (written < data.length)
- Thread.sleep(100);
- }
- } catch (IOException e) {
- // IOException received. If this is happening when already disposed -> ignore
- if (!disposed) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.InputStreamMonitor_error_writingToStream, e.getLocalizedMessage()), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- catch (InterruptedException e) {
- break;
- }
- }
- }
-
- // Dispose the stream
- dispose();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- @Override
- public void write(int b) throws IOException {
- synchronized(queue) {
- queue.add(new byte[] { (byte)b });
- queue.notifyAll();
- }
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- // Write the whole block to the queue to avoid synchronization
- // to happen for every byte. To do so, we have to avoid calling
- // the super method. Therefore we have to do the same checking
- // here as the base class does.
-
- // Null check. See the implementation in OutputStream.
- if (b == null) throw new NullPointerException();
-
- // Boundary check. See the implementation in OutputStream.
- if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
- throw new IndexOutOfBoundsException();
- }
- else if (len == 0) {
- return;
- }
-
- // Make sure that the written block is not interlaced with other input.
- synchronized(queue) {
- // Preprocess the block to be written
- byte[] processedBytes = onWriteContentToStream(b, off, len);
- // If the returned array is not the original one, adjust offset and length
- if (processedBytes != b) {
- off = 0; len = processedBytes.length; b = processedBytes;
- }
-
- // Get the content from the byte buffer specified by offset and length
- byte[] bytes = new byte[len];
- int j = 0;
- for (int i = 0 ; i < len ; i++) {
- bytes[j++] = b[off + i];
- }
-
- queue.add(bytes);
- queue.notifyAll();
- }
- }
-
- /**
- * Allow for processing of data from byte stream from the terminal before
- * it is written to the output stream. If the returned byte array is different
- * than the one that was passed in with the bytes argument, then the
- * length value will be adapted.
- *
- * @param bytes The byte stream. Must not be <code>null</code>.
- * @param off The offset.
- * @param len the length.
- *
- * @return The processed byte stream.
- *
- */
- protected byte[] onWriteContentToStream(byte[] bytes, int off, int len) {
- Assert.isNotNull(bytes);
-
- if (replacement != NO_CHANGE && len > 0) {
- String origText = new String(bytes, off, len);
- String text = null;
- //
- // TODO: check whether this is correct! new String(byte[], int, int) always uses the default
- // encoding!
-
- if (replacement == CHANGE_CR_TO_LF) {
- text = origText.replace('\r', '\n');
- }
- else if (replacement == INSERT_LF_AFTER_CR) {
- text = origText.replaceAll("\r\n|\r", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else if (replacement == REMOVE_CR) {
- text = origText.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_CR, ""); //$NON-NLS-1$
- }
- else if (replacement == REMOVE_LF) {
- text = origText.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_LF, ""); //$NON-NLS-1$
- }
-
- if (text != null && !origText.equals(text)) {
- bytes = text.getBytes();
- }
- }
-
- return bytes;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
deleted file mode 100644
index 5714bf9fd..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.streams;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Output stream monitor implementation.
- * <p>
- * <b>Note:</b> The output is going <i>to</i> the terminal. Therefore, the output
- * stream monitor is attached to the stdout and/or stderr stream of the monitored
- * (remote) process.
- */
-@SuppressWarnings("restriction")
-public class OutputStreamMonitor implements IDisposable {
- // The default buffer size to use
- private static final int BUFFER_SIZE = 8192;
-
- // Reference to the parent terminal control
- private final ITerminalControl terminalControl;
-
- // Reference to the monitored (input) stream
- private final InputStream stream;
-
- // The line separator used by the monitored (input) stream
- private final String lineSeparator;
-
- // Reference to the thread reading the stream
- private Thread thread;
-
- // Flag to mark the monitor disposed. When disposed,
- // no further data is read from the monitored stream.
- private boolean disposed;
-
- // A list of object to dispose if this monitor is disposed
- private final List<IDisposable> disposables = new ArrayList<IDisposable>();
-
- // The list of registered listener
- private final ListenerList listeners;
-
- /**
- * Constructor.
- *
- * @param terminalControl The parent terminal control. Must not be <code>null</code>.
- * @param stream The stream. Must not be <code>null</code>.
- * @param lineSeparator The line separator used by the stream.
- */
- public OutputStreamMonitor(ITerminalControl terminalControl, InputStream stream, String lineSeparator) {
- super();
-
- Assert.isNotNull(terminalControl);
- this.terminalControl = terminalControl;
- Assert.isNotNull(stream);
- this.stream = new BufferedInputStream(stream, BUFFER_SIZE);
-
- this.lineSeparator = lineSeparator;
-
- this.listeners = new ListenerList();
- }
-
- /**
- * Register a streams data receiver listener.
- *
- * @param listener The listener. Must not be <code>null</code>.
- */
- public final void addListener(ITerminalServiceOutputStreamMonitorListener listener) {
- Assert.isNotNull(listener);
- listeners.add(listener);
- }
-
- /**
- * Unregister a streams data receiver listener.
- *
- * @param listener The listener. Must not be <code>null</code>.
- */
- public final void removeListener(ITerminalServiceOutputStreamMonitorListener listener) {
- Assert.isNotNull(listener);
- listeners.remove(listener);
- }
-
- /**
- * Adds the given disposable object to the list. The method will do nothing
- * if either the disposable object is already part of the list or the monitor
- * is disposed.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void addDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- if (!disposed && !disposables.contains(disposable)) disposables.add(disposable);
- }
-
- /**
- * Removes the disposable object from the list.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void removeDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- disposables.remove(disposable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- // If already disposed --> return immediately
- if (disposed) return;
-
- // Mark the monitor disposed
- disposed = true;
-
- // Close the stream (ignore exceptions on close)
- try { stream.close(); } catch (IOException e) { /* ignored on purpose */ }
-
- // Dispose all registered disposable objects
- for (IDisposable disposable : disposables) disposable.dispose();
- // Clear the list
- disposables.clear();
- }
-
- /**
- * Starts the terminal output stream monitor.
- */
- protected void startMonitoring() {
- // If already initialized -> return immediately
- if (thread != null) return;
-
- // Create a new runnable which is constantly reading from the stream
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- readStream();
- }
- };
-
- // Create the reader thread
- thread = new Thread(runnable, "Terminal Output Stream Monitor Thread"); //$NON-NLS-1$
-
- // Configure the reader thread
- thread.setDaemon(true);
- thread.setPriority(Thread.MIN_PRIORITY);
-
- // Start the processing
- thread.start();
- }
-
- /**
- * Returns the terminal control that this stream monitor is associated with.
- */
- protected ITerminalControl getTerminalControl() {
- return terminalControl;
- }
-
- /**
- * Reads from the output stream and write the read content
- * to the terminal control output stream.
- */
- void readStream() {
- // Creates the read buffer
- byte[] readBuffer = new byte[BUFFER_SIZE];
-
- // We need to maintain UI responsiveness but still stream the content
- // to the terminal control fast. Put the thread to a short sleep each second.
- long sleepMarker = System.currentTimeMillis();
-
- // Read from the stream until EOS is reached or the
- // monitor is marked disposed.
- int read = 0;
- while (read >= 0 && !disposed) {
- try {
- // Read from the stream
- read = stream.read(readBuffer);
- // If some data has been read, append to the terminal
- // control output stream
- if (read > 0) {
- // Allow for post processing the read content before appending
- byte[] processedReadBuffer = onContentReadFromStream(readBuffer, read);
- if (processedReadBuffer != readBuffer) {
- read = processedReadBuffer.length;
- }
- terminalControl.getRemoteToTerminalOutputStream().write(processedReadBuffer, 0, read);
- }
- } catch (IOException e) {
- // IOException received. If this is happening when already disposed -> ignore
- if (!disposed) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.OutputStreamMonitor_error_readingFromStream, e.getLocalizedMessage()), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- break;
- } catch (NullPointerException e) {
- // killing the stream monitor while reading can cause an NPE
- // when reading from the stream
- if (!disposed && thread != null) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.OutputStreamMonitor_error_readingFromStream, e.getLocalizedMessage()), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- break;
- }
-
- // See above -> Thread will go to sleep each second
- if (System.currentTimeMillis() - sleepMarker > 1000) {
- sleepMarker = System.currentTimeMillis();
- try { Thread.sleep(1); } catch (InterruptedException e) { /* ignored on purpose */ }
- }
- }
-
- // Dispose ourself
- dispose();
- }
-
- /**
- * Allow for processing of data from byte stream after it is read from
- * client but before it is appended to the terminal. If the returned byte
- * array is different than the one that was passed in with the byteBuffer
- * argument, then the bytesRead value will be ignored and the full
- * returned array will be written out.
- *
- * @param byteBuffer The byte stream. Must not be <code>null</code>.
- * @param bytesRead The number of bytes that were read into the read buffer.
- * @return The processed byte stream.
- *
- */
- protected byte[] onContentReadFromStream(byte[] byteBuffer, int bytesRead) {
- Assert.isNotNull(byteBuffer);
-
- // If tracing is enabled, print out the decimal byte values read
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_OUTPUT_STREAM_MONITOR)) {
- StringBuilder debug = new StringBuilder("byteBuffer [decimal, " + bytesRead + " bytes] : "); //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < bytesRead; i++) {
- debug.append(Byte.valueOf(byteBuffer[i]).intValue());
- debug.append(' ');
- }
- System.out.println(debug.toString());
- }
-
- // Remember if the text got changed.
- boolean changed = false;
-
- // How can me make sure that we don't mess with the encoding here?
- String text = new String(byteBuffer, 0, bytesRead);
-
- // Shift-In (14) and Shift-Out(15) confuses the terminal widget
- if (text.indexOf(14) != -1 || text.indexOf(15) != -1) {
- text = text.replaceAll("\\x0e", "").replaceAll("\\x0f", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- changed = true;
- }
-
- // Check on the line separator setting
- if (lineSeparator != null
- && !ILineSeparatorConstants.LINE_SEPARATOR_CRLF.equals(lineSeparator)) {
- String separator = ILineSeparatorConstants.LINE_SEPARATOR_LF.equals(lineSeparator) ? "\n" : "\r"; //$NON-NLS-1$ //$NON-NLS-2$
- String separator2 = ILineSeparatorConstants.LINE_SEPARATOR_LF.equals(lineSeparator) ? "\r" : "\n"; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (text.indexOf(separator) != -1) {
- String[] fragments = text.split(separator);
- StringBuilder b = new StringBuilder();
- for (int i = 0; i < fragments.length; i++) {
- String fragment = fragments[i];
- String nextFragment = i + 1 < fragments.length ? fragments[i + 1] : null;
- b.append(fragment);
- if (fragment.endsWith(separator2) || (nextFragment != null && nextFragment.startsWith(separator2))) {
- // Both separators are found, just add the original separator
- b.append(separator);
- } else {
- b.append("\n\r"); //$NON-NLS-1$
- }
- }
- if (!text.equals(b.toString())) {
- text = b.toString();
- changed = true;
- }
- }
- }
-
- // If changed, get the new bytes array
- if (changed) {
- byteBuffer = text.getBytes();
- bytesRead = byteBuffer.length;
- }
-
- // If listeners are registered, invoke the listeners now.
- if (listeners.size() > 0) {
- for (Object candidate : listeners.getListeners()) {
- if (!(candidate instanceof ITerminalServiceOutputStreamMonitorListener)) continue;
- ((ITerminalServiceOutputStreamMonitorListener)candidate).onContentReadFromStream(byteBuffer, bytesRead);
- }
- }
-
- return byteBuffer;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
deleted file mode 100644
index b9780be51..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.streams;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Streams connector implementation.
- */
-@SuppressWarnings("restriction")
-public class StreamsConnector extends AbstractStreamsConnector implements IDisposable {
- // Reference to the streams settings
- private final StreamsSettings settings;
-
- /**
- * Constructor.
- */
- public StreamsConnector() {
- this(new StreamsSettings());
- }
-
- /**
- * Constructor.
- *
- * @param settings The streams settings. Must not be <code>null</code>
- */
- public StreamsConnector(StreamsSettings settings) {
- super();
-
- Assert.isNotNull(settings);
- this.settings = settings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#connect(org.eclipse.tcf.internal.terminal.provisional.api.ITerminalControl)
- */
- @Override
- public void connect(ITerminalControl control) {
- Assert.isNotNull(control);
- super.connect(control);
-
- // Setup the listeners
- setStdoutListeners(settings.getStdOutListeners());
- setStderrListeners(settings.getStdErrListeners());
-
- // connect the streams
- connectStreams(control, settings.getStdinStream(), settings.getStdoutStream(), settings.getStderrStream(), settings.isLocalEcho(), settings.getLineSeparator());
-
- // Set the terminal control state to CONNECTED
- control.setState(TerminalState.CONNECTED);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#isLocalEcho()
- */
- @Override
- public boolean isLocalEcho() {
- return settings.isLocalEcho();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- disconnect();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect()
- */
- @Override
- public void doDisconnect() {
- // Dispose the streams
- super.doDisconnect();
-
- // Set the terminal control state to CLOSED.
- fControl.setState(TerminalState.CLOSED);
- }
-
- // ***** Process Connector settings handling *****
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getSettingsSummary()
- */
- @Override
- public String getSettingsSummary() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#load(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore)
- */
- @Override
- public void load(ISettingsStore store) {
- settings.load(store);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#save(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore)
- */
- @Override
- public void save(ISettingsStore store) {
- settings.save(store);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java
deleted file mode 100644
index 6d492e7ba..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.ui.terminals.streams;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-
-/**
- * Streams launcher delegate implementation.
- */
-@SuppressWarnings("restriction")
-public class StreamsLauncherDelegate extends AbstractLauncherDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration()
- */
- @Override
- public boolean needsUserConfiguration() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
- */
- @Override
- public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
- */
- @Override
- public void execute(Map<String, Object> properties, Done done) {
- Assert.isNotNull(properties);
-
- // Get the terminal service
- ITerminalService terminal = TerminalServiceFactory.getService();
- // If not available, we cannot fulfill this request
- if (terminal != null) {
- terminal.openConsole(properties, done);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
- */
- @Override
- public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.StreamsConnector"; //$NON-NLS-1$
-
- // Extract the streams properties
- OutputStream stdin = (OutputStream)properties.get(ITerminalsConnectorConstants.PROP_STREAMS_STDIN);
- InputStream stdout = (InputStream)properties.get(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT);
- InputStream stderr = (InputStream)properties.get(ITerminalsConnectorConstants.PROP_STREAMS_STDERR);
- Object value = properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
- boolean localEcho = value instanceof Boolean ? ((Boolean)value).booleanValue() : false;
- String lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the streams settings
- StreamsSettings streamsSettings = new StreamsSettings();
- streamsSettings.setStdinStream(stdin);
- streamsSettings.setStdoutStream(stdout);
- streamsSettings.setStderrStream(stderr);
- streamsSettings.setLocalEcho(localEcho);
- streamsSettings.setLineSeparator(lineSeparator);
- streamsSettings.setStdOutListeners(stdoutListeners);
- streamsSettings.setStdErrListeners(stderrListeners);
- // And save the settings to the store
- streamsSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java
deleted file mode 100644
index dcaaac457..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.streams;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-
-/**
- * Streams connector settings implementation.
- */
-@SuppressWarnings("restriction")
-public class StreamsSettings {
- // Reference to the stdin stream
- private OutputStream stdin;
- // Reference to the stdout stream
- private InputStream stdout;
- // Reference to the stderr stream
- private InputStream stderr;
- // Flag to control the local echo
- private boolean localEcho = true;
- // The line separator setting
- private String lineSeparator = null;
- // The list of stdout output listeners
- private ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = null;
- // The list of stderr output listeners
- private ITerminalServiceOutputStreamMonitorListener[] stderrListeners = null;
-
- /**
- * Sets the stdin stream instance.
- *
- * @param stdin The stream instance or <code>null</code>.
- */
- public void setStdinStream(OutputStream stdin) {
- this.stdin = stdin;
- }
-
- /**
- * Returns the stdin stream instance.
- *
- * @return The stream instance or <code>null</code>.
- */
- public OutputStream getStdinStream() {
- return stdin;
- }
-
- /**
- * Sets the stdout stream instance.
- *
- * @param stdout The stream instance or <code>null</code>.
- */
- public void setStdoutStream(InputStream stdout) {
- this.stdout = stdout;
- }
-
- /**
- * Returns the stdout stream instance.
- *
- * @return The stream instance or <code>null</code>.
- */
- public InputStream getStdoutStream() {
- return stdout;
- }
-
- /**
- * Sets the stderr stream instance.
- *
- * @param stderr The stream instance or <code>null</code>.
- */
- public void setStderrStream(InputStream stderr) {
- this.stderr = stderr;
- }
-
- /**
- * Returns the stderr stream instance.
- *
- * @return The stream instance or <code>null</code>.
- */
- public InputStream getStderrStream() {
- return stderr;
- }
-
- /**
- * Sets if the process requires a local echo from the terminal widget.
- *
- * @param value Specify <code>true</code> to enable the local echo, <code>false</code> otherwise.
- */
- public void setLocalEcho(boolean value) {
- this.localEcho = value;
- }
-
- /**
- * Returns <code>true</code> if the process requires a local echo
- * from the terminal widget.
- *
- * @return <code>True</code> if local echo is enabled, <code>false</code> otherwise.
- */
- public boolean isLocalEcho() {
- return localEcho;
- }
-
- /**
- * Sets the stream line separator.
- *
- * @param separator The stream line separator <code>null</code>.
- */
- public void setLineSeparator(String separator) {
- this.lineSeparator = separator;
- }
-
- /**
- * Returns the stream line separator.
- *
- * @return The stream line separator or <code>null</code>.
- */
- public String getLineSeparator() {
- return lineSeparator;
- }
-
- /**
- * Sets the list of stdout listeners.
- *
- * @param listeners The list of stdout listeners or <code>null</code>.
- */
- public void setStdOutListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) {
- this.stdoutListeners = listeners;
- }
-
- /**
- * Returns the list of stdout listeners.
- *
- * @return The list of stdout listeners or <code>null</code>.
- */
- public ITerminalServiceOutputStreamMonitorListener[] getStdOutListeners() {
- return stdoutListeners;
- }
-
- /**
- * Sets the list of stderr listeners.
- *
- * @param listeners The list of stderr listeners or <code>null</code>.
- */
- public void setStdErrListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) {
- this.stderrListeners = listeners;
- }
-
- /**
- * Returns the list of stderr listeners.
- *
- * @return The list of stderr listeners or <code>null</code>.
- */
- public ITerminalServiceOutputStreamMonitorListener[] getStdErrListeners() {
- return stderrListeners;
- }
-
- /**
- * Loads the streams settings from the given settings store.
- *
- * @param store The settings store. Must not be <code>null</code>.
- */
- public void load(ISettingsStore store) {
- Assert.isNotNull(store);
- localEcho = Boolean.parseBoolean(store.get("LocalEcho", Boolean.FALSE.toString())); //$NON-NLS-1$
- lineSeparator = store.get("LineSeparator", null); //$NON-NLS-1$
- if (store instanceof SettingsStore) {
- stdin = (OutputStream)((SettingsStore)store).getSettings().get("stdin"); //$NON-NLS-1$
- stdout = (InputStream)((SettingsStore)store).getSettings().get("stdout"); //$NON-NLS-1$
- stderr = (InputStream)((SettingsStore)store).getSettings().get("stderr"); //$NON-NLS-1$
- stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdOutListeners"); //$NON-NLS-1$
- stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdErrListeners"); //$NON-NLS-1$
- }
- }
-
- /**
- * Saves the process settings to the given settings store.
- *
- * @param store The settings store. Must not be <code>null</code>.
- */
- public void save(ISettingsStore store) {
- Assert.isNotNull(store);
- store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$
- store.put("LineSeparator", lineSeparator); //$NON-NLS-1$
- if (store instanceof SettingsStore) {
- ((SettingsStore)store).getSettings().put("stdin", stdin); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("stdout", stdout); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("stderr", stderr); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("StdOutListeners", stdoutListeners); //$NON-NLS-1$
- ((SettingsStore)store).getSettings().put("StdErrListeners", stderrListeners); //$NON-NLS-1$
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java
deleted file mode 100644
index c6f5e814d..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Tab command input field handler implementation.
- */
-@SuppressWarnings("restriction")
-public class TabCommandFieldHandler implements IDisposable, IAdaptable {
- // Reference to the parent tab folder manager
- private final TabFolderManager tabFolderManager;
- // Reference to the associated tab
- private final CTabItem item;
-
- // Reference to the command input field
- private CommandInputFieldWithHistory field;
- // The command field history
- private String history;
-
- /**
- * Constructor.
- *
- * @param tabFolderManager The parent tab folder manager. Must not be <code>null</code>
- * @param item The associated tab item. Must not be <code>null</code>.
- */
- public TabCommandFieldHandler(TabFolderManager tabFolderManager, CTabItem item) {
- Assert.isNotNull(tabFolderManager);
- this.tabFolderManager = tabFolderManager;
- Assert.isNotNull(item);
- this.item = item;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- field = null;
- history = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (TabFolderManager.class.equals(adapter)) {
- return tabFolderManager;
- }
- if (CTabItem.class.equals(adapter)) {
- return item;
- }
- return null;
- }
-
- /**
- * Returns if or if not the associated tab item has the command input field enabled.
- *
- * @return <code>True</code> if the command input field is enabled, <code>false</code> otherwise.
- */
- public boolean hasCommandInputField() {
- return field != null;
- }
-
- /**
- * Set the command input field on or off.
- *
- * @param on <code>True</code> for on, <code>false</code> for off.
- */
- public void setCommandInputField(boolean on) {
- // save the old history
- if (field != null) {
- history = field.getHistory();
- field = null;
- }
-
- if (on) {
- field = new CommandInputFieldWithHistory(100);
- field.setHistory(history);
- }
-
- // Apply to the terminal control
- Assert.isTrue(!item.isDisposed());
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- if (terminal != null) terminal.setCommandInputField(field);
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java
deleted file mode 100644
index 382b734fe..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2015 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.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.ui.terminals.services.TerminalService;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-
-/**
- * Terminals tab default dispose listener implementation.
- */
-@SuppressWarnings("restriction")
-public class TabDisposeListener implements DisposeListener {
- private final TabFolderManager parentTabFolderManager;
-
- /**
- * Constructor.
- *
- * @param parentTabFolderManager The parent tab folder manager. Must not be <code>null</code>
- */
- public TabDisposeListener(TabFolderManager parentTabFolderManager) {
- Assert.isNotNull(parentTabFolderManager);
- this.parentTabFolderManager = parentTabFolderManager;
- }
-
- /**
- * Returns the parent terminal console tab folder manager instance.
- *
- * @return The parent terminal console tab folder manager instance.
- */
- protected final TabFolderManager getParentTabFolderManager() {
- return parentTabFolderManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
- */
- @Override
- public void widgetDisposed(DisposeEvent e) {
- // If a tab item gets disposed, we have to dispose the terminal as well
- if (e.getSource() instanceof CTabItem) {
- // Get the terminal control (if any) from the tab item
- Object candidate = ((CTabItem)e.getSource()).getData();
- if (candidate instanceof ITerminalViewControl) ((ITerminalViewControl)candidate).disposeTerminal();
- // Dispose the command input field handler
- parentTabFolderManager.disposeTabCommandFieldHandler((CTabItem)e.getSource());
-
- // If all items got removed, we have to switch back to the empty page control
- if (parentTabFolderManager.getTabFolder() != null && parentTabFolderManager.getTabFolder().getItemCount() == 0) {
- parentTabFolderManager.getParentView().switchToEmptyPageControl();
- }
- // Fire selection changed event
- parentTabFolderManager.fireSelectionChanged();
- // Fire the terminal console disposed event
- ITerminalService service = TerminalServiceFactory.getService();
- if (service instanceof TerminalService) {
- ((TerminalService)service).fireTerminalTabEvent(TerminalService.TAB_DISPOSED, e.getSource(), ((CTabItem)e.getSource()).getData("customData")); //$NON-NLS-1$
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java
deleted file mode 100644
index 34dda2459..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java
+++ /dev/null
@@ -1,794 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.tabs;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.control.ITerminalListener;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
-import org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Terminals tab folder manager.
- */
-@SuppressWarnings({ "restriction" })
-public class TabFolderManager extends PlatformObject implements ISelectionProvider {
- // Reference to the parent terminal consoles view
- private final ITerminalsView parentView;
- // Reference to the selection listener instance
- private final SelectionListener selectionListener;
-
- /**
- * List of selection changed listeners.
- */
- private final List<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
-
- /**
- * Map of tab command input field handler per tab item
- */
- private final Map<CTabItem, TabCommandFieldHandler> commandFieldHandler = new HashMap<CTabItem, TabCommandFieldHandler>();
-
- /**
- * The terminal control selection listener implementation.
- */
- private class TerminalControlSelectionListener implements DisposeListener, MouseListener {
- private final ITerminalViewControl terminal;
- private boolean selectMode;
-
- /**
- * Constructor.
- *
- * @param terminal The terminal control. Must not be <code>null</code>.
- */
- public TerminalControlSelectionListener(ITerminalViewControl terminal) {
- Assert.isNotNull(terminal);
- this.terminal = terminal;
-
- // Register ourself as the required listener
- terminal.getControl().addDisposeListener(this);
- terminal.getControl().addMouseListener(this);
- }
-
- /**
- * Returns the associated terminal view control.
- *
- * @return The terminal view control.
- */
- protected final ITerminalViewControl getTerminal() {
- return terminal;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
- */
- @Override
- public void widgetDisposed(DisposeEvent e) {
- // Widget got disposed, check if it is ours
- // If a tab item gets disposed, we have to dispose the terminal as well
- if (e.getSource().equals(terminal.getControl())) {
- // Remove as listener
- getTerminal().getControl().removeDisposeListener(this);
- getTerminal().getControl().removeMouseListener(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- @Override
- public void mouseDown(MouseEvent e) {
- // Left button down -> select mode starts
- if (e.button == 1) selectMode = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- @Override
- public void mouseUp(MouseEvent e) {
- if (e.button == 1 && selectMode) {
- selectMode = false;
- // Fire a selection changed event with the terminal controls selection
- try {
- Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- fireSelectionChanged(new StructuredSelection(getTerminal().getSelection()));
- }
- });
- }
- catch (Exception ex) {
- // if display is disposed, silently ignore.
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- }
-
- /**
- * Constructor.
- *
- * @param parentView The parent terminals console view. Must not be <code>null</code>.
- */
- public TabFolderManager(ITerminalsView parentView) {
- super();
- Assert.isNotNull(parentView);
- this.parentView = parentView;
-
- // Attach a selection listener to the tab folder
- selectionListener = doCreateTabFolderSelectionListener(this);
- if (getTabFolder() != null) getTabFolder().addSelectionListener(selectionListener);
- }
-
- /**
- * Creates the terminal console tab folder selection listener instance.
- *
- * @param parent The parent terminal console tab folder manager. Must not be <code>null</code>.
- * @return The selection listener instance.
- */
- protected TabFolderSelectionListener doCreateTabFolderSelectionListener(TabFolderManager parent) {
- Assert.isNotNull(parent);
- return new TabFolderSelectionListener(parent);
- }
-
- /**
- * Returns the parent terminal consoles view.
- *
- * @return The terminal consoles view instance.
- */
- protected final ITerminalsView getParentView() {
- return parentView;
- }
-
- /**
- * Returns the tab folder associated with the parent view.
- *
- * @return The tab folder or <code>null</code>.
- */
- protected final CTabFolder getTabFolder() {
- return (CTabFolder)getParentView().getAdapter(CTabFolder.class);
- }
-
- /**
- * Returns the selection changed listeners currently registered.
- *
- * @return The registered selection changed listeners or an empty array.
- */
- protected final ISelectionChangedListener[] getSelectionChangedListeners() {
- return selectionChangedListeners.toArray(new ISelectionChangedListener[selectionChangedListeners.size()]);
- }
-
- /**
- * Dispose the tab folder manager instance.
- */
- public void dispose() {
- // Dispose the selection listener
- if (getTabFolder() != null && !getTabFolder().isDisposed()) getTabFolder().removeSelectionListener(selectionListener);
- // Dispose the tab command field handler
- for (TabCommandFieldHandler handler : commandFieldHandler.values()) {
- handler.dispose();
- }
- commandFieldHandler.clear();
- }
-
- /**
- * Creates a new tab item with the given title and connector.
- *
- * @param title The tab title. Must not be <code>null</code>.
- * @param encoding The terminal encoding or <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- * @param flags The flags controlling how the console is opened or <code>null</code> to use defaults.
- *
- * @return The created tab item or <code>null</code> if failed.
- */
- @SuppressWarnings({ "unused", "unchecked" })
- public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data, Map<String, Boolean> flags) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
-
- // The result tab item
- CTabItem item = null;
-
- // Get the tab folder from the parent viewer
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder != null) {
- // Generate a unique title string for the new tab item (must be called before creating the item itself)
- title = makeUniqueTitle(title, tabFolder);
- // Create the tab item
- item = new CTabItem(tabFolder, SWT.CLOSE);
- // Set the tab item title
- item.setText(title);
- // Set the tab icon
- Image image = getTabItemImage(connector, data);
- if (image != null) item.setImage(image);
-
- // Setup the tab item listeners
- setupTerminalTabListeners(item);
-
- // Create the composite to create the terminal control within
- Composite composite = new Composite(tabFolder, SWT.NONE);
- composite.setLayout(new FillLayout());
- // Associate the composite with the tab item
- item.setControl(composite);
-
- // Refresh the layout
- tabFolder.getParent().layout(true);
-
- // Create the terminal control
- ITerminalViewControl terminal = TerminalViewControlFactory.makeControl(doCreateTerminalTabTerminalListener(this, item), composite, new ITerminalConnector[] { connector }, true);
- if (terminal instanceof ITerminalControl && data instanceof Map<?,?>) {
- Object value = ((Map<String, Object>)data).get(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT);
- boolean noReconnect = value instanceof Boolean ? ((Boolean)value).booleanValue() : false;
- ((ITerminalControl)terminal).setConnectOnEnterIfClosed(!noReconnect);
- }
-
- // Add the "selection" listener to the terminal control
- new TerminalControlSelectionListener(terminal);
- // Configure the terminal encoding
- try { terminal.setEncoding(encoding); } catch (UnsupportedEncodingException e) { /* ignored on purpose */ }
- // Associated the terminal with the tab item
- item.setData(terminal);
- // Associated the custom data node with the tab item (if any)
- if (data != null) item.setData("customData", data); //$NON-NLS-1$
- // Set the property that marks the item has a disconnect button or not if selected
- item.setData(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, flags != null && flags.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON) ? flags.get(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON) : Boolean.FALSE);
-
- // Overwrite the text canvas help id
- String contextHelpId = getParentView().getContextHelpId();
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(terminal.getControl(), contextHelpId);
- }
-
- // Set the context menu
- TabFolderMenuHandler menuHandler = (TabFolderMenuHandler)getParentView().getAdapter(TabFolderMenuHandler.class);
- if (menuHandler != null) {
- Menu menu = (Menu)menuHandler.getAdapter(Menu.class);
- if (menu != null) {
- // One weird occurrence of IllegalArgumentException: Widget has wrong parent.
- // Inspecting the code, this seem extremely unlikely. The terminal is created
- // from a composite parent, the composite parent from the tab folder and the menu
- // from the tab folder. Means, at the end all should have the same menu shell, shouldn't they?
- try {
- terminal.getControl().setMenu(menu);
- } catch (IllegalArgumentException e) {
- // Log exception only if debug mode is set to 1.
- if (UIPlugin.getTraceHandler().isSlotEnabled(1, null)) {
- e.printStackTrace();
- }
- }
- }
- }
-
- // Select the created item within the tab folder
- tabFolder.setSelection(item);
-
- // Set the connector
- terminal.setConnector(connector);
-
- // And connect the terminal
- terminal.connectTerminal();
-
- // Fire selection changed event
- fireSelectionChanged();
- }
-
- // Return the create tab item finally.
- return item;
- }
-
- /**
- * Used for DnD of terminal tab items between terminal views
- * <p>
- * Create a new tab item in the "dropped" terminal view using the
- * information stored in the given item.
- *
- * @param oldItem The old dragged tab item. Must not be <code>null</code>.
- * @return The new dropped tab item.
- */
- @SuppressWarnings("unchecked")
- public CTabItem cloneTabItemAfterDrop(CTabItem oldItem) {
- Assert.isNotNull(oldItem);
-
- ITerminalViewControl terminal = (ITerminalViewControl)oldItem.getData();
- ITerminalConnector connector = terminal.getTerminalConnector();
- Object data = oldItem.getData("customData"); //$NON-NLS-1$
- Map<String, Object> properties = (Map<String, Object>)oldItem.getData("properties"); //$NON-NLS-1$
- String title = oldItem.getText();
-
- // The result tab item
- CTabItem item = null;
-
- // Get the tab folder from the parent viewer
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder != null) {
- // Generate a unique title string for the new tab item (must be called before creating the item itself)
- title = makeUniqueTitle(title, tabFolder);
- // Create the tab item
- item = new CTabItem(tabFolder, SWT.CLOSE);
- // Set the tab item title
- item.setText(title);
- // Set the tab icon
- Image image = getTabItemImage(connector, data);
- if (image != null) item.setImage(image);
-
- // Setup the tab item listeners
- setupTerminalTabListeners(item);
-
- // Create the composite to create the terminal control within
- Composite composite = new Composite(tabFolder, SWT.NONE);
- composite.setLayout(new FillLayout());
- // Associate the composite with the tab item
- item.setControl(composite);
-
- // Refresh the layout
- tabFolder.getParent().layout(true);
-
- // change the "parent".
- //
- // Note: We have to cast to VT100TerminalControl here until setupTerminal is
- // re-exposed to clients via the ITerminalControl.
- Assert.isTrue(terminal instanceof VT100TerminalControl);
- ((VT100TerminalControl)terminal).setupTerminal(composite);
-
- item.setData(terminal);
-
- // Associate the custom data node with the tab item (if any)
- if (data != null) item.setData("customData", data); //$NON-NLS-1$
- // Associate the properties with the tab item (if any)
- if (properties != null) item.setData("properties", properties); //$NON-NLS-1$
-
- // Overwrite the text canvas help id
- String contextHelpId = getParentView().getContextHelpId();
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(terminal.getControl(), contextHelpId);
- }
-
- // Set the context menu
- TabFolderMenuHandler menuHandler = (TabFolderMenuHandler)getParentView().getAdapter(TabFolderMenuHandler.class);
- if (menuHandler != null) {
- Menu menu = (Menu)menuHandler.getAdapter(Menu.class);
- if (menu != null) {
- // One weird occurrence of IllegalArgumentException: Widget has wrong parent.
- // Inspecting the code, this seem extremely unlikely. The terminal is created
- // from a composite parent, the composite parent from the tab folder and the menu
- // from the tab folder. Means, at the end all should have the same menu shell, shouldn't they?
- try {
- terminal.getControl().setMenu(menu);
- } catch (IllegalArgumentException e) {
- // Log exception only if debug mode is set to 1.
- if (UIPlugin.getTraceHandler().isSlotEnabled(1, null)) {
- e.printStackTrace();
- }
- }
- }
- }
-
- // Select the created item within the tab folder
- tabFolder.setSelection(item);
-
- // Set the connector
- terminal.setConnector(connector);
-
- // needed to get the focus and cursor
- Assert.isTrue(terminal instanceof ITerminalControl);
- ((ITerminalControl)terminal).setState(TerminalState.CONNECTED);
-
- // Fire selection changed event
- fireSelectionChanged();
- }
-
- // Return the create tab item finally.
- return item;
- }
-
-
- /**
- * Generate a unique title string based on the given proposal.
- *
- * @param proposal The proposal. Must not be <code>null</code>.
- * @return The unique title string.
- */
- protected String makeUniqueTitle(String proposal, CTabFolder tabFolder) {
- Assert.isNotNull(proposal);
- Assert.isNotNull(tabFolder);
-
- String title = proposal;
- int index = 0;
-
- // Loop all existing tab items and check the titles. We have to remember
- // all found titles as modifying the proposal might in turn conflict again
- // with the title of a tab already checked.
- List<String> titles = new ArrayList<String>();
- for (CTabItem item : tabFolder.getItems()) {
- // Get the tab item title
- titles.add(item.getText());
- }
- // Make the proposal unique be appending (<n>) against all known titles.
- while (titles.contains(title)) title = proposal + " (" + ++index + ")"; //$NON-NLS-1$ //$NON-NLS-2$
-
- return title;
- }
-
- /**
- * Setup the terminal console tab item listeners.
- *
- * @param item The tab item. Must not be <code>null</code>.
- */
- protected void setupTerminalTabListeners(final CTabItem item) {
- Assert.isNotNull(item);
-
- // Create and associate the disposal listener
- DisposeListener disposeListener = doCreateTerminalTabDisposeListener(this);
-
- // store the listener to make access easier e.g. needed in DnD
- item.setData("disposeListener", disposeListener); //$NON-NLS-1$
- item.addDisposeListener(disposeListener);
- }
-
- /**
- * Creates a new terminal console tab terminal listener instance.
- *
- * @param tabFolderManager The tab folder manager. Must not be <code>null</code>.
- * @param item The tab item. Must not be <code>null</code>.
- *
- * @return The terminal listener instance.
- */
- protected ITerminalListener doCreateTerminalTabTerminalListener(TabFolderManager tabFolderManager, CTabItem item) {
- Assert.isNotNull(item);
- return new TabTerminalListener(tabFolderManager, item);
- }
-
- /**
- * Creates a new terminal console tab dispose listener instance.
- *
- * @param parent The parent terminal console tab folder manager. Must not be <code>null</code>.
- * @return The dispose listener instance.
- */
- protected DisposeListener doCreateTerminalTabDisposeListener(TabFolderManager parent) {
- Assert.isNotNull(parent);
- return new TabDisposeListener(parent);
- }
-
- /**
- * Returns the tab item image.
- *
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The tab item image or <code>null</code>.
- */
- protected Image getTabItemImage(ITerminalConnector connector, Object data) {
- Assert.isNotNull(connector);
- return UIPlugin.getImage(ImageConsts.VIEW_Terminals);
- }
-
- /**
- * Lookup a tab item with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method will handle unified tab item titles itself.
- *
- * @param title The tab item title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The corresponding tab item or <code>null</code>.
- */
- public CTabItem findTabItem(String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
-
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return null;
-
- // Loop all existing tab items and try to find a matching title
- for (CTabItem item : tabFolder.getItems()) {
- // Disposed items cannot be matched
- if (item.isDisposed()) continue;
- // Get the title from the current tab item
- String itemTitle = item.getText();
- // The terminal console state might be signaled to the user via the
- // terminal console tab title. Filter out any prefix "<.*>\s*".
- itemTitle = itemTitle.replaceFirst("^<.*>\\s*", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (itemTitle.startsWith(title)) {
- // The title string matches -> double check with the terminal connector
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- ITerminalConnector connector2 = terminal.getTerminalConnector();
- // If the connector id and name matches -> check on the settings
- if (connector.getId().equals(connector2.getId()) && connector.getName().equals(connector2.getName())) {
- if (!connector.isInitialized()) {
- // an uninitialized connector does not yield a sensible summary
- return item;
- }
- String summary = connector.getSettingsSummary();
- String summary2 = connector2.getSettingsSummary();
- // If we have matching settings -> we've found the matching item
- if (summary.equals(summary2)) return item;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Make the given tab item the active tab and bring the tab to the top.
- *
- * @param item The tab item. Must not be <code>null</code>.
- */
- public void bringToTop(CTabItem item) {
- Assert.isNotNull(item);
-
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return;
-
- // Set the given tab item as selection to the tab folder
- tabFolder.setSelection(item);
- // Fire selection changed event
- fireSelectionChanged();
- }
-
- /**
- * Returns the currently active tab.
- *
- * @return The active tab item or <code>null</code> if none.
- */
- public CTabItem getActiveTabItem() {
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return null;
-
- return tabFolder.getSelection();
- }
-
- /**
- * Remove all terminated tab items.
- */
- public void removeTerminatedItems() {
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return;
-
- // Loop the items and check for terminated status
- for (CTabItem item: tabFolder.getItems()) {
- // Disposed items cannot be matched
- if (item.isDisposed()) continue;
- // Check if the item is terminated
- if (isTerminatedTabItem(item)) {
- // item is terminated -> dispose
- item.dispose();
- }
- }
- }
-
- /**
- * Checks if the given tab item represents a terminated console. Subclasses may
- * overwrite this method to extend the definition of terminated.
- *
- * @param item The tab item or <code>null</code>.
- * @return <code>True</code> if the tab item represents a terminated console, <code>false</code> otherwise.
- */
- protected boolean isTerminatedTabItem(CTabItem item) {
- // Null items or disposed items cannot be matched
- if (item == null || item.isDisposed()) return false;
-
- // First, match the item title. If it contains "<terminated>", the item can be removed
- String itemTitle = item.getText();
- if (itemTitle != null && itemTitle.contains("<terminated>")) { //$NON-NLS-1$
- return true;
- }
- // Second, check if the associated terminal control is closed
- // The title string matches -> double check with the terminal connector
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- if (terminal != null && terminal.getState() == TerminalState.CLOSED) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns the command input field handler for the given tab item.
- *
- * @param item The tab item or <code>null</code>.
- * @return The command input field handler or <code>null</code>.
- */
- public final TabCommandFieldHandler getTabCommandFieldHandler(CTabItem item) {
- // Null items or disposed items cannot be matched
- if (item == null || item.isDisposed()) return null;
-
- TabCommandFieldHandler handler = commandFieldHandler.get(item);
- if (handler == null) {
- handler = new TabCommandFieldHandler(this, item);
- commandFieldHandler.put(item, handler);
- }
- return handler;
- }
-
- /**
- * Dispose the command input field handler for the given tab item.
- *
- * @param item The tab item or <code>null</code>.
- */
- protected void disposeTabCommandFieldHandler(CTabItem item) {
- // Null items or disposed items cannot be matched
- if (item == null || item.isDisposed()) return;
-
- TabCommandFieldHandler handler = commandFieldHandler.remove(item);
- if (handler != null) handler.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- @Override
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- if (listener != null && !selectionChangedListeners.contains(listener)) selectionChangedListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- @Override
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- if (listener != null) selectionChangedListeners.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- @Override
- public ISelection getSelection() {
- CTabItem activeTabItem = getActiveTabItem();
- return activeTabItem != null ? new StructuredSelection(activeTabItem) : new StructuredSelection();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void setSelection(ISelection selection) {
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- // The first selection element which is a CTabItem will become the active item
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (candidate instanceof CTabItem) { bringToTop((CTabItem)candidate); return; }
- }
- }
- // fire a changed event in any case
- fireSelectionChanged(selection);
- }
-
- /**
- * Fire the selection changed event to the registered listeners.
- */
- protected void fireSelectionChanged() {
- updateStatusLine();
- fireSelectionChanged(getSelection());
- }
-
- /**
- * Fire the selection changed event to the registered listeners.
- */
- protected final void fireSelectionChanged(ISelection selection) {
- // Create the selection changed event
- SelectionChangedEvent event = new SelectionChangedEvent(TabFolderManager.this, selection);
-
- // First, invoke the registered listeners and let them do their job
- for (ISelectionChangedListener listener : selectionChangedListeners) {
- listener.selectionChanged(event);
- }
- }
-
- /**
- * Update the parent view status line.
- */
- public final void updateStatusLine() {
- String message = null;
- IStatusLineManager manager = parentView.getViewSite().getActionBars().getStatusLineManager();
-
- CTabItem item = getActiveTabItem();
- if (item != null && !item.isDisposed()) {
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- if (terminal != null && !terminal.isDisposed()) {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append(state2msg(item, terminal.getState()));
- buffer.append(" - "); //$NON-NLS-1$
-
- String encoding = terminal.getEncoding();
- if (encoding == null || "ISO-8859-1".equals(encoding)) { //$NON-NLS-1$
- encoding = "Default (ISO-8859-1)"; //$NON-NLS-1$
- }
- buffer.append(NLS.bind(Messages.TabFolderManager_encoding, encoding));
-
- message = buffer.toString();
- }
- }
-
- manager.setMessage(message);
- }
-
- /**
- * Returns the string representation of the given terminal state.
- *
- * @param item The tab folder item. Must not be <code>null</code>.
- * @param state The terminal state. Must not be <code>null</code>.
- *
- * @return The string representation.
- */
- @SuppressWarnings("unchecked")
- protected String state2msg(CTabItem item, TerminalState state) {
- Assert.isNotNull(item);
- Assert.isNotNull(state);
-
- // Determine the terminal properties of the tab folder
- Map<String, Object> properties = (Map<String, Object>)item.getData("properties"); //$NON-NLS-1$
-
- // Get he current terminal state as string
- String stateStr = state.toString();
- // Lookup a matching text representation of the state
- String key = "TabFolderManager_state_" + stateStr.replaceAll("\\.", " ").trim().toLowerCase(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String stateMsg = null;
- if (properties != null) stateMsg = properties.get(key) instanceof String ? (String) properties.get(key) : null;
- if (stateMsg == null) stateMsg = Messages.getString(key);
- if (stateMsg == null) stateMsg = stateStr;
-
- return stateMsg;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java
deleted file mode 100644
index 3a3e745c0..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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.ui.terminals.tabs;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener2;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.actions.SelectEncodingAction;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-/**
- * Terminals tab folder menu handler.
- */
-@SuppressWarnings("restriction")
-public class TabFolderMenuHandler extends PlatformObject {
- // Reference to the parent terminals console view
- private final ITerminalsView parentView;
- // Reference to the tab folder context menu manager
- private MenuManager contextMenuManager;
- // Reference to the tab folder context menu
- private Menu contextMenu;
- // The list of actions available within the context menu
- private final List<AbstractTerminalAction> contextMenuActions = new ArrayList<AbstractTerminalAction>();
-
- // The list of invalid context menu contributions "startsWith" expressions
- /* default */ static final String[] INVALID_CONTRIBUTIONS_STARTS_WITH = {
- "org.eclipse.cdt", "org.eclipse.ui.edit" //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- /**
- * Default menu listener implementation.
- */
- protected class MenuListener implements IMenuListener2 {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuListener2#menuAboutToHide(org.eclipse.jface.action.IMenuManager)
- */
- @Override
- public void menuAboutToHide(IMenuManager manager) {
- // CQ:WIND00192293 and CQ:WIND194204 - don't update actions on menuAboutToHide
- // See also http://bugs.eclipse.org/296212
- // updateMenuItems(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- removeInvalidContributions(manager);
- updateMenuItems(true);
- }
-
- /**
- * Bug 392249: Remove contributions that appear in the context in Eclipse 4.x which are
- * not visible in Eclipse 3.8.x. Re-evaluate from time to time!
- *
- * @param manager The menu manager or <code>null</code>
- */
- private void removeInvalidContributions(IMenuManager manager) {
- if (manager == null) return;
-
- IContributionItem[] items = manager.getItems();
- for (IContributionItem item : items) {
- String id = item.getId();
- if (id != null) {
- for (String prefix : INVALID_CONTRIBUTIONS_STARTS_WITH) {
- if (id.startsWith(prefix)) {
- manager.remove(item);
- break;
- }
- }
- }
- }
- }
- }
-
- /**
- * Constructor.
- *
- * @param parentView The parent terminals console view. Must not be <code>null</code>.
- */
- public TabFolderMenuHandler(ITerminalsView parentView) {
- super();
- Assert.isNotNull(parentView);
- this.parentView = parentView;
- }
-
- /**
- * Returns the parent terminals console view.
- *
- * @return The parent terminals console view instance.
- */
- protected final ITerminalsView getParentView() {
- return parentView;
- }
-
- /**
- * Returns the tab folder associated with the parent view.
- *
- * @return The tab folder or <code>null</code>.
- */
- protected final CTabFolder getTabFolder() {
- return (CTabFolder)getParentView().getAdapter(CTabFolder.class);
- }
-
- /**
- * Dispose the tab folder menu handler instance.
- */
- public void dispose() {
- // Dispose the context menu
- if (contextMenu != null) { contextMenu.dispose(); contextMenu = null; }
- // Dispose the context menu manager
- if (contextMenuManager != null) { contextMenuManager.dispose(); contextMenuManager = null; }
- // Clear all actions
- contextMenuActions.clear();
- }
-
- /**
- * Setup the context menu for the tab folder. The method will return
- * immediately if the menu handler had been initialized before.
- *
- * @param tabFolder The tab folder control. Must not be <code>null</code>.
- */
- public void initialize() {
- // Return immediately if the menu manager and menu got initialized already
- if (contextMenuManager != null && contextMenu != null) {
- return;
- }
-
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) {
- return;
- }
-
- // Create the menu manager if not done before
- contextMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
-
- // Bug 392249: Register our menu listener after registering the context menu
- // for contributions. That way we can use our menu listener to get
- // rid of unwanted/misguided contributions. At least until this is
- // fixed in the Eclipse 4.x platform.
-
- // Create the context menu
- contextMenu = contextMenuManager.createContextMenu(tabFolder);
-
- // Create the context menu action instances
- doCreateContextMenuActions();
-
- // Fill the context menu
- doFillContextMenu(contextMenuManager);
-
- // Register to the view site to open the menu for contributions
- getParentView().getSite().registerContextMenu(contextMenuManager, getParentView().getSite().getSelectionProvider());
-
- // Create and associated the menu listener
- contextMenuManager.addMenuListener(new MenuListener());
- }
-
- /**
- * Adds the given action to the context menu actions list.
- *
- * @param action The action instance. Must not be <code>null</code>.
- */
- protected final void add(AbstractTerminalAction action) {
- Assert.isNotNull(action);
- contextMenuActions.add(action);
- }
-
- /**
- * Create the context menu actions.
- */
- protected void doCreateContextMenuActions() {
- // Create and add the copy action
- add(new TerminalActionCopy() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the paste action
- add(new TerminalActionPaste() {
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- // Determine if pasting to the active tab require backslash translation
- boolean needsTranslation = false;
-
- TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- Map<String, Object> properties = (Map<String, Object>)activeTabItem.getData("properties"); //$NON-NLS-1$
- if (properties != null && properties.containsKey(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE)) {
- Object value = properties.get(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE);
- needsTranslation = value instanceof Boolean ? ((Boolean)value).booleanValue() : false;
- }
- }
- }
-
- if (needsTranslation) {
- ITerminalViewControl target = getTarget();
- if (target != null && target.getClipboard() != null && !target.getClipboard().isDisposed()) {
- String text = (String) target.getClipboard().getContents(TextTransfer.getInstance());
- if (text != null) {
- text = text.replace('\\', '/');
-
- Object[] data = new Object[] { text };
- Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
- target.getClipboard().setContents(data, types, DND.CLIPBOARD);
- }
- }
- }
-
- super.run();
- }
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the clear all action
- add(new TerminalActionClearAll() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- super.updateAction(aboutToShow);
- if (getTarget() != null && getTarget().getState() != TerminalState.CONNECTED) {
- setEnabled(false);
- }
- }
- });
-
- // Create and add the select all action
- add(new TerminalActionSelectAll() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the select encoding action
- add (new SelectEncodingAction((TabFolderManager)getParentView().getAdapter(TabFolderManager.class)) {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
- }
-
- /**
- * Returns the currently active terminal control.
- *
- * @return The currently active terminal control or <code>null</code>.
- */
- protected ITerminalViewControl getActiveTerminalViewControl() {
- ITerminalViewControl terminal = null;
-
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- terminal = (ITerminalViewControl)activeTabItem.getData();
- }
- }
-
- return terminal;
- }
-
- /**
- * Fill in the context menu content within the given manager.
- *
- * @param manager The menu manager. Must not be <code>null</code>.
- */
- protected void doFillContextMenu(MenuManager manager) {
- Assert.isNotNull(manager);
-
- // Loop all actions and add them to the menu manager
- for (AbstractTerminalAction action : contextMenuActions) {
- manager.add(action);
- // Add a separator after the paste action
- if (action instanceof TerminalActionPaste) {
- manager.add(new Separator());
- }
- // Add a separator after the select all action
- if (action instanceof TerminalActionSelectAll) {
- manager.add(new Separator());
- }
- }
-
- // Menu contributions will end up here
- manager.add(new Separator());
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /**
- * Update the context menu items on showing or hiding the context menu.
- *
- * @param aboutToShow <code>True</code> if the menu is about to show, <code>false</code> otherwise.
- */
- protected void updateMenuItems(boolean aboutToShow) {
- // Loop all actions and update the status
- for (AbstractTerminalAction action : contextMenuActions) {
- action.updateAction(aboutToShow);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (MenuManager.class.isAssignableFrom(adapter)) {
- return contextMenuManager;
- } else if (Menu.class.isAssignableFrom(adapter)) {
- return contextMenu;
- }
-
- // Try the parent view
- Object adapted = getParentView().getAdapter(adapter);
- if (adapted != null) {
- return adapted;
- }
-
- return super.getAdapter(adapter);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java
deleted file mode 100644
index 37e4110cb..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 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.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-
-/**
- * Terminals tab folder default selection listener implementation.
- */
-public class TabFolderSelectionListener implements SelectionListener {
- private final TabFolderManager parentTabFolderManager;
-
- /**
- * Constructor.
- *
- * @param parentTabFolderManager The parent tab folder manager. Must not be <code>null</code>
- */
- public TabFolderSelectionListener(TabFolderManager parentTabFolderManager) {
- Assert.isNotNull(parentTabFolderManager);
- this.parentTabFolderManager = parentTabFolderManager;
- }
-
- /**
- * Returns the parent terminal console tab folder manager instance.
- *
- * @return The parent terminal console tab folder manager instance.
- */
- protected final TabFolderManager getParentTabFolderManager() {
- return parentTabFolderManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- parentTabFolderManager.fireSelectionChanged();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
deleted file mode 100644
index 07d1a7868..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.tabs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.ui.terminals.actions.AbstractAction;
-import org.eclipse.tcf.te.ui.terminals.actions.PinTerminalAction;
-import org.eclipse.tcf.te.ui.terminals.actions.TabScrollLockAction;
-import org.eclipse.tcf.te.ui.terminals.actions.ToggleCommandFieldAction;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-
-/**
- * Terminals tab folder toolbar handler.
- */
-@SuppressWarnings("restriction")
-public class TabFolderToolbarHandler extends PlatformObject {
- // Reference to the parent terminals console view
- private final ITerminalsView parentView;
- // Reference to the toolbar manager
- private IToolBarManager toolbarManager;
- // Reference to the selection listener
- private ToolbarSelectionChangedListener selectionChangedListener;
- // The list of actions available within the toolbar
- private final List<AbstractTerminalAction> toolbarActions = new ArrayList<AbstractTerminalAction>();
-
- /**
- * Default selection listener implementation.
- */
- protected class ToolbarSelectionChangedListener implements ISelectionChangedListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- boolean enable = event != null;
-
- // The VlmConsoleTabFolderManager is listening to the selection changes of the
- // TabFolder and fires selection changed events.
- if (enable && event.getSource() instanceof TabFolderManager) {
- enable = event.getSelection() instanceof StructuredSelection
- && !event.getSelection().isEmpty()
- && (((StructuredSelection)event.getSelection()).getFirstElement() instanceof CTabItem
- || ((StructuredSelection)event.getSelection()).getFirstElement() instanceof String);
- }
-
- updateToolbarItems(enable);
- }
- }
-
- /**
- * Constructor.
- *
- * @param parentView The parent terminals console view. Must not be <code>null</code>.
- */
- public TabFolderToolbarHandler(ITerminalsView parentView) {
- super();
- Assert.isNotNull(parentView);
- this.parentView = parentView;
- }
-
- /**
- * Returns the parent terminals console view.
- *
- * @return The terminals console view instance.
- */
- protected final ITerminalsView getParentView() {
- return parentView;
- }
-
- /**
- * Returns the tab folder associated with the parent view.
- *
- * @return The tab folder or <code>null</code>.
- */
- protected final CTabFolder getTabFolder() {
- return (CTabFolder)getParentView().getAdapter(CTabFolder.class);
- }
-
- /**
- * Returns the currently active terminal control.
- *
- * @return The currently active terminal control or <code>null</code>.
- */
- public ITerminalViewControl getActiveTerminalViewControl() {
- ITerminalViewControl terminal = null;
-
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null && !activeTabItem.isDisposed()) {
- terminal = (ITerminalViewControl)activeTabItem.getData();
- }
- }
-
- return terminal;
- }
-
- /**
- * Dispose the tab folder menu handler instance.
- */
- public void dispose() {
- // Dispose the selection changed listener
- if (selectionChangedListener != null) {
- getParentView().getViewSite().getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
- selectionChangedListener = null;
- }
-
- // Clear all actions
- toolbarActions.clear();
- }
-
- /**
- * Setup the context menu for the tab folder. The method will return
- * immediately if the toolbar handler had been initialized before.
- *
- * @param tabFolder The tab folder control. Must not be <code>null</code>.
- */
- public void initialize() {
- // Return immediately if the toolbar manager got initialized already
- if (toolbarManager != null) {
- return;
- }
-
- // Register ourself as selection listener to the tab folder
- selectionChangedListener = doCreateSelectionChangedListener();
- Assert.isNotNull(selectionChangedListener);
- getParentView().getViewSite().getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
-
- // Get the parent view action bars
- IActionBars bars = getParentView().getViewSite().getActionBars();
-
- // From the action bars, get the toolbar manager
- toolbarManager = bars.getToolBarManager();
-
- // Create the toolbar action instances
- doCreateToolbarActions();
-
- // Fill the toolbar
- doFillToolbar(toolbarManager);
-
- // Update actions
- updateToolbarItems(false);
- }
-
- /**
- * Creates a new selection changed listener instance.
- *
- * @return The new selection changed listener instance.
- */
- protected ToolbarSelectionChangedListener doCreateSelectionChangedListener() {
- return new ToolbarSelectionChangedListener();
- }
-
- /**
- * Adds the given action to the toolbar actions list.
- *
- * @param action The action instance. Must not be <code>null</code>.
- */
- protected final void add(AbstractTerminalAction action) {
- Assert.isNotNull(action);
- toolbarActions.add(action);
- }
-
- /**
- * Removes the given action from the toolbar actions list.
- *
- * @param action The action instance. Must not be <code>null</code>.
- */
- protected final void remove(AbstractTerminalAction action) {
- Assert.isNotNull(action);
- toolbarActions.remove(action);
- }
-
- /**
- * Create the toolbar actions.
- */
- protected void doCreateToolbarActions() {
- // Create and add the paste action
- add(new TerminalActionPaste() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the copy action
- add(new TerminalActionCopy() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the scroll lock action
- add (new TabScrollLockAction() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the clear all action
- add(new TerminalActionClearAll() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- super.updateAction(aboutToShow);
- if (getTarget() != null && getTarget().getState() != TerminalState.CONNECTED) {
- setEnabled(false);
- }
- }
- });
-
- // Create and add the toggle command input field action
- add (new ToggleCommandFieldAction(getParentView()) {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the pin view action
- add (new PinTerminalAction(getParentView()) {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
- }
-
- /**
- * Fill in the context menu content within the given manager.
- *
- * @param manager The menu manager. Must not be <code>null</code>.
- */
- protected void doFillToolbar(IToolBarManager manager) {
- Assert.isNotNull(manager);
-
- // Note: For the toolbar, the actions are added from left to right!
- // So we start with the additions marker here which is the most
- // left contribution item.
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(new Separator("anchor")); //$NON-NLS-1$
-
- // we want that at the end
- PinTerminalAction pinAction=null;
-
- // Loop all actions and add them to the menu manager
- for (AbstractTerminalAction action : toolbarActions) {
- // Add a separator before the clear all action or if the action is a separator
- if (action instanceof TabScrollLockAction
- || (action instanceof AbstractAction && ((AbstractAction)action).isSeparator())) {
- manager.insertAfter("anchor", new Separator()); //$NON-NLS-1$
- }
- // skip pin action for now
- if(action instanceof PinTerminalAction){
- pinAction=(PinTerminalAction)action;
- continue;
- }
- // Add the action itself
- manager.insertAfter("anchor", action); //$NON-NLS-1$
- }
- // now add pin at the end
- if(pinAction!=null){
- manager.add(pinAction);
- }
- }
-
- /**
- * Update the toolbar items.
- *
- * @param enabled <code>True</code> if the items shall be enabled, <code>false</code> otherwise.
- */
- protected void updateToolbarItems(boolean enabled) {
- // Determine the currently active terminal control
- ITerminalViewControl control = getActiveTerminalViewControl();
- // Loop all actions and update the status
- for (AbstractTerminalAction action : toolbarActions) {
- // If the terminal control is not available, the updateAction
- // method of certain actions enable the action (bugzilla #260372).
- // Workaround by forcing the action to get disabled with setEnabled.
- if (control == null && !(action instanceof PinTerminalAction)) {
- action.setEnabled(false);
- }
- else {
- action.updateAction(enabled);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (IToolBarManager.class.isAssignableFrom(adapter)) {
- return toolbarManager;
- }
-
- // Try the toolbar actions
- for (AbstractTerminalAction action : toolbarActions) {
- if (adapter.isAssignableFrom(action.getClass())) {
- return action;
- }
- }
-
- // Try the parent view
- Object adapted = getParentView().getAdapter(adapter);
- if (adapted != null) {
- return adapted;
- }
-
- return super.getAdapter(adapter);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java
deleted file mode 100644
index efd1b2f87..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 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.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.internal.terminal.control.ITerminalListener;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-
-/**
- * Terminals tab default terminal listener implementation.
- */
-@SuppressWarnings("restriction")
-public class TabTerminalListener implements ITerminalListener {
- /* default */ final TabFolderManager tabFolderManager;
- private final CTabItem tabItem;
- private final String tabItemTitle;
-
- /**
- * Constructor.
- *
- * @param tabFolderManager The parent tab folder manager. Must not be <code>null</code>.
- * @param tabItem The parent tab item. Must not be <code>null</code>.
- */
- public TabTerminalListener(TabFolderManager tabFolderManager, CTabItem tabItem) {
- super();
- Assert.isNotNull(tabFolderManager);
- this.tabFolderManager = tabFolderManager;
- Assert.isNotNull(tabItem);
- this.tabItem = tabItem;
-
- // Remember the original tab item title
- tabItemTitle = tabItem.getText();
- }
-
- /**
- * Returns the associated parent tab item.
- *
- * @return The parent tab item.
- */
- protected final CTabItem getTabItem() {
- return tabItem;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.ITerminalListener#setState(org.eclipse.tcf.internal.terminal.provisional.api.TerminalState)
- */
- @Override
- public void setState(final TerminalState state) {
- // The tab item must have been not yet disposed
- final CTabItem item = getTabItem();
- if (item == null || item.isDisposed()) return;
-
- // Run asynchronously in the display thread
- item.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- // Update the tab item title
- String newTitle = getTerminalConsoleTabTitle(state);
- if (newTitle != null) item.setText(newTitle);
-
- // Turn off the command field (if necessary)
- TabCommandFieldHandler handler = tabFolderManager.getTabCommandFieldHandler(item);
- if (TerminalState.CLOSED.equals(state) && handler != null && handler.hasCommandInputField()) {
- handler.setCommandInputField(false);
- // Trigger a selection changed event to update the action enablements
- // and the status line
- ISelectionProvider provider = tabFolderManager.getParentView().getViewSite().getSelectionProvider();
- Assert.isNotNull(provider);
- provider.setSelection(provider.getSelection());
- } else {
- // Update the status line
- tabFolderManager.updateStatusLine();
- }
- }
- });
- }
-
- /**
- * Returns the title to set to the terminal console tab for the given state.
- * <p>
- * <b>Note:</b> This method is called from {@link #setState(TerminalState)} and
- * is expected to by called within the UI thread.
- *
- * @param state The terminal state. Must not be <code>null</code>.
- * @return The terminal console tab title to set or <code>null</code> to leave the title unchanged.
- */
- protected String getTerminalConsoleTabTitle(TerminalState state) {
- Assert.isNotNull(state);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // The tab item must have been not yet disposed
- CTabItem item = getTabItem();
- if (item == null || item.isDisposed()) return null;
-
- // Get the current tab title
- String oldTitle = item.getText();
-
- // Construct the new title
- String newTitle = null;
-
- if (TerminalState.CLOSED.equals(state)) {
- newTitle = NLS.bind(Messages.TabTerminalListener_consoleClosed, tabItemTitle, tabFolderManager.state2msg(item, state));
- }
- else if (TerminalState.CONNECTING.equals(state)) {
- newTitle = NLS.bind(Messages.TabTerminalListener_consoleConnecting, tabItemTitle, tabFolderManager.state2msg(item, state));
- }
- else if (TerminalState.CONNECTED.equals(state)) {
- newTitle = tabItemTitle;
- }
-
- return newTitle != null && !newTitle.equals(oldTitle) ? newTitle : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.internal.terminal.control.ITerminalListener#setTerminalTitle(java.lang.String)
- */
- @Override
- public void setTerminalTitle(String title) {
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
deleted file mode 100644
index 4120959fd..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.terminals.view;
-
-import java.util.Iterator;
-import java.util.UUID;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderMenuHandler;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.part.IShowInTarget;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.part.ViewPart;
-import org.osgi.framework.Bundle;
-
-/**
- * Terminals view.
- */
-public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTarget {
-
- // Reference to the main page book control
- private PageBook pageBookControl;
- // Reference to the tab folder maintaining the consoles
- /* default */ CTabFolder tabFolderControl;
- // Reference to the tab folder manager
- /* default */ TabFolderManager tabFolderManager;
- // Reference to the tab folder menu handler
- private TabFolderMenuHandler tabFolderMenuHandler;
- // Reference to the tab folder toolbar handler
- private TabFolderToolbarHandler tabFolderToolbarHandler;
- // Reference to the empty page control (to be show if no console is open)
- private Control emptyPageControl;
- // Whether this terminal is pinned.
- private boolean pinned = false;
- // The view's memento handler
- private final TerminalsViewMementoHandler mementoHandler = new TerminalsViewMementoHandler();
-
- /**
- * "dummy" transfer just to store the information needed for the DnD
- *
- */
- private static class TerminalTransfer extends ByteArrayTransfer {
- // The static terminal transfer type name. Unique per terminals view instance.
- private static final String TYPE_NAME = "terminal-transfer-format:" + UUID.randomUUID().toString(); //$NON-NLS-1$
- // Register the type name and remember the associated unique type id.
- private static final int TYPEID = registerType(TYPE_NAME);
-
- private CTabItem draggedFolderItem;
- private TabFolderManager draggedTabFolderManager;
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static TerminalTransfer instance = new TerminalTransfer();
- }
-
- /**
- * Constructor.
- */
- TerminalTransfer() {
- }
-
- /**
- * Returns the singleton terminal transfer instance.
- * @return
- */
- public static TerminalTransfer getInstance() {
- return LazyInstanceHolder.instance;
- }
-
- /**
- * Sets the dragged folder item.
- *
- * @param tabFolderItem The dragged folder item or <code>null</code>.
- */
- public void setDraggedFolderItem(CTabItem tabFolderItem) {
- draggedFolderItem = tabFolderItem;
- }
-
- /**
- * Returns the dragged folder item.
- *
- * @return The dragged folder item or <code>null</code>.
- */
- public CTabItem getDraggedFolderItem() {
- return draggedFolderItem;
- }
-
- /**
- * Sets the tab folder manager the associated folder item is dragged from.
- *
- * @param tabFolderManager The tab folder manager or <code>null</code>.
- */
- public void setTabFolderManager(TabFolderManager tabFolderManager) {
- draggedTabFolderManager = tabFolderManager;
- }
-
- /**
- * Returns the tab folder manager the associated folder item is dragged from.
- *
- * @return The tab folder manager or <code>null</code>.
- */
- public TabFolderManager getTabFolderManager() {
- return draggedTabFolderManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.Transfer#getTypeIds()
- */
- @Override
- protected int[] getTypeIds() {
- return new int[] { TYPEID };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.Transfer#getTypeNames()
- */
- @Override
- protected String[] getTypeNames() {
- return new String[] { TYPE_NAME };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.ByteArrayTransfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)
- */
- @Override
- public void javaToNative(Object data, TransferData transferData) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(org.eclipse.swt.dnd.TransferData)
- */
- @Override
- public Object nativeToJava(TransferData transferData) {
- return null;
- }
- }
-
- /**
- * Constructor.
- */
- public TerminalsView() {
- super();
- }
-
- /**
- * Initialize the drag support.
- */
- private void addDragSupport() {
- // The event listener is registered as filter. It will receive events from all widgets.
- PlatformUI.getWorkbench().getDisplay().addFilter(SWT.DragDetect, new Listener() {
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
- */
- @Override
- public void handleEvent(Event event) {
- // Only handle events where a CTabFolder is the source
- if (!(event.widget instanceof CTabFolder)) return;
- // TabFolderManager must be created
- if (tabFolderManager == null) return;
-
- // only for own tab folders
- if (event.widget != tabFolderControl) return;
-
- // Skip drag if DnD is still ongoing (bug 443787)
- if (tabFolderControl.getData(DND.DRAG_SOURCE_KEY) != null) return;
-
- final CTabFolder draggedFolder = (CTabFolder) event.widget;
-
- int operations = DND.DROP_MOVE | DND.DROP_DEFAULT;
- final DragSource dragSource = new DragSource(draggedFolder, operations);
-
- // Initialize the terminal transfer type data
- TerminalTransfer.getInstance().setDraggedFolderItem(tabFolderManager.getActiveTabItem());
- TerminalTransfer.getInstance().setTabFolderManager(tabFolderManager);
-
- Transfer[] transferTypes = new Transfer[] { TerminalTransfer.getInstance() };
- dragSource.setTransfer(transferTypes);
-
- // Add a drag source listener to cleanup after the drag operation finished
- dragSource.addDragListener(new DragSourceListener() {
- @Override
- public void dragStart(DragSourceEvent event) {
- }
-
- @Override
- public void dragSetData(DragSourceEvent event) {
- }
-
- @Override
- public void dragFinished(DragSourceEvent event) {
- // dispose this drag-source-listener by disposing its drag-source
- dragSource.dispose();
-
- // Inhibit the action of CTabFolder's default DragDetect-listeners,
- // fire a mouse-click event on the widget that was dragged.
- draggedFolder.notifyListeners(SWT.MouseUp, null);
- }
- });
- }
- });
- }
-
- /**
- * Initialize the drop support on the terminals page book control.
- */
- private void addDropSupport() {
- int operations = DND.DROP_MOVE | DND.DROP_DEFAULT;
- final DropTarget target = new DropTarget(pageBookControl, operations);
-
- Transfer[] transferTypes = new Transfer[] { TerminalTransfer.getInstance() };
- target.setTransfer(transferTypes);
-
- target.addDropListener(new DropTargetListener() {
- @Override
- public void dragEnter(DropTargetEvent event) {
- // only if the drop target is different then the drag source
- if (TerminalTransfer.getInstance().getTabFolderManager() == tabFolderManager) {
- event.detail = DND.DROP_NONE;
- }
- else {
- event.detail = DND.DROP_MOVE;
- }
- }
-
- @Override
- public void dragOver(DropTargetEvent event) {
- }
-
- @Override
- public void dragOperationChanged(DropTargetEvent event) {
- }
-
- @Override
- public void dragLeave(DropTargetEvent event) {
- }
-
- @Override
- public void dropAccept(DropTargetEvent event) {
- }
-
- @Override
- public void drop(DropTargetEvent event) {
- if (TerminalTransfer.getInstance().getDraggedFolderItem() != null && tabFolderManager != null) {
- CTabItem draggedItem = TerminalTransfer.getInstance().getDraggedFolderItem();
-
- CTabItem item = tabFolderManager.cloneTabItemAfterDrop(draggedItem);
- tabFolderManager.bringToTop(item);
- switchToTabFolderControl();
-
- // need to remove the dispose listener first
- DisposeListener disposeListener = (DisposeListener) draggedItem.getData("disposeListener"); //$NON-NLS-1$
- draggedItem.removeDisposeListener(disposeListener);
- draggedItem.dispose();
-
- // make sure the "new" terminals view has the focus after dragging a terminal
- setFocus();
- }
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- */
- @Override
- public void dispose() {
- // Dispose the tab folder manager
- if (tabFolderManager != null) {
- tabFolderManager.dispose();
- tabFolderManager = null;
- }
- // Dispose the tab folder menu handler
- if (tabFolderMenuHandler != null) {
- tabFolderMenuHandler.dispose();
- tabFolderMenuHandler = null;
- }
- // Dispose the tab folder toolbar handler
- if (tabFolderToolbarHandler != null) {
- tabFolderToolbarHandler.dispose();
- tabFolderToolbarHandler = null;
- }
-
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- */
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- restoreState(memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createPartControl(Composite parent) {
- // Create the page book control
- pageBookControl = doCreatePageBookControl(parent);
- Assert.isNotNull(pageBookControl);
- // Configure the page book control
- doConfigurePageBookControl(pageBookControl);
-
- // Create the empty page control
- emptyPageControl = doCreateEmptyPageControl(pageBookControl);
- Assert.isNotNull(emptyPageControl);
- // Configure the empty page control
- doConfigureEmptyPageControl(emptyPageControl);
-
- // Create the tab folder control (empty)
- tabFolderControl = doCreateTabFolderControl(pageBookControl);
- Assert.isNotNull(tabFolderControl);
- // Configure the tab folder control
- doConfigureTabFolderControl(tabFolderControl);
-
- // Create the tab folder manager
- tabFolderManager = doCreateTabFolderManager(this);
- Assert.isNotNull(tabFolderManager);
- // Set the tab folder manager as the selection provider
- getSite().setSelectionProvider(tabFolderManager);
-
- // Setup the tab folder menu handler
- tabFolderMenuHandler = doCreateTabFolderMenuHandler(this);
- Assert.isNotNull(tabFolderMenuHandler);
- doConfigureTabFolderMenuHandler(tabFolderMenuHandler);
-
- // Setup the tab folder toolbar handler
- tabFolderToolbarHandler = doCreateTabFolderToolbarHandler(this);
- Assert.isNotNull(tabFolderToolbarHandler);
- doConfigureTabFolderToolbarHandler(tabFolderToolbarHandler);
-
- // Show the empty page control by default
- switchToEmptyPageControl();
-
- String secondaryId = ((IViewSite) getSite()).getSecondaryId();
- if (secondaryId != null) {
- String defaultTitle = getPartName();
- // set title
- setPartName(defaultTitle + " " + secondaryId); //$NON-NLS-1$
- }
-
- // Initialize DnD support
- addDragSupport();
- addDropSupport();
- }
-
- /**
- * Creates the {@link PageBook} instance.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @return The page book instance. Must never be <code>null</code>.
- */
- protected PageBook doCreatePageBookControl(Composite parent) {
- return new PageBook(parent, SWT.NONE);
- }
-
- /**
- * Configure the given page book control.
- *
- * @param pagebook The page book control. Must not be <code>null</code>.
- */
- protected void doConfigurePageBookControl(PageBook pagebook) {
- Assert.isNotNull(pagebook);
-
- if (getContextHelpId() != null) PlatformUI.getWorkbench().getHelpSystem().setHelp(pagebook, getContextHelpId());
- }
-
- /**
- * Returns the context help id associated with the terminals console view instance.
- * <p>
- * <b>Note:</b> The default implementation returns the view id as context help id.
- *
- * @return The context help id or <code>null</code> if none is associated.
- */
- @Override
- public String getContextHelpId() {
- return getViewSite().getId();
- }
-
- /**
- * Creates the empty page control instance.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @return The empty page control instance. Must never be <code>null</code>.
- */
- protected Control doCreateEmptyPageControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
- /**
- * Configures the empty page control.
- *
- * @param control The empty page control. Must not be <code>null</code>.
- */
- protected void doConfigureEmptyPageControl(Control control) {
- Assert.isNotNull(control);
- }
-
- /**
- * Creates the tab folder control instance.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @return The tab folder control instance. Must never be <code>null</code>.
- */
- protected CTabFolder doCreateTabFolderControl(Composite parent) {
- return new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT | SWT.BORDER);
- }
-
- /**
- * Configures the tab folder control.
- *
- * @param tabFolder The tab folder control. Must not be <code>null</code>.
- */
- protected void doConfigureTabFolderControl(CTabFolder tabFolder) {
- Assert.isNotNull(tabFolder);
-
- // Set the layout data
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Set the tab gradient coloring from the global preferences
- if (useGradientTabBackgroundColor()) {
- tabFolder.setSelectionBackground(new Color[] {
- JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$
- JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END") //$NON-NLS-1$
- }, new int[] { 100 }, true);
- }
- // Apply the tab folder selection foreground color
- tabFolder.setSelectionForeground(JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
-
- // Set the tab style from the global preferences
- tabFolder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
- }
-
- /**
- * If <code>True</code> is returned, the inner tabs are colored with gradient coloring set in
- * the Eclipse workbench color settings.
- *
- * @return <code>True</code> to use gradient tab colors, <code>false</code> otherwise.
- */
- protected boolean useGradientTabBackgroundColor() {
- return false;
- }
-
- /**
- * Creates the tab folder manager.
- *
- * @param parentView The parent view instance. Must not be <code>null</code>.
- * @return The tab folder manager. Must never be <code>null</code>.
- */
- protected TabFolderManager doCreateTabFolderManager(ITerminalsView parentView) {
- Assert.isNotNull(parentView);
- return new TabFolderManager(parentView);
- }
-
- /**
- * Creates the tab folder menu handler.
- *
- * @param parentView The parent view instance. Must not be <code>null</code>.
- * @return The tab folder menu handler. Must never be <code>null</code>.
- */
- protected TabFolderMenuHandler doCreateTabFolderMenuHandler(ITerminalsView parentView) {
- Assert.isNotNull(parentView);
- return new TabFolderMenuHandler(parentView);
- }
-
- /**
- * Configure the tab folder menu handler
- *
- * @param menuHandler The tab folder menu handler. Must not be <code>null</code>.
- */
- protected void doConfigureTabFolderMenuHandler(TabFolderMenuHandler menuHandler) {
- Assert.isNotNull(menuHandler);
- menuHandler.initialize();
- }
-
- /**
- * Creates the tab folder toolbar handler.
- *
- * @param parentView The parent view instance. Must not be <code>null</code>.
- * @return The tab folder toolbar handler. Must never be <code>null</code>.
- */
- protected TabFolderToolbarHandler doCreateTabFolderToolbarHandler(ITerminalsView parentView) {
- Assert.isNotNull(parentView);
- return new TabFolderToolbarHandler(parentView);
- }
-
- /**
- * Configure the tab folder toolbar handler
- *
- * @param toolbarHandler The tab folder toolbar handler. Must not be <code>null</code>.
- */
- protected void doConfigureTabFolderToolbarHandler(TabFolderToolbarHandler toolbarHandler) {
- Assert.isNotNull(toolbarHandler);
- toolbarHandler.initialize();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
- @Override
- public void setFocus() {
- if (pageBookControl != null) pageBookControl.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#switchToEmptyPageControl()
- */
- @Override
- public void switchToEmptyPageControl() {
- if (pageBookControl != null && !pageBookControl.isDisposed()
- && emptyPageControl != null && !emptyPageControl.isDisposed()) {
- pageBookControl.showPage(emptyPageControl);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#switchToTabFolderControl()
- */
- @Override
- public void switchToTabFolderControl() {
- if (pageBookControl != null && !pageBookControl.isDisposed()
- && tabFolderControl != null && !tabFolderControl.isDisposed()) {
- pageBookControl.showPage(tabFolderControl);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (CTabFolder.class.isAssignableFrom(adapter)) {
- return tabFolderControl;
- }
- if (TabFolderManager.class.isAssignableFrom(adapter)) {
- return tabFolderManager;
- }
- if (TabFolderMenuHandler.class.isAssignableFrom(adapter)) {
- return tabFolderMenuHandler;
- }
- if (TabFolderToolbarHandler.class.isAssignableFrom(adapter)) {
- return tabFolderToolbarHandler;
- }
- if (TerminalsViewMementoHandler.class.isAssignableFrom(adapter)) {
- return mementoHandler;
- }
-
- return super.getAdapter(adapter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#setPinned(boolean)
- */
- @Override
- public void setPinned(boolean pin) {
- this.pinned = pin;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#isPinned()
- */
- @Override
- public boolean isPinned() {
- return pinned;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento)
- */
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- if (memento == null) return;
- mementoHandler.saveState(this, memento);
- }
-
- /**
- * Restore the view state from the given memento.
- *
- * @param memento The memento or <code>null</code>.
- */
- public void restoreState(IMemento memento) {
- if (memento == null) return;
- mementoHandler.restoreState(this, memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
- */
- @Override
- public boolean show(ShowInContext context) {
- if (context != null) {
- // Get the selection from the context
- ISelection selection = context.getSelection();
- // The selection must contain elements that can be adapted to IResource
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- boolean isValid = true;
-
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext() && isValid) {
- Object element = iterator.next();
- Object adapted = null;
-
- Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
- if (element instanceof org.eclipse.core.resources.IResource) continue;
-
- adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null;
- if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, org.eclipse.core.resources.IResource.class);
- if (adapted == null) adapted = Platform.getAdapterManager().loadAdapter(element, org.eclipse.core.resources.IResource.class.getName());
- }
-
- isValid = adapted != null;
- }
-
- // If the selection is valid, fire the command to open the local terminal
- if (isValid) {
- ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
- Command command = service != null ? service.getCommand("org.eclipse.tcf.te.ui.terminals.local.command.launch") : null; //$NON-NLS-1$
- if (command != null && command.isDefined() && command.isEnabled()) {
- try {
- ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
- Assert.isNotNull(pCmd);
- IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- Assert.isNotNull(handlerSvc);
- IEvaluationContext ctx = handlerSvc.getCurrentState();
- ctx = new EvaluationContext(ctx, selection);
- ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- handlerSvc.executeCommandInContext(pCmd, null, ctx);
- } catch (Exception e) {
- // If the platform is in debug mode, we print the exception to the log view
- if (Platform.inDebugMode()) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- Messages.AbstractTriggerCommandHandler_error_executionFailed, e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
deleted file mode 100644
index 4fcd76596..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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.ui.terminals.view;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
-import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.terminals.actions.PinTerminalAction;
-import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
-import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Take care of the persisted state handling of the "Terminals" view.
- */
-public class TerminalsViewMementoHandler {
- // The list of items to save. See the workbench listener implementation
- // in o.e.tcf.te.ui.terminals.activator.UIPlugin.
- private final List<CTabItem> saveables = new ArrayList<CTabItem>();
-
- /**
- * Sets the list of saveable items.
- *
- * @param saveables The list of saveable items. Must not be <code>null</code>.
- */
- public void setSaveables(List<CTabItem> saveables) {
- Assert.isNotNull(saveables);
- this.saveables.clear();
- this.saveables.addAll(saveables);
- }
-
- /**
- * Saves the view state in the given memento.
- *
- * @param view The terminals view. Must not be <code>null</code>.
- * @param memento The memento. Must not be <code>null</code>.
- */
- @SuppressWarnings("unchecked")
- public void saveState(TerminalsView view, IMemento memento) {
- Assert.isNotNull(view);
- Assert.isNotNull(memento);
-
- // Create a child element within the memento holding the
- // connection info of the open, non-terminated tab items
- memento = memento.createChild("terminalConnections"); //$NON-NLS-1$
- Assert.isNotNull(memento);
-
- // Write the view id and secondary id
- memento.putString("id", view.getViewSite().getId()); //$NON-NLS-1$
- memento.putString("secondaryId", view.getViewSite().getSecondaryId()); //$NON-NLS-1$
-
- // Save the pinned state
- memento.putBoolean("pinned", view.isPinned()); //$NON-NLS-1$
-
- // Loop the saveable items and store the connection data of each
- // item to the memento
- for (CTabItem item : saveables) {
- // Ignore disposed items
- if (item.isDisposed()) continue;
-
- // Get the original terminal properties associated with the tab item
- Map<String, Object> properties = (Map<String, Object>)item.getData("properties"); //$NON-NLS-1$
- if (properties == null) continue;
-
- // Get the terminal launcher delegate
- String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
- ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null;
- IMementoHandler mementoHandler = delegate != null ? (IMementoHandler)delegate.getAdapter(IMementoHandler.class) : null;
- if (mementoHandler != null) {
- // Create terminal connection child memento
- IMemento connectionMemento = memento.createChild("connection"); //$NON-NLS-1$
- Assert.isNotNull(connectionMemento);
- // Store the common attributes
- connectionMemento.putString(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegateId);
-
- String terminalConnectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (terminalConnectorId != null) {
- connectionMemento.putString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, terminalConnectorId);
- }
-
- if (properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW) instanceof Boolean) {
- connectionMemento.putBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW, ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW)).booleanValue());
- }
-
- // Pass on to the memento handler
- mementoHandler.saveState(connectionMemento, properties);
- }
- }
- }
-
- /**
- * Restore the view state from the given memento.
- *
- * @param view The terminals view. Must not be <code>null</code>.
- * @param memento The memento. Must not be <code>null</code>.
- */
- protected void restoreState(final TerminalsView view, IMemento memento) {
- Assert.isNotNull(view);
- Assert.isNotNull(memento);
-
- // Get the "terminalConnections" memento
- memento = memento.getChild("terminalConnections"); //$NON-NLS-1$
- if (memento != null) {
- // Read view id and secondary id
- String id = memento.getString("id"); //$NON-NLS-1$
- String secondaryId = memento.getString("secondaryId"); //$NON-NLS-1$
- if ("null".equals(secondaryId)) secondaryId = null; //$NON-NLS-1$
-
- final IMemento finMemento = memento;
- // Restore the pinned state of the after all connections completed
- final Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (finMemento.getBoolean("pinned") != null) { //$NON-NLS-1$
- asyncExec(new Runnable() {
- @Override
- public void run() {
- view.setPinned(finMemento.getBoolean("pinned").booleanValue()); //$NON-NLS-1$
-
- TabFolderToolbarHandler toolbarHandler = (TabFolderToolbarHandler)view.getAdapter(TabFolderToolbarHandler.class);
- if (toolbarHandler != null) {
- PinTerminalAction action = (PinTerminalAction)toolbarHandler.getAdapter(PinTerminalAction.class);
- if (action != null) action.setChecked(view.isPinned());
- }
- }
- });
- }
- }
- };
-
- final AtomicBoolean allProcessed = new AtomicBoolean(false);
- final List<ITerminalService.Done> callbacks = new ArrayList<ITerminalService.Done>();
-
- // Get all the "connection" memento's.
- IMemento[] connections = memento.getChildren("connection"); //$NON-NLS-1$
- for (IMemento connection : connections) {
- // Create the properties container that holds the terminal properties
- Map<String, Object> properties = new HashMap<String, Object>();
-
- // Set the view id attributes
- properties.put(ITerminalsConnectorConstants.PROP_ID, id);
- properties.put(ITerminalsConnectorConstants.PROP_SECONDARY_ID, secondaryId);
-
- // Restore the common attributes
- properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, connection.getString(ITerminalsConnectorConstants.PROP_DELEGATE_ID));
- properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, connection.getString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID));
- if (connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW) != null) {
- properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW));
- }
-
- // Get the terminal launcher delegate
- String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
- ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null;
- IMementoHandler mementoHandler = delegate != null ? (IMementoHandler)delegate.getAdapter(IMementoHandler.class) : null;
- if (mementoHandler != null) {
- // Pass on to the memento handler
- mementoHandler.restoreState(connection, properties);
- }
-
- // Restore the terminal connection
- if (delegate != null && !properties.isEmpty()) {
- ITerminalService.Done done = new ITerminalService.Done() {
- @Override
- public void done(IStatus status) {
- callbacks.remove(this);
- if (allProcessed.get() && callbacks.isEmpty()) {
- asyncExec(runnable);
- }
- }
- };
- callbacks.add(done);
- delegate.execute(properties, done);
- }
- }
-
- allProcessed.set(true);
- if (callbacks.isEmpty()) asyncExec(runnable);
- }
- }
-
- /**
- * Executes the given runnable asynchronously in the display thread.
- *
- * @param runnable The runnable. Must not be <code>null</code>.
- */
- /* default */ void asyncExec(Runnable runnable) {
- Assert.isNotNull(runnable);
- if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getDisplay() != null && !PlatformUI.getWorkbench().getDisplay().isDisposed()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(runnable);
- }
- }
-}

Back to the top