Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-02-09 10:06:51 +0000
committerUwe Stieber2015-02-09 10:07:30 +0000
commit33f33935be3522db525ebe0d68a387966b2b6208 (patch)
tree6a564be83f2d85d4bc4d9ae83aaee9e309e4de6f /target_explorer
parentcd1674a4ff43d1f2e9c8dc3c2b3691684b9c6056 (diff)
downloadorg.eclipse.tcf-33f33935be3522db525ebe0d68a387966b2b6208.tar.gz
org.eclipse.tcf-33f33935be3522db525ebe0d68a387966b2b6208.tar.xz
org.eclipse.tcf-33f33935be3522db525ebe0d68a387966b2b6208.zip
Terminal: Reduce terminal dependencies to depend on plain Eclipse platform only.
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/features/org.eclipse.tcf.te.feature/feature.xml7
-rw-r--r--target_explorer/features/org.eclipse.tcf.te.sdk.feature/feature.xml7
-rw-r--r--target_explorer/features/org.eclipse.tcf.te.terminals.feature/feature.xml16
-rw-r--r--target_explorer/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.classpath7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.project39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.core.prefs362
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.ui.prefs56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.pde.prefs32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/META-INF/MANIFEST.MF20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/about.html28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/build.properties16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/pom.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd129
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java228
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java51
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java73
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalServiceOutputStreamMonitorListener.java)4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java50
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ILineSeparatorConstants.java)4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java)87
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java459
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java295
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java231
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalService.java45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/DisposedEvent.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationAdvancedTabSection.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/TerminalContextPropertiesProvider.java47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java81
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherEventListener.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherTerminalTabListener.java50
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/LaunchProcessStep.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/META-INF/MANIFEST.MF6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java70
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncherTerminalTabListener.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncherEventListener.java)29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsListener.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsConnectorType.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsSettings.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsConfigurationPanel.java132
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java147
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsMementoHandler.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/META-INF/MANIFEST.MF4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java138
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypePanelControl.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java1048
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java355
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java375
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java65
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java68
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java74
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnectorType.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertiesAccessService.java103
-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.serial/.options1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java)64
-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.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nodes/interfaces/wire/IWireTypeSerial.java)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java40
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/types/SerialConnectorType.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java98
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/types/SshConnectorType.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java72
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/types/TelnetConnectorType.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java8
-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/events/SelectionChangedBroadcastEvent.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java116
-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/IConnectorType.java17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java102
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java255
-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/LaunchTerminalCommandHandler.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java88
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java312
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java656
-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.java202
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java177
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java311
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java51
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java86
155 files changed, 8333 insertions, 4105 deletions
diff --git a/target_explorer/features/org.eclipse.tcf.te.feature/feature.xml b/target_explorer/features/org.eclipse.tcf.te.feature/feature.xml
index 4de660ee3..3524b59f6 100644
--- a/target_explorer/features/org.eclipse.tcf.te.feature/feature.xml
+++ b/target_explorer/features/org.eclipse.tcf.te.feature/feature.xml
@@ -188,6 +188,13 @@
unpack="false"/>
<plugin
+ id="org.eclipse.tcf.te.core.terminals"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.eclipse.tcf.te.ui.terminals"
download-size="0"
install-size="0"
diff --git a/target_explorer/features/org.eclipse.tcf.te.sdk.feature/feature.xml b/target_explorer/features/org.eclipse.tcf.te.sdk.feature/feature.xml
index e03558223..387357889 100644
--- a/target_explorer/features/org.eclipse.tcf.te.sdk.feature/feature.xml
+++ b/target_explorer/features/org.eclipse.tcf.te.sdk.feature/feature.xml
@@ -149,6 +149,13 @@
unpack="false"/>
<plugin
+ id="org.eclipse.tcf.te.core.terminals.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.eclipse.tcf.te.ui.terminals.source"
download-size="0"
install-size="0"
diff --git a/target_explorer/features/org.eclipse.tcf.te.terminals.feature/feature.xml b/target_explorer/features/org.eclipse.tcf.te.terminals.feature/feature.xml
index 16e7bbcc2..1f232d935 100644
--- a/target_explorer/features/org.eclipse.tcf.te.terminals.feature/feature.xml
+++ b/target_explorer/features/org.eclipse.tcf.te.terminals.feature/feature.xml
@@ -27,18 +27,13 @@
<requires>
<import plugin="org.eclipse.core.expressions" version="3.4.400" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.runtime" version="3.8.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.core" version="1.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.runtime" version="1.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.runtime.services" version="1.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.ui" version="1.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.ui.controls" version="1.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.ui.swt" version="1.3.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.core.terminals" version="1.3.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.tm.terminal" version="3.2.300" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui" version="3.8.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.forms" version="3.5.200" match="greaterOrEqual"/>
<import plugin="org.eclipse.tcf.te.ui.terminals" version="1.3.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.tcf.te.ui.terminals.process" version="1.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.runtime.statushandler" version="1.3.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.core.native"/>
<import plugin="org.eclipse.equinox.security" version="1.1.100" match="greaterOrEqual"/>
<import plugin="org.eclipse.tm.terminal.serial" version="2.1.200" match="greaterOrEqual"/>
<import plugin="org.eclipse.tm.terminal.ssh" version="2.1.300" match="greaterOrEqual"/>
@@ -50,6 +45,13 @@
</requires>
<plugin
+ id="org.eclipse.tcf.te.core.terminals"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.eclipse.tcf.te.ui.terminals"
download-size="0"
install-size="0"
diff --git a/target_explorer/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml b/target_explorer/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml
index 3022bf70d..9cf77cfb5 100644
--- a/target_explorer/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml
+++ b/target_explorer/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml
@@ -29,6 +29,13 @@
</requires>
<plugin
+ id="org.eclipse.tcf.te.core.terminals.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.eclipse.tcf.te.ui.terminals.source"
download-size="0"
install-size="0"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.classpath
new file mode 100644
index 000000000..ad32c83a7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.options b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.options
new file mode 100644
index 000000000..cd0d16fd1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.options
@@ -0,0 +1 @@
+org.eclipse.tcf.te.core.terminals/debugmode = 0
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.project b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.project
new file mode 100644
index 000000000..755248325
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.project
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tcf.te.core.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>1329501981620</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.core.terminals/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..536dbb4bf
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,362 @@
+#Sat Oct 15 08:44:04 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.core.terminals/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..88bb9570e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,56 @@
+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.core.terminals/.settings/org.eclipse.pde.prefs b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.pde.prefs
new file mode 100644
index 000000000..cf80c8bc5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,32 @@
+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.core.terminals/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..574ee9c72
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.core.terminals;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.core.runtime;bundle-version="3.8.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.core.terminals,
+ org.eclipse.tcf.te.core.terminals.activator;x-internal:=true,
+ org.eclipse.tcf.te.core.terminals.interfaces,
+ org.eclipse.tcf.te.core.terminals.interfaces.constants,
+ org.eclipse.tcf.te.core.terminals.nls;x-internal:=true,
+ org.eclipse.tcf.te.core.terminals.preferences,
+ org.eclipse.tcf.te.core.terminals.tracing,
+ org.eclipse.tcf.te.core.terminals.utils
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/about.html b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/about.html
new file mode 100644
index 000000000..0f07cf034
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/about.html
@@ -0,0 +1,28 @@
+<!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.core.terminals/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/build.properties
new file mode 100644
index 000000000..e14313bd4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# 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,\
+ about.html,\
+ plugin.xml
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties
new file mode 100644
index 000000000..8bb225013
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties
@@ -0,0 +1,14 @@
+##################################################################################
+# 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
+##################################################################################
+
+pluginName = Target Explorer, Terminals Core
+providerName = Eclipse.org - Target Explorer
+
+ExtensionPoint.contextPropertiesProviders = Terminal Context Properties Providers
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml
new file mode 100644
index 000000000..4d281a2f1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="contextPropertiesProviders" name="%contextPropertiesProviders" schema="schema/contextPropertiesProviders.exsd"/>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/pom.xml
new file mode 100644
index 000000000..bcef6fca9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.tcf</groupId>
+ <artifactId>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.core.terminals</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd
new file mode 100644
index 000000000..929f094d5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf.te.core.terminals" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tcf.te.core.terminals" id="contextPropertiesProviders" name="Terminal Context Properties Providers"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to contribute terminal context properties providers. The context properties provider allows querying desired properties for a given context.
+&lt;p&gt;
+The terminal context is passed in as default variable to the enablement expression evaluation. The terminal context is not expected to be iteratable or countable.
+
+ </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="contextPropertiesProvider" 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="contextPropertiesProvider">
+ <annotation>
+ <documentation>
+ Declares a terminal context properties provider contribution.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="enablement"/>
+ </sequence>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The class that implements &lt;code&gt;org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider&lt;/code&gt;.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.3.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.core.terminals.contextPropertiesProviders&quot;&gt;
+ &lt;contextPropertiesProvider
+ class=&quot;com.my.contribution.MyContextPropertiesProviderImpl&quot;&gt;
+ &lt;/contextPropertiesProvider&gt;
+ &lt;/extension&gt;
+&lt;/code&gt;&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ The provider of a terminal context properties provider must implement &lt;samp&gt;org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider&lt;/samp&gt;.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java
new file mode 100644
index 000000000..c0bddc9bc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * 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.core.terminals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.expressions.EvaluationResult;
+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.IExecutableExtension;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+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.core.terminals.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider;
+import org.eclipse.tcf.te.core.terminals.nls.Messages;
+
+/**
+ * Terminal context properties provider factory.
+ */
+public final class TerminalContextPropertiesProviderFactory {
+ // Flag to remember if the contributions got loaded
+ private static boolean contributionsLoaded = false;
+
+ // The list of all loaded contributions
+ private static final List<Proxy> contributions = new ArrayList<Proxy>();
+
+ // The proxy used to achieve lazy class loading and plug-in activation
+ private static class Proxy implements IExecutableExtension {
+ // Reference to the configuration element
+ private IConfigurationElement configElement = null;
+ // The class implementing the provider
+ public String clazz;
+ // The context properties provider instance
+ private ITerminalContextPropertiesProvider provider = null;
+ // The converted expression
+ private Expression expression;
+
+ /**
+ * Constructor.
+ */
+ protected Proxy() {
+ }
+
+ /* (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 {
+ Assert.isNotNull(config);
+ this.configElement = config;
+
+ // Read the class attribute.
+ // Throws an exception if the attribute value is empty or null.
+ clazz = config.getAttribute("class"); //$NON-NLS-1$
+ if (clazz == null || "".equals(clazz.trim())) { //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR,
+ CoreBundleActivator.getUniqueIdentifier(),
+ NLS.bind(Messages.Extension_error_missingRequiredAttribute, "class", config.getContributor().getName()))); //$NON-NLS-1$
+ }
+
+ // Read the "enablement" sub element of the extension
+ IConfigurationElement[] children = configElement.getChildren("enablement"); //$NON-NLS-1$
+ if (children == null || children.length == 0) {
+ throw new CoreException(new Status(IStatus.ERROR,
+ CoreBundleActivator.getUniqueIdentifier(),
+ NLS.bind(Messages.Extension_error_missingRequiredAttribute, "enablement", config.getContributor().getName()))); //$NON-NLS-1$
+ }
+ // Only one "enablement" element is expected
+ expression = ExpressionConverter.getDefault().perform(children[0]);
+ }
+
+ /**
+ * Return the real terminal context properties provider instance for this proxy.
+ */
+ protected ITerminalContextPropertiesProvider getProvider() {
+ if (provider == null && configElement != null) {
+ try {
+ // Create the service class instance via the configuration element
+ Object provider = configElement.createExecutableExtension("class"); //$NON-NLS-1$
+ if (provider instanceof ITerminalContextPropertiesProvider) {
+ this.provider = (ITerminalContextPropertiesProvider)provider;
+ }
+ else {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Terminal context properties provider '" + provider.getClass().getName() + "' not of type ITerminalContextPropertiesProvider."); //$NON-NLS-1$ //$NON-NLS-2$
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ }
+ }
+ catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Cannot create terminal context properties provider '" + clazz + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ }
+ }
+ return provider;
+ }
+
+ /**
+ * Returns if or if not the context properties provider contribution is enabled for
+ * the given terminal context.
+ *
+ * @param context The terminal context or <code>null</code>.
+ * @return <code>True</code> if the context properties provider contribution is enabled
+ * for the given terminal context, <code>false</code> otherwise.
+ */
+ protected boolean isEnabled(Object context) {
+ if (context == null) {
+ return getEnablement() == null;
+ }
+
+ Expression enablement = getEnablement();
+
+ // The service contribution is enabled by default if no expression is specified.
+ boolean enabled = enablement == null;
+
+ if (enablement != null) {
+ // Set the default variable to the service context.
+ EvaluationContext evalContext = new EvaluationContext(null, context);
+ // Allow plug-in activation
+ evalContext.setAllowPluginActivation(true);
+ // Evaluate the expression
+ try {
+ enabled = enablement.evaluate(evalContext).equals(EvaluationResult.TRUE);
+ } catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), e.getLocalizedMessage(), e);
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ }
+ }
+
+ return enabled;
+ }
+
+ /**
+ * Returns the enablement expression.
+ *
+ * @return The enablement expression or <code>null</code>.
+ */
+ protected Expression getEnablement() {
+ return expression;
+ }
+ }
+
+
+ /**
+ * Creates a new terminal context properties provider proxy instance and initialize it.
+ *
+ * @param config The configuration element. Must not be <code>null</code>.
+ * @return The new terminal context properties provider proxy instance.
+ */
+ private static Proxy getProxy(IConfigurationElement config) {
+ Assert.isNotNull(config);
+ Proxy proxy = new Proxy();
+ try {
+ proxy.setInitializationData(config, null, null);
+ } catch (CoreException e) {
+ if (Platform.inDebugMode()) {
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(e.getStatus());
+ }
+ }
+ return proxy;
+ }
+
+ /**
+ * Load the terminal context properties provider contributions.
+ */
+ private static void loadContributions() {
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.tcf.te.core.terminals.contextPropertiesProviders"); //$NON-NLS-1$
+ if (ep != null) {
+ IExtension[] extensions = ep.getExtensions();
+ if (extensions != null) {
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ if (configElements != null) {
+ for (IConfigurationElement configElement : configElements) {
+ if ("contextPropertiesProvider".equals(configElement.getName())) { //$NON-NLS-1$
+ Proxy proxy = getProxy(configElement);
+ contributions.add(proxy);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the terminal context properties provider for the given context. The first terminal
+ * context properties provider which is enabled is returned.
+ *
+ * @param context The terminal context. Must not be <code>null</code>.
+ *
+ * @return The service or <code>null</code>.
+ */
+ public static ITerminalContextPropertiesProvider getProvider(Object context) {
+ Assert.isNotNull(context);
+
+ // Load the contributions if not yet loaded
+ synchronized (contributions) {
+ if (!contributionsLoaded) {
+ loadContributions();
+ contributionsLoaded = true;
+ }
+ }
+
+ for (Proxy proxy : contributions) {
+ if (proxy.isEnabled(context)) {
+ return proxy.getProvider();
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java
new file mode 100644
index 000000000..a86287da3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.core.terminals;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+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.nls.Messages;
+import org.osgi.framework.Bundle;
+
+/**
+ * Terminal service factory implementation.
+ * <p>
+ * Provides access to the terminal service instance.
+ */
+public final class TerminalServiceFactory {
+ public static ITerminalService instance = null;
+
+ static {
+ // Tries to instantiate the terminal service implementation
+ // from the o.e.tcf.te.ui.terminals bundle
+ Bundle bundle = Platform.getBundle("org.eclipse.tcf.te.ui.terminals"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ try {
+ Class<?> clazz = bundle.loadClass("org.eclipse.tcf.te.ui.terminals.services.TerminalService"); //$NON-NLS-1$
+ instance = (ITerminalService) clazz.newInstance();
+ }
+ catch (Exception e) {
+ if (Platform.inDebugMode()) {
+ Platform.getLog(bundle).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.TerminalServiceFactory_error_serviceImplLoadFailed, e));
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the terminal service instance.
+ */
+ public static ITerminalService getService() {
+ return instance;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java
new file mode 100644
index 000000000..054468888
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.core.terminals.activator;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CoreBundleActivator implements BundleActivator {
+ // The bundle context
+ private static BundleContext context;
+
+ /**
+ * Returns the bundle context
+ *
+ * @return the bundle context
+ */
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * 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.core.terminals"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ CoreBundleActivator.context = bundleContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ CoreBundleActivator.context = null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java
new file mode 100644
index 000000000..41f2cd3e7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.core.terminals.interfaces;
+
+import java.util.Map;
+
+/**
+ * Terminal context properties provider.
+ * <p>
+ * The context properties provider allows querying desired properties
+ * for a given context. The context is typically an element from a selection
+ * and the inner structure of the element is unknown to the terminal.
+ */
+public interface ITerminalContextPropertiesProvider {
+
+ /**
+ * Returns a unmodifiable map containing the target address and port for the given context,
+ * if it can be determined.
+ * <p>
+ * A context may return multiple target addresses and ports if the context can be reached using
+ * different connection methods.
+ * <p>
+ * <b>Note:</b>
+ * <ul>
+ * <li>See the constants defined in the context provider constants interface for default
+ * address and port types.</li>
+ * <li>The target address returned must <b>not</b> necessarily be an IP address.</li>
+ * <li>The values of the address or port properties might be <code>null</code>.</li>
+ * </ul>
+ *
+ * @param context The context to get the target addresses and ports from. Must not be <code>null</code>.
+ * @return The unmodifiable map containing the target addresses and ports, or <code>null</code>.
+ */
+ public Map<String, String> getTargetAddress(Object context);
+
+ /**
+ * Returns the property value stored under the given property key. If the property does not
+ * exist, <code>null</code> is returned.
+ *
+ * @param context The context to get the property from. Must not be <code>null</code>.
+ * @param key The property key. Must not be <code>null</code>.
+ *
+ * @return The stored property value or <code>null</code>.
+ */
+ public Object getProperty(Object context, String key);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java
new file mode 100644
index 000000000..e4c90c587
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.core.terminals.interfaces;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * Terminals service.
+ */
+public interface ITerminalService {
+
+ /**
+ * Client call back interface.
+ */
+ public interface Done {
+ /**
+ * Called when the terminal service operation is done.
+ *
+ * @param status The status of the terminal service operation.
+ */
+ public void done(IStatus status);
+ }
+
+ /**
+ * Opens a terminal asynchronously and invokes the given callback if done.
+ *
+ * @param properties The terminal properties. Must not be <code>null</code>.
+ * @param done The callback to invoke if finished or <code>null</code>.
+ */
+ public void openConsole(Map<String, Object> properties, Done done);
+
+ /**
+ * Close the terminal asynchronously and invokes the given callback if done.
+ *
+ * @param properties The terminal properties. Must not be <code>null</code>.
+ * @param done The callback to invoke if finished or <code>null</code>.
+ */
+ public void closeConsole(Map<String, Object> properties, Done done);
+
+ /**
+ * Terminate (disconnect) the terminal asynchronously and invokes the given callback if done.
+ *
+ * @param properties The terminal properties. Must not be <code>null</code>.
+ * @param done The callback to invoke if finished or <code>null</code>.
+ */
+ public void terminateConsole(Map<String, Object> properties, Done done);
+
+ /**
+ * Register the given listener to receive notifications about terminal events.
+ * Calling this method multiple times with the same listener has no effect.
+
+ * @param listener The terminal tab listener. Must not be <code>null</code>.
+ */
+ public void addTerminalTabListener(ITerminalTabListener listener);
+
+ /**
+ * Unregister the given listener from receiving notifications about terminal
+ * events. Calling this method multiple times with the same listener
+ * has no effect.
+ *
+ * @param listener The terminal tab listener. Must not be <code>null</code>.
+ */
+ public void removeTerminalTabListener(ITerminalTabListener listener);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalServiceOutputStreamMonitorListener.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java
index 003c475f5..dda3704b0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalServiceOutputStreamMonitorListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -7,7 +7,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.services.interfaces;
+package org.eclipse.tcf.te.core.terminals.interfaces;
/**
* An interface to be implemented by listeners who want to listen
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java
new file mode 100644
index 000000000..77e3e04eb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.core.terminals.interfaces;
+
+/**
+ * Listener to implement and to register to get notified about
+ * terminal tabs events, like the disposal of a terminal tab.
+ */
+public interface ITerminalTabListener {
+
+ /**
+ * Invoked once a terminal tab got disposed. The source object is
+ * the disposed tab item and data is the custom data object associated
+ * with the disposed tab item.
+ *
+ * @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 void terminalTabDisposed(Object source, Object data);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java
new file mode 100644
index 000000000..b2e98aacd
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.core.terminals.interfaces.constants;
+
+/**
+ * Defines the terminal context properties constants.
+ */
+public interface IContextPropertiesConstants {
+
+ /**
+ * Target name.
+ * <p>
+ * The target name is not meant to be identical with the targets network name. It can
+ * be the targets network name, but it can be any other string identifying the target
+ * to the user as well. The name is for display only, it is not meant to be used for
+ * communicating with the target.
+ */
+ public static String PROP_NAME = "name"; //$NON-NLS-1$
+
+ /**
+ * Target agent address.
+ * <p>
+ * <i>The value is typically the address an agent running at the target.</i>
+ */
+ public static String PROP_ADDRESS = "address"; //$NON-NLS-1$
+
+ /**
+ * Target agent port.
+ * <p>
+ * <i>The value is typically the port an agent running at the target.</i>
+ */
+ public static String PROP_PORT = "port"; //$NON-NLS-1$
+
+ /**
+ * The default user name to use to log into the target.
+ */
+ public static String PROP_DEFAULT_USER = "defaultUser"; //$NON-NLS-1$
+
+ /**
+ * The default encoding to use.
+ */
+ public static String PROP_DEFAULT_ENCODING = "defaultEncoding"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ILineSeparatorConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java
index 0528d431c..8fea4b82d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ILineSeparatorConstants.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -7,7 +7,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.services.interfaces.constants;
+package org.eclipse.tcf.te.core.terminals.interfaces.constants;
/**
* Line separator constants.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java
index a272ec1bb..938f76cd4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/constants/ITerminalsConnectorConstants.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -8,7 +8,10 @@
* Wind River Systems - initial API and implementation
* Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.services.interfaces.constants;
+package org.eclipse.tcf.te.core.terminals.interfaces.constants;
+
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
+
/**
* Defines the terminals connector constants.
@@ -17,51 +20,71 @@ public interface ITerminalsConnectorConstants {
/**
* Property: The unique id of the terminals view to open.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_ID = "id"; //$NON-NLS-1$
/**
* Property: The unique secondary id of the terminals view to open.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SECONDARY_ID = "secondaryId"; //$NON-NLS-1$
/**
* Property: The title of the terminal tab to open.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_TITLE = "title"; //$NON-NLS-1$
/**
* Property: The encoding of the terminal tab to open.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_ENCODING = "encoding"; //$NON-NLS-1$
/**
* Property: Custom data object to associate with the terminal tab.
+ * <p>
+ * Property Type: {@link Object}
*/
public static final String PROP_DATA = "data"; //$NON-NLS-1$
/**
* Property: External selection to associate with the terminal tab.
+ * <p>
+ * Property Type: {@link org.eclipse.jface.viewers.ISelection}
*/
public static final String PROP_SELECTION = "selection"; //$NON-NLS-1$
/**
* Property: Flag to force a new terminal tab.
+ * <p>
+ * Property Type: {@link Boolean}
*/
public static final String PROP_FORCE_NEW = "terminal.forceNew"; //$NON-NLS-1$
/**
* Property: Flag to signal if the terminal tab shall have a disconnect button or not.
+ * <p>
+ * Property Type: {@link Boolean}
*/
public static final String PROP_HAS_DISCONNECT_BUTTON = "hasDisconnectButton"; //$NON-NLS-1$
/**
* Property: Terminals launcher delegate id.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_DELEGATE_ID = "delegateId"; //$NON-NLS-1$
/**
* Property: Terminals connector type id.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_CONNECTOR_TYPE_ID = "connector.type.id"; //$NON-NLS-1$
@@ -69,6 +92,8 @@ public interface ITerminalsConnectorConstants {
* Property: Specific terminal connector type id. Allows clients to
* override the specifically used terminal connector
* implementation for a given type.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_TERMINAL_CONNECTOR_ID = "tm.terminal.connector.id"; //$NON-NLS-1$
@@ -78,12 +103,16 @@ public interface ITerminalsConnectorConstants {
* Property: Timeout to be passed to the terminal connector. The specific terminal
* connector implementation may interpret this value differently. If not
* set, the terminal connector may use a default value.
+ * <p>
+ * Property Type: {@link Integer}
*/
public static final String PROP_TIMEOUT = "timeout"; //$NON-NLS-1$
/**
* Property: Flag to control if a local echo is needed from the terminal widget.
* <p>Typical for process and streams terminals.
+ * <p>
+ * Property Type: {@link Boolean}
*/
public static final String PROP_LOCAL_ECHO = "localEcho"; //$NON-NLS-1$
@@ -92,6 +121,8 @@ public interface ITerminalsConnectorConstants {
* in a disconnected terminal.
* The flag can be set by adding an IPropertiesContainer with the set
* flag as PROP_DATA.
+ * <p>
+ * Property Type: {@link Boolean}
*/
public static final String PROP_DATA_NO_RECONNECT = "data.noReconnect"; //$NON-NLS-1$
@@ -99,24 +130,32 @@ public interface ITerminalsConnectorConstants {
* Property: The line separator expected by the remote terminal on input streams and
* send by the remote terminal on output streams.
* <p>Typical for process and streams terminals.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_LINE_SEPARATOR = "lineSeparator"; //$NON-NLS-1$
/**
* Property: The list of stdout listeners to attach to the corresponding stream monitor.
* <p>Typical for process and streams terminals.
+ * <p>
+ * Property Type: {@link ITerminalServiceOutputStreamMonitorListener} array
*/
public static final String PROP_STDOUT_LISTENERS = "stdoutListeners"; //$NON-NLS-1$
/**
* Property: The list of stderr listeners to attach to the corresponding stream monitor.
* <p>Typical for process and streams terminals.
+ * <p>
+ * Property Type: {@link ITerminalServiceOutputStreamMonitorListener} array
*/
public static final String PROP_STDERR_LISTENERS = "stderrListeners"; //$NON-NLS-1$
/**
* Property: If set to <code>true</code>, backslashes are translated to
* slashes before pasting the text to the terminal widget.
+ * <p>
+ * Property Type: {@link Boolean}
*/
public static final String PROP_TRANSLATE_BACKSLASHES_ON_PASTE = "translateBackslashesOnPaste"; //$NON-NLS-1$
@@ -125,18 +164,24 @@ public interface ITerminalsConnectorConstants {
/**
* Property: Host name or IP address the terminal server is running.
* <p>Typical for telnet or ssh terminals.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_IP_HOST = "ip.host"; //$NON-NLS-1$
/**
* Property: Port at which the terminal server is providing the console input and output.
* <p>Typical for telnet or ssh terminals.
+ * <p>
+ * Property Type: {@link Integer}
*/
public static final String PROP_IP_PORT = "ip.port"; //$NON-NLS-1$
/**
* Property: An offset to add to the specified port number.
* <p>Typical for telnet or ssh terminals.
+ * <p>
+ * Property Type: {@link Integer}
*/
public static final String PROP_IP_PORT_OFFSET = "ip.port.offset"; //$NON-NLS-1$
@@ -145,42 +190,56 @@ public interface ITerminalsConnectorConstants {
/**
* Property: Process image path.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_PROCESS_PATH = "process.path"; //$NON-NLS-1$
/**
* Property: Process arguments.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_PROCESS_ARGS = "process.args"; //$NON-NLS-1$
/**
* Property: Process arguments.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_PROCESS_WORKING_DIR = "process.working_dir"; //$NON-NLS-1$
/**
* Property: Process environment.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link String} array
*/
public static final String PROP_PROCESS_ENVIRONMENT = "process.environment"; //$NON-NLS-1$
/**
* Property: Flag to merge process environment with native environment.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link Boolean}
*/
public static final String PROP_PROCESS_MERGE_ENVIRONMENT = "process.environment.merge"; //$NON-NLS-1$
/**
* Property: Runtime process instance.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link Process}
*/
public static final String PROP_PROCESS_OBJ = "process"; //$NON-NLS-1$
/**
* Property: Runtime process PTY instance.
* <p>Typical for process terminals.
+ * <p>
+ * Property Type: {@link org.eclipse.cdt.utils.pty.PTY}
*/
public static final String PROP_PTY_OBJ = "pty"; //$NON-NLS-1$
@@ -189,18 +248,24 @@ public interface ITerminalsConnectorConstants {
/**
* Property: Stdin streams instance.
* <p>Typical for streams terminals.
+ * <p>
+ * Property Type: {@link OutputStream}
*/
public static final String PROP_STREAMS_STDIN = "streams.stdin"; //$NON-NLS-1$
/**
* Property: Stdout streams instance.
* <p>Typical for streams terminals.
+ * <p>
+ * Property Type: {@link InputStream}
*/
public static final String PROP_STREAMS_STDOUT = "streams.stdout"; //$NON-NLS-1$
/**
* Property: Stderr streams instance.
* <p>Typical for streams terminals.
+ * <p>
+ * Property Type: {@link InputStream}
*/
public static final String PROP_STREAMS_STDERR = "streams.stderr"; //$NON-NLS-1$
@@ -208,16 +273,22 @@ public interface ITerminalsConnectorConstants {
/**
* Property: ssh keep alive value.
+ * <p>
+ * Property Type: {@link Integer}
*/
public static final String PROP_SSH_KEEP_ALIVE = "ssh.keep_alive"; //$NON-NLS-1$
/**
* Property: Ssh password.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SSH_PASSWORD = "ssh.password"; //$NON-NLS-1$
/**
* Property: Ssh user.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SSH_USER = "ssh.user"; //$NON-NLS-1$
@@ -225,31 +296,43 @@ public interface ITerminalsConnectorConstants {
/**
* The serial device name.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SERIAL_DEVICE = "serial.device"; //$NON-NLS-1$
/**
* The baud rate.
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SERIAL_BAUD_RATE = "serial.baudrate"; //$NON-NLS-1$
/**
* The data bits
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SERIAL_DATA_BITS = "serial.databits"; //$NON-NLS-1$
/**
* The parity
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SERIAL_PARITY = "serial.parity"; //$NON-NLS-1$
/**
* The stop bits
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SERIAL_STOP_BITS = "serial.stopbits"; //$NON-NLS-1$
/**
* The flow control
+ * <p>
+ * Property Type: {@link String}
*/
public static final String PROP_SERIAL_FLOW_CONTROL = "serial.flowcontrol"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java
new file mode 100644
index 000000000..23cc87c46
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.core.terminals.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.core.terminals.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 TerminalServiceFactory_error_serviceImplLoadFailed;
+
+ public static String Extension_error_missingRequiredAttribute;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties
new file mode 100644
index 000000000..212cd1893
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# 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
+###############################################################################
+
+TerminalServiceFactory_error_serviceImplLoadFailed=Failed to load terminal service implementation.
+
+Extension_error_missingRequiredAttribute=Required attribute "{0}" missing for extension "{1}"!
+
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java
new file mode 100644
index 000000000..e46ad9546
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java
@@ -0,0 +1,459 @@
+/*******************************************************************************
+ * 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.core.terminals.preferences;
+
+import java.io.OutputStream;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.core.runtime.preferences.IPreferenceFilter;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * Helper class to handle scoped Eclipse preferences for plug-in's. Scoped
+ * preferences means a given preference context plus the default preferences
+ * scope.
+ * <p>
+ * On changes a {@link PreferenceChangeEvent} is sent to inform all listeners of the change.
+ *
+ * @see IEclipsePreferences
+ * @see IEclipsePreferences.PreferenceChangeEvent
+ * @see IEclipsePreferences.IPreferenceChangeListener
+ */
+public class ScopedEclipsePreferences {
+ /**
+ * The preferences scope qualifier.
+ */
+ private final String qualifier;
+
+ /**
+ * The default scope preference node.
+ */
+ protected final IEclipsePreferences defaultPrefs;
+
+ /**
+ * The context scope preference node.
+ */
+ protected final IEclipsePreferences contextScopePrefs;
+
+ /**
+ * The registered preference change listeners.
+ */
+ private final ListenerList listeners = new ListenerList();
+
+ /**
+ * Constructor.
+ * <p>
+ * Initialize the scoped preferences with a new instance scope for the given qualifier. The default
+ * scope is determined by calling <code>DefaultScope().getNode(qualifier)</code>.
+ *
+ * @param qualifier The qualifier for the preferences (in example the unique identifier of a plugin). Must not be <code>null</code>.
+ */
+ public ScopedEclipsePreferences(String qualifier) {
+ this(InstanceScope.INSTANCE, qualifier);
+ }
+
+ /**
+ * Constructor.
+ * <p>
+ * Initialize the scoped preferences with the given scope. The default scope
+ * is determined by calling <code>DefaultScope().getNode(qualifier)</code>.
+ *
+ * @param context The preference scope context. Must not be <code>null</code>.
+ * @param qualifier The qualifier for the preferences (in example the unique identifier of a plugin). Must not be <code>null</code>.
+ */
+ public ScopedEclipsePreferences(IScopeContext context, String qualifier) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(qualifier);
+ this.qualifier = qualifier;
+ defaultPrefs = DefaultScope.INSTANCE.getNode(getQualifier());
+ contextScopePrefs = context.getNode(getQualifier());
+ }
+
+ /**
+ * Returns the qualifier that is used to get the preferences.
+ * For plugin preferences, this is the unique identifier of the plugin.
+ */
+ protected final String getQualifier() {
+ return qualifier;
+ }
+
+ /**
+ * Exports the preferences to the stream.
+ * <p>
+ * <b>Note:</b> The stream will be closed after the export.
+ *
+ * @param stream The stream to where preferences and defaults should be exported.
+ */
+ public void exportPreferences(OutputStream stream) {
+ Assert.isNotNull(stream);
+ try {
+ IPreferenceFilter filter = new IPreferenceFilter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getScopes()
+ */
+ @Override
+ public String[] getScopes() {
+ return new String[] { InstanceScope.SCOPE };
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getMapping(java.lang.String)
+ */
+ @Override
+ public Map getMapping(String scope) {
+ return null;
+ }
+ };
+
+ Platform.getPreferencesService().exportPreferences(contextScopePrefs, new IPreferenceFilter[] { filter }, stream);
+ stream.close();
+ }
+ catch (Exception e) {
+ }
+ }
+
+ /**
+ * Check whether a key is set or not.
+ *
+ * @param key The key to check.
+ * @return <code>null</code> if the key does not exist.
+ */
+ public boolean containsKey(String key) {
+ return Platform.getPreferencesService().getString(getQualifier(), key, null, null) != null;
+ }
+
+ /**
+ * Get a String preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final String getString(String key) {
+ return Platform.getPreferencesService().getString(getQualifier(), key, null, null);
+ }
+
+ /**
+ * Get a boolean preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final boolean getBoolean(String key) {
+ return Platform.getPreferencesService().getBoolean(getQualifier(), key, false, null);
+ }
+
+ /**
+ * Get an int preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final int getInt(String key) {
+ return Platform.getPreferencesService().getInt(getQualifier(), key, 0, null);
+ }
+
+ /**
+ * Get a long preference value.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key or the default value if not set.
+ */
+ public final long getLong(String key) {
+ return Platform.getPreferencesService().getLong(getQualifier(), key, 0, null);
+ }
+
+ /**
+ * Get a default String preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or <code>null</code>.
+ */
+ public final String getDefaultString(String key) {
+ return defaultPrefs.get(key, null);
+ }
+
+ /**
+ * Get a default boolean preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or <code>null</code>.
+ */
+ public final boolean getDefaultBoolean(String key) {
+ return defaultPrefs.getBoolean(key, false);
+ }
+
+ /**
+ * Get a default int preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or <code>null</code>.
+ */
+ public final int getDefaultInt(String key) {
+ return defaultPrefs.getInt(key, 0);
+ }
+
+ /**
+ * Get a default long preference value.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key or <code>null</code>.
+ */
+ public final long getDefaultLong(String key) {
+ return defaultPrefs.getLong(key, 0);
+ }
+
+ /**
+ * Set a String preference value. If the value is <code>null</code> or is equal to
+ * the default value, the entry will be removed.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putString(String key, String value) {
+ String defValue = defaultPrefs.get(key, null);
+ String instValue = getString(key);
+ if (value == null || value.equals(defValue)) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, instValue, defValue);
+ }
+ else if (!value.equals(instValue)) {
+ contextScopePrefs.put(key, value);
+ flushAndNotify(contextScopePrefs, key, instValue, value);
+ }
+ }
+
+ /**
+ * Set a boolean preference value. If the value is equal the default value,
+ * the entry will be removed.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putBoolean(String key, boolean value) {
+ boolean defValue = defaultPrefs.getBoolean(key, false);
+ boolean instValue = getBoolean(key);
+ if (value == defValue) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, Boolean.toString(instValue), Boolean.toString(defValue));
+ }
+ else if (value != instValue) {
+ contextScopePrefs.putBoolean(key, value);
+ flushAndNotify(contextScopePrefs, key, Boolean.toString(instValue), Boolean.toString(value));
+ }
+ }
+
+ /**
+ * Set an int preference value. If the value is equal to the default value,
+ * the entry will be removed.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putInt(String key, int value) {
+ int defValue = defaultPrefs.getInt(key, 0);
+ int instValue = getInt(key);
+ if (value == defValue) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, Integer.toString(instValue), Integer.toString(defValue));
+ }
+ else if (value != instValue) {
+ contextScopePrefs.putInt(key, value);
+ flushAndNotify(contextScopePrefs, key, Integer.toString(instValue), Integer.toString(value));
+ }
+ }
+
+ /**
+ * Set a long preference value. If the given value is equal to the default
+ * value, the entry will be removed.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The value of the preference key.
+ */
+ public void putLong(String key, long value) {
+ long defValue = defaultPrefs.getLong(key, 0);
+ long instValue = getLong(key);
+ if (value == defValue) {
+ contextScopePrefs.remove(key);
+ flushAndNotify(contextScopePrefs, key, Long.toString(instValue), Long.toString(defValue));
+ }
+ else if (value != instValue) {
+ contextScopePrefs.putLong(key, value);
+ flushAndNotify(contextScopePrefs, key, Long.toString(instValue), Long.toString(value));
+ }
+ }
+
+ /**
+ * Set a default String preference value. If the given value is <code>null</code>,
+ * the entry will be removed.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultString(String key, String value) {
+ String defValue = defaultPrefs.get(key, null);
+ if (value == null) {
+ defaultPrefs.remove(key);
+ flushAndNotify(defaultPrefs, key, defValue, null);
+ }
+ else if (!value.equals(defValue)) {
+ defaultPrefs.put(key, value);
+ flushAndNotify(defaultPrefs, key, defValue, value);
+ }
+ }
+
+ /**
+ * Set a default boolean preference value.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultBoolean(String key, boolean value) {
+ boolean defValue = defaultPrefs.getBoolean(key, false);
+ if (value != defValue) {
+ defaultPrefs.putBoolean(key, value);
+ flushAndNotify(defaultPrefs, key, Boolean.toString(defValue), Boolean.toString(value));
+ }
+ }
+
+ /**
+ * Set a default int preference value.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultInt(String key, int value) {
+ int defValue = defaultPrefs.getInt(key, 0);
+ if (value != defValue) {
+ defaultPrefs.putInt(key, value);
+ flushAndNotify(defaultPrefs, key, Integer.toString(defValue), Integer.toString(value));
+ }
+ }
+
+ /**
+ * Set a default long preference value.
+ * <p>
+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old
+ * and new values are string representation in base 10.
+ *
+ * @param key The preference key.
+ * @return The default value of the preference key.
+ */
+ public void putDefaultLong(String key, long value) {
+ long defValue = defaultPrefs.getLong(key, 0);
+ if (value != defValue) {
+ defaultPrefs.putLong(key, value);
+ flushAndNotify(defaultPrefs, key, Long.toString(defValue), Long.toString(value));
+ }
+ }
+
+ /**
+ * Write back the changes to the store and notify all listeners about the changed key.
+ *
+ * @param node The preference node which has changed. Must not be <code>null</code>.
+ * @param key The key of the changed preference. Must not be <code>null</code>.
+ * @param oldValue The old value as a {@link String}, or <code>null</code>.
+ * @param newValue The new value as a {@link String}, or <code>null</code>.
+ */
+ protected final void flushAndNotify(IEclipsePreferences node, String key, String oldValue, String newValue) {
+ // Flush the preferences to the persistence store
+ try { node.flush(); } catch (BackingStoreException e) { /* Ignored on purpose */ }
+
+ // Notify the listeners
+ firePreferenceEvent(node, key, oldValue, newValue);
+ }
+
+ /**
+ * Register the given listener to receive notifications of preference changes to this node.
+ * Calling this method multiple times with the same listener has no effect. The given listener
+ * argument must not be <code>null</code>.
+ *
+ * @param listener The preference change listener. Must not be <code>null</code>.
+ */
+ public void addPreferenceChangeListener(IPreferenceChangeListener listener) {
+ Assert.isNotNull(listener);
+ listeners.add(listener);
+ }
+
+ /**
+ * De-register the given listener from receiving notifications of preference changes
+ * to this node. Calling this method multiple times with the same listener has no
+ * effect. The given listener argument must not be <code>null</code>.
+ *
+ * @param listener The preference change listener. Must not be <code>null</code>.
+ */
+ public void removePreferenceChangeListener(IPreferenceChangeListener listener) {
+ Assert.isNotNull(listener);
+ listeners.remove(listener);
+ }
+
+ /**
+ * Convenience method for notifying the registered preference change listeners.
+ *
+ * @param node The preference node which has changed. Must not be <code>null</code>.
+ * @param key The key of the changed preference. Must not be <code>null</code>.
+ * @param oldValue The old value as a {@link String}, or <code>null</code>.
+ * @param newValue The new value as a {@link String}, or <code>null</code>.
+ */
+ protected void firePreferenceEvent(IEclipsePreferences node, String key, String oldValue, String newValue) {
+ Assert.isNotNull(node);
+ Assert.isNotNull(key);
+
+ // If no listener is registered, we are done here
+ if (listeners.isEmpty()) return;
+
+ // Get the list or currently registered listeners
+ Object[] l = listeners.getListeners();
+ // Create the preference change event
+ final PreferenceChangeEvent event = new PreferenceChangeEvent(node, key, oldValue, newValue);
+ for (int i = 0; i < l.length; i++) {
+ final IPreferenceChangeListener listener = (IPreferenceChangeListener) l[i];
+ ISafeRunnable job = new ISafeRunnable() {
+ @Override
+ public void handleException(Throwable exception) {
+ // already logged in Platform#run()
+ }
+
+ @Override
+ public void run() throws Exception {
+ listener.preferenceChange(event);
+ }
+ };
+ SafeRunner.run(job);
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java
new file mode 100644
index 000000000..d461449d9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * 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.core.terminals.tracing;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator;
+
+/**
+ * Helper class to handle tracing using the platforms debug capabilities.
+ */
+public class TraceHandler {
+ /**
+ * The bundle identifier.
+ */
+ private final String identifier;
+
+ /**
+ * The tracer instance.
+ */
+ private Tracer tracer = null;
+
+ /**
+ * The tracer is responsible for writing the trace message to the desired
+ * output media.
+ */
+ protected static class Tracer {
+
+ /**
+ * The bundle identifier.
+ */
+ private final String fIdentifier;
+
+ /**
+ * The qualifier for the default &quot;&lt;bundle identifier&gt;/debugmode&quot;
+ * tracing slot.
+ */
+ private final String fDebugModeQualifier;
+
+ /**
+ * Constructor.
+ *
+ * @param identifier The bundle identifier. Must not be <code>null</code>.
+ */
+ public Tracer(String identifier) {
+ Assert.isNotNull(identifier);
+ fIdentifier = identifier;
+
+ // Initialize the debug mode qualifier
+ fDebugModeQualifier = fIdentifier + "/debugmode"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the value of the debug mode tracing slot.
+ * <p>
+ * If not set, or the value is not an {@link Integer}, the method returns <code>0</code>.
+ *
+ * @return The debug mode value.
+ */
+ protected int getDebugMode() {
+ try {
+ String mode = Platform.getDebugOption(fDebugModeQualifier);
+ if (mode != null && Integer.decode(mode).intValue() > 0) {
+ return Integer.decode(mode).intValue();
+ }
+ } catch (NumberFormatException e) { /* ignored on purpose */ }
+
+ return 0;
+ }
+
+ /**
+ * Check if the specified trace slot is enabled.
+ *
+ * @param slotId The name of the slot.
+ * @return <code>true</code> if the slot is defined and enabled, <code>false</code> otherwise.
+ */
+ protected boolean isSlotEnabled(String slotId) {
+ return fIdentifier != null ? Boolean.parseBoolean(Platform.getDebugOption(fIdentifier + "/" + slotId)) : false; //$NON-NLS-1$
+ }
+
+ /**
+ * Check if tracing is enabled for given mode and slot.
+ *
+ * @param debugMode The debug mode for the current debug.
+ * @param slotId The name of the slot.
+ *
+ * @return <code>true</code> if the debug should be written, <code>false</code> otherwise.
+ */
+ protected final boolean isEnabled(int debugMode, String slotId) {
+ return getDebugMode() < 0 ||
+ (debugMode <= getDebugMode() &&
+ (slotId == null || slotId.trim().length() == 0 || isSlotEnabled(slotId)));
+ }
+
+ /**
+ * Format the trace message.
+ *
+ * @param message The trace message.
+ * @param debugMode The debug mode.
+ * @param slotId The name of the slot.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer.
+ *
+ * @see IStatus
+ */
+ protected String getFormattedDebugMessage(String message, int debugMode, String slotId, int severity, Object clazz) {
+ StringBuffer debug = new StringBuffer();
+ if (slotId != null || clazz != null) {
+ if (clazz != null) {
+ String name = clazz instanceof Class<?> ? ((Class<?>)clazz).getSimpleName() : clazz.getClass().getSimpleName();
+ debug.append(name.trim().length() > 0 ? name.trim() : clazz instanceof Class<?> ? ((Class<?>)clazz).getName() : clazz.getClass().getName());
+ }
+ if (slotId != null) {
+ debug.append(" at "); //$NON-NLS-1$
+ debug.append(slotId);
+ }
+ if (debugMode >= 0) {
+ debug.append(" (Mode "); //$NON-NLS-1$
+ debug.append(debugMode);
+ debug.append(')');
+ }
+ debug.append('\n');
+ debug.append('\t');
+ }
+ debug.append(message);
+
+ return debug.toString();
+ }
+
+ /**
+ * Write the trace message.
+ *
+ * @param message The trace message.
+ * @param debugMode The debug mode.
+ * @param slotId The name of the slot.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer.
+ *
+ * @see IStatus
+ */
+ protected void write(String message, int debugMode, String slotId, int severity, Object clazz) {
+ String formattedMessage = getFormattedDebugMessage(message, debugMode, slotId, severity, clazz);
+ if (severity == IStatus.ERROR || severity == IStatus.WARNING) {
+ System.err.println(formattedMessage);
+ }
+ else {
+ System.out.println(formattedMessage);
+ }
+ }
+
+ /**
+ * Trace the given message with the given debug mode and slot.
+ *
+ * @param message The trace message.
+ * @param debugMode The debug mode.
+ * @param slotId The name of the slot.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer.
+ *
+ * @see IStatus
+ */
+ public final void trace(String message, int debugMode, String slotId, int severity, Object clazz) {
+ if (isEnabled(debugMode, slotId)) {
+ write(message, debugMode, slotId, severity, clazz);
+ }
+ }
+ }
+
+ /**
+ * Constructor.
+ * <p>
+ * Initializes the tracing handler with the given bundle identifier.
+ *
+ * @param identifier The bundle identifier or <code>null</code>.
+ */
+ public TraceHandler(String identifier) {
+ this.identifier = identifier != null ? identifier : CoreBundleActivator.getUniqueIdentifier();
+ Assert.isNotNull(this.identifier);
+ }
+
+ /**
+ * Returns the identifier.
+ */
+ protected final String getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ * Returns the tracer instance. Create a new tracer instance
+ * on first invocation.
+ *
+ * @return The tracer instance.
+ */
+ protected Tracer getTracer() {
+ if (tracer == null) {
+ tracer = new Tracer(identifier);
+ }
+ return tracer;
+ }
+
+ /**
+ * Return the current debug mode.
+ */
+ public final int getDebugMode() {
+ return getTracer().getDebugMode();
+ }
+
+ /**
+ * Check whether a trace slot is enabled. The debug mode defaults
+ * to 0.
+ *
+ * @param slotId The name of the slot.
+ *
+ * @return <code>true</code> if the slot is enabled, <code>false</code> otherwise.
+ */
+ public final boolean isSlotEnabled(String slotId) {
+ return isSlotEnabled(0, slotId);
+ }
+
+ /**
+ * Check whether a trace slot is enabled with the given debug mode.
+ *
+ * @param debugMode The debug mode
+ * @param slotId The name of the slot.
+ *
+ * @return <code>true</code> if the slot is enabled, <code>false</code> otherwise.
+ */
+ public final boolean isSlotEnabled(int debugMode, String slotId) {
+ return getTracer().isEnabled(debugMode, slotId);
+ }
+
+ /**
+ * Trace the given message.
+ * <p>
+ * The message severity will be {@link IStatus#INFO} and the message will be
+ * traced unconditionally.
+ *
+ * @param message The message.
+ * @param clazz The class that calls this tracer or <code>null</code>.
+ */
+ public final void trace(String message, Object clazz) {
+ getTracer().trace(message, 0, null, IStatus.INFO, clazz);
+ }
+
+ /**
+ * Trace the given message.
+ * <p>
+ * The message severity will be {@link IStatus#INFO}.
+ *
+ * @param message The message.
+ * @param debugMode The minimum debug mode that has to be set to write out the message.
+ * @param clazz The class that calls this tracer or <code>null</code>.
+ */
+ public final void trace(String message, int debugMode, Object clazz) {
+ getTracer().trace(message, debugMode, null, IStatus.INFO, clazz);
+ }
+
+ /**
+ * Trace the given message.
+ * <p>
+ * The message severity will be {@link IStatus#INFO} and the debug mode
+ * will default to <code>0</code>.
+ *
+ * @param message The message.
+ * @param slotId The slot that has to be enabled to write out the message.
+ * @param clazz The class that calls this tracer or <code>null</code>.
+ */
+ public final void trace(String message, String slotId, Object clazz) {
+ getTracer().trace(message, 0, slotId, IStatus.INFO, clazz);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * @param message The message.
+ * @param debugMode The minimum debug mode that has to be set to write out the message.
+ * @param slotId The slot that has to be enabled to write out the message.
+ * @param severity The severity. See {@link IStatus} for valid severity values.
+ * @param clazz The class that calls this tracer or <code>null</code>.
+ *
+ * @see IStatus
+ */
+ public final void trace(String message, int debugMode, String slotId, int severity, Object clazz) {
+ getTracer().trace(message, debugMode, slotId, severity, clazz);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java
new file mode 100644
index 000000000..b19fea37d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * 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.core.terminals.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.service.environment.Constants;
+
+/**
+ * Environment handling utility methods.
+ */
+public class Env {
+
+ // Reference to the monitor to lock if determining the native environment
+ private final static Object ENV_GET_MONITOR = new Object();
+
+ // Reference to the native environment with the case of the variable names preserved
+ private static Map<String, String> nativeEnvironmentCasePreserved = null;
+
+ /**
+ * Returns the merged environment of the native environment and the passed
+ * in environment. Passed in variables will overwrite the native environment
+ * if the same variables are set there.
+ * <p>
+ * For use with terminals, the parameter <code>terminal</code> should be set to
+ * <code>true</code>. In this case, the method will assure that the <code>TERM</code>
+ * environment variable is always set to <code>ANSI</code> and is not overwritten
+ * by the passed in environment.
+ *
+ * @param envp The environment to set on top of the native environment or <code>null</code>.
+ * @param terminal <code>True</code> if used with an terminal, <code>false</code> otherwise.
+ *
+ * @return The merged environment.
+ */
+ public static String[] getEnvironment(String[] envp, boolean terminal) {
+ // Get the cached native environment
+ Map<String, String> nativeEnv = getNativeEnvironmentCasePreserved();
+ // Make a copy of the native environment so it can be manipulated without changing
+ // the cached environment
+ Map<String, String> env = new LinkedHashMap<String, String>(nativeEnv);
+ // Set the TERM environment variable if in terminal mode
+ if (terminal) env.put("TERM", "xterm"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // On Windows, the environment variable names are not case-sensitive. However,
+ // we desire to preserve the original case. Build up a translation map between
+ // an all lowercase name and the original environment name
+ Map<String, String> k2n = null;
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ k2n = new HashMap<String, String>();
+ for (String name : env.keySet()) {
+ k2n.put(name.toLowerCase(), name);
+ }
+ }
+
+ // If a "local" environment is provided, merge it with the native
+ // environment.
+ if (envp != null) {
+ for (int i = 0; i < envp.length; i++) {
+ // The full provided variable in form "name=value"
+ String envpPart = envp[i];
+ // Split the variable
+ String[] parts = envpPart.split("=");//$NON-NLS-1$
+ String name = parts[0].trim();
+ // Map the variable name to the real environment name (Windows only)
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ if (k2n.containsKey(name.toLowerCase())) {
+ String candidate = k2n.get(name.toLowerCase());
+ Assert.isNotNull(candidate);
+ name = candidate;
+ }
+ // Filter out environment variables with bad names
+ if ("".equals(name.trim()) || name.contains("=") || name.contains(":")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+ }
+ // Get the variable value
+ String value = parts.length > 1 ? parts[1].trim() : ""; //$NON-NLS-1$
+ // Don't overwrite the TERM variable if in terminal mode
+ if (terminal && "TERM".equals(name)) continue; //$NON-NLS-1$
+ // If a variable with the name does not exist, just append it
+ if (!env.containsKey(name) && !"<unset>".equals(value)) { //$NON-NLS-1$
+ env.put(name, value);
+ } else if (env.containsKey(name)) {
+ // If the value contains the special placeholder "<unset>", remove the variable from the environment
+ if ("<unset>".equals(value)) {//$NON-NLS-1$
+ env.remove(name);
+ } else {
+ // A variable with the name already exist, check if the value is different
+ String oldValue = env.get(name);
+ if (oldValue != null && !oldValue.equals(value) || oldValue == null && value != null) {
+ env.put(name, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Convert into an array of strings
+ List<String> keys = new ArrayList<String>(env.keySet());
+ // On Windows hosts, sort the environment keys
+ if (Platform.OS_WIN32.equals(Platform.getOS())) Collections.sort(keys);
+ Iterator<String> iter = keys.iterator();
+ List<String> strings = new ArrayList<String>(env.size());
+ StringBuilder buffer = null;
+ while (iter.hasNext()) {
+ String key = iter.next();
+ buffer = new StringBuilder(key);
+ buffer.append('=').append(env.get(key));
+ strings.add(buffer.toString());
+ }
+
+ return strings.toArray(new String[strings.size()]);
+ }
+
+ /**
+ * Determine the native environment.
+ *
+ * @return The native environment, or an empty map.
+ */
+ private static Map<String, String> getNativeEnvironmentCasePreserved() {
+ synchronized (ENV_GET_MONITOR) {
+ if (nativeEnvironmentCasePreserved == null) {
+ nativeEnvironmentCasePreserved = new LinkedHashMap<String, String>();
+ cacheNativeEnvironment(nativeEnvironmentCasePreserved);
+ }
+ return new LinkedHashMap<String, String>(nativeEnvironmentCasePreserved);
+ }
+ }
+
+ /**
+ * Query the native environment and store it to the specified cache.
+ *
+ * @param cache The environment cache. Must not be <code>null</code>.
+ */
+ private static void cacheNativeEnvironment(Map<String, String> cache) {
+ Assert.isNotNull(cache);
+
+ try {
+ String nativeCommand = null;
+ if (Platform.getOS().equals(Constants.OS_WIN32)) {
+ nativeCommand = "cmd.exe /C set"; //$NON-NLS-1$
+ } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)) {
+ nativeCommand = "env"; //$NON-NLS-1$
+ }
+ if (nativeCommand == null) { return; }
+ Process process = Runtime.getRuntime().exec(nativeCommand);
+
+ // read process directly on other platforms
+ // we need to parse out matching '{' and '}' for function declarations in .bash environments
+ // pattern is [function name]=() { and we must find the '}' on its own line with no trailing ';'
+ InputStream stream = process.getInputStream();
+ InputStreamReader isreader = new InputStreamReader(stream);
+ BufferedReader reader = new BufferedReader(isreader);
+ try {
+ String line = reader.readLine();
+ String key = null;
+ String value = null;
+ while (line != null) {
+ int func = line.indexOf("=()"); //$NON-NLS-1$
+ if (func > 0) {
+ key = line.substring(0, func);
+ // scan until we find the closing '}' with no following chars
+ value = line.substring(func + 1);
+ while (line != null && !line.equals("}")) { //$NON-NLS-1$
+ line = reader.readLine();
+ if (line != null) {
+ value += line;
+ }
+ }
+ line = reader.readLine();
+ } else {
+ int separator = line.indexOf('=');
+ if (separator > 0) {
+ key = line.substring(0, separator);
+ value = line.substring(separator + 1);
+ StringBuilder bufValue = new StringBuilder(value);
+ line = reader.readLine();
+ if (line != null) {
+ // this line has a '=' read ahead to check next line for '=', might be broken on more
+ // than one line
+ separator = line.indexOf('=');
+ while (separator < 0) {
+ bufValue.append(line.trim());
+ line = reader.readLine();
+ if (line == null) {
+ // if next line read is the end of the file quit the loop
+ break;
+ }
+ separator = line.indexOf('=');
+ }
+ }
+ value = bufValue.toString();
+ }
+ }
+ if (key != null) {
+ cache.put(key, value);
+ key = null;
+ value = null;
+ } else {
+ line = reader.readLine();
+ }
+ }
+ } finally {
+ reader.close();
+ }
+ } catch (IOException e) {
+ // Native environment-fetching code failed.
+ // This can easily happen and is not useful to log.
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalService.java
deleted file mode 100644
index 1b77ff9a9..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/ITerminalService.java
+++ /dev/null
@@ -1,45 +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.runtime.services.interfaces;
-
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-
-/**
- * Terminals service.
- * <p>
- * Allow to use the embedded terminals view for remote input and output.
- */
-public interface ITerminalService extends IService {
-
- /**
- * Opens a terminal asynchronously and invokes the given callback if done.
- *
- * @param properties The terminal properties. Must not be <code>null</code>.
- * @param callback The target callback to invoke if finished or <code>null</code>.
- */
- public void openConsole(IPropertiesContainer properties, ICallback callback);
-
- /**
- * Close the terminal asynchronously and invokes the given callback if done.
- *
- * @param properties The terminal properties. Must not be <code>null</code>.
- * @param callback The target callback to invoke if finished or <code>null</code>.
- */
- public void closeConsole(IPropertiesContainer properties, ICallback callback);
-
- /**
- * Terminate (disconnect) the terminal asynchronously and invokes the given callback if done.
- *
- * @param properties The terminal properties. Must not be <code>null</code>.
- * @param callback The target callback to invoke if finished or <code>null</code>.
- */
- public void terminateConsole(IPropertiesContainer properties, ICallback callback);
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/DisposedEvent.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/DisposedEvent.java
deleted file mode 100644
index d8f1ad85a..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/DisposedEvent.java
+++ /dev/null
@@ -1,67 +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.runtime.events;
-
-import java.util.EventObject;
-
-import org.eclipse.tcf.te.runtime.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.runtime.interfaces.tracing.ITraceIds;
-
-/**
- * Event used to signal the disposal of an element.
- */
-public class DisposedEvent extends EventObject {
- private static final long serialVersionUID = -8900361742097122798L;
-
- private final Object data;
-
- /**
- * Constructor.
- *
- * @param source The event source. Must not be <code>null</code>.
- * <p>
- * The event source is expected to be of type {@link CTabItem}.
- *
- * @param data The custom data object or <code>null</code>.
- */
- public DisposedEvent(Object source, Object data) {
- super(source);
- this.data = data;
- }
-
- /**
- * Returns the custom data object associated with the disposed terminal console.
- *
- * @return The custom data object or <code>null</code>.
- */
- public final Object getData() {
- return data;
- }
-
- /* (non-Javadoc)
- * @see java.util.EventObject#toString()
- */
- @Override
- public String toString() {
- StringBuffer toString = new StringBuffer(getClass().getName());
-
- String prefix = ""; //$NON-NLS-1$
- // if debugging the event, formating them a little bit better readable.
- if (CoreBundleActivator.getTraceHandler().isSlotEnabled(1, ITraceIds.TRACE_EVENTS))
- prefix = "\n\t\t"; //$NON-NLS-1$
-
- toString.append(prefix + "{source="); //$NON-NLS-1$
- toString.append(source);
- toString.append("}"); //$NON-NLS-1$
-
- return toString.toString();
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/META-INF/MANIFEST.MF
index c8875d1ce..5b7030a72 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/META-INF/MANIFEST.MF
@@ -20,6 +20,7 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6.0",
org.eclipse.ui;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.core.terminals;bundle-version="1.3.0",
org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.3.0",
org.eclipse.tcf.te.runtime.model;bundle-version="1.3.0",
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java
index 702dac1bc..b704b488b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/utils/TEHelper.java
@@ -34,6 +34,8 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IFileSystem;
+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.core.utils.text.StringUtil;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
@@ -42,8 +44,6 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.processes.ProcessOutputReaderThread;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
import org.eclipse.tcf.te.runtime.utils.Host;
import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil;
@@ -234,8 +234,7 @@ public class TEHelper {
else Protocol.invokeAndWait(runnable);
if (isLocalhost.get()) {
- container.setProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, Host
- .isWindowsHost() ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF);
+ container.setProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, Host.isWindowsHost() ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
index 26e112c56..561f0f0aa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
@@ -11,7 +11,9 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.tcf.core;bundle-version="1.3.0",
org.eclipse.tcf.debug;bundle-version="1.3.0",
org.eclipse.tcf.debug.ui;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core;bundle-version="1.3.0",
org.eclipse.tcf.te.core.cdt;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
org.eclipse.tcf.te.launch.core;bundle-version="1.3.0",
org.eclipse.tcf.te.launch.ui;bundle-version="1.3.0",
org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
@@ -27,6 +29,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.tcf.te.tcf.locator;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.processes.core;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.controls;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",
@@ -34,9 +37,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.ui;bundle-version="3.8.0",
org.eclipse.ui.forms;bundle-version="3.5.200",
org.eclipse.ui.navigator;bundle-version="3.5.200",
- org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300",
- org.eclipse.tcf.te.ui;bundle-version="1.3.0",
- org.eclipse.tcf.te.core;bundle-version="1.3.0"
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationAdvancedTabSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationAdvancedTabSection.java
index 2144cb9bb..00ab6a104 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationAdvancedTabSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationAdvancedTabSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -21,10 +21,10 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+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.launch.core.persistence.DefaultPersistenceDelegate;
import org.eclipse.tcf.te.launch.ui.interfaces.ILaunchConfigurationTabFormPart;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages;
import org.eclipse.tcf.te.ui.forms.parts.AbstractSection;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
index 0c3ac059b..b6ba26d82 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF
@@ -5,18 +5,19 @@ Bundle-SymbolicName: org.eclipse.tcf.te.tcf.locator; singleton:=true
Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator
Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.core.expressions;bundle-version="3.4.400",
+Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.core.runtime;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.core.terminals;bundle-version="1.3.0",
org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.concurrent;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.runtime.stepper;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.3.0",
- org.eclipse.tcf.te.tcf.core.model;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.3.0"
+ org.eclipse.tcf.te.tcf.core.model;bundle-version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
index 6d4b05f6a..6f3600aeb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
@@ -165,6 +165,19 @@
</service>
</extension>
+<!-- Terminal context properties provider contributions -->
+ <extension point="org.eclipse.tcf.te.core.terminals.contextPropertiesProviders">
+ <contextPropertiesProvider
+ class="org.eclipse.tcf.te.tcf.locator.services.TerminalContextPropertiesProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.eclipse.tcf.protocol.IPeer"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
+ </or>
+ </enablement>
+ </contextPropertiesProvider>
+ </extension>
+
<!-- Step contributions -->
<extension point="org.eclipse.tcf.te.runtime.stepper.steps">
<step
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/TerminalContextPropertiesProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/TerminalContextPropertiesProvider.java
new file mode 100644
index 000000000..14b4adf68
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/TerminalContextPropertiesProvider.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.tcf.locator.services;
+
+import java.util.Map;
+
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+
+/**
+ * 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) {
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(context, IPropertiesAccessService.class);
+ if (service != null) {
+ return service.getTargetAddress(context);
+ }
+ 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) {
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(context, IPropertiesAccessService.class);
+ if (service != null) {
+ return service.getProperty(context, key);
+ }
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
index 7deac26cb..9b53aa4d8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
@@ -9,16 +9,17 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.core.runtime;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.core.terminals;bundle-version="1.3.0",
org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.concurrent;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.runtime.statushandler;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.core.model;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.runtime.persistence;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.3.0"
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
index 6bd95e653..0e022f1c8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
@@ -45,17 +45,15 @@ import org.eclipse.tcf.services.IProcesses;
import org.eclipse.tcf.services.IProcesses.ProcessContext;
import org.eclipse.tcf.services.IProcessesV1;
import org.eclipse.tcf.services.IStreams;
+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.ITerminalTabListener;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.runtime.callback.AsyncCallbackCollector;
import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.events.DisposedEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate;
@@ -98,8 +96,8 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
private IChannelManager.IStreamsListener streamsListener = null;
// The process listener instance
private IProcesses.ProcessesListener processesListener = null;
- // The event listener instance
- private IEventListener eventListener = null;
+ // The terminal tab listener instance
+ private ITerminalTabListener terminalTabListener = null;
// The streams proxy instance
private IProcessStreamsProxy streamsProxy = null;
@@ -139,9 +137,9 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
final IChannel finChannel = channel;
// Remove the notification listener
- if (eventListener != null) {
- EventManager.getInstance().removeEventListener(eventListener);
- eventListener = null;
+ if (terminalTabListener != null) {
+ TerminalServiceFactory.getService().removeTerminalTabListener(terminalTabListener);
+ terminalTabListener = null;
}
// Create the callback collector
@@ -567,13 +565,6 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
- if (status.getSeverity() == IStatus.ERROR) {
- invokeCallback(status, null);
- return;
- }
-
- // Launch the process
- onAttachStreamsDone();
}
}, new CallbackInvocationDelegate());
@@ -588,22 +579,22 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
} else if (properties.getBooleanProperty(IProcessLauncher.PROP_PROCESS_ASSOCIATE_CONSOLE)) {
// We don't have a streams proxy, we default the output redirection to the standard terminals console view
- // Register the notification listener to listen to the console disposal
- eventListener = new ProcessLauncherEventListener(this);
- EventManager.getInstance().addEventListener(eventListener, DisposedEvent.class);
+ // Register the terminal tab listener to listen to the terminal events
+ terminalTabListener = new ProcessLauncherTerminalTabListener(this);
+ TerminalServiceFactory.getService().addTerminalTabListener(terminalTabListener);
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
// Create the terminal streams settings
- PropertiesContainer props = new PropertiesContainer();
- props.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.streams"); //$NON-NLS-1$
- props.setProperty(ITerminalsConnectorConstants.PROP_ID, "org.eclipse.tcf.te.ui.terminals.TerminalsView"); //$NON-NLS-1$
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.streams"); //$NON-NLS-1$
+ props.put(ITerminalsConnectorConstants.PROP_ID, "org.eclipse.tcf.te.ui.terminals.TerminalsView"); //$NON-NLS-1$
// Set the terminal tab title
String terminalTitle = getTerminalTitle();
if (terminalTitle != null) {
- props.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ props.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
}
// Get the process output listener list from the properties
@@ -611,27 +602,43 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
StreamsDataReceiver.Listener[] listeners = value instanceof StreamsDataReceiver.Listener[] ? (StreamsDataReceiver.Listener[]) value : null;
// Create and store the streams which will be connected to the terminals stdin
- props.setProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDIN, connectRemoteOutputStream(getStreamsListener(), new String[] { IProcesses.PROP_STDIN_ID }));
+ props.put(ITerminalsConnectorConstants.PROP_STREAMS_STDIN, connectRemoteOutputStream(getStreamsListener(), new String[] { IProcesses.PROP_STDIN_ID }));
// Create and store the streams the terminal will see as stdout
- props.setProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT, connectRemoteInputStream(getStreamsListener(), new String[] { IProcesses.PROP_STDOUT_ID }, listeners));
+ props.put(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT, connectRemoteInputStream(getStreamsListener(), new String[] { IProcesses.PROP_STDOUT_ID }, listeners));
// Create and store the streams the terminal will see as stderr
- props.setProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDERR, connectRemoteInputStream(getStreamsListener(), new String[] { IProcesses.PROP_STDERR_ID }, null));
+ props.put(ITerminalsConnectorConstants.PROP_STREAMS_STDERR, connectRemoteInputStream(getStreamsListener(), new String[] { IProcesses.PROP_STDERR_ID }, null));
// Copy the terminal properties
- props.setProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO));
- props.setProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR));
- props.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW));
+ props.put(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, Boolean.valueOf(properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)));
+ props.put(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR));
+ props.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.valueOf(properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW)));
// The custom data object is the process launcher itself
- props.setProperty(ITerminalsConnectorConstants.PROP_DATA, this);
+ props.put(ITerminalsConnectorConstants.PROP_DATA, this);
// Initialize the process specific terminal state text representations
- props.setProperty("TabFolderManager_state_connected", Messages.ProcessLauncher_state_connected); //$NON-NLS-1$
- props.setProperty("TabFolderManager_state_connecting", Messages.ProcessLauncher_state_connecting); //$NON-NLS-1$
- props.setProperty("TabFolderManager_state_closed", Messages.ProcessLauncher_state_closed); //$NON-NLS-1$
+ props.put("TabFolderManager_state_connected", Messages.ProcessLauncher_state_connected); //$NON-NLS-1$
+ props.put("TabFolderManager_state_connecting", Messages.ProcessLauncher_state_connecting); //$NON-NLS-1$
+ props.put("TabFolderManager_state_closed", Messages.ProcessLauncher_state_closed); //$NON-NLS-1$
// Open the console
- terminal.openConsole(props, new AsyncCallbackCollector.SimpleCollectorCallback(collector));
+ terminal.openConsole(props, new ITerminalService.Done() {
+ @Override
+ public void done(IStatus status) {
+ if (status.getSeverity() == IStatus.ERROR) {
+ invokeCallback(status, null);
+ return;
+ }
+
+ // Launch the process (from within the TCF event dispatch thread)
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ onAttachStreamsDone();
+ }
+ });
+ }
+ });
}
} else if (properties.getStringProperty(IProcessLauncher.PROP_PROCESS_OUTPUT_REDIRECT_TO_FILE) != null) {
// Get the file name where to redirect the process output to
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherEventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherEventListener.java
deleted file mode 100644
index 58a76aea3..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherEventListener.java
+++ /dev/null
@@ -1,55 +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.tcf.processes.core.launcher;
-
-import java.util.EventObject;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.tcf.te.runtime.events.DisposedEvent;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
-
-/**
- * Remote process launcher default notification listener implementation.
- * <p>
- * <b>Note:</b> The notifications may occur in every thread!
- */
-public class ProcessLauncherEventListener extends PlatformObject implements IEventListener {
- // Reference to the parent launcher
- private final ProcessLauncher parent;
-
- /**
- * Constructor.
- *
- * @param parent The parent launcher. Must not be <code>null</code>.
- */
- public ProcessLauncherEventListener(ProcessLauncher parent) {
- super();
-
- Assert.isNotNull(parent);
- this.parent = parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
- */
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof DisposedEvent) {
- // Get the custom data object from the disposed event
- Object data = ((DisposedEvent)event).getData();
- // The custom data object must be of type TcfRemoteProcessLauncher and match the parent launcher
- if (data instanceof ProcessLauncher && parent.equals(data)) {
- // Terminate the remote process (leads to the disposal of the parent)
- parent.terminate();
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherTerminalTabListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherTerminalTabListener.java
new file mode 100644
index 000000000..261160082
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncherTerminalTabListener.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.tcf.processes.core.launcher;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener;
+
+/**
+ * Remote process launcher terminal tab listener implementation.
+ * <p>
+ * <b>Note:</b> The notifications may occur in every thread!
+ */
+public class ProcessLauncherTerminalTabListener extends PlatformObject implements ITerminalTabListener {
+ // Reference to the parent launcher
+ private final ProcessLauncher parent;
+
+ /**
+ * Constructor.
+ *
+ * @param parent The parent launcher. Must not be <code>null</code>.
+ */
+ public ProcessLauncherTerminalTabListener(ProcessLauncher parent) {
+ super();
+
+ Assert.isNotNull(parent);
+ this.parent = parent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener#terminalTabDisposed(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void terminalTabDisposed(Object source, Object data) {
+ Assert.isNotNull(source);
+
+ // The custom data object must be of type TcfRemoteProcessLauncher and match the parent launcher
+ if (data instanceof ProcessLauncher && parent.equals(data)) {
+ // Terminate the remote process (leads to the disposal of the parent)
+ parent.terminate();
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/LaunchProcessStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/LaunchProcessStep.java
index 553d6564e..9358ab820 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/LaunchProcessStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/steps/LaunchProcessStep.java
@@ -23,13 +23,13 @@ import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IProcesses;
import org.eclipse.tcf.services.IProcessesV1;
+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.core.utils.text.StringUtil;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
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;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/META-INF/MANIFEST.MF
index bafeb6b64..0193670f0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/META-INF/MANIFEST.MF
@@ -6,10 +6,10 @@ Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.tcf.te.tcf.terminals.core.activator.CoreBundleActivator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.core;bundle-version="1.3.0",
org.eclipse.tcf.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
index b5a24bb97..f90618117 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
@@ -41,17 +41,15 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IStreams;
import org.eclipse.tcf.services.ITerminals;
import org.eclipse.tcf.services.ITerminals.TerminalContext;
+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.ITerminalTabListener;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.runtime.callback.AsyncCallbackCollector;
import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.events.DisposedEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
@@ -92,8 +90,8 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
private IChannelManager.IStreamsListener streamsListener = null;
// The terminals listener instance
private ITerminals.TerminalsListener terminalsListener = null;
- // The event listener instance
- private IEventListener eventListener = null;
+ // The terminal tab listener instance
+ private ITerminalTabListener terminalTabListener = null;
/**
* Constructor.
@@ -114,9 +112,9 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
final IChannel finChannel = channel;
// Remove the notification listener
- if (eventListener != null) {
- EventManager.getInstance().removeEventListener(eventListener);
- eventListener = null;
+ if (terminalTabListener != null) {
+ TerminalServiceFactory.getService().removeTerminalTabListener(terminalTabListener);
+ terminalTabListener = null;
}
// Create the callback collector
@@ -411,45 +409,57 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
return;
}
- // Register the notification listener to listen to the console disposal
- eventListener = new TerminalsLauncherEventListener(this);
- EventManager.getInstance().addEventListener(eventListener, DisposedEvent.class);
+ // Register the terminal tab listener to listen to the terminal events
+ terminalTabListener = new TerminalsLauncherTerminalTabListener(this);
+ TerminalServiceFactory.getService().addTerminalTabListener(terminalTabListener);
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
// Create the terminal streams settings
- PropertiesContainer props = new PropertiesContainer();
+ Map<String, Object> props = new HashMap<String, Object>();
// Copy over the common terminal properties passed in by the global properties
- props.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, properties.getProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID));
- props.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, properties.getProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID));
- props.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, properties.getProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID));
- props.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, properties.getProperty(ITerminalsConnectorConstants.PROP_ENCODING));
- props.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION));
+ if (properties.getProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID) != null) {
+ props.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, properties.getProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID));
+ }
+ if (properties.getProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID) != null) {
+ props.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, properties.getProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID));
+ }
+ if (properties.getProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID) != null) {
+ props.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, properties.getProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID));
+ }
+ if (properties.getProperty(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
+ props.put(ITerminalsConnectorConstants.PROP_ENCODING, properties.getProperty(ITerminalsConnectorConstants.PROP_ENCODING));
+ }
+ if (properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION) != null) {
+ props.put(ITerminalsConnectorConstants.PROP_SELECTION, properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION));
+ }
// Force creation of new terminal tabs if connecting to the same agent again
- props.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
+ props.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
// Show the disconnect button
- props.setProperty(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, true);
+ props.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
// Set the terminal tab title
String terminalTitle = getTerminalTitle();
if (terminalTitle != null) {
- props.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ props.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
}
// Create and store the streams which will be connected to the terminals stdin
- props.setProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDIN, connectRemoteOutputStream(getStreamsListener(), new String[] { ITerminals.PROP_STDIN_ID }));
+ props.put(ITerminalsConnectorConstants.PROP_STREAMS_STDIN, connectRemoteOutputStream(getStreamsListener(), new String[] { ITerminals.PROP_STDIN_ID }));
// Create and store the streams the terminal will see as stdout
- props.setProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT, connectRemoteInputStream(getStreamsListener(), new String[] { ITerminals.PROP_STDOUT_ID }));
+ props.put(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT, connectRemoteInputStream(getStreamsListener(), new String[] { ITerminals.PROP_STDOUT_ID }));
// Create and store the streams the terminal will see as stderr
- props.setProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDERR, connectRemoteInputStream(getStreamsListener(), new String[] { ITerminals.PROP_STDERR_ID }));
+ props.put(ITerminalsConnectorConstants.PROP_STREAMS_STDERR, connectRemoteInputStream(getStreamsListener(), new String[] { ITerminals.PROP_STDERR_ID }));
// Copy the terminal properties
- props.setProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO));
- props.setProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR));
+ props.put(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, Boolean.valueOf(properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)));
+ if (properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) != null) {
+ props.put(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR, properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR));
+ }
// The custom data object is the terminal launcher itself
- props.setProperty(ITerminalsConnectorConstants.PROP_DATA, this);
+ props.put(ITerminalsConnectorConstants.PROP_DATA, this);
// Open the console
terminal.openConsole(props, null);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncherEventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncherTerminalTabListener.java
index b663b8a47..23c57b6fa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncherEventListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncherTerminalTabListener.java
@@ -9,19 +9,16 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.terminals.core.launcher;
-import java.util.EventObject;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.tcf.te.runtime.events.DisposedEvent;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener;
/**
- * Remote terminals launcher default notification listener implementation.
+ * Remote terminals launcher terminal tab listener implementation.
* <p>
* <b>Note:</b> The notifications may occur in every thread!
*/
-public class TerminalsLauncherEventListener extends PlatformObject implements IEventListener {
+public class TerminalsLauncherTerminalTabListener extends PlatformObject implements ITerminalTabListener {
// Reference to the parent launcher
private final TerminalsLauncher parent;
@@ -30,7 +27,7 @@ public class TerminalsLauncherEventListener extends PlatformObject implements IE
*
* @param parent The parent launcher. Must not be <code>null</code>.
*/
- public TerminalsLauncherEventListener(TerminalsLauncher parent) {
+ public TerminalsLauncherTerminalTabListener(TerminalsLauncher parent) {
super();
Assert.isNotNull(parent);
@@ -38,18 +35,16 @@ public class TerminalsLauncherEventListener extends PlatformObject implements IE
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener#terminalTabDisposed(java.lang.Object, java.lang.Object)
*/
@Override
- public void eventFired(EventObject event) {
- if (event instanceof DisposedEvent) {
- // Get the custom data object from the disposed event
- Object data = ((DisposedEvent)event).getData();
- // The custom data object must be of type TerminalsLauncher and match the parent launcher
- if (data instanceof TerminalsLauncher && parent.equals(data)) {
- // Terminate the remote terminal (leads to the disposal of the parent)
- parent.exit();
- }
+ public void terminalTabDisposed(Object source, Object data) {
+ Assert.isNotNull(source);
+
+ // The custom data object must be of type TerminalsLauncher and match the parent launcher
+ if (data instanceof TerminalsLauncher && parent.equals(data)) {
+ // Terminate the remote terminal (leads to the disposal of the parent)
+ parent.exit();
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsListener.java
index f28b6f7f4..9fc96102a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsListener.java
@@ -14,11 +14,11 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.services.ITerminals;
import org.eclipse.tcf.services.ITerminals.TerminalContext;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.tcf.terminals.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.terminals.core.interfaces.launcher.ITerminalsContextAwareListener;
import org.eclipse.tcf.te.tcf.terminals.core.interfaces.tracing.ITraceIds;
-import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
/**
* Remote process processes listener implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF
index 177c0ce84..6cce07b69 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/META-INF/MANIFEST.MF
@@ -7,19 +7,17 @@ Bundle-Activator: org.eclipse.tcf.te.tcf.terminals.ui.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.tcf.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core;bundle-version="1.3.0",
+ org.eclipse.tcf.te.core.terminals;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.services;bundle-version="1.3.0",
- org.eclipse.tcf.core;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.locator;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.terminals.core;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui;bundle-version="1.3.0",
org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.controls;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",
- org.eclipse.tcf.te.core;bundle-version="1.3.0"
+ org.eclipse.ui.forms;bundle-version="3.5.200"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsConnectorType.java
index 2b6c72dcd..a173827a5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsConnectorType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -11,16 +11,16 @@ package org.eclipse.tcf.te.tcf.terminals.ui.connector;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Map;
import org.eclipse.core.runtime.Assert;
-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.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
+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;
/**
* Terminals terminal connector type implementation.
@@ -29,23 +29,24 @@ import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
public class TerminalsConnectorType extends AbstractConnectorType {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ @Override
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
+ String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
if (connectorId == null) connectorId = "org.eclipse.tcf.te.tcf.terminals.ui.TerminalsConnector"; //$NON-NLS-1$
// Extract the streams properties
- OutputStream stdin = (OutputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDIN);
- InputStream stdout = (InputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT);
- InputStream stderr = (InputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDERR);
- boolean localEcho = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
- String lineSeparator = properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
- ITerminalsLauncher launcher = (ITerminalsLauncher)properties.getProperty(ITerminalsConnectorConstants.PROP_DATA);
+ 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);
+ ITerminalsLauncher launcher = (ITerminalsLauncher)properties.get(ITerminalsConnectorConstants.PROP_DATA);
// Construct the terminal settings store
ISettingsStore store = new SettingsStore();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsSettings.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsSettings.java
index 226f7b711..f788044fe 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsSettings.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/connector/TerminalsSettings.java
@@ -13,9 +13,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
+import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
/**
* Terminals connector settings implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsConfigurationPanel.java
new file mode 100644
index 000000000..57064fcc5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsConfigurationPanel.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * 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.terminals.ui.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;
+
+/**
+ * Terminals (TCF) terminal launcher configuration panel implementation.
+ */
+public class TerminalsConfigurationPanel extends AbstractExtendedConfigurationPanel {
+
+ /**
+ * Constructor.
+ *
+ * @param container The configuration panel container or <code>null</code>.
+ */
+ public TerminalsConfigurationPanel(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);
+
+ // Create the encoding selection combo
+ createEncodingUI(panel, false);
+
+ 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) {
+ if (data == null) return;
+
+ // set the terminal connector id for terminals (TCF)
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.tcf.terminals.ui.TerminalsConnector"); //$NON-NLS-1$
+
+ // set the connector type for terminals (TCF)
+ data.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.terminals"); //$NON-NLS-1$
+
+ // Extract the encoding
+ 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 isEncodingValid();
+ }
+
+ /* (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);
+ // 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);
+ // 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.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java
deleted file mode 100644
index 866bf3c33..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/controls/TerminalsWizardConfigurationPanel.java
+++ /dev/null
@@ -1,147 +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.tcf.terminals.ui.controls;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Terminals (TCF) wizard configuration panel implementation.
- */
-public class TerminalsWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
-
- /**
- * Constructor.
- *
- * @param parentControl The parent control. Must not be <code>null</code>!
- */
- public TerminalsWizardConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
- }
-
- /* (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);
-
- // Create the encoding selection combo
- createEncodingUI(panel, false);
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void setupData(IPropertiesContainer data) {
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void extractData(IPropertiesContainer data) {
- // set the terminal connector id for terminals (TCF)
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.tcf.terminals.ui.TerminalsConnector"); //$NON-NLS-1$
-
- // set the connector type for terminals (TCF)
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.terminals"); //$NON-NLS-1$
-
- // Extract the encoding
- data.setProperty(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){
- }
-
- /* (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 isEncodingValid();
- }
-
- /* (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) {
- Assert.isNotNull(settings);
- // 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) {
- Assert.isNotNull(settings);
- // 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;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java
index 592f7bd9d..858f7ab1e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsLauncherDelegate.java
@@ -9,22 +9,26 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.terminals.ui.launcher;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+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.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.terminals.core.interfaces.launcher.ITerminalsLauncher;
import org.eclipse.tcf.te.tcf.terminals.core.launcher.TerminalsLauncher;
-import org.eclipse.tcf.te.tcf.terminals.ui.controls.TerminalsWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tcf.te.tcf.terminals.ui.controls.TerminalsConfigurationPanel;
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.launcher.AbstractLauncherDelegate;
@@ -36,11 +40,11 @@ public class TerminalsLauncherDelegate extends AbstractLauncherDelegate {
private final IMementoHandler mementoHandler = new TerminalsMementoHandler();
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
*/
@Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return new TerminalsWizardConfigurationPanel(parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new TerminalsConfigurationPanel(container);
}
/* (non-Javadoc)
@@ -52,14 +56,14 @@ public class TerminalsLauncherDelegate extends AbstractLauncherDelegate {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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(IPropertiesContainer properties, ICallback callback) {
+ public void execute(final Map<String, Object> properties, final Done done) {
Assert.isNotNull(properties);
// Get the selection from the properties
- ISelection selection = (ISelection)properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION);
+ ISelection selection = (ISelection)properties.get(ITerminalsConnectorConstants.PROP_SELECTION);
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IPeerNode) {
@@ -78,7 +82,14 @@ public class TerminalsLauncherDelegate extends AbstractLauncherDelegate {
if (peer.get() != null) {
ITerminalsLauncher launcher = new TerminalsLauncher();
- launcher.launch(peer.get(), properties, callback);
+ IPropertiesContainer p = new PropertiesContainer();
+ p.addProperties(properties);
+ launcher.launch(peer.get(), p, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ done.done(status);
+ }
+ });
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsMementoHandler.java
index 72b4cafc7..1b85e4eca 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsMementoHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.ui/src/org/eclipse/tcf/te/tcf/terminals/ui/launcher/TerminalsMementoHandler.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.terminals.ui.launcher;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
@@ -16,8 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
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.IPeerModelLookupService;
@@ -31,19 +31,19 @@ import org.eclipse.ui.IMemento;
public class TerminalsMementoHandler implements IMementoHandler {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void saveState(IMemento memento, IPropertiesContainer properties) {
+ 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_ENCODING, properties.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING));
+ memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING));
// Get the selection from the properties
- ISelection selection = (ISelection)properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION);
+ ISelection selection = (ISelection)properties.get(ITerminalsConnectorConstants.PROP_SELECTION);
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IPeerNode) {
@@ -53,16 +53,17 @@ public class TerminalsMementoHandler implements IMementoHandler {
}
}
+
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void restoreState(IMemento memento, IPropertiesContainer properties) {
+ public void restoreState(IMemento memento, Map<String, Object> properties) {
Assert.isNotNull(memento);
Assert.isNotNull(properties);
// Restore the terminal properties from the memento
- properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
+ properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
final String peerID = memento.getString("peerID"); //$NON-NLS-1$
if (peerID != null) {
@@ -87,7 +88,7 @@ public class TerminalsMementoHandler implements IMementoHandler {
}
if (peerNode.get() != null) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, new StructuredSelection(peerNode.get()));
+ properties.put(ITerminalsConnectorConstants.PROP_SELECTION, new StructuredSelection(peerNode.get()));
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/META-INF/MANIFEST.MF
index 2b317004f..937fb9c2d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/META-INF/MANIFEST.MF
@@ -28,7 +28,5 @@ Export-Package: org.eclipse.tcf.te.ui.controls,
org.eclipse.tcf.te.ui.controls.nls,
org.eclipse.tcf.te.ui.controls.panels,
org.eclipse.tcf.te.ui.controls.validator,
- org.eclipse.tcf.te.ui.controls.wire,
- org.eclipse.tcf.te.ui.controls.wire.network,
- org.eclipse.tcf.te.ui.controls.wire.serial
+ org.eclipse.tcf.te.ui.controls.wire.network
Import-Package: gnu.io;resolution:=optional
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java
deleted file mode 100644
index 15e79b100..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypeControl.java
+++ /dev/null
@@ -1,138 +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.controls.wire;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.core.nodes.interfaces.wire.IWireTypeNetwork;
-import org.eclipse.tcf.te.core.nodes.interfaces.wire.IWireTypeSerial;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.controls.nls.Messages;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-
-/**
- * Wire type control implementation.
- */
-public class WireTypeControl extends BaseEditBrowseTextControl {
-
- private final static String[] WIRE_TYPES = new String[] {
- IWireTypeNetwork.PROPERTY_CONTAINER_NAME,
- IWireTypeSerial.PROPERTY_CONTAINER_NAME
- };
-
- /**
- * Constructor.
- *
- * @param parentPage The parent dialog page this control is embedded in.
- * Might be <code>null</code> if the control is not associated with a page.
- */
- public WireTypeControl(IDialogPage parentPage) {
- super(parentPage);
- setIsGroup(false);
- setReadOnly(true);
- setHideBrowseButton(true);
- setEditFieldLabel(Messages.WireTypeControl_label);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#setupPanel(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void setupPanel(Composite parent) {
- super.setupPanel(parent);
-
- List<String> wireTypeLabels = new ArrayList<String>();
- for (String wireType : WIRE_TYPES) {
- String label = getWireTypeLabel(wireType);
- if (label != null) wireTypeLabels.add(label);
- }
-
- setEditFieldControlHistory(wireTypeLabels.toArray(new String[wireTypeLabels.size()]));
- SWTControlUtil.select(getEditFieldControl(), 0);
- }
-
- /**
- * Returns the list of supported wire types.
- *
- * @return The list of supported wire types.
- */
- public static final String[] getSupportedWireTypes() {
- return Arrays.copyOf(WIRE_TYPES, WIRE_TYPES.length);
- }
-
- /**
- * Returns the label of the given wire type.
- *
- * @param wireType The wire type. Must not be <code>null</code>.
- * @return The corresponding label or <code>null</code> if the wire type is unknown.
- */
- protected String getWireTypeLabel(String wireType) {
- Assert.isNotNull(wireType);
-
- if (IWireTypeNetwork.PROPERTY_CONTAINER_NAME.equals(wireType)) return Messages.WireTypeControl_networkType_label;
- if (IWireTypeSerial.PROPERTY_CONTAINER_NAME.equals(wireType)) return Messages.WireTypeControl_serialType_label;
-
- return null;
- }
-
- /**
- * Returns the currently selected wire type.
- *
- * @return The currently selected wire type.
- */
- public String getSelectedWireType() {
- String type = getEditFieldControlText();
-
- if (Messages.WireTypeControl_networkType_label.equals(type)) type = IWireTypeNetwork.PROPERTY_CONTAINER_NAME;
- else if (Messages.WireTypeControl_serialType_label.equals(type)) type = IWireTypeSerial.PROPERTY_CONTAINER_NAME;
-
- return type;
- }
-
- /**
- * Sets the selected wire type to the specified one.
- *
- * @param wireType The wire type. Must not be <code>null</code>.
- */
- public void setSelectedWireType(String wireType) {
- Assert.isNotNull(wireType);
-
- // Get the wire type label for given wire type
- String label = getWireTypeLabel(wireType);
- int index = SWTControlUtil.indexOf(getEditFieldControl(), label);
- if (index != -1) SWTControlUtil.select(getEditFieldControl(), index);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
- // The widget is not user editable and the history is used
- // for presenting the available wire types. Neither save
- // or restore the history actively.
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
- */
- @Override
- public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
- // The widget is not user editable and the history is used
- // for presenting the available wire types. Neither save
- // or restore the history actively.
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypePanelControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypePanelControl.java
deleted file mode 100644
index fef078435..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/WireTypePanelControl.java
+++ /dev/null
@@ -1,30 +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.controls.wire;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl;
-
-/**
- * Custom wire type wizard panel control.
- */
-public class WireTypePanelControl extends BaseWizardConfigurationPanelControl {
-
- /**
- * Constructor.
- *
- * @param parentPage The parent dialog page this control is embedded in.
- * Might be <code>null</code> if the control is not associated with a page.
- */
- public WireTypePanelControl(IDialogPage parentPage) {
- super(parentPage);
- }
-
-} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java
deleted file mode 100644
index 43ae4a5cc..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java
+++ /dev/null
@@ -1,1048 +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.controls.wire.serial;
-
-import gnu.io.CommPortIdentifier;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-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.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.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-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.events.TypedEvent;
-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.nodes.interfaces.wire.IWireTypeSerial;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.controls.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.controls.interfaces.tracing.ITraceIds;
-import org.eclipse.tcf.te.ui.controls.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.controls.validator.NumberValidator;
-import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode3;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * Serial line wire type wizard configuration panel.
- */
-public class SerialLinePanel extends AbstractWizardConfigurationPanel implements IDataExchangeNode3 {
- 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$
- };
-
- private final boolean editable;
- private final boolean terminalMode;
- private final boolean showAdvancedSerialOptions;
-
- 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 parentPageControl The parent control this backend configuration panel is embedded in. Must not be <code>null</code>!
- * @param terminalMode Specify <code>true</code> if the configuration panel controls are layout one per row.
- * @param editable Specify <code>true</code> if the user should be allowed to edit the serial device name, <code>false</code> otherwise.
- */
- public SerialLinePanel(BaseDialogPageControl parentPageControl, boolean terminalMode, boolean editable) {
- this(parentPageControl, terminalMode, editable, false);
- }
-
- /**
- * Constructor.
- *
- * @param parentPageControl The parent control this backend configuration panel is embedded in. Must not be <code>null</code>!
- * @param terminalMode Specify <code>true</code> if the configuration panel controls are layout one per row.
- * @param editable Specify <code>true</code> if the user should be allowed to edit the serial device name and serial baud rate, <code>false</code> otherwise.
- * @param showAdvancedOptions If <code>true</code>, advanced serial options are available to the user.
- */
- public SerialLinePanel(BaseDialogPageControl parentPageControl, boolean terminalMode, boolean editable, boolean showAdvancedOptions) {
- super(parentPageControl);
- this.terminalMode = terminalMode;
- this.editable = editable;
- this.showAdvancedSerialOptions = showAdvancedOptions;
- }
-
- protected class CustomSerialBaudRateInputValidator implements IInputValidator {
- private final Validator validator;
-
- /**
- * Constructor.
- *
- */
- public CustomSerialBaudRateInputValidator() {
- validator = new NumberValidator();
- validator.setMessageText(RegexValidator.ERROR_INVALID_VALUE, Messages.SerialLinePanel_error_invalidCharactesBaudRate);
- }
-
- /* (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 (!validator.isValid(newText)) {
- return validator.getMessage();
- }
- } 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;
- }
-
- /**
- * Returns if or if not to adjust the background color of the panels.
- *
- * @return <code>True</code> to adjust the background color.
- */
- protected boolean isAdjustBackgroundColor() {
- return getParentControl().getParentPage() != null || terminalMode;
- }
-
- /* (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);
-
- boolean adjustBackgroundColor = isAdjustBackgroundColor();
-
- 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));
- if (adjustBackgroundColor) panel.setBackground(parent.getBackground());
-
- setControl(panel);
-
- // Create the wire type section
- Composite section;
- if (!terminalMode) {
- section = toolkit.createSection(panel, ExpandableComposite.TITLE_BAR);
- Assert.isNotNull(section);
- ((Section)section).setText(Messages.SerialLinePanel_section);
- section.setLayout(new GridLayout());
- section.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
- } else {
- // No section -> Use the panel directly
- section = panel;
- }
- if (adjustBackgroundColor) section.setBackground(panel.getBackground());
-
- final Composite client = toolkit.createComposite(section);
- Assert.isNotNull(client);
- client.setLayout(new GridLayout(terminalMode ? 2 : 4, false));
- client.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- if (adjustBackgroundColor) client.setBackground(section.getBackground());
- if (section instanceof Section) ((Section)section).setClient(client);
-
- // Host TTY settings
- hostTTYDeviceLabel = new Label(client, SWT.NONE);
- hostTTYDeviceLabel.setText(terminalMode ? Messages.SerialLinePanel_hostTTYDevice_label_terminalMode : 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(SWTControlUtil.getText(hostTTYDeviceCombo))) {
- List<String> tty = new ArrayList<String>();
- List<String> tcp = new ArrayList<String>();
- String selected = SWTControlUtil.getItem(hostTTYDeviceCombo, lastSelected);
- for (String device : SWTControlUtil.getItems(hostTTYDeviceCombo)) {
- 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) {
- SWTControlUtil.add(hostTTYDeviceCombo, device.trim());
- SWTControlUtil.setText(hostTTYDeviceCombo, device.trim());
- } else if (lastSelected != -1) {
- SWTControlUtil.setText(hostTTYDeviceCombo, SWTControlUtil.getItem(hostTTYDeviceCombo, lastSelected));
- }
- } else if (lastSelected != -1){
- SWTControlUtil.setText(hostTTYDeviceCombo, SWTControlUtil.getItem(hostTTYDeviceCombo, lastSelected));
- }
- }
- lastSelected = SWTControlUtil.getSelectionIndex(hostTTYDeviceCombo);
-
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.validate();
- }
- });
-
- hostTTYSpeedLabel = new Label(client, SWT.NONE);
- hostTTYSpeedLabel.setText(terminalMode ? Messages.SerialLinePanel_hostTTYSpeed_label_terminalMode : 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(SWTControlUtil.getText(hostTTYSpeedCombo))) {
- 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 = SWTControlUtil.indexOf(hostTTYSpeedCombo, fcEditableTTYOther);
- if (index != -1 && index == SWTControlUtil.getItemCount(hostTTYSpeedCombo) - 1) {
- SWTControlUtil.add(hostTTYSpeedCombo, device.trim());
- } else if (index != -1) {
- SWTControlUtil.setItem(hostTTYSpeedCombo, index + 1, device.trim());
- }
- SWTControlUtil.setText(hostTTYSpeedCombo, device.trim());
- } else if (lastSelectedBaud != -1) {
- SWTControlUtil.setText(hostTTYSpeedCombo, SWTControlUtil.getItem(hostTTYSpeedCombo, lastSelectedBaud));
- }
- } else if (lastSelectedBaud != -1){
- SWTControlUtil.setText(hostTTYSpeedCombo, SWTControlUtil.getItem(hostTTYSpeedCombo, lastSelectedBaud));
- }
- }
- lastSelectedBaud = SWTControlUtil.getSelectionIndex(hostTTYSpeedCombo);
-
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.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. If we are in the wizard, we can show a progress
- // bar in the bottom of the wizard. Otherwise, show at least a busy indicator.
- if (getParentControl().getRunnableContext() instanceof WizardDialog) {
- IRunnableContext context = getParentControl().getRunnableContext();
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(Messages.SerialLinePanel_task_queryAvailableSerialDevices, IProgressMonitor.UNKNOWN);
- queryAvailableSerialDevices();
- monitor.done();
- }
- };
- try {
- context.run(true, false, runnable);
- } catch (InvocationTargetException e) {
- /* ignored on purpose. The runnable is directly declared here. */
- } catch (InterruptedException e) {
- /* ignored on purpose. The runnable is not cancelable */
- }
- } else {
- 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
- if (editable) {
- SWTControlUtil.add(hostTTYDeviceCombo, fcEditableTTYOther);
- }
-
- if (SWTControlUtil.indexOf(hostTTYDeviceCombo, getDefaultHostTTYDevice()) != -1) {
- SWTControlUtil.setText(hostTTYDeviceCombo, getDefaultHostTTYDevice());
- } else {
- if ("".equals(SWTControlUtil.getText(hostTTYDeviceCombo)) && SWTControlUtil.getItemCount(hostTTYDeviceCombo) > 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 (SWTControlUtil.getItemCount(hostTTYDeviceCombo) == 1
- && fcEditableTTYOther.equals(SWTControlUtil.getItem(hostTTYDeviceCombo, 0))) {
- SWTControlUtil.add(hostTTYDeviceCombo, "", 0, true); //$NON-NLS-1$
- }
- SWTControlUtil.setText(hostTTYDeviceCombo, SWTControlUtil.getItem(hostTTYDeviceCombo, 0));
- }
- }
-
- if (SWTControlUtil.getItemCount(hostTTYDeviceCombo) > 0) {
- SWTControlUtil.setEnabled(hostTTYDeviceCombo, true);
- } else {
- SWTControlUtil.setEnabled(hostTTYDeviceCombo, false);
- }
- lastSelected = SWTControlUtil.getSelectionIndex(hostTTYDeviceCombo);
-
- for (String fcTTYSpeedRate : fcTTYSpeedRates) {
- SWTControlUtil.add(hostTTYSpeedCombo, fcTTYSpeedRate);
- }
- if (editable) {
- SWTControlUtil.add(hostTTYSpeedCombo, fcEditableTTYOther);
- }
-
- SWTControlUtil.setText(hostTTYSpeedCombo, fcDefaultTTYSpeed);
- lastSelectedBaud = SWTControlUtil.getSelectionIndex(hostTTYSpeedCombo);
-
- // add the advanced serial options if configured
- if (showAdvancedSerialOptions) {
- Composite bitsPanel = terminalMode ? client : new Composite(client, SWT.NONE);
- if (!terminalMode) {
- layout = new GridLayout();
- layout.marginHeight = 0; layout.marginWidth = 0;
- layout.numColumns = 3;
- bitsPanel.setLayout(layout);
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
- layoutData.horizontalSpan = 4;
- bitsPanel.setLayoutData(layoutData);
- }
-
- Composite panel2 = terminalMode ? client : new Composite(bitsPanel, SWT.NONE);
- if (!terminalMode) {
- layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- hostTTYBitsLabel = new Label(panel2, SWT.NONE);
- hostTTYBitsLabel.setText(Messages.SerialLinePanel_hostTTYDatabits_label);
- hostTTYBitsCombo = new Combo(panel2, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYBitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYBitsCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.validate();
- }
- });
-
- for (String fcTTYDatabit : fcTTYDatabits) {
- SWTControlUtil.add(hostTTYBitsCombo, fcTTYDatabit);
- }
- SWTControlUtil.setText(hostTTYBitsCombo, fcDefaultTTYDatabits);
-
- hostTTYParityLabel = new Label(panel2, SWT.NONE);
- hostTTYParityLabel.setText(Messages.SerialLinePanel_hostTTYParity_label);
- hostTTYParityCombo = new Combo(panel2, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYParityCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYParityCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.validate();
- }
- });
-
- for (String element : fcTTYParity) {
- SWTControlUtil.add(hostTTYParityCombo, element);
- }
- SWTControlUtil.setText(hostTTYParityCombo, fcDefaultTTYParity);
-
- hostTTYStopbitsLabel = new Label(panel2, SWT.NONE);
- hostTTYStopbitsLabel.setText(Messages.SerialLinePanel_hostTTYStopbits_label);
- hostTTYStopbitsCombo = new Combo(panel2, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYStopbitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYStopbitsCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.validate();
- }
- });
-
- for (String fcTTYStopbit : fcTTYStopbits) {
- SWTControlUtil.add(hostTTYStopbitsCombo, fcTTYStopbit);
- }
- SWTControlUtil.setText(hostTTYStopbitsCombo, fcDefaultTTYStopbits);
-
- hostTTYFlowControlLabel = new Label(panel2, SWT.NONE);
- hostTTYFlowControlLabel.setText(Messages.SerialLinePanel_hostTTYFlowControl_label);
- hostTTYFlowControlCombo = new Combo(panel2, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- hostTTYFlowControlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYFlowControlCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.validate();
- }
- });
-
- for (String element : fcTTYFlowControl) {
- SWTControlUtil.add(hostTTYFlowControlCombo, element);
- }
- SWTControlUtil.setText(hostTTYFlowControlCombo, fcDefaultTTYFlowControl);
-
- if (terminalMode) {
- hostTTYTimeoutLabel = new Label(panel2, SWT.NONE);
- hostTTYTimeoutLabel.setText(Messages.SerialLinePanel_hostTTYTimeout_label);
- hostTTYTimeoutText = new Text(panel2, SWT.SINGLE | SWT.BORDER);
- hostTTYTimeoutText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- hostTTYTimeoutText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- IValidatingContainer validatingContainer = SerialLinePanel.this.getParentControl().getValidatingContainer();
- if (validatingContainer != null) validatingContainer.validate();
- }
- });
- SWTControlUtil.setText(hostTTYTimeoutText, 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) {
- SWTControlUtil.add(hostTTYDeviceCombo, 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) {
- SWTControlUtil.setEnabled(hostTTYDeviceLabel, enabled);
- SWTControlUtil.setEnabled(hostTTYDeviceCombo, enabled);
- SWTControlUtil.setEnabled(hostTTYSpeedLabel, enabled);
- SWTControlUtil.setEnabled(hostTTYSpeedCombo, enabled);
- SWTControlUtil.setEnabled(hostTTYBitsLabel, enabled);
- SWTControlUtil.setEnabled(hostTTYBitsCombo, enabled);
- SWTControlUtil.setEnabled(hostTTYParityLabel, enabled);
- SWTControlUtil.setEnabled(hostTTYParityCombo, enabled);
- SWTControlUtil.setEnabled(hostTTYStopbitsLabel, enabled);
- SWTControlUtil.setEnabled(hostTTYStopbitsCombo, enabled);
- SWTControlUtil.setEnabled(hostTTYFlowControlLabel, enabled);
- SWTControlUtil.setEnabled(hostTTYFlowControlCombo, 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 (SWTControlUtil.indexOf(combo, value) != 1) {
- SWTControlUtil.setText(combo, 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 < SWTControlUtil.getItemCount(hostTTYDeviceCombo)) {
- SWTControlUtil.setText(hostTTYDeviceCombo, SWTControlUtil.getItem(hostTTYDeviceCombo, 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 = SWTControlUtil.getText(hostTTYDeviceCombo);
- 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 = SWTControlUtil.getText(hostTTYSpeedCombo);
- 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;
- }
-
- if (showAdvancedSerialOptions) {
- String option = SWTControlUtil.getText(hostTTYBitsCombo);
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYDatabits, IMessageProvider.ERROR);
- return false;
- }
-
- option = SWTControlUtil.getText(hostTTYParityCombo);
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYParity, IMessageProvider.ERROR);
- return false;
- }
-
- option = SWTControlUtil.getText(hostTTYStopbitsCombo);
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYStopbits, IMessageProvider.ERROR);
- return false;
- }
-
- option = SWTControlUtil.getText(hostTTYFlowControlCombo);
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR);
- return false;
- }
-
- if (terminalMode) {
- option = SWTControlUtil.getText(hostTTYTimeoutText);
- if (option == null || option.trim().length() == 0) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR);
- return false;
- }
- }
- }
-
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.nodes.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- Assert.isNotNull(data);
-
- boolean isDirty = false;
-
- if (!terminalMode) {
- @SuppressWarnings("unchecked")
- Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME);
- if (container == null) container = new HashMap<String, Object>();
-
- String value = SWTControlUtil.getText(hostTTYDeviceCombo);
- if (value != null) isDirty |= !value.equals(container.get(IWireTypeSerial.PROPERTY_SERIAL_DEVICE) != null ? container.get(IWireTypeSerial.PROPERTY_SERIAL_DEVICE) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYSpeedCombo);
- if (value != null) isDirty |= !value.equals(container.get(IWireTypeSerial.PROPERTY_SERIAL_BAUD_RATE) != null ? container.get(IWireTypeSerial.PROPERTY_SERIAL_BAUD_RATE) : ""); //$NON-NLS-1$
-
- if (showAdvancedSerialOptions) {
- value = SWTControlUtil.getText(hostTTYBitsCombo);
- if (value != null) isDirty |= !value.equals(container.get(IWireTypeSerial.PROPERTY_SERIAL_DATA_BITS) != null ? container.get(IWireTypeSerial.PROPERTY_SERIAL_DATA_BITS) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYParityCombo);
- if (value != null) isDirty |= !value.equals(container.get(IWireTypeSerial.PROPERTY_SERIAL_PARITY) != null ? container.get(IWireTypeSerial.PROPERTY_SERIAL_PARITY) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYStopbitsCombo);
- if (value != null) isDirty |= !value.equals(container.get(IWireTypeSerial.PROPERTY_SERIAL_STOP_BITS) != null ? container.get(IWireTypeSerial.PROPERTY_SERIAL_STOP_BITS) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYFlowControlCombo);
- if (value != null) isDirty |= !value.equals(container.get(IWireTypeSerial.PROPERTY_SERIAL_FLOW_CONTROL) != null ? container.get(IWireTypeSerial.PROPERTY_SERIAL_FLOW_CONTROL) : ""); //$NON-NLS-1$
- }
- } else {
- String value = SWTControlUtil.getText(hostTTYDeviceCombo);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYSpeedCombo);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE) : ""); //$NON-NLS-1$
-
- if (showAdvancedSerialOptions) {
- value = SWTControlUtil.getText(hostTTYBitsCombo);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYParityCombo);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYStopbitsCombo);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYFlowControlCombo);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL) : ""); //$NON-NLS-1$
-
- value = SWTControlUtil.getText(hostTTYTimeoutText);
- if (value != null) isDirty |= !value.equals(data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT) != null ? data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT) : ""); //$NON-NLS-1$
- }
- }
-
- return isDirty;
- }
-
- 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(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix));
- if (selectedTTYDevice != null && selectedTTYDevice.trim().length() > 0) {
- if (SWTControlUtil.indexOf(hostTTYDeviceCombo, selectedTTYDevice) != -1) {
- SWTControlUtil.setText(hostTTYDeviceCombo, selectedTTYDevice);
- }
- }
-
- String selectedTTYSpeedRate = settings.get(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix));
- if (selectedTTYSpeedRate != null && selectedTTYSpeedRate.trim().length() > 0) {
- if (SWTControlUtil.indexOf(hostTTYSpeedCombo, selectedTTYSpeedRate) != -1) {
- SWTControlUtil.setText(hostTTYSpeedCombo, selectedTTYSpeedRate);
- }
- }
-
- if (showAdvancedSerialOptions) {
- String option = settings.get(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && SWTControlUtil.indexOf(hostTTYBitsCombo, option) != -1) {
- SWTControlUtil.setText(hostTTYBitsCombo, option);
- }
-
- option = settings.get(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && SWTControlUtil.indexOf(hostTTYParityCombo, option) != -1) {
- SWTControlUtil.setText(hostTTYParityCombo, option);
- }
-
- option = settings.get(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && SWTControlUtil.indexOf(hostTTYStopbitsCombo, option) != -1) {
- SWTControlUtil.setText(hostTTYStopbitsCombo, option);
- }
-
- option = settings.get(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && SWTControlUtil.indexOf(hostTTYFlowControlCombo, option) != -1) {
- SWTControlUtil.setText(hostTTYFlowControlCombo, option);
- }
-
- if (terminalMode) {
- option = settings.get(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix));
- if (option != null && option.trim().length() > 0 && SWTControlUtil.indexOf(hostTTYTimeoutText, option) != -1) {
- SWTControlUtil.setText(hostTTYTimeoutText, 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(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix), SWTControlUtil.getText(hostTTYDeviceCombo));
- settings.put(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix), SWTControlUtil.getText(hostTTYSpeedCombo));
-
- if (showAdvancedSerialOptions) {
- settings.put(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix), SWTControlUtil.getText(hostTTYBitsCombo));
- settings.put(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix), SWTControlUtil.getText(hostTTYParityCombo));
- settings.put(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix), SWTControlUtil.getText(hostTTYStopbitsCombo));
- settings.put(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix), SWTControlUtil.getText(hostTTYFlowControlCombo));
-
- if (terminalMode) {
- settings.put(getParentControl().prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix), SWTControlUtil.getText(hostTTYTimeoutText));
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataExchangeNode#setupData(org.eclipse.tcf.te.runtime.interfaces.nodes.IPropertiesContainer)
- */
- @Override
- public void setupData(IPropertiesContainer data) {
- if (data == null) return;
-
- if (!terminalMode) {
- @SuppressWarnings("unchecked")
- Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME);
- if (container == null) container = new HashMap<String, Object>();
-
- SWTControlUtil.setText(hostTTYDeviceCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_DEVICE));
- SWTControlUtil.setText(hostTTYSpeedCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_BAUD_RATE));
-
- if (showAdvancedSerialOptions) {
- SWTControlUtil.setText(hostTTYBitsCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_DATA_BITS));
- SWTControlUtil.setText(hostTTYParityCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_PARITY));
- SWTControlUtil.setText(hostTTYStopbitsCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_STOP_BITS));
- SWTControlUtil.setText(hostTTYFlowControlCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_FLOW_CONTROL));
- }
- } else {
- // In terminal mode, read the properties directly from the given properties container
- // and use the constants from ITerminalConnectorConstants!
- SWTControlUtil.setText(hostTTYDeviceCombo, data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE));
- SWTControlUtil.setText(hostTTYSpeedCombo, data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE));
-
- if (showAdvancedSerialOptions) {
- SWTControlUtil.setText(hostTTYBitsCombo, data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS));
- SWTControlUtil.setText(hostTTYParityCombo, data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY));
- SWTControlUtil.setText(hostTTYStopbitsCombo, data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS));
- SWTControlUtil.setText(hostTTYFlowControlCombo, data.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL));
- SWTControlUtil.setText(hostTTYTimeoutText, data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT));
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataExchangeNode#extractData(org.eclipse.tcf.te.runtime.interfaces.nodes.IPropertiesContainer)
- */
- @Override
- public void extractData(IPropertiesContainer data) {
- if (data == null) return;
-
- if (!terminalMode) {
- @SuppressWarnings("unchecked")
- Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME);
- if (container == null) container = new HashMap<String, Object>();
-
- container.put(IWireTypeSerial.PROPERTY_SERIAL_DEVICE, SWTControlUtil.getText(hostTTYDeviceCombo));
- container.put(IWireTypeSerial.PROPERTY_SERIAL_BAUD_RATE, SWTControlUtil.getText(hostTTYSpeedCombo));
-
- container.put(IWireTypeSerial.PROPERTY_SERIAL_DATA_BITS, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYBitsCombo) : null);
- container.put(IWireTypeSerial.PROPERTY_SERIAL_PARITY, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYParityCombo) : null);
- container.put(IWireTypeSerial.PROPERTY_SERIAL_STOP_BITS, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYStopbitsCombo) : null);
- container.put(IWireTypeSerial.PROPERTY_SERIAL_FLOW_CONTROL, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYFlowControlCombo) : null);
-
- data.setProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME, !container.isEmpty() ? container : null);
- } else {
- // In terminal mode, write the properties directly to the given properties container
- // and use the constants from ITerminalConnectorConstants!
- data.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, SWTControlUtil.getText(hostTTYDeviceCombo));
- data.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, SWTControlUtil.getText(hostTTYSpeedCombo));
-
- data.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYBitsCombo) : null);
- data.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYParityCombo) : null);
- data.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYStopbitsCombo) : null);
- data.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYFlowControlCombo) : null);
-
- data.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, showAdvancedSerialOptions ? SWTControlUtil.getText(hostTTYTimeoutText) : null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode2#initializeData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void initializeData(IPropertiesContainer data) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode3#removeData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void removeData(IPropertiesContainer data) {
- if (data == null) return;
- data.setProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME, null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode3#copyData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void copyData(IPropertiesContainer src, IPropertiesContainer dst) {
- Assert.isNotNull(src);
- Assert.isNotNull(dst);
-
- @SuppressWarnings("unchecked")
- Map<String, Object> srcContainer = (Map<String, Object>)src.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME);
- Map<String, Object> dstContainer = null;
-
- if (srcContainer != null) {
- dstContainer = new HashMap<String, Object>(srcContainer);
- }
-
- dst.setProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME, dstContainer);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java
deleted file mode 100644
index 738577fac..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialPortAddressDialog.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************
- * 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.ui.controls.wire.serial;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.controls.help.IContextHelpIds;
-import org.eclipse.tcf.te.ui.controls.net.RemoteHostAddressControl;
-import org.eclipse.tcf.te.ui.controls.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.validator.NameOrIPValidator;
-import org.eclipse.tcf.te.ui.controls.validator.NumberValidator;
-import org.eclipse.tcf.te.ui.controls.validator.PortNumberValidator;
-import org.eclipse.tcf.te.ui.controls.validator.PortNumberVerifyListener;
-import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-import org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog;
-
-/**
- * Serial line port or address dialog.
- */
-public class SerialPortAddressDialog extends CustomTitleAreaDialog {
-
- BaseEditBrowseTextControl ttyControl;
- RemoteHostAddressControl addressControl;
- BaseEditBrowseTextControl portControl;
-
- Validator ttyValidator;
- Validator portValidator;
-
- List<String> ttyHistory;
- List<String> tcpHistory;
-
- String data = null;
-
- /**
- * Constructor.
- * @param parentShell
- */
- public SerialPortAddressDialog(Shell parentShell, String selected, List<String> ttyHistory, List<String> tcpHistory) {
- super(parentShell, IContextHelpIds.SERIAL_PORT_ADDRESS_DIALOG);
- this.ttyHistory = ttyHistory;
- this.tcpHistory = tcpHistory;
- this.data = selected;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#isResizable()
- */
- @Override
- protected boolean isResizable() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected void createDialogAreaContent(Composite parent) {
- super.createDialogAreaContent(parent);
-
- setDialogTitle(Messages.SerialLinePanel_customSerialDevice_title);
-
- Composite ttyComp = new Composite(parent, SWT.NONE);
- GridLayout gl = new GridLayout();
- ttyComp.setLayout(gl);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = 250;
- ttyComp.setLayoutData(gd);
-
- ttyControl = new BaseEditBrowseTextControl(null);
- ttyControl.setLabelIsButton(true);
- parent.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- boolean enable = ttyHistory != null && ttyHistory.contains(data);
- setTTYControlEnabled(enable);
- setTCPControlEnabled(!enable);
- onModify();
- }
- });
- ttyControl.setIsGroup(false);
- ttyControl.setEditFieldLabel(Messages.SerialLinePanel_hostTTYDevice_label);
- ttyControl.setHideBrowseButton(true);
- ttyControl.setupPanel(ttyComp);
- ((Button)ttyControl.getLabelControl()).addSelectionListener(new SelectionListener(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean selected = ((Button)ttyControl.getLabelControl()).getSelection();
- setTTYControlEnabled(selected);
- setTCPControlEnabled(!selected);
- onModify();
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- ((Combo)ttyControl.getEditFieldControl()).addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e) {
- onModify();
- }
- });
-
- Composite tcpComp = new Composite(parent, SWT.NONE);
- gl = new GridLayout(4, true);
- tcpComp.setLayout(gl);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- tcpComp.setLayoutData(gd);
-
- Composite tcpAddrComp = new Composite(tcpComp, SWT.NONE);
- gl = new GridLayout();
- gl.marginWidth = 0;
- gl.marginHeight = 0;
- tcpAddrComp.setLayout(gl);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- tcpAddrComp.setLayoutData(gd);
-
- addressControl = new RemoteHostAddressControl(null) {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText(ModifyEvent e) {
- super.modifyText(e);
- onModify();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean selected = ((Button)addressControl.getLabelControl()).getSelection();
- setTTYControlEnabled(!selected);
- setTCPControlEnabled(selected);
- onModify();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.net.RemoteHostAddressControl#setCheckResultMessage(int, java.lang.String)
- */
- @Override
- protected void setCheckResultMessage(int severity, String message) {
- SerialPortAddressDialog.this.setMessage(message, severity);
- }
- };
- addressControl.setLabelIsButton(true);
- addressControl.setIsGroup(false);
- addressControl.setEditFieldLabel(org.eclipse.tcf.te.ui.controls.nls.Messages.RemoteHostAddressControl_label);
- addressControl.setButtonLabel(org.eclipse.tcf.te.ui.controls.nls.Messages.RemoteHostAddressControl_button_label);
- addressControl.setupPanel(tcpAddrComp);
-
- Composite tcpPortComp = new Composite(tcpComp, SWT.NONE);
- gl = new GridLayout();
- gl.marginWidth = 0;
- gl.marginHeight = 0;
- tcpPortComp.setLayout(gl);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- tcpPortComp.setLayoutData(gd);
-
- portControl = new BaseEditBrowseTextControl(null);
- portControl.setIsGroup(false);
- portControl.setEditFieldLabel(Messages.SerialPortAddressDialog_port);
- portControl.setHideBrowseButton(true);
- portControl.setupPanel(tcpPortComp);
- ((Combo)portControl.getEditFieldControl()).addVerifyListener(new PortNumberVerifyListener(PortNumberVerifyListener.ATTR_DECIMAL | PortNumberVerifyListener.ATTR_HEX));
- ((Combo)portControl.getEditFieldControl()).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();
- }
- });
-
- ttyValidator = new Validator(Validator.ATTR_MANDATORY) {
- private final Pattern fValidCharacters = System.getProperty("os.name","").toLowerCase().startsWith("windows") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ? Pattern.compile("[\\w]+") : Pattern.compile("[\\w/]+"); //$NON-NLS-1$ //$NON-NLS-2$
-
- @Override
- public boolean isValid(String newText) {
- setMessage(null);
- setMessageType(INFORMATION);
- if (newText != null && newText.trim().length() > 0) {
- Matcher matcher = fValidCharacters.matcher(newText);
- if (!matcher.matches()) {
- setMessage(Messages.SerialLinePanel_error_invalidCharactes, ERROR);
- }
- }
- else if (newText != null) {
- setMessage(Messages.SerialLinePanel_error_emptyHostTTYDevice, INFORMATION);
- }
- return getMessageType() != ERROR;
- }
- };
- ttyControl.setEditFieldValidator(ttyValidator);
-
- portValidator = new PortNumberValidator(Validator.ATTR_MANDATORY | PortNumberValidator.ATTR_DECIMAL | PortNumberValidator.ATTR_HEX);
- portValidator.setMessageText(RegexValidator.INFO_MISSING_VALUE,
- Messages.SerialPortAddressDialog_Information_MissingPort);
- portValidator.setMessageText(RegexValidator.ERROR_INVALID_VALUE,
- Messages.SerialPortAddressDialog_Error_InvalidPort);
- portValidator.setMessageText(NumberValidator.ERROR_INVALID_RANGE,
- Messages.SerialPortAddressDialog_Error_InvalidPortRange);
- portControl.setEditFieldValidator(portValidator);
-
- applyDialogFont(ttyComp);
- applyDialogFont(tcpComp);
-
- setupData();
- }
-
- private void setupData() {
- setTTYControlEnabled(true);
- setTCPControlEnabled(false);
- if (ttyHistory != null && !ttyHistory.isEmpty()) {
- for (String tty : ttyHistory) {
- ttyControl.addToEditFieldControlHistory(tty.trim());
- if (tty.equals(data)) {
- ttyControl.setEditFieldControlText(tty.trim());
- }
- }
- }
- if (tcpHistory != null && !tcpHistory.isEmpty()) {
- for (String tcp : tcpHistory) {
- String[] data = tcp.split(":"); //$NON-NLS-1$
- if (data.length > 1) {
- addressControl.addToEditFieldControlHistory(data[1]);
- }
- if (data.length > 2) {
- portControl.addToEditFieldControlHistory(data[2]);
- }
- if (tcp.equals(this.data)) {
- setTTYControlEnabled(false);
- setTCPControlEnabled(true);
- if (data.length > 1) {
- addressControl.setEditFieldControlText(data[1]);
- }
- if (data.length > 2) {
- portControl.setEditFieldControlText(data[2]);
- }
- }
- }
- }
- onModify();
- }
-
- void setTTYControlEnabled(boolean enable) {
- ttyControl.setLabelControlSelection(enable);
- ttyControl.getEditFieldControl().setEnabled(enable);
- }
-
- void setTCPControlEnabled(boolean enable) {
- addressControl.setLabelControlSelection(enable);
- addressControl.getEditFieldControl().setEnabled(enable);
- addressControl.getButtonControl().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 (((Button)ttyControl.getLabelControl()).getSelection()) {
- data = ttyControl.getEditFieldControlText();
- }
- else {
- data = "tcp:" + addressControl.getEditFieldControlText() + ":" + portControl.getEditFieldControlText(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- super.okPressed();
- }
-
- void onModify() {
- setMessage(null);
-
- boolean ttySelected = ((Button)ttyControl.getLabelControl()).getSelection();
-
- boolean isTTYValid = ttyControl.isValid();
- if (ttySelected && ttyControl.getMessageType() > getMessageType()) {
- setMessage(ttyControl.getMessage(), ttyControl.getMessageType());
- }
-
- boolean isTCPValid = addressControl.isValid();
- if (!ttySelected && addressControl.getMessageType() > getMessageType()) {
- setMessage(addressControl.getMessage(), addressControl.getMessageType());
- }
-
- isTCPValid &= portControl.isValid();
- if (!ttySelected && portControl.getMessageType() > getMessageType()) {
- setMessage(portControl.getMessage(), portControl.getMessageType());
- }
-
- if (getMessage() == null) {
- setDefaultMessage(Messages.SerialLinePanel_customSerialDevice_message, IMessageProvider.INFORMATION);
- }
-
- addressControl.getButtonControl().setEnabled(!ttySelected && addressControl.isValid() &&
- (addressControl.getEditFieldValidator() instanceof NameOrIPValidator) &&
- ((NameOrIPValidator)addressControl.getEditFieldValidator()).isName());
- setButtonEnabled(OK, ttySelected ? isTTYValid : isTCPValid);
- }
-
- /**
- * Return the new name after OK was pressed.
- * Unless OK was pressed, the old name is returned.
- */
- public String getData() {
- return data;
- }
-}
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
index 068f6c0ed..8c59ff792 100644
--- 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
@@ -6,21 +6,16 @@ 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: com.google.gson;bundle-version="2.2.4",
- org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional,
+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.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.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.swt;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.tcf.te.ui.controls;bundle-version="1.3.0",
- org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.tcf.te.ui;bundle-version="1.3.0",
- org.eclipse.ui.forms;bundle-version="3.5.200",
- org.eclipse.tcf.te.ui.terminals.process;bundle-version="1.3.0"
+ org.eclipse.ui.forms;bundle-version="3.5.200"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
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
index 9013e8f32..80de64f1c 100644
--- 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
@@ -12,8 +12,8 @@ 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.runtime.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
+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;
@@ -44,7 +44,7 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Convenience method which returns the unique identifier of this plugin.
+ * Convenience method which returns the unique identifier of this plug-in.
*/
public static String getUniqueIdentifier() {
if (getDefault() != null && getDefault().getBundle() != null) {
@@ -54,7 +54,7 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Return the scoped preferences for this plugin.
+ * Return the scoped preferences for this plug-in.
*/
public static ScopedEclipsePreferences getScopedPreferences() {
if (scopedPreferences == null) {
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
index 7b3e3249b..8384b530e 100644
--- 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
@@ -9,7 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.local.controls;
-import org.eclipse.core.resources.IResource;
+import java.util.Map;
+
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -17,35 +18,33 @@ 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.events.TypedEvent;
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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+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 AbstractConfigurationPanel implements IDataExchangeNode {
+public class LocalWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
- private IResource resource;
+ private Object resource;
/**
* Constructor.
*
- * @param parentControl The parent control. Must not be <code>null</code>!
+ * @param container The configuration panel container or <code>null</code>.
*/
- public LocalWizardConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
+ public LocalWizardConfigurationPanel(IConfigurationPanelContainer container) {
+ super(container);
}
/* (non-Javadoc)
@@ -77,51 +76,47 @@ public class LocalWizardConfigurationPanel extends AbstractConfigurationPanel im
layoutData.heightHint = 80;
label.setLayoutData(layoutData);
- resource = getSelectionResource();
+ 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.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
*/
@Override
- public void setupData(IPropertiesContainer data) {
+ public void setupData(Map<String, Object> data) {
if (data == null) return;
- String value = data.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
+ String value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
if (value != null) setEncoding(value);
}
-
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
*/
@Override
- public void extractData(IPropertiesContainer data) {
+ public void extractData(Map<String, Object> data) {
// set the terminal connector id for local terminal
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
// set the connector type for local terminal
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
// Store the encoding
- data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
-
- // if we have a IResource selection use the location for working directory
- if (resource != null){
- String dir = resource.getProject().getLocation().toString();
- data.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
- }
+ 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)
@@ -185,17 +180,17 @@ public class LocalWizardConfigurationPanel extends AbstractConfigurationPanel im
*
* @return the IResource, or <code>null</code>.
*/
- private IResource getSelectionResource() {
+ 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 IResource){
- return ((IResource)element);
+ if (element instanceof org.eclipse.core.resources.IResource){
+ return ((org.eclipse.core.resources.IResource)element);
}
if (element instanceof IAdaptable) {
- return (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ 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
index fb64f5a17..d3fde5c3d 100644
--- 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
@@ -10,12 +10,13 @@
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.Iterator;
+import java.util.Map;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
@@ -24,14 +25,12 @@ 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.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+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.launcher.AbstractLauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
@@ -40,6 +39,7 @@ import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchEncoding;
+import org.osgi.framework.Bundle;
/**
* Serial launcher delegate implementation.
@@ -57,24 +57,24 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
*/
@Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return new LocalWizardConfigurationPanel(parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new LocalWizardConfigurationPanel(container);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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(IPropertiesContainer properties, ICallback callback) {
+ 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.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
}
// If not configured, set the default encodings for the local terminal
@@ -87,13 +87,13 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
} else {
encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
}
- if (encoding != null && !"".equals(encoding)) properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, encoding); //$NON-NLS-1$
+ 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.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
+ properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
}
// Initialize the local terminal working directory.
@@ -112,11 +112,14 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
} catch (URISyntaxException ex) { /* ignored on purpose */ }
}
} else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
- if (ResourcesPlugin.getWorkspace() != null
- && ResourcesPlugin.getWorkspace().getRoot() != null
- && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- cwd = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
- }
+ 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()) {
@@ -125,14 +128,14 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
}
if (cwd != null && !"".equals(cwd)) { //$NON-NLS-1$
- properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, cwd);
+ 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.getProperty(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;
@@ -140,37 +143,40 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
while (iter.hasNext()) {
Object element = iter.next();
- // If the element is not an IResource, try to adapt to IResource
- if (!(element instanceof IResource)) {
- Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(IResource.class) : null;
- if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, IResource.class);
- if (adapted != null) element = adapted;
- }
+ 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 IResource && ((IResource)element).exists()) {
- IPath location = ((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 (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.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
String basename = new Path(dir).lastSegment();
- properties.setProperty(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
- terminal.openConsole(properties, callback);
+ terminal.openConsole(properties, done);
}
}
@@ -181,11 +187,13 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
- private String getTerminalTitle(IPropertiesContainer properties) {
- String[] hostNames= IPAddressUtil.getInstance().getCanonicalHostNames();
- if (hostNames.length != 0){
- return hostNames[0];
- }
+ 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$
}
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
index b3e441b19..879461855 100644
--- 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
@@ -9,13 +9,14 @@
*******************************************************************************/
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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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;
@@ -46,10 +47,10 @@ public class LocalLauncherHandler extends AbstractHandler {
// Launch the local terminal
if (delegate != null) {
- IPropertiesContainer properties = new PropertiesContainer();
- properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- properties.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
- properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
delegate.execute(properties, 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
index 5596ddb38..b1852b64a 100644
--- 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
@@ -9,8 +9,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.local.launcher;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento;
@@ -20,20 +21,19 @@ import org.eclipse.ui.IMemento;
public class LocalMementoHandler implements IMementoHandler {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void saveState(IMemento memento, IPropertiesContainer properties) {
+ 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, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void restoreState(IMemento memento, IPropertiesContainer properties) {
+ 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
index b86b7c04d..5052f96cf 100644
--- 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
@@ -49,18 +49,10 @@ public class Messages extends NLS {
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_name_info_missingValue;
- public static String ExternalExecutablesDialog_path_info_missingFilename;
- public static String ExternalExecutablesDialog_path_error_mustExist;
- public static String ExternalExecutablesDialog_path_error_invalidFilename;
- public static String ExternalExecutablesDialog_path_error_noAccess;
- public static String ExternalExecutablesDialog_path_error_isRelativ;
+ public static String ExternalExecutablesDialog_field_name;
public static String ExternalExecutablesDialog_field_args;
public static String ExternalExecutablesDialog_field_icon;
public static String ExternalExecutablesDialog_field_translate;
- public static String ExternalExecutablesDialog_icon_error_mustExist;
- public static String ExternalExecutablesDialog_icon_error_invalidFilename;
- public static String ExternalExecutablesDialog_icon_error_noAccess;
- public static String ExternalExecutablesDialog_icon_error_isRelativ;
}
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
index a48a0977c..626196402 100644
--- 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
@@ -13,20 +13,12 @@ ProcessConnector_error_creatingProcess=Exception when creating process. Possibly
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_name_info_missingValue=Please enter a valid name for the external executable.
-ExternalExecutablesDialog_path_info_missingFilename=Please enter the absolute path of the external executable.
-ExternalExecutablesDialog_path_error_mustExist=The external executable path you entered doesn't exist.
-ExternalExecutablesDialog_path_error_invalidFilename=The external executable path you entered is not valid.
-ExternalExecutablesDialog_path_error_noAccess=The external executable path cannot be accessed.
-ExternalExecutablesDialog_path_error_isRelativ=The external executable path cannot be relative.
+ExternalExecutablesDialog_field_name=Name:
ExternalExecutablesDialog_field_args=Arguments:
ExternalExecutablesDialog_field_icon=Icon:
ExternalExecutablesDialog_field_translate=Translate Backslashes on Paste
-ExternalExecutablesDialog_icon_error_mustExist=The external executable icon path you entered doesn't exist.
-ExternalExecutablesDialog_icon_error_invalidFilename=The external executable icon path you entered is not valid.
-ExternalExecutablesDialog_icon_error_noAccess=The external executable icon path cannot be accessed.
-ExternalExecutablesDialog_icon_error_isRelativ=The external executable icon path cannot be relative.
# ***** Preference Pages *****
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
index d05e81de1..7aa244eb6 100644
--- 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
@@ -10,11 +10,11 @@
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.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
@@ -22,10 +22,7 @@ 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.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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;
@@ -63,15 +60,15 @@ public class DynamicContributionItems extends CompoundContributionItem implement
List<IContributionItem> items = new ArrayList<IContributionItem>();
if (delegate != null) {
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
if (l != null && !l.isEmpty()) {
- for (Map<String, Object> executableData : l) {
- String name = (String) executableData.get(IExternalExecutablesProperties.PROP_NAME);
- String path = (String) executableData.get(IExternalExecutablesProperties.PROP_PATH);
- String args = (String) executableData.get(IExternalExecutablesProperties.PROP_ARGS);
- String icon = (String) executableData.get(IExternalExecutablesProperties.PROP_ICON);
+ 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 = (String) executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
+ 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$
@@ -116,19 +113,15 @@ public class DynamicContributionItems extends CompoundContributionItem implement
ISelection selection = service != null ? service.getSelection() : null;
if (selection != null && selection.isEmpty()) selection = null;
- IPropertiesContainer properties = new PropertiesContainer();
- properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- properties.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
- if (selection != null) properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
- properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path);
- if (args != null) properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args);
- properties.setProperty(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, translate);
-
- delegate.execute(properties, new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- }
- });
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ 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);
}
};
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
index fedc5b072..0179898e3 100644
--- 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
@@ -9,42 +9,52 @@
*******************************************************************************/
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.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.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.controls.common.NameControl;
-import org.eclipse.tcf.te.ui.controls.file.FileSelectionControl;
-import org.eclipse.tcf.te.ui.controls.validator.FileNameValidator;
-import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-import org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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 CustomTrayDialog implements IValidatingContainer {
+public class ExternalExecutablesDialog extends TrayDialog {
+ private String contextHelpId = null;
private final boolean edit;
- private NameControl name;
- private FileSelectionControl path;
- private BaseEditBrowseTextControl args;
- private FileSelectionControl icon;
+
+ private Text name;
+ /* default */ Text path;
+ private Text args;
+ /* default */ Text icon;
private Button translate;
- private Map<String, Object> executableData;
+ /* default */ String last_filter_path = null;
+ /* default */ String last_filter_icon = null;
+
+ private Map<String, String> executableData;
/**
* Constructor.
@@ -52,16 +62,61 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
* @param shell The parent shell or <code>null</code>.
*/
public ExternalExecutablesDialog(Shell shell, boolean edit) {
- super(shell, IContextHelpIds.EXTERNAL_EXECUTABLES_DIALOG);
+ super(shell);
this.edit = edit;
- }
+
+ this.contextHelpId = IContextHelpIds.EXTERNAL_EXECUTABLES_DIALOG;
+ setHelpAvailable(true);
+ }
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected void createDialogAreaContent(Composite parent) {
- super.createDialogAreaContent(parent);
+ 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(edit ? Messages.ExternalExecutablesDialog_title_edit : Messages.ExternalExecutablesDialog_title_add);
@@ -70,86 +125,146 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
layout.marginHeight = 0; layout.marginWidth = 0;
panel.setLayout(layout);
GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);
- layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(panel, 50);
+ layoutData.widthHint = convertWidthInCharsToPixels(50);
panel.setLayoutData(layoutData);
- name = new NameControl(null) {
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- super.configureEditFieldValidator(validator);
- validator.setMessageText(RegexValidator.INFO_MISSING_VALUE, Messages.ExternalExecutablesDialog_name_info_missingValue);
- }
- @Override
- public IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
- }
- };
- name.setParentControlIsInnerPanel(true);
- name.setupPanel(panel);
-
- path = new FileSelectionControl(null) {
- @Override
- protected Validator doCreateEditFieldValidator() {
- return new FileNameValidator(Validator.ATTR_MANDATORY |
- FileNameValidator.ATTR_MUST_EXIST |
- FileNameValidator.ATTR_CAN_READ |
- FileNameValidator.ATTR_ABSOLUT);
- }
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- super.configureEditFieldValidator(validator);
- validator.setMessageText(FileNameValidator.INFO_MISSING_FILE_NAME, Messages.ExternalExecutablesDialog_path_info_missingFilename);
- validator.setMessageText(FileNameValidator.ERROR_MUST_EXIST, Messages.ExternalExecutablesDialog_path_error_mustExist);
- validator.setMessageText(FileNameValidator.ERROR_INVALID_FILE_NAME, Messages.ExternalExecutablesDialog_path_error_invalidFilename);
- validator.setMessageText(FileNameValidator.ERROR_NO_ACCESS, Messages.ExternalExecutablesDialog_path_error_noAccess);
- validator.setMessageText(FileNameValidator.ERROR_IS_RELATIV, Messages.ExternalExecutablesDialog_path_error_isRelativ);
-
+ 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);
- }
- @Override
- public IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
- }
- };
- path.setIsGroup(false);
- path.setParentControlIsInnerPanel(true);
- path.setEditFieldLabel(Messages.ExternalExecutablesDialog_field_path);
- path.setupPanel(panel);
+ name = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ name.setLayoutData(layoutData);
- args = new BaseEditBrowseTextControl(null) {
+ Composite panel2 = new Composite(panel, SWT.NONE);
+ layout = new GridLayout(3, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel2.setLayout(layout);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ panel2.setLayoutData(layoutData);
+
+ label = new Label(panel2, SWT.HORIZONTAL);
+ label.setText(Messages.ExternalExecutablesDialog_field_path);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(layoutData);
+
+ path = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ path.setLayoutData(layoutData);
+
+ 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 IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
+ 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);
+ }
}
- };
- args.setEditFieldLabel(Messages.ExternalExecutablesDialog_field_args);
- args.setParentControlIsInnerPanel(true);
- args.setupPanel(panel);
+ });
- icon = new FileSelectionControl(null) {
- @Override
- protected Validator doCreateEditFieldValidator() {
- return new FileNameValidator(FileNameValidator.ATTR_MUST_EXIST | FileNameValidator.ATTR_CAN_READ | FileNameValidator.ATTR_ABSOLUT);
- }
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- super.configureEditFieldValidator(validator);
- validator.setMessageText(FileNameValidator.ERROR_MUST_EXIST, Messages.ExternalExecutablesDialog_icon_error_mustExist);
- validator.setMessageText(FileNameValidator.ERROR_INVALID_FILE_NAME, Messages.ExternalExecutablesDialog_icon_error_invalidFilename);
- validator.setMessageText(FileNameValidator.ERROR_NO_ACCESS, Messages.ExternalExecutablesDialog_icon_error_noAccess);
- validator.setMessageText(FileNameValidator.ERROR_IS_RELATIV, Messages.ExternalExecutablesDialog_icon_error_isRelativ);
+ 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);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ args.setLayoutData(layoutData);
- }
+ panel2 = new Composite(panel, SWT.NONE);
+ layout = new GridLayout(3, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel2.setLayout(layout);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ panel2.setLayoutData(layoutData);
+
+ label = new Label(panel2, SWT.HORIZONTAL);
+ label.setText(Messages.ExternalExecutablesDialog_field_icon);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(layoutData);
+
+ icon = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ icon.setLayoutData(layoutData);
+
+ 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 IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
+ 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);
+ }
}
- };
- icon.setIsGroup(false);
- icon.setParentControlIsInnerPanel(true);
- icon.setEditFieldLabel(Messages.ExternalExecutablesDialog_field_icon);
- icon.setupPanel(panel);
+ });
translate = new Button(panel, SWT.CHECK);
translate.setText(Messages.ExternalExecutablesDialog_field_translate);
@@ -158,15 +273,15 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
translate.setLayoutData(layoutData);
if (executableData != null) {
- String value = (String)executableData.get(IExternalExecutablesProperties.PROP_NAME);
- name.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_PATH);
- path.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_ARGS);
- args.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_ICON);
- icon.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
+ 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);
}
}
@@ -199,30 +314,30 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
protected void okPressed() {
if (name != null && path != null) {
// Extract the executable properties
- if (executableData == null) executableData = new HashMap<String, Object>();
+ if (executableData == null) executableData = new HashMap<String, String>();
- String value = name.getEditFieldControlText();
+ 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.getEditFieldControlText();
+ 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.getEditFieldControlText();
+ 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.getEditFieldControlText();
+ value = icon.getText();
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
executableData.put(IExternalExecutablesProperties.PROP_ICON, value);
} else {
@@ -252,7 +367,7 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
*
* @return The executable properties or <code>null</code>.
*/
- public Map<String, Object> getExecutableData() {
+ public Map<String, String> getExecutableData() {
return executableData;
}
@@ -262,44 +377,54 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
*
* @param data The executable properties or <code>null</code>.
*/
- public void setExecutableData(Map<String, Object> data) {
+ public void setExecutableData(Map<String, String> data) {
if (data == null) {
executableData = data;
} else {
- executableData = new HashMap<String, Object>(data);
+ executableData = new HashMap<String, String>(data);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ /**
+ * Validate the dialog.
*/
- @Override
public void validate() {
boolean valid = true;
- if (name != null) {
- valid = name.isValid();
- }
-
- if (path != null) {
- valid |= path.isValid();
+ if (name != null && !name.isDisposed()) {
+ valid = !"".equals(name.getText()); //$NON-NLS-1$
}
- if (args != null) {
- valid |= args.isValid();
+ 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) {
- valid |= icon.isValid();
+ 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();
+ }
}
- SWTControlUtil.setEnabled(getButton(IDialogConstants.OK_ID), valid);
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null) okButton.setEnabled(valid);
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#setMessage(java.lang.String, int)
+ /**
+ * Sets the title for this dialog.
+ *
+ * @param title The title.
*/
- @Override
- public void setMessage(String message, int messageType) {
- }
+ 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
index af9bade27..1bcca4a52 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-import org.eclipse.tcf.te.runtime.utils.Host;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
import org.eclipse.ui.IStartup;
@@ -31,7 +31,7 @@ public class ExternalExecutablesInitializer implements IStartup {
@Override
public void earlyStartup() {
// On Windows, initialize the "Git Bash" custom "Show In" menu entry
- if (Host.isWindowsHost()) {
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
String gitPath = null;
String iconPath = null;
@@ -59,12 +59,12 @@ public class ExternalExecutablesInitializer implements IStartup {
if (gitPath != null) {
// Load the configured external executables
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
- if (l == null) l = new ArrayList<Map<String, Object>>();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
+ if (l == null) l = new ArrayList<Map<String, String>>();
// Find a entry labeled "Git Bash"
- Map<String, Object> m = null;
- for (Map<String, Object> candidate : l) {
- String name = (String) candidate.get(IExternalExecutablesProperties.PROP_NAME);
+ 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;
@@ -72,7 +72,7 @@ public class ExternalExecutablesInitializer implements IStartup {
}
if (m == null) {
- m = new HashMap<String, Object>();
+ 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$
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
index 477d8b914..5178be44c 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -12,8 +12,13 @@ package org.eclipse.tcf.te.ui.terminals.local.showin;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
+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;
@@ -22,9 +27,6 @@ import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* External executables manager implementation.
*/
@@ -35,16 +37,45 @@ public class ExternalExecutablesManager {
*
* @return The list of all saved external executables or <code>null</code>.
*/
- public static List<Map<String, Object>> load() {
- List<Map<String, Object>> l = null;
+ 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.json").toFile(); //$NON-NLS-1$
+ File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$
if (f.canRead()) {
try {
- Gson g = new GsonBuilder().create();
- l = g.fromJson(new FileReader(f), List.class);
+ Properties data = new Properties();
+ data.load(new FileReader(f));
+
+ 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();
@@ -61,23 +92,31 @@ public class ExternalExecutablesManager {
*
* @param l The list of external executables or <code>null</code>.
*/
- public static void save(List<Map<String, Object>> l) {
+ public static void save(List<Map<String, String>> l) {
IPath stateLocation = UIPlugin.getDefault().getStateLocation();
if (stateLocation != null) {
- File f = stateLocation.append(".executables/data.json").toFile(); //$NON-NLS-1$
+ 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 {
try {
- Gson g = new GsonBuilder().setPrettyPrinting().create();
+ 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();
}
FileWriter w = new FileWriter(f);
- g.toJson(l, w);
+ data.store(w, null);
w.flush();
w.close();
} catch (Exception e) {
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
index bc4e2f0d8..9b4470a86 100644
--- 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
@@ -18,11 +18,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.ResourcesPlugin;
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;
@@ -39,6 +41,7 @@ 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;
@@ -52,8 +55,7 @@ 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.swt.SWTControlUtil;
-import org.eclipse.tcf.te.ui.swt.widgets.NoteCompositeHelper;
+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;
@@ -62,6 +64,7 @@ import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutab
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.
@@ -74,7 +77,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
/* default */ Combo workingDir;
private Button browseButton;
- /* default */ final List<Map<String, Object>> executables = new ArrayList<Map<String, Object>>();
+ /* 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];
@@ -91,6 +94,9 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
*/
@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);
@@ -106,14 +112,19 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
workingDir = new Combo(group, SWT.DROP_DOWN);
- workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label, Messages.PreferencePage_workingDir_eclipsews_label });
+ 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 = SWTControlUtil.convertWidthInCharsToPixels(browseButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
browseButton.setLayoutData(layoutData);
browseButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -137,11 +148,14 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
// ECLIPSE_WORKSPACE
- if (ResourcesPlugin.getWorkspace() != null
- && ResourcesPlugin.getWorkspace().getRoot() != null
- && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- ew = ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
+ 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);
@@ -211,7 +225,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
table.setLayout(tableLayout);
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.heightHint = SWTControlUtil.convertHeightInCharsToPixels(table, 10);
+ layoutData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 10);
table.setLayoutData(layoutData);
Composite buttonsPanel = new Composite(group, SWT.NONE);
@@ -223,7 +237,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
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 = SWTControlUtil.convertWidthInCharsToPixels(addButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
addButton.setLayoutData(layoutData);
addButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -231,7 +245,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
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, Object> executableData = dialog.getExecutableData();
+ Map<String, String> executableData = dialog.getExecutableData();
if (executableData != null && !executables.contains(executableData)) {
executables.add(executableData);
viewer.refresh();
@@ -243,7 +257,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
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 = SWTControlUtil.convertWidthInCharsToPixels(editButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
editButton.setLayoutData(layoutData);
editButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("unchecked")
@@ -253,11 +267,11 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
if (s instanceof IStructuredSelection && !s.isEmpty()) {
Object element = ((IStructuredSelection)s).getFirstElement();
if (element instanceof Map) {
- final Map<String, Object> m = (Map<String, Object>)element;
+ 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, Object> executableData = dialog.getExecutableData();
+ Map<String, String> executableData = dialog.getExecutableData();
if (executableData != null) {
m.clear();
m.putAll(executableData);
@@ -272,7 +286,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
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 = SWTControlUtil.convertWidthInCharsToPixels(removeButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
removeButton.setLayoutData(layoutData);
removeButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("unchecked")
@@ -376,7 +390,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
});
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
if (l != null) executables.addAll(l);
viewer.setInput(executables);
@@ -390,6 +404,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
updateButtons();
+ gc.dispose();
+
return panel;
}
@@ -398,19 +414,19 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
*/
protected void updateButtons() {
if (viewer != null) {
- SWTControlUtil.setEnabled(addButton, true);
+ addButton.setEnabled(true);
ISelection selection = viewer.getSelection();
boolean hasSelection = selection != null && !selection.isEmpty();
int count = selection instanceof IStructuredSelection ? ((IStructuredSelection)selection).size() : 0;
- SWTControlUtil.setEnabled(editButton, hasSelection && count == 1);
- SWTControlUtil.setEnabled(removeButton, hasSelection && count > 0);
+ editButton.setEnabled(hasSelection && count == 1);
+ removeButton.setEnabled(hasSelection && count > 0);
} else {
- SWTControlUtil.setEnabled(addButton, false);
- SWTControlUtil.setEnabled(editButton, false);
- SWTControlUtil.setEnabled(removeButton, false);
+ addButton.setEnabled(false);
+ editButton.setEnabled(false);
+ removeButton.setEnabled(false);
}
}
@@ -431,7 +447,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
executables.clear();
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
if (l != null) executables.addAll(l);
viewer.refresh();
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
index b5729bc4e..11d7d9d1b 100644
--- 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
@@ -10,7 +10,7 @@
package org.eclipse.tcf.te.ui.terminals.local.showin.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
+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;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
index 3586e004e..b5350ddf2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
@@ -15,22 +15,22 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.runtime.utils.Host;
+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.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.process.ProcessSettings;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
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.osgi.framework.Bundle;
/**
* Streams terminal connector type implementation.
@@ -46,7 +46,7 @@ public class LocalConnectorType extends AbstractConnectorType {
*/
private final File defaultShell() {
String shell = null;
- if (Host.isWindowsHost()) {
+ 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 {
@@ -65,64 +65,64 @@ public class LocalConnectorType extends AbstractConnectorType {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
@Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_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.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) {
+ || properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) {
File defaultShell = defaultShell();
image = defaultShell.isAbsolute() ? defaultShell.getAbsolutePath() : defaultShell.getPath();
} else {
- image = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
+ image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
}
// Determine if a PTY will be used
- boolean isUsingPTY = (properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_OBJ) == null && PTY.isSupported(PTY.Mode.TERMINAL))
- || properties.getProperty(ITerminalsConnectorConstants.PROP_PTY_OBJ) instanceof PTY;
+ 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.getStringProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) == null) {
+ || !(properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) instanceof Boolean)) {
// On Windows, turn on local echo by default if no PTY is used (bug 433645)
- if (Host.isWindowsHost()) {
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
localEcho = !isUsingPTY;
}
} else {
- localEcho = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
+ localEcho = ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)).booleanValue();
}
String lineSeparator = null;
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR)
- || properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) == null) {
+ || !(properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) instanceof String)) {
// No line separator will be set if a PTY is used
if (!isUsingPTY) {
- lineSeparator = Host.isWindowsHost() ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF;
+ lineSeparator = Platform.OS_WIN32.equals(Platform.getOS()) ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF;
}
} else {
- lineSeparator = properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
+ lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
}
- String arguments = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
- Process process = (Process)properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
- PTY pty = (PTY)properties.getProperty(ITerminalsConnectorConstants.PROP_PTY_OBJ);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
- String workingDir = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
+ 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.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
- properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
- envp = (String[])properties.getProperty(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
@@ -140,11 +140,14 @@ public class LocalConnectorType extends AbstractConnectorType {
}
// ECLIPSE_WORKSPACE
- if (ResourcesPlugin.getWorkspace() != null
- && ResourcesPlugin.getWorkspace().getRoot() != null
- && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- envpList.add("ECLIPSE_WORKSPACE=" + ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$
- }
+ 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()]);
@@ -168,7 +171,8 @@ public class LocalConnectorType extends AbstractConnectorType {
processSettings.setEnvironment(envp);
if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) {
- processSettings.setMergeWithNativeEnvironment(properties.getBooleanProperty(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
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
index 72f1c07bd..3472d2c0b 100644
--- 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
@@ -10,11 +10,8 @@ Import-Package: org.eclipse.cdt.utils.pty;mandatory:=native,
Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional,
org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional,
org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.statushandler;bundle-version="1.3.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.swt;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
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
index ea324c382..9a8c8fba1 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -19,17 +19,13 @@ 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.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
-import org.eclipse.tcf.te.runtime.utils.Env;
+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.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.terminals.process.help.IContextHelpIds;
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;
@@ -218,9 +214,8 @@ public class ProcessConnector extends AbstractStreamsConnector {
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);
- // Create the status object
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), msg, e);
- StatusHandlerUtil.handleStatus(status, this, msg, Messages.ProcessConnector_error_title, IContextHelpIds.MESSAGE_CREATE_PROCESS_FAILED, this, null);
+ // Open an error dialog
+ MessageDialog.openError(control.getShell(), Messages.ProcessConnector_error_title, msg);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnectorType.java
index c7f67410e..2c982b8c6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnectorType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -9,11 +9,12 @@
*******************************************************************************/
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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
@@ -27,32 +28,33 @@ import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtensi
public class ProcessConnectorType extends AbstractConnectorType {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
@Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_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 = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
- String arguments = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
- Process process = (Process)properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
- PTY pty = (PTY)properties.getProperty(ITerminalsConnectorConstants.PROP_PTY_OBJ);
- boolean localEcho = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
- String lineSeparator = properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
- String workingDir = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
+ 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.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
- properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
- envp = (String[])properties.getProperty(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);
@@ -74,7 +76,8 @@ public class ProcessConnectorType extends AbstractConnectorType {
processSettings.setEnvironment(envp);
if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) {
- processSettings.setMergeWithNativeEnvironment(properties.getBooleanProperty(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
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
index c062f75cb..b5e8a5dd4 100644
--- 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
@@ -11,8 +11,8 @@ 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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
+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;
/**
@@ -266,12 +266,12 @@ public class ProcessSettings {
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 IPropertiesContainer) {
- process = (Process)((IPropertiesContainer)store).getProperty("Process"); //$NON-NLS-1$
- pty = (PTY)((IPropertiesContainer)store).getProperty("PTY"); //$NON-NLS-1$
- stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])((IPropertiesContainer)store).getProperty("StdOutListeners"); //$NON-NLS-1$
- stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])((IPropertiesContainer)store).getProperty("StdErrListeners"); //$NON-NLS-1$
- environment = (String[])((IPropertiesContainer)store).getProperty("Environment"); //$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$
}
}
@@ -288,12 +288,12 @@ public class ProcessSettings {
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 IPropertiesContainer) {
- ((IPropertiesContainer)store).setProperty("Process", process); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("PTY", pty); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("StdOutListeners", stdoutListeners); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("StdErrListeners", stderrListeners); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("Environment", environment); //$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
index ae90a3a7d..af1216886 100644
--- 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
@@ -25,7 +25,6 @@ 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.swt.SWTControlUtil;
import org.eclipse.tcf.te.ui.terminals.nls.Messages;
import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage;
import org.eclipse.ui.PlatformUI;
@@ -135,7 +134,7 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
// 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 = SWTControlUtil.getText(processImageSelectorControl);
+ 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
@@ -158,7 +157,7 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
// Open the dialog
selectedFile = dialog.open();
if (selectedFile != null) {
- SWTControlUtil.setText(processImageSelectorControl, selectedFile);
+ processImageSelectorControl.setText(selectedFile);
}
}
@@ -167,10 +166,10 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
*/
@Override
public void saveSettings() {
- settings.setImage(SWTControlUtil.getText(processImageSelectorControl));
- settings.setArguments(SWTControlUtil.getText(processArgumentsControl));
- settings.setLocalEcho(SWTControlUtil.getSelection(localEchoSelectorControl));
- settings.setWorkingDir(SWTControlUtil.getText(processWorkingDirControl));
+ settings.setImage(processImageSelectorControl.getText());
+ settings.setArguments(processArgumentsControl.getText());
+ settings.setLocalEcho(localEchoSelectorControl.getSelection());
+ settings.setWorkingDir(processWorkingDirControl.getText());
settings.setProcess(null);
}
@@ -179,10 +178,10 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
*/
@Override
public void loadSettings() {
- SWTControlUtil.setText(processImageSelectorControl, settings.getImage());
- SWTControlUtil.setText(processArgumentsControl, settings.getArguments());
- SWTControlUtil.setSelection(localEchoSelectorControl, settings.isLocalEcho());
- SWTControlUtil.setText(processWorkingDirControl, settings.getWorkingDir());
+ processImageSelectorControl.setText(settings.getImage());
+ processArgumentsControl.setText(settings.getArguments());
+ localEchoSelectorControl.setSelection(settings.isLocalEcho());
+ processWorkingDirControl.setText(settings.getWorkingDir());
}
/* (non-Javadoc)
@@ -191,7 +190,7 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
@Override
public boolean validateSettings() {
// The settings are considered valid if the selected process image can be read.
- String selectedFile = SWTControlUtil.getText(processImageSelectorControl);
+ 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
index 22b3c1936..15fa6e96d 100644
--- 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
@@ -12,7 +12,7 @@ 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.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
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
index 88c420264..e652c77c9 100644
--- 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
@@ -10,11 +10,9 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
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.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.swt;bundle-version="1.3.0",
org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.terminals.ssh;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"
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
index 43805b18f..00c7cee50 100644
--- 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
@@ -2,19 +2,14 @@
<?eclipse version="3.4"?>
<plugin>
-<!-- Service contributions -->
- <extension point="org.eclipse.tcf.te.runtime.services.services">
- <service
- class="org.eclipse.tcf.te.ui.terminals.rse.internal.PropertiesAccessService"
- id="org.eclipse.tcf.te.ui.terminals.rse.PropertiesAccessService">
- <serviceType
- bundleId="org.eclipse.tcf.te.runtime.services"
- class="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService">
- </serviceType>
+<!-- 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>
- </service>
+ </contextPropertiesProvider>
</extension>
<!-- Perspective extension contributions -->
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
index 41e7d44d5..5295f3883 100644
--- 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
@@ -23,8 +23,8 @@ 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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.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;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertiesAccessService.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertiesAccessService.java
deleted file mode 100644
index 2531162f5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertiesAccessService.java
+++ /dev/null
@@ -1,103 +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.HashMap;
-import java.util.Map;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.tcf.te.runtime.services.AbstractService;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
-
-/**
- * Properties access service implementation.
- */
-public class PropertiesAccessService extends AbstractService implements IPropertiesAccessService {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#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(IPropertiesAccessServiceConstants.PROP_ADDRESS, host.getHostName());
- props.put(IPropertiesAccessServiceConstants.PROP_NAME, host.getName());
-
- return props;
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getProperty(java.lang.Object, java.lang.String)
- */
- @Override
- public Object getProperty(Object context, String key) {
- if (context instanceof IHost) {
- IHost host = (IHost) context;
-
- if (IPropertiesAccessServiceConstants.PROP_DEFAULT_USER.equals(key)) {
- String user = host.getDefaultUserId();
- if (user != null && !"".equals(user.trim())) { //$NON-NLS-1$
- return user;
- }
- }
-
- if (IPropertiesAccessServiceConstants.PROP_DEFAULT_ENCODING.equals(key)) {
- String encoding = host.getDefaultEncoding(true);
- if (encoding != null && !"".equals(encoding)) { //$NON-NLS-1$
- return encoding;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#setProperty(java.lang.Object, java.lang.String, java.lang.Object)
- */
- @Override
- public boolean setProperty(Object context, String key, Object value) {
- // Changing the properties via this API is not supported.
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#isProperty(java.lang.Object, java.lang.String, java.lang.Object)
- */
- @Override
- public boolean isProperty(Object context, String key, Object value) {
- if (context instanceof IHost) {
- IHost host = (IHost) context;
-
- if (IPropertiesAccessServiceConstants.PROP_DEFAULT_USER.equals(key)) {
- return value == null ? host.getDefaultUserId() == null : value.equals(host.getDefaultUserId());
- }
- if (IPropertiesAccessServiceConstants.PROP_DEFAULT_ENCODING.equals(key)) {
- return value == null ? host.getDefaultEncoding(true) == null : value.equals(host.getDefaultEncoding(true));
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getParent(java.lang.Object)
- */
- @Override
- public Object getParent(Object context) {
- return null;
- }
-
-}
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
new file mode 100644
index 000000000..706379f6a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.serial/.options b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options
index c7572d4b3..9d8591b76 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options
@@ -1 +1,2 @@
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/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF
index 01b741ec6..53c8cd0e8 100644
--- 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
@@ -8,11 +8,7 @@ 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.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.controls;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.swt;bundle-version="1.3.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.tm.terminal.serial;bundle-version="2.1.200",
@@ -23,6 +19,8 @@ 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,
org.eclipse.tcf.te.ui.terminals.serial.types
+Import-Package: gnu.io;resolution:=optional
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
index f7dfdde22..44441fd4c 100644
--- 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
@@ -12,7 +12,7 @@ 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.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java
index 9d87b21a3..8c2814bd6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java
@@ -9,39 +9,37 @@
*******************************************************************************/
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.events.TypedEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.controls.wire.serial.SerialLinePanel;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+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 SerialWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
+public class SerialConfigurationPanel extends AbstractExtendedConfigurationPanel {
private SerialLinePanel serialSettingsPage;
/**
* Constructor.
*
- * @param parentControl The parent control. Must not be <code>null</code>!
+ * @param container The configuration panel container or <code>null</code>.
*/
- public SerialWizardConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
+ public SerialConfigurationPanel(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)
+ * @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) {
@@ -53,7 +51,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
// Create the host selection combo
if (isWithoutSelection()) createHostsUI(panel, true);
- serialSettingsPage = new SerialLinePanel(getParentControl(), true, true, true);
+ serialSettingsPage = new SerialLinePanel(getContainer());
serialSettingsPage.setupPanel(panel, toolkit);
// Create the encoding selection combo
@@ -63,52 +61,36 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void setupData(IPropertiesContainer data) {
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
*/
@Override
- public void extractData(IPropertiesContainer data) {
+ public void extractData(Map<String, Object> data) {
// set the terminal connector id for serial
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.serial.SerialConnector"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.serial.SerialConnector"); //$NON-NLS-1$
// set the connector type for serial
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.serial"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.serial"); //$NON-NLS-1$
serialSettingsPage.extractData(data);
- data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+ data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String)
+ * @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.AbstractConfigurationPanel#saveSettingsForHost(boolean)
+ * @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.controls.panels.AbstractWizardConfigurationPanel#isValid()
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isValid()
*/
@Override
public boolean isValid(){
@@ -116,7 +98,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @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) {
@@ -127,7 +109,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @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) {
@@ -138,7 +120,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings()
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#getHostFromSettings()
*/
@Override
protected String getHostFromSettings() {
@@ -146,7 +128,7 @@ public class SerialWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isWithHostList()
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#isWithHostList()
*/
@Override
public boolean isWithHostList() {
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
new file mode 100644
index 000000000..04c9312a9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java
@@ -0,0 +1,789 @@
+/*******************************************************************************
+ * 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.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
new file mode 100644
index 000000000..3e6f682f1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java
@@ -0,0 +1,689 @@
+/*******************************************************************************
+ * 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.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.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
new file mode 100644
index 000000000..9f0df469e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.core/src/org/eclipse/tcf/te/core/nodes/interfaces/wire/IWireTypeSerial.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java
index 989107b97..46473ea2e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nodes/interfaces/wire/IWireTypeSerial.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java
@@ -7,7 +7,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.core.nodes.interfaces.wire;
+package org.eclipse.tcf.te.ui.terminals.serial.interfaces;
/**
* The properties specific to the wire type &quot;serial&quot;.
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
index 6636bad29..2a089e30a 100644
--- 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
@@ -11,19 +11,19 @@ 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.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+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.launcher.AbstractLauncherDelegate;
-import org.eclipse.tcf.te.ui.terminals.serial.controls.SerialWizardConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.serial.controls.SerialConfigurationPanel;
import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages;
/**
@@ -42,36 +42,36 @@ public class SerialLauncherDelegate extends AbstractLauncherDelegate {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
*/
@Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return new SerialWizardConfigurationPanel(parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new SerialConfigurationPanel(container);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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(IPropertiesContainer properties, ICallback callback) {
+ 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.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
}
// Serial terminals do have a disconnect button
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, true);
+ properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
}
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
- terminal.openConsole(properties, callback);
+ terminal.openConsole(properties, done);
}
}
@@ -82,13 +82,13 @@ public class SerialLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
- private String getTerminalTitle(IPropertiesContainer properties) {
- String port = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE);
+ private String getTerminalTitle(Map<String, Object> properties) {
+ String device = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE);
- if (port != null) {
+ 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[]{port, date});
+ return NLS.bind(Messages.SerialLauncherDelegate_terminalTitle, new String[]{device, date});
}
return Messages.SerialLauncherDelegate_terminalTitle_default;
}
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
index d4d1624ad..0336dfd75 100644
--- 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
@@ -9,9 +9,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.serial.launcher;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento;
@@ -21,41 +22,43 @@ import org.eclipse.ui.IMemento;
public class SerialMementoHandler implements IMementoHandler {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void saveState(IMemento memento, IPropertiesContainer properties) {
+ 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, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS));
- memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL));
- memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, properties.getIntProperty(ITerminalsConnectorConstants.PROP_TIMEOUT));
- memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, properties.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING));
+ 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, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void restoreState(IMemento memento, IPropertiesContainer properties) {
+ public void restoreState(IMemento memento, Map<String, Object> properties) {
Assert.isNotNull(memento);
Assert.isNotNull(properties);
// Restore the terminal properties from the memento
- properties.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL));
- properties.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT));
- properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
+ 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
index 474a0367f..530171509 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -31,4 +31,38 @@ public class Messages extends NLS {
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
index fd6442ddd..2b89c1009 100644
--- 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
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+# 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
@@ -10,3 +10,37 @@
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.serial/src/org/eclipse/tcf/te/ui/terminals/serial/types/SerialConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/types/SerialConnectorType.java
index 2e7990dca..7a6999b49 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/types/SerialConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/types/SerialConnectorType.java
@@ -9,9 +9,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.serial.types;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
@@ -26,48 +27,24 @@ import org.eclipse.tm.internal.terminal.serial.SerialSettings;
public class SerialConnectorType extends AbstractConnectorType {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ @Override
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
-
- String port = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE);
- String baud = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE);
- String timeout = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
- String databits = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS);
- String stopbits = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS);
- String parity = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_PARITY);
- String flowcontrol = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL);
-
- return createSerialConnector(connectorId, new String[] { port, baud, timeout, databits, stopbits, parity, flowcontrol }, 0);
- }
-
- /**
- * Creates a terminal connector object based on the given serial attributes.
- * <p>
- *
- * @param connectorId The terminal connector id or <code>null</code>.
- * @param attributes The serial attributes. Must not be <code>null</code> and must have at least two elements.
- * @param portOffset Offset to add to the port.
- *
- * @return The terminal connector object instance or <code>null</code>.
- */
- protected ITerminalConnector createSerialConnector(String connectorId, String[] attributes, int portOffset) {
- Assert.isNotNull(attributes);
-
+ String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.serial.SerialConnector"; //$NON-NLS-1$
- final String port = attributes[0];
- final String baud = attributes[1];
- final String timeout = attributes[2];
- final String databits = attributes[3];
- final String stopbits = attributes[4];
- final String parity = attributes[5];
- final String flowcontrol = attributes[6];
+ 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();
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
index 9cb686f56..f3f257a8f 100644
--- 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
@@ -8,12 +8,8 @@ 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.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui;bundle-version="1.3.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.controls;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.swt;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",
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
index 9ea9b5846..c7fe91621 100644
--- 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
@@ -12,7 +12,7 @@ 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.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
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
index 582e3e5bd..69d7eb2fb 100644
--- 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
@@ -21,22 +21,18 @@ 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.events.TypedEvent;
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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+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;
@@ -48,7 +44,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
* SSH wizard configuration panel implementation.
*/
@SuppressWarnings("restriction")
-public class SshWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
+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$
@@ -61,10 +57,10 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
/**
* Constructor.
*
- * @param parentControl The parent control. Must not be <code>null</code>!
+ * @param container The configuration panel container or <code>null</code>.
*/
- public SshWizardConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
+ public SshWizardConfigurationPanel(IConfigurationPanelContainer container) {
+ super(container);
}
/* (non-Javadoc)
@@ -92,15 +88,12 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
sshSettingsPage.createControl(panel);
// Add the listener to the settings page
- if (getParentControl() instanceof IValidatingContainer) {
- sshSettingsPage.addListener(new ISettingsPage.Listener() {
-
- @Override
- public void onSettingsPageChanged(Control control) {
- ((IValidatingContainer)getParentControl()).validate();
- }
- });
- }
+ sshSettingsPage.addListener(new ISettingsPage.Listener() {
+ @Override
+ public void onSettingsPageChanged(Control control) {
+ if (getContainer() != null) getContainer().validate();
+ }
+ });
// Create the encoding selection combo
createEncodingUI(panel, true);
@@ -112,39 +105,34 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataExchangeNode#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
*/
@Override
- public void setupData(IPropertiesContainer data) {
+ public void setupData(Map<String, Object> data) {
if (data == null || sshSettings == null || sshSettingsPage == null) return;
- String value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
+ String value = (String)data.get(ITerminalsConnectorConstants.PROP_IP_HOST);
if (value != null) sshSettings.setHost(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
+ Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT);
+ value = v != null ? v.toString() : null;
if (value != null) sshSettings.setPort(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ value = v != null ? v.toString() : null;
if (value != null) sshSettings.setTimeout(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
+ v = data.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
+ value = v != null ? v.toString() : null;
if (value != null) sshSettings.setKeepalive(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
+ value = (String)data.get(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
if (value != null) sshSettings.setPassword(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_USER);
+ value = (String)data.get(ITerminalsConnectorConstants.PROP_SSH_USER);
if (value != null) sshSettings.setUser(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
+ value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
if (value != null) setEncoding(value);
sshSettingsPage.loadSettings();
@@ -159,9 +147,9 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
Object element = ((IStructuredSelection) selection).getFirstElement();
- IPropertiesAccessService service = ServiceManager.getInstance().getService(element, IPropertiesAccessService.class);
- if (service != null) {
- Object user = service.getProperty(element, IPropertiesAccessServiceConstants.PROP_DEFAULT_USER);
+ 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();
}
}
@@ -170,24 +158,26 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataExchangeNode#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
*/
@Override
- public void extractData(IPropertiesContainer data) {
+ public void extractData(Map<String, Object> data) {
+ if (data == null) return;
+
// set the terminal connector id for ssh
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.ssh.SshConnector"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.ssh.SshConnector"); //$NON-NLS-1$
// set the connector type for ssh
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.ssh"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.ssh"); //$NON-NLS-1$
sshSettingsPage.saveSettings();
- data.setProperty(ITerminalsConnectorConstants.PROP_IP_HOST,sshSettings.getHost());
- data.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, sshSettings.getPort());
- data.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, sshSettings.getTimeout());
- data.setProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, sshSettings.getKeepalive());
- data.setProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, sshSettings.getPassword());
- data.setProperty(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser());
- data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+ 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)
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
index aa82e06fe..5225fc1b8 100644
--- 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
@@ -12,16 +12,16 @@ 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.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+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.launcher.AbstractLauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.ssh.controls.SshWizardConfigurationPanel;
@@ -43,42 +43,42 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
*/
@Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return new SshWizardConfigurationPanel(parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new SshWizardConfigurationPanel(container);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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(IPropertiesContainer properties, ICallback callback) {
+ 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.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ 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.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
+ properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
}
// SSH terminals do have a disconnect button
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, true);
+ properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
}
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
- terminal.openConsole(properties, callback);
+ terminal.openConsole(properties, done);
}
}
@@ -89,9 +89,9 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
- private String getTerminalTitle(IPropertiesContainer properties) {
- String host = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
- String user = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_USER);
+ 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);
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
index 3edd1711c..0893ffe2e 100644
--- 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
@@ -9,12 +9,13 @@
*******************************************************************************/
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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento;
@@ -23,22 +24,26 @@ import org.eclipse.ui.IMemento;
*/
public class SshMementoHandler implements IMementoHandler {
+
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void saveState(IMemento memento, IPropertiesContainer properties) {
+ 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, properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST));
- memento.putString(ITerminalsConnectorConstants.PROP_IP_PORT, properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT));
- memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, properties.getIntProperty(ITerminalsConnectorConstants.PROP_TIMEOUT));
- memento.putInteger(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, properties.getIntProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE));
- memento.putString(ITerminalsConnectorConstants.PROP_SSH_USER, properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_USER));
- memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, properties.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING));
+ 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
//
@@ -69,28 +74,28 @@ public class SshMementoHandler implements IMementoHandler {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void restoreState(IMemento memento, IPropertiesContainer properties) {
+ public void restoreState(IMemento memento, Map<String, Object> properties) {
Assert.isNotNull(memento);
Assert.isNotNull(properties);
// Restore the terminal properties from the memento
- properties.setProperty(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST));
- properties.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getString(ITerminalsConnectorConstants.PROP_IP_PORT));
- properties.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, memento.getInteger(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE));
- properties.setProperty(ITerminalsConnectorConstants.PROP_SSH_USER, memento.getString(ITerminalsConnectorConstants.PROP_SSH_USER));
- properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
+ 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 && properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
+ if (preferences != null && (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) {
// Construct the secure preferences node key
- String nodeKey = "/Target Explorer SSH Password/" + properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST); //$NON-NLS-1$
+ 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 {
@@ -122,7 +127,7 @@ public class SshMementoHandler implements IMementoHandler {
}
*/
- properties.setProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, password);
+ 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/types/SshConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/types/SshConnectorType.java
index 1bf05cefd..bfd8e7630 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/types/SshConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/types/SshConnectorType.java
@@ -10,9 +10,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.ssh.types;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
@@ -27,26 +28,30 @@ import org.eclipse.tm.internal.terminal.ssh.SshSettings;
public class SshConnectorType extends AbstractConnectorType {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ @Override
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_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 = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
- String port = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
- String timeout = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
- String keepAlive=properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE);
- String password=properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD);
- String user=properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_USER);
+ 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.getProperty(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) != null) {
- portOffset = properties.getIntProperty(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET);
+ 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;
}
@@ -66,18 +71,17 @@ public class SshConnectorType extends AbstractConnectorType {
* <li>attributes[5] --> ssh user</li>
* </ul>
*
- * @param connectorId The terminal connector id or <code>null</code>.
+ * @param connectorId The terminal connector id. Must not be <code>null</code>.
* @param attributes The ssh server attributes. Must not be <code>null</code>.
* @param portOffset Offset to add to the port.
*
* @return The terminal connector object instance or <code>null</code>.
*/
protected ITerminalConnector createSshConnector(String connectorId, String[] attributes, int portOffset) {
+ Assert.isNotNull(connectorId);
Assert.isNotNull(attributes);
Assert.isTrue(attributes.length == 6);
- if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.ssh.SshConnector"; //$NON-NLS-1$
-
final String serverName = attributes[0];
final String serverPort = Integer.toString(Integer.decode(attributes[1]).intValue() + portOffset);
final String timeout = attributes[2];
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
index 5d3736ca3..189cb80d5 100644
--- 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
@@ -8,12 +8,8 @@ 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.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui;bundle-version="1.3.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.controls;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.swt;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",
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
index 5284d6f45..2f7ec22d9 100644
--- 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
@@ -13,7 +13,7 @@ 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.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
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
index d65ad73f1..3e7792fdc 100644
--- 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
@@ -15,17 +15,13 @@ import java.util.Map;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.TypedEvent;
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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+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;
@@ -37,7 +33,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
* telnet wizard configuration panel implementation.
*/
@SuppressWarnings("restriction")
-public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
+public class TelnetWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
public TelnetSettings telnetSettings;
private ISettingsPage telnetSettingsPage;
@@ -45,10 +41,10 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
/**
* Constructor.
*
- * @param parentControl The parent control. Must not be <code>null</code>!
+ * @param container The configuration panel container or <code>null</code>.
*/
- public TelnetWizardConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
+ public TelnetWizardConfigurationPanel(IConfigurationPanelContainer container) {
+ super(container);
}
/* (non-Javadoc)
@@ -77,15 +73,13 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
telnetSettingsPage.createControl(panel);
// Add the listener to the settings page
- if (getParentControl() instanceof IValidatingContainer) {
- telnetSettingsPage.addListener(new ISettingsPage.Listener() {
+ telnetSettingsPage.addListener(new ISettingsPage.Listener() {
- @Override
- public void onSettingsPageChanged(Control control) {
- ((IValidatingContainer)getParentControl()).validate();
- }
- });
- }
+ @Override
+ public void onSettingsPageChanged(Control control) {
+ if (getContainer() != null) getContainer().validate();
+ }
+ });
// Create the encoding selection combo
createEncodingUI(panel, true);
@@ -94,51 +88,47 @@ public class TelnetWizardConfigurationPanel extends AbstractConfigurationPanel i
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
*/
@Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataExchangeNode#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public void setupData(IPropertiesContainer data) {
+ public void setupData(Map<String, Object> data) {
if (data == null || telnetSettings == null || telnetSettingsPage == null) return;
- String value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
+ String value = (String)data.get(ITerminalsConnectorConstants.PROP_IP_HOST);
if (value != null) telnetSettings.setHost(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
+ Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT);
+ value = v != null ? v.toString() : null;
if (value != null) telnetSettings.setNetworkPort(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ value = v != null ? v.toString() : null;
if (value != null) telnetSettings.setTimeout(value);
- value = data.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
+ value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
if (value != null) setEncoding(value);
telnetSettingsPage.loadSettings();
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataExchangeNode#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
*/
@Override
- public void extractData(IPropertiesContainer data) {
+ public void extractData(Map<String, Object> data) {
+ if (data == null) return;
+
// set the terminal connector id for ssh
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"); //$NON-NLS-1$
// set the connector type for ssh
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.telnet"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.telnet"); //$NON-NLS-1$
telnetSettingsPage.saveSettings();
- data.setProperty(ITerminalsConnectorConstants.PROP_IP_HOST,telnetSettings.getHost());
- data.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, telnetSettings.getNetworkPort());
- data.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, telnetSettings.getTimeout());
- data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+ 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)
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
index 1123f358b..8bf1aad12 100644
--- 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
@@ -12,16 +12,16 @@ 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.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+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.launcher.AbstractLauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.telnet.controls.TelnetWizardConfigurationPanel;
@@ -43,42 +43,42 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
*/
@Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return new TelnetWizardConfigurationPanel(parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new TelnetWizardConfigurationPanel(container);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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(IPropertiesContainer properties, ICallback callback) {
+ 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.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ 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.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
+ properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
}
// Telnet terminals do have a disconnect button
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, true);
+ properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
}
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
- terminal.openConsole(properties, callback);
+ terminal.openConsole(properties, done);
}
}
@@ -89,8 +89,8 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
- private String getTerminalTitle(IPropertiesContainer properties) {
- String host = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
+ 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);
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
index 124fc8b7d..7dff9c0bf 100644
--- 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
@@ -9,9 +9,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.telnet.launcher;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento;
@@ -21,33 +22,35 @@ import org.eclipse.ui.IMemento;
public class TelnetMementoHandler implements IMementoHandler {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void saveState(IMemento memento, IPropertiesContainer properties) {
+ 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, properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST));
- memento.putString(ITerminalsConnectorConstants.PROP_IP_PORT, properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT));
- memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, properties.getIntProperty(ITerminalsConnectorConstants.PROP_TIMEOUT));
- memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, properties.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING));
+ 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, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void restoreState(IMemento memento, IPropertiesContainer properties) {
+ public void restoreState(IMemento memento, Map<String, Object> properties) {
Assert.isNotNull(memento);
Assert.isNotNull(properties);
// Restore the terminal properties from the memento
- properties.setProperty(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST));
- properties.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getString(ITerminalsConnectorConstants.PROP_IP_PORT));
- properties.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT));
- properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING));
+ 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/types/TelnetConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/types/TelnetConnectorType.java
index 02b0a5157..d5e67096f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/types/TelnetConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/types/TelnetConnectorType.java
@@ -10,9 +10,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.telnet.types;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
@@ -27,23 +28,26 @@ import org.eclipse.tm.internal.terminal.telnet.TelnetSettings;
public class TelnetConnectorType extends AbstractConnectorType {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ @Override
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_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 = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
- String port = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
- String timeout = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ 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.getProperty(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) != null) {
- portOffset = properties.getIntProperty(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET);
+ 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;
}
@@ -60,18 +64,17 @@ public class TelnetConnectorType extends AbstractConnectorType {
* <li>attributes[2] --> timeout (optional)</li>
* </ul>
*
- * @param connectorId The terminal connector id or <code>null</code>.
+ * @param connectorId The terminal connector id. Must not be <code>null</code>.
* @param attributes The telnet server attributes. Must not be <code>null</code> and must have at least two elements.
* @param portOffset Offset to add to the port.
*
* @return The terminal connector object instance or <code>null</code>.
*/
protected ITerminalConnector createTelnetConnector(String connectorId, String[] attributes, int portOffset) {
+ Assert.isNotNull(connectorId);
Assert.isNotNull(attributes);
Assert.isTrue(attributes.length >= 2);
- if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"; //$NON-NLS-1$
-
final String serverName = attributes[0];
final String serverPort = Integer.toString(Integer.decode(attributes[1]).intValue() + portOffset);
final String timeout = attributes.length >= 3 ? attributes[2] : null;
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
index 872a13d33..6b366fe17 100644
--- 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
@@ -8,12 +8,7 @@ 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;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.controls;bundle-version="1.3.0",
- org.eclipse.tcf.te.ui.swt;bundle-version="1.3.0",
+ 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"
@@ -22,7 +17,7 @@ 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.events,
+ 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,
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
index 7de166ec0..831f95eeb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
@@ -103,15 +103,6 @@
</propertyTester>
</extension>
-<!-- Service contributions -->
- <extension point="org.eclipse.tcf.te.runtime.services.services">
- <service
- class="org.eclipse.tcf.te.ui.terminals.services.TerminalService"
- id="org.eclipse.tcf.te.runtime.services.terminal">
- <serviceType class="org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService"/>
- </service>
- </extension>
-
<!-- Terminal connector type contributions -->
<extension point="org.eclipse.tcf.te.ui.terminals.connectorTypes">
<connectorType
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
index 9bdc4a593..af4f287fe 100644
--- 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
@@ -21,8 +21,8 @@ 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.runtime.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
+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;
@@ -72,7 +72,7 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Convenience method which returns the unique identifier of this plugin.
+ * Convenience method which returns the unique identifier of this plug-in.
*/
public static String getUniqueIdentifier() {
if (getDefault() != null && getDefault().getBundle() != null) {
@@ -82,7 +82,7 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Return the scoped preferences for this plugin.
+ * Return the scoped preferences for this plug-in.
*/
public static ScopedEclipsePreferences getScopedPreferences() {
if (scopedPreferences == null) {
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
new file mode 100644
index 000000000..9f6b227ed
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java
@@ -0,0 +1,448 @@
+/*******************************************************************************
+ * 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.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
new file mode 100644
index 000000000..acc51f7b2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.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/events/SelectionChangedBroadcastEvent.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
deleted file mode 100644
index 807673aaf..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
+++ /dev/null
@@ -1,77 +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.events;
-
-import java.util.EventObject;
-
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
-
-/**
- * Terminal console selection changed broadcast event. The event is typically fired
- * by a terminal console tab folder manager to signal a tab switch to all listeners.
- */
-public class SelectionChangedBroadcastEvent extends EventObject {
- private static final long serialVersionUID = -4970244776543572896L;
-
- // The selection changed event to broadcast
- private final SelectionChangedEvent selectionChangedEvent;
-
- /**
- * Constructor.
- *
- * @param source The event source. Must not be <code>null</code>.
- * @param selectionChangedEvent The selection changed event or <code>null</code>.
- */
- public SelectionChangedBroadcastEvent(TabFolderManager source, SelectionChangedEvent selectionChangedEvent) {
- super(source);
- this.selectionChangedEvent = selectionChangedEvent;
- }
-
- /**
- * Convenience method to return the source tab folder manager.
- *
- * @return The source tab folder manager.
- */
- public TabFolderManager getSourceTabFolderManager() {
- return (TabFolderManager)getSource();
- }
-
- /**
- * Returns the broadcasted selection changed event.
- *
- * @return The broadcasted selection changed event or <code>null</code>.
- */
- public SelectionChangedEvent getSelectionChangedEvent() {
- return selectionChangedEvent;
- }
-
- /* (non-Javadoc)
- * @see java.util.EventObject#toString()
- */
- @Override
- public String toString() {
- StringBuilder toString = new StringBuilder(getClass().getName());
-
- String prefix = ""; //$NON-NLS-1$
- // if debugging the event, formating them a little bit better readable.
- if (EventManager.isTracingEnabled())
- prefix = "\n\t\t"; //$NON-NLS-1$
-
- toString.append(prefix + "source="); //$NON-NLS-1$
- toString.append(source);
- toString.append("," + prefix + "selectionChangedEvent="); //$NON-NLS-1$ //$NON-NLS-2$
- toString.append(selectionChangedEvent);
- toString.append("}"); //$NON-NLS-1$
-
- return toString.toString();
- }
-}
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
index c1bcf12e5..2f7e9d3d1 100644
--- 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
@@ -9,23 +9,131 @@
*******************************************************************************/
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.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* Terminal launcher configuration panel.
*/
-public interface IConfigurationPanel extends IWizardConfigurationPanel {
+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 configuration panel.
+ * 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 configuration panel.
+ * Returns the selection associated with the terminal launcher configuration panel.
*
* @return The selection or <code>null</code>.
*/
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
new file mode 100644
index 000000000..03d3f41ee
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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/IConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java
index f1629ceca..4d0e1d823 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConnectorType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -9,8 +9,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.interfaces;
-import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
/**
@@ -20,11 +21,19 @@ import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
public interface IConnectorType extends IExecutableExtension {
/**
+ * Returns the unique id of the terminal connector type. The returned
+ * id must be never <code>null</code> or an empty string.
+ *
+ * @return The unique id.
+ */
+ public String getId();
+
+ /**
* Creates the terminal connector for this terminal connector type
* 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(IPropertiesContainer properties);
+ 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/ILauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java
index 666ad0c2b..15cb5ef14 100644
--- 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
@@ -9,12 +9,12 @@
*******************************************************************************/
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.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
/**
* Terminal launcher delegate.
@@ -22,6 +22,21 @@ import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
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.
@@ -52,16 +67,16 @@ public interface ILauncherDelegate extends IExecutableExtension, IAdaptable {
* configurable settings. In this case, {@link #needsUserConfiguration()} should return
* <code>false</code>.
*
- * @param parentControl The parent control. Must not be <code>null</code>.
+ * @param container The configuration panel container or <code>null</code>.
* @return The configuration panel instance or <code>null</code>
*/
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container);
/**
* Execute the terminal launch.
*
* @param properties The properties. Must not be <code>null</code>.
- * @param callback The callback or <code>null</code>.
+ * @param done The callback or <code>null</code>.
*/
- public void execute(IPropertiesContainer properties, ICallback callback);
+ public void execute(Map<String, Object> properties, ITerminalService.Done done);
}
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
index f65f48097..a8d90faf7 100644
--- 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
@@ -9,7 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.interfaces;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import java.util.Map;
+
import org.eclipse.ui.IMemento;
/**
@@ -21,15 +22,15 @@ public interface IMementoHandler {
* Saves the terminal properties in the given memento.
*
* @param memento The memento. Must not be <code>null</code>.
- * @param properties The properties container containing the terminal properties to save. 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, IPropertiesContainer properties);
+ 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 properties container receiving the restored terminal properties. 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, IPropertiesContainer properties);
+ 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/internal/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java
index 672b17d54..aa4a66ccb 100644
--- 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
@@ -10,7 +10,7 @@
package org.eclipse.tcf.te.ui.terminals.internal;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
+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;
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
index 053b040bb..c8cc0c237 100644
--- 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
@@ -12,7 +12,7 @@ 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.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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;
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
index 8ccbb41e5..951185709 100644
--- 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
@@ -9,7 +9,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.internal;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
/**
@@ -17,7 +20,8 @@ import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
* within memory.
*/
@SuppressWarnings("restriction")
-public class SettingsStore extends PropertiesContainer implements ISettingsStore {
+public class SettingsStore implements ISettingsStore {
+ private final Map<String, Object> settings = new HashMap<String, Object>();
/**
* Constructor.
@@ -25,12 +29,22 @@ public class SettingsStore extends PropertiesContainer implements ISettingsStore
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 String get(String key, String defaultValue) {
- String value = getStringProperty(key);
+ 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;
}
@@ -38,15 +52,18 @@ public class SettingsStore extends PropertiesContainer implements ISettingsStore
* @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String)
*/
@Override
- public String get(String key) {
- return getStringProperty(key);
+ 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 void put(String key, String value) {
- setProperty(key, value);
+ 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
index 219044944..e465e525c 100644
--- 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
@@ -9,24 +9,28 @@
*******************************************************************************/
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.events.TypedEvent;
+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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog;
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.AbstractConfigurationPanel;
+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 CustomTrayDialog {
+public class EncodingSelectionDialog extends TrayDialog {
+ private String contextHelpId = null;
+
// The selected encoding or null
/* default */ String encoding = null;
@@ -36,13 +40,15 @@ public class EncodingSelectionDialog extends CustomTrayDialog {
/**
* Encodings panel implementation
*/
- protected class EncodingPanel extends AbstractConfigurationPanel {
+ protected class EncodingPanel extends AbstractExtendedConfigurationPanel {
/**
* Constructor
+ *
+ * @param container The configuration panel container or <code>null</code>.
*/
- public EncodingPanel() {
- super(new BaseDialogPageControl());
+ public EncodingPanel(IConfigurationPanelContainer container) {
+ super(container);
}
/* (non-Javadoc)
@@ -65,14 +71,6 @@ public class EncodingSelectionDialog extends CustomTrayDialog {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean)
*/
@Override
@@ -117,15 +115,60 @@ public class EncodingSelectionDialog extends CustomTrayDialog {
* @param shell The parent shell or <code>null</code>.
*/
public EncodingSelectionDialog(Shell shell) {
- super(shell, IContextHelpIds.ENCODING_SELECTION_DIALOG);
+ super(shell);
+
+ this.contextHelpId = IContextHelpIds.ENCODING_SELECTION_DIALOG;
+ setHelpAvailable(true);
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
- */
- @Override
+ /* (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) {
- super.createDialogAreaContent(parent);
+ Assert.isNotNull(parent);
setDialogTitle(Messages.EncodingSelectionDialog_title);
@@ -135,12 +178,23 @@ public class EncodingSelectionDialog extends CustomTrayDialog {
panel.setLayout(layout);
panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- encodingPanel = new EncodingPanel();
+ 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()
*/
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
index 71c179400..cd14fea72 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -19,11 +19,12 @@ import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogPage;
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;
@@ -35,56 +36,51 @@ 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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl;
-import org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+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 CustomTrayDialog implements IValidatingContainer {
+public class LaunchTerminalSettingsDialog extends TrayDialog {
+ private String contextHelpId = null;
+
// The parent selection
private ISelection selection = null;
- // The subcontrols
+ // The sub controls
/* default */ Combo terminals;
/* default */ SettingsPanelControl settings;
private FormToolkit toolkit = null;
- // Map the label added to the combobox to the corresponding launcher delegate.
+ // 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 IPropertiesContainer data = null;
+ private Map<String, Object> data = null;
+
+ // The dialog settings storage
+ private IDialogSettings dialogSettings;
/**
* The control managing the terminal setting panels.
*/
- protected class SettingsPanelControl extends BaseWizardConfigurationPanelControl implements IValidatingContainer {
+ protected class SettingsPanelControl extends ConfigurationPanelControl {
/**
* Constructor.
- *
- * @param parentPage The parent dialog page this control is embedded in.
- * Might be <code>null</code> if the control is not associated with a page.
*/
- public SettingsPanelControl(IDialogPage parentPage) {
- super(parentPage);
+ public SettingsPanelControl() {
setPanelIsGroup(true);
}
@@ -102,7 +98,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
@Override
public void showConfigurationPanel(String key) {
// Check if we have to create the panel first
- IWizardConfigurationPanel configPanel = getConfigurationPanel(key);
+ IConfigurationPanel configPanel = getConfigurationPanel(key);
if (isEmptyConfigurationPanel(configPanel)) {
// Get the corresponding delegate
ILauncherDelegate delegate = label2delegate.get(key);
@@ -113,7 +109,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
// Add it to the settings panel control
settings.addConfigurationPanel(key, configPanel);
// Push the selection to the configuration panel
- if (configPanel instanceof IConfigurationPanel) ((IConfigurationPanel)configPanel).setSelection(getSelection());
+ configPanel.setSelection(getSelection());
// Create the panel controls
configPanel.setupPanel(getPanel(), getFormToolkit());
// Restore widget values
@@ -124,22 +120,15 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
}
super.showConfigurationPanel(key);
-
- validate();
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer#validate()
*/
@Override
public void validate() {
LaunchTerminalSettingsDialog.this.validate();
}
-
- @Override
- public IValidatingContainer getValidatingContainer() {
- return this;
- }
}
/**
@@ -148,7 +137,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
* @param shell The parent shell or <code>null</code>.
*/
public LaunchTerminalSettingsDialog(Shell shell) {
- super(shell, IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG);
+ this(shell, 0);
}
private long start = 0;
@@ -159,8 +148,13 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
* @param shell The parent shell or <code>null</code>.
*/
public LaunchTerminalSettingsDialog(Shell shell, long start) {
- super(shell, IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG);
+ super(shell);
this.start = start;
+
+ initializeDialogSettings();
+
+ this.contextHelpId = IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG;
+ setHelpAvailable(true);
}
/**
@@ -182,14 +176,21 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#dispose()
+ * @see org.eclipse.jface.dialogs.Dialog#close()
+ */
+ @Override
+ public boolean close() {
+ dispose();
+ return super.close();
+ }
+
+ /**
+ * Dispose the dialog resources.
*/
- @Override
protected void dispose() {
if (settings != null) { settings.dispose(); settings = null; }
if (toolkit != null) { toolkit.dispose(); toolkit = null; }
-
- super.dispose();
+ dialogSettings = null;
}
/* (non-Javadoc)
@@ -213,12 +214,65 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
return composite;
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
- */
- @Override
+ /* (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) {
- super.createDialogAreaContent(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$
@@ -242,22 +296,22 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
@Override
public void widgetSelected(SelectionEvent e) {
// Get the old panel
- IWizardConfigurationPanel oldPanel = settings.getActiveConfigurationPanel();
+ IConfigurationPanel oldPanel = settings.getActiveConfigurationPanel();
// Extract the current settings in an special properties container
- IPropertiesContainer data = new PropertiesContainer();
- if (oldPanel instanceof IDataExchangeNode) ((IDataExchangeNode)oldPanel).extractData(data);
+ 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.setProperty(ITerminalsConnectorConstants.PROP_IP_PORT, null);
- data.setProperty(ITerminalsConnectorConstants.PROP_TIMEOUT, null);
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, null);
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, null);
- data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, null);
+ data.remove(ITerminalsConnectorConstants.PROP_IP_PORT);
+ data.remove(ITerminalsConnectorConstants.PROP_TIMEOUT);
+ data.remove(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
+ data.remove(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID);
+ data.remove(ITerminalsConnectorConstants.PROP_ENCODING);
// Switch to the new panel
settings.showConfigurationPanel(terminals.getText());
// Get the new panel
- IWizardConfigurationPanel newPanel = settings.getActiveConfigurationPanel();
+ IConfigurationPanel newPanel = settings.getActiveConfigurationPanel();
// Re-setup the relevant data
- if (newPanel instanceof IDataExchangeNode) ((IDataExchangeNode)newPanel).setupData(data);
+ if (newPanel != null) newPanel.setupData(data);
// resize the dialog if needed to show the complete panel
getShell().pack();
@@ -268,11 +322,11 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
fillCombo(terminals);
// Create the settings panel control
- settings = new SettingsPanelControl(null);
+ settings = new SettingsPanelControl();
// Create, initialize and add the first visible panel. All
// other panels are created on demand only.
- String terminalLabel = SWTControlUtil.getItem(terminals, 0);
+ String terminalLabel = terminals.getItem(0);
if (terminalLabel != null) {
// Get the corresponding delegate
ILauncherDelegate delegate = label2delegate.get(terminalLabel);
@@ -299,7 +353,7 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
terminals.select(0);
settings.showConfigurationPanel(terminals.getText());
- SWTControlUtil.setEnabled(terminals, terminals.getItemCount() > 1);
+ terminals.setEnabled(terminals.getItemCount() > 1);
restoreWidgetValues();
@@ -386,42 +440,41 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ /**
+ * Validate the dialog.
*/
- @Override
public void validate() {
- IWizardConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
+ IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
Button okButton = getButton(IDialogConstants.OK_ID);
- SWTControlUtil.setEnabled(okButton, panel.isValid());
+ if (okButton != null) okButton.setEnabled(panel.isValid());
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#setMessage(java.lang.String, int)
+ /**
+ * 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>.
*/
- @Override
public void setMessage(String message, int messageType) {
if (settings != null) {
settings.setMessage(message, messageType);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#saveWidgetValues()
+ /**
+ * Save the dialog's widget values.
*/
- @Override
protected void saveWidgetValues() {
IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- settings.put("terminalLabel", SWTControlUtil.getText(terminals)); //$NON-NLS-1$
+ if (settings != null && terminals != null) {
+ settings.put("terminalLabel", terminals.getText()); //$NON-NLS-1$
this.settings.saveWidgetValues(settings, null);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#restoreWidgetValues()
+ /**
+ * Restore the dialog's widget values.
*/
- @Override
protected void restoreWidgetValues() {
IDialogSettings settings = getDialogSettings();
if (settings != null) {
@@ -437,32 +490,34 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#okPressed()
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
- IWizardConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
+ IConfigurationPanel panel = this.settings.getActiveConfigurationPanel();
+ Assert.isNotNull(panel);
- if(!panel.isValid()){
+ 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 PropertiesContainer();
+ data = new HashMap<String, Object>();
// Store the id of the selected delegate
- data.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, label2delegate.get(terminals.getText()).getId());
+ data.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, label2delegate.get(terminals.getText()).getId());
// Store the selection
- data.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+ data.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
// Store the delegate specific settings
- if (panel instanceof IDataExchangeNode) {
- ((IDataExchangeNode)panel).extractData(data);
- }
+ panel.extractData(data);
+
+ // Save the current widget values
+ saveWidgetValues();
- super.okPressed();
+ super.okPressed();
}
/**
@@ -473,7 +528,43 @@ public class LaunchTerminalSettingsDialog extends CustomTrayDialog implements IV
*
* @return The configured terminal launcher settings or <code>null</code>.
*/
- public IPropertiesContainer getSettings() {
+ 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
new file mode 100644
index 000000000..da9dde56e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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/LaunchTerminalCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
index c6eaa4d37..f7e2bea64 100644
--- 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
@@ -11,6 +11,7 @@ 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;
@@ -21,12 +22,10 @@ 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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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;
@@ -77,9 +76,9 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
}
if (dialog.open() == Window.OK) {
// Get the terminal settings from the dialog
- IPropertiesContainer properties = dialog.getSettings();
+ Map<String, Object> properties = dialog.getSettings();
if (properties != null) {
- String delegateId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
+ String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
Assert.isNotNull(delegateId);
ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
Assert.isNotNull(delegateId);
@@ -114,9 +113,9 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
}
if (dialog.open() == Window.OK) {
// Get the terminal settings from the dialog
- IPropertiesContainer properties = dialog.getSettings();
+ Map<String, Object> properties = dialog.getSettings();
if (properties != null) {
- String delegateId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
+ String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
Assert.isNotNull(delegateId);
ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
Assert.isNotNull(delegateId);
@@ -126,12 +125,12 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
}
else if (delegates.length == 1) {
ILauncherDelegate delegate = delegates[0];
- IPropertiesContainer properties = new PropertiesContainer();
+ Map<String, Object> properties = new HashMap<String, Object>();
// Store the id of the selected delegate
- properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
// Store the selection
- properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+ properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
// Execute
delegate.execute(properties, null);
@@ -144,10 +143,10 @@ public class LaunchTerminalCommandHandler extends AbstractHandler {
private boolean isValidSelection(ISelection selection) {
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
Object element = ((IStructuredSelection) selection).getFirstElement();
- IPropertiesAccessService service = ServiceManager.getInstance().getService(element, IPropertiesAccessService.class);
- if (service != null) {
- Map<String, String> props = service.getTargetAddress(element);
- if (props != null && props.containsKey(IPropertiesAccessServiceConstants.PROP_ADDRESS)) {
+ 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;
}
}
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
index 290ff9882..29cd1d0e9 100644
--- 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
@@ -9,26 +9,20 @@
*******************************************************************************/
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.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.events.TriggerCommandEvent;
-import org.eclipse.ui.handlers.HandlerUtil;
/**
* Maximize view handler implementation.
*/
-public class MaximizeViewHandler extends AbstractHandler {
+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 {
- TriggerCommandEvent e = new TriggerCommandEvent(HandlerUtil.getActivePart(event), "org.eclipse.ui.window.maximizePart"); //$NON-NLS-1$
- EventManager.getInstance().fireEvent(e);
-
+ 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
index aa480e639..608ce1c43 100644
--- 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
@@ -9,26 +9,20 @@
*******************************************************************************/
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.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.events.TriggerCommandEvent;
-import org.eclipse.ui.handlers.HandlerUtil;
/**
* Quick access handler implementation.
*/
-public class QuickAccessHandler extends AbstractHandler {
+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 {
- TriggerCommandEvent e = new TriggerCommandEvent(HandlerUtil.getActivePart(event), "org.eclipse.ui.window.quickAccess"); //$NON-NLS-1$
- EventManager.getInstance().fireEvent(e);
-
+ 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
index 5d87fe0b8..84157eb7c 100644
--- 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
@@ -11,29 +11,51 @@ 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.tcf.te.runtime.extensions.ExecutableExtension;
+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 ExecutableExtension implements ILauncherDelegate {
+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.tcf.te.runtime.extensions.ExecutableExtension#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
*/
@Override
- public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- super.doSetInitializationData(config, propertyName, data);
-
+ 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
@@ -46,7 +68,42 @@ public abstract class AbstractLauncherDelegate extends ExecutableExtension imple
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)
@@ -64,4 +121,23 @@ public abstract class AbstractLauncherDelegate extends ExecutableExtension imple
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
index d4cf480bc..1b99f4389 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -10,21 +10,31 @@
package org.eclipse.tcf.te.ui.terminals.launcher;
import java.util.ArrayList;
-import java.util.Collection;
+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.tcf.te.runtime.extensions.AbstractExtensionPointManager;
-import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+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;
@@ -32,7 +42,179 @@ import org.eclipse.ui.handlers.IHandlerService;
/**
* Terminal launcher delegate manager implementation.
*/
-public class LauncherDelegateManager extends AbstractExtensionPointManager<ILauncherDelegate> {
+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.
@@ -55,22 +237,6 @@ public class LauncherDelegateManager extends AbstractExtensionPointManager<ILaun
super();
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
- */
- @Override
- protected String getExtensionPointId() {
- return "org.eclipse.tcf.te.ui.terminals.launcherDelegates"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName()
- */
- @Override
- protected String getConfigurationElementName() {
- return "delegate"; //$NON-NLS-1$
- }
-
/**
* Returns the list of all contributed terminal launcher delegates.
*
@@ -81,8 +247,7 @@ public class LauncherDelegateManager extends AbstractExtensionPointManager<ILaun
*/
public ILauncherDelegate[] getLauncherDelegates(boolean unique) {
List<ILauncherDelegate> contributions = new ArrayList<ILauncherDelegate>();
- Collection<ExecutableExtensionProxy<ILauncherDelegate>> launcherDelegates = getExtensions().values();
- for (ExecutableExtensionProxy<ILauncherDelegate> launcherDelegate : launcherDelegates) {
+ for (Proxy launcherDelegate : getExtensions().values()) {
ILauncherDelegate instance = unique ? launcherDelegate.newInstance() : launcherDelegate.getInstance();
if (instance != null && !contributions.contains(instance)) {
contributions.add(instance);
@@ -103,8 +268,9 @@ public class LauncherDelegateManager extends AbstractExtensionPointManager<ILaun
*/
public ILauncherDelegate getLauncherDelegate(String id, boolean unique) {
ILauncherDelegate contribution = null;
- if (getExtensions().containsKey(id)) {
- ExecutableExtensionProxy<ILauncherDelegate> proxy = getExtensions().get(id);
+ Map<String, Proxy> extensions = getExtensions();
+ if (extensions.containsKey(id)) {
+ Proxy proxy = extensions.get(id);
// Get the extension instance
contribution = unique ? proxy.newInstance() : proxy.getInstance();
}
@@ -135,7 +301,7 @@ public class LauncherDelegateManager extends AbstractExtensionPointManager<ILaun
EvaluationContext context = new EvaluationContext(currentState, selection);
// Set the "selection" variable to the selection.
context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- // Allow plugin activation
+ // Allow plug-in activation
context.setAllowPluginActivation(true);
// Evaluate the expression
try {
@@ -158,4 +324,98 @@ public class LauncherDelegateManager extends AbstractExtensionPointManager<ILaun
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/manager/ConsoleManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
index 59dacea65..429f5f02b 100644
--- 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
@@ -22,7 +22,7 @@ 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.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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;
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
index 498cfb828..0d47192eb 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -50,6 +50,12 @@ public class Messages extends NLS {
// **** 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;
@@ -104,4 +110,6 @@ public class Messages extends NLS {
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
index a8d1b511b..f7a77a435 100644
--- 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
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2012, 2013 Wind River Systems, Inc. and others. All rights reserved.
+# 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
@@ -8,6 +8,12 @@
# 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
@@ -65,4 +71,5 @@ 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
index 46499b3bd..8ee9b2506 100644
--- 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
@@ -1,636 +1,202 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
+ * 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.dialogs.IMessageProvider;
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.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tcf.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.osgi.framework.Bundle;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
/**
- * Abstract terminal configuration panel implementation.
+ * Abstract terminal launcher configuration panel implementation.
*/
-public abstract class AbstractConfigurationPanel extends AbstractWizardConfigurationPanel implements IConfigurationPanel {
- 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$
+public abstract class AbstractConfigurationPanel implements IConfigurationPanel {
+ private final IConfigurationPanelContainer container;
- // 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>();
+ private Composite topControl = null;
// The selection
private ISelection selection;
- // A map containing the settings per host
- protected final Map<String, Map<String, String>> hostSettingsMap = new HashMap<String, Map<String, String>>();
+
+ private String message = null;
+ private int messageType = IMessageProvider.NONE;
+
+ private boolean enabled = true;
/**
* Constructor.
*
- * @param parentControl The parent control. Must not be <code>null</code>!
+ * @param container The configuration panel container or <code>null</code>.
*/
- public AbstractConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
+ public AbstractConfigurationPanel(IConfigurationPanelContainer container) {
+ super();
+ this.container = container;
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getContainer()
*/
@Override
- public void setSelection(ISelection selection) {
- this.selection = selection;
+ public IConfigurationPanelContainer getContainer() {
+ return container;
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getSelection()
+ * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
*/
@Override
- public ISelection getSelection() {
- return selection;
- }
-
- /**
- * 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();
- IPropertiesAccessService service = ServiceManager.getInstance().getService(element, IPropertiesAccessService.class);
- if (service != null) {
- Map<String, String> props = service.getTargetAddress(element);
- if (props != null && props.containsKey(IPropertiesAccessServiceConstants.PROP_ADDRESS)) {
- return props.get(IPropertiesAccessServiceConstants.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();
- IPropertiesAccessService service = ServiceManager.getInstance().getService(element, IPropertiesAccessService.class);
- if (service != null) {
- Object encoding = service.getProperty(element, IPropertiesAccessServiceConstants.PROP_DEFAULT_ENCODING);
- if (encoding instanceof String) return ((String) encoding).trim();
- }
- }
-
- return null;
+ public final String getMessage() {
+ return message;
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
*/
@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) {
- SWTControlUtil.add(encodingCombo, encoding, SWTControlUtil.getItemCount(encodingCombo) - 1);
- }
- }
+ public final int getMessageType() {
+ return messageType;
}
/**
- * Restore the encodings widget values.
+ * Set the message and the message type to display.
*
- * @param settings The dialog settings. Must not be <code>null</code>.
- * @param idPrefix The prefix or <code>null</code>.
+ * @param message The message or <code>null</code>.
+ * @param messageType The message type or <code>IMessageProvider.NONE</code>.
*/
- protected void doRestoreEncodingsWidgetValues(IDialogSettings settings, String idPrefix) {
- Assert.isNotNull(settings);
-
- String encoding = settings.get(getParentControl().prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix));
- if (encoding != null && encoding.trim().length() > 0) {
- setEncoding(encoding);
- }
+ protected final void setMessage(String message, int messageType) {
+ this.message = message;
+ this.messageType = messageType;
}
- /**
- * 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.
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#dispose()
*/
- 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;
+ @Override
+ public void dispose() {
}
/**
- * Encode the host settings to a string.
+ * Sets the top control.
*
- * @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>.
+ * @param topControl The top control or <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);
- }
+ protected void setControl(Composite topControl) {
+ this.topControl = topControl;
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getControl()
*/
@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(getParentControl().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
+ public Composite getControl() {
+ return topControl;
}
- /**
- * Returns the selected host from the hosts combo widget.
- *
- * @return The selected host or <code>null</code>.
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
*/
- protected final String getHostFromCombo() {
- return SWTControlUtil.getText(hostCombo);
- }
-
- protected void removeSettingsForHost(String host) {
- if (hostSettingsMap.containsKey(host)) {
- hostSettingsMap.remove(host);
- }
+ @Override
+ public void setSelection(ISelection selection) {
+ this.selection = selection;
}
- /**
- * Returns the list of host names of the persisted hosts.
- *
- * @return The list of host names.
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getSelection()
*/
- private List<String> getHostList() {
- List<String> hostList = new ArrayList<String>();
- hostList.addAll(hostSettingsMap.keySet());
- return hostList;
+ @Override
+ public ISelection getSelection() {
+ return selection;
}
- /**
- * Fill the host combo with the stored per host setting names.
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
*/
- 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;
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
}
- /**
- * 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.
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
*/
- 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 = SWTControlUtil.getText(hostCombo);
- 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();
- SWTControlUtil.select(hostCombo, 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));
- }
- }
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
}
/**
- * Create the encoding selection combo.
+ * 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 parent The parent composite. Must not be <code>null</code>.
- * @param separator If <code>true</code>, a separator will be added before the controls.
+ * @param settingsSlotId The dialog settings slot id to prefix.
+ * @param prefix The prefix.
+ * @return The correctly prefixed dialog settings slot id.
*/
- 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(SWTControlUtil.getText(encodingCombo))) {
- 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();
- SWTControlUtil.add(encodingCombo, encoding, SWTControlUtil.getItemCount(encodingCombo) - 1);
- SWTControlUtil.select(encodingCombo, SWTControlUtil.indexOf(encodingCombo, encoding));
- lastSelectedEncoding = SWTControlUtil.getText(encodingCombo);
-
- // Remember the last 5 custom encodings entered
- if (!encodingHistory.contains(encoding)) {
- if (encodingHistory.size() == 5) encodingHistory.remove(4);
- encodingHistory.add(encoding);
- }
-
- } else {
- SWTControlUtil.select(encodingCombo, SWTControlUtil.indexOf(encodingCombo, lastSelectedEncoding));
- }
- }
- }
- });
-
- fillEncodingCombo();
-
- // Apply any default encoding derived from the current selection
- String defaultEncoding = getSelectionEncoding();
- if (defaultEncoding != null && !"".equals(defaultEncoding)) { //$NON-NLS-1$
- setEncoding(defaultEncoding);
+ 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;
}
- /**
- * 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);
-
- SWTControlUtil.setItems(encodingCombo, encodings.toArray(new String[encodings.size()]));
- SWTControlUtil.select(encodingCombo, 0);
-
- lastSelectedEncoding = SWTControlUtil.getText(encodingCombo);
- }
- }
-
- /**
- * 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
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setEnabled(boolean)
*/
- @SuppressWarnings("deprecation")
- private String getResourceEncoding() {
- String preference = null;
-
- if (Platform.getBundle("org.eclipse.core.resources") != null //$NON-NLS-1$
- && Platform.getBundle("org.eclipse.core.resources").getState() == Bundle.ACTIVE) { //$NON-NLS-1$
- preference = org.eclipse.core.resources.ResourcesPlugin.getPlugin().getPluginPreferences().getString(org.eclipse.core.resources.ResourcesPlugin.PREF_ENCODING);
- }
-
- return preference != null && preference.length() > 0 ? preference : null;
+ @Override
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
}
/**
- * Select the encoding.
- *
- * @param encoding The encoding. Must not be <code>null</code>.
- */
- protected void setEncoding(String encoding) {
- Assert.isNotNull(encoding);
+ * @return Returns the enabled state.
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
- int index = SWTControlUtil.indexOf(encodingCombo, "ISO-8859-1".equals(encoding) ? "Default (ISO-8859-1)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$
- if (index != -1) SWTControlUtil.select(encodingCombo, index);
- else {
- SWTControlUtil.add(encodingCombo, encoding, SWTControlUtil.getItemCount(encodingCombo) - 1);
- SWTControlUtil.select(encodingCombo, SWTControlUtil.indexOf(encodingCombo, encoding));
- }
-
- lastSelectedEncoding = SWTControlUtil.getText(encodingCombo);
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ setMessage(null, NONE);
+ return true;
}
- /**
- * Returns the selected encoding.
- *
- * @return The selected encoding or <code>null</code>.
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#activate()
*/
- protected String getEncoding() {
- String encoding = SWTControlUtil.getText(encodingCombo);
- return encoding != null && encoding.startsWith("Default") ? null : encoding; //$NON-NLS-1$
+ @Override
+ public void activate() {
}
- /**
- * 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;
- }
- }
+ /* (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
new file mode 100644
index 000000000..770d24f51
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java
@@ -0,0 +1,615 @@
+/*******************************************************************************
+ * 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.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
index 3c08b36ee..eedd25fcb 100644
--- 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
@@ -13,27 +13,44 @@ 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.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.AbstractService;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.runtime.utils.StatusHelper;
-import org.eclipse.tcf.te.ui.swt.DisplayUtil;
+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.IConnectorType;
import org.eclipse.tcf.te.ui.terminals.interfaces.IUIConstants;
import org.eclipse.tcf.te.ui.terminals.manager.ConsoleManager;
import org.eclipse.tcf.te.ui.terminals.nls.Messages;
import org.eclipse.tcf.te.ui.terminals.types.ConnectorManager;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
+import org.eclipse.ui.PlatformUI;
/**
* Terminal service implementation.
*/
@SuppressWarnings("restriction")
-public class TerminalService extends AbstractService implements ITerminalService {
+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.
@@ -48,9 +65,9 @@ public class TerminalService extends AbstractService implements ITerminalService
* @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 callback The target callback to invoke if the operation finished 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, ICallback callback);
+ 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.
@@ -63,7 +80,67 @@ public class TerminalService extends AbstractService implements ITerminalService
public boolean isExecuteAsync() { return true; }
}
- private boolean fRestoringView;
+ /**
+ * 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,
@@ -71,17 +148,17 @@ public class TerminalService extends AbstractService implements ITerminalService
*
* @param properties The terminal properties. Must not be <code>null</code>.
* @param runnable The terminal service runnable. Must not be <code>null</code>.
- * @param callback The target callback to invoke if the operation has been finished or <code>null</code>.
+ * @param done The callback to invoke if the operation has been finished or <code>null</code>.
*/
- protected final void executeServiceOperation(final IPropertiesContainer properties, final TerminalServiceRunnable runnable, final ICallback callback) {
+ 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 = properties.getStringProperty(ITerminalsConnectorConstants.PROP_ID);
- String secondaryId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SECONDARY_ID);
- String title = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TITLE);
- Object data = properties.getProperty(ITerminalsConnectorConstants.PROP_DATA);
+ 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);
@@ -92,8 +169,9 @@ public class TerminalService extends AbstractService implements ITerminalService
final ITerminalConnector connector = createTerminalConnector(properties);
if (connector == null) {
// Properties contain invalid connector arguments
- if (callback != null) {
- callback.done(this, StatusHelper.getStatus(new IllegalArgumentException(Messages.TerminalService_error_cannotCreateConnector)));
+ if (done != null) {
+ Exception e = new IllegalArgumentException(Messages.TerminalService_error_cannotCreateConnector);
+ done.done(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), e.getLocalizedMessage(), e));
}
return;
}
@@ -106,15 +184,21 @@ public class TerminalService extends AbstractService implements ITerminalService
// Execute the operation
if (!runnable.isExecuteAsync()) {
- runnable.run(finId, finSecondaryId, finTitle, connector, finData, callback);
+ runnable.run(finId, finSecondaryId, finTitle, connector, finData, done);
}
else {
- DisplayUtil.safeAsyncExec(new Runnable() {
- @Override
- public void run() {
- runnable.run(finId, finSecondaryId, finTitle, connector, finData, callback);
- }
- });
+ 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.
+ }
}
}
@@ -152,14 +236,14 @@ public class TerminalService extends AbstractService implements ITerminalService
* @param properties The terminal console properties. Must not be <code>null</code>.
* @return The terminal connector or <code>null</code>.
*/
- protected ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ protected ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// The terminal connector result object
ITerminalConnector connector = null;
// Get the connector type id from the properties
- String connectorTypeId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID);
+ String connectorTypeId = (String)properties.get(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID);
if (connectorTypeId != null) {
// Get the connector type
IConnectorType connectorType = ConnectorManager.getInstance().getConnectorType(connectorTypeId, false);
@@ -173,10 +257,10 @@ public class TerminalService extends AbstractService implements ITerminalService
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService#openConsole(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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 IPropertiesContainer properties, final ICallback callback) {
+ public void openConsole(final Map<String, Object> properties, final Done done) {
Assert.isNotNull(properties);
final boolean restoringView = fRestoringView;
@@ -184,9 +268,9 @@ public class TerminalService extends AbstractService implements ITerminalService
@Override
@SuppressWarnings("synthetic-access")
public void run(final String id, final String secondaryId, final String title,
- final ITerminalConnector connector, final Object data, final ICallback callback) {
+ final ITerminalConnector connector, final Object data, final Done done) {
if (restoringView) {
- doRun(id, secondaryId, title, connector, data, callback);
+ doRun(id, secondaryId, title, connector, data, done);
} else {
// First, restore the view. This opens consoles from the memento
fRestoringView = true;
@@ -194,23 +278,33 @@ public class TerminalService extends AbstractService implements ITerminalService
fRestoringView = false;
// After that schedule opening the requested console
- DisplayUtil.safeAsyncExec(new Runnable() {
- @Override
- public void run() {
- doRun(id, secondaryId, title, connector, data, callback);
- }
- });
+ 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, ICallback callback) {
+ public void doRun(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) {
// Determine the terminal encoding
- String encoding = properties.getStringProperty(ITerminalsConnectorConstants.PROP_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$
- flags.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.valueOf(properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW)));
- flags.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.valueOf(properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)));
+ 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)
@@ -222,44 +316,44 @@ public class TerminalService extends AbstractService implements ITerminalService
if (item != null && !item.isDisposed()) item.setData("properties", properties); //$NON-NLS-1$
// Invoke the callback
- if (callback != null) callback.done(this, Status.OK_STATUS);
+ if (done != null) done.done(Status.OK_STATUS);
}
- }, callback);
+ }, done);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService#closeConsole(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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 IPropertiesContainer properties, final ICallback callback) {
+ 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, ICallback callback) {
+ 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 (callback != null) callback.done(this, Status.OK_STATUS);
+ if (done != null) done.done(Status.OK_STATUS);
}
- }, callback);
+ }, done);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService#terminateConsole(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @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(IPropertiesContainer properties, ICallback callback) {
+ 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, ICallback callback) {
+ 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 (callback != null) callback.done(this, Status.OK_STATUS);
+ if (done != null) done.done(Status.OK_STATUS);
}
- }, callback);
+ }, 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
index d7b85f23a..07317d4ee 100644
--- 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
@@ -13,10 +13,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
+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.
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
index ce9a6260e..e6a1660d3 100644
--- 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
@@ -20,11 +20,11 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
+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.
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
index 5e2f7c3b1..9dc0acdb9 100644
--- 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
@@ -20,13 +20,13 @@ 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.runtime.interfaces.IDisposable;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
+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.
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
index 6d8ccb0a7..2bd4f7bb2 100644
--- 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
@@ -10,10 +10,10 @@
package org.eclipse.tcf.te.ui.terminals.streams;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
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.
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
index e45b17b9a..9d3298d4a 100644
--- 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
@@ -13,8 +13,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
+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;
/**
@@ -173,12 +173,12 @@ public class StreamsSettings {
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 IPropertiesContainer) {
- stdin = (OutputStream)((IPropertiesContainer)store).getProperty("stdin"); //$NON-NLS-1$
- stdout = (InputStream)((IPropertiesContainer)store).getProperty("stdout"); //$NON-NLS-1$
- stderr = (InputStream)((IPropertiesContainer)store).getProperty("stderr"); //$NON-NLS-1$
- stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])((IPropertiesContainer)store).getProperty("StdOutListeners"); //$NON-NLS-1$
- stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])((IPropertiesContainer)store).getProperty("StdErrListeners"); //$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$
}
}
@@ -191,12 +191,12 @@ public class StreamsSettings {
Assert.isNotNull(store);
store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$
store.put("LineSeparator", lineSeparator); //$NON-NLS-1$
- if (store instanceof IPropertiesContainer) {
- ((IPropertiesContainer)store).setProperty("stdin", stdin); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("stdout", stdout); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("stderr", stderr); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("StdOutListeners", stdoutListeners); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("StdErrListeners", stderrListeners); //$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
index ccccc93d1..613eaf6f6 100644
--- 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
@@ -12,9 +12,9 @@ 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.tcf.te.runtime.interfaces.IDisposable;
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.
@@ -45,7 +45,7 @@ public class TabCommandFieldHandler implements IDisposable, IAdaptable {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
+ * @see org.eclipse.ui.services.IDisposable#dispose()
*/
@Override
public void dispose() {
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
index 123813713..382b734fe 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -13,8 +13,9 @@ 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.runtime.events.DisposedEvent;
-import org.eclipse.tcf.te.runtime.events.EventManager;
+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;
/**
@@ -63,7 +64,10 @@ public class TabDisposeListener implements DisposeListener {
// Fire selection changed event
parentTabFolderManager.fireSelectionChanged();
// Fire the terminal console disposed event
- EventManager.getInstance().fireEvent(new DisposedEvent(e.getSource(), ((CTabItem)e.getSource()).getData("customData"))); //$NON-NLS-1$
+ 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
index 23730cbfd..9e4eb09be 100644
--- 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
@@ -11,7 +11,6 @@ package org.eclipse.tcf.te.ui.terminals.tabs;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import java.util.EventObject;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -38,14 +37,10 @@ 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.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.events.AbstractEventListener;
-import org.eclipse.tcf.te.ui.swt.DisplayUtil;
+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.events.SelectionChangedBroadcastEvent;
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;
@@ -67,8 +62,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
private final ITerminalsView parentView;
// Reference to the selection listener instance
private final SelectionListener selectionListener;
- // Reference to the broadcasted selection changed event listener instance
- private final BroadcastedSelectionChangedEventListener broadcastedSelectionChangedEventListener;
/**
* List of selection changed listeners.
@@ -141,12 +134,18 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
if (e.button == 1 && selectMode) {
selectMode = false;
// Fire a selection changed event with the terminal controls selection
- DisplayUtil.safeAsyncExec(new Runnable() {
- @Override
- public void run() {
- fireSelectionChanged(new StructuredSelection(getTerminal().getSelection()));
- }
- });
+ 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.
+ }
}
}
@@ -159,67 +158,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
}
/**
- * The event listener to process broadcasted selection changed events
- */
- private class BroadcastedSelectionChangedEventListener extends AbstractEventListener {
- private final TabFolderManager parent;
-
- /**
- * Constructor.
- *
- * @param parent The parent tab folder manager. Must not be <code>null</code>.
- */
- public BroadcastedSelectionChangedEventListener(TabFolderManager parent) {
- super();
-
- Assert.isNotNull(parent);
- this.parent = parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
- */
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof SelectionChangedBroadcastEvent && !event.getSource().equals(parent)) {
- // Don't need to do anything if the parent tab folder is disposed or does not have a open tab
- CTabFolder tabFolder = parent.getTabFolder();
- if (tabFolder == null || tabFolder.isDisposed() || tabFolder.getItemCount() == 0) return;
-
- // Received a broadcasted selection changed event from another tab folder manager.
- SelectionChangedEvent selectionChangedEvent = ((SelectionChangedBroadcastEvent)event).getSelectionChangedEvent();
- if (selectionChangedEvent != null && selectionChangedEvent.getSelection() instanceof IStructuredSelection && !selectionChangedEvent.getSelection().isEmpty()) {
- // Extract the selection from the selection changed event
- IStructuredSelection selection = (IStructuredSelection)selectionChangedEvent.getSelection();
- // Determine the first element in the selection being a CTabItem
- CTabItem item = null;
- Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (candidate instanceof CTabItem) { item = (CTabItem)candidate; break; }
- }
- // If we got an CTabItem from the selection, try to find a CTabItem in our own tab folder manager
- // which is associated with the exact same data object.
- if (item != null && item.getData("customData") != null) { //$NON-NLS-1$
- Object data = item.getData("customData"); //$NON-NLS-1$
-
- CTabItem[] ourItems = tabFolder.getItems();
- for (CTabItem ourItem : ourItems) {
- Object ourData = ourItem.getData("customData"); //$NON-NLS-1$
- if (data.equals(ourData) && !ourItem.equals(parent.getActiveTabItem())) {
- // Select this item and we are done
- parent.setSelection(new StructuredSelection(ourItem));
- break;
- }
- }
- }
- }
- }
- }
-
- }
-
- /**
* Constructor.
*
* @param parentView The parent terminals console view. Must not be <code>null</code>.
@@ -232,13 +170,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
// Attach a selection listener to the tab folder
selectionListener = doCreateTabFolderSelectionListener(this);
if (getTabFolder() != null) getTabFolder().addSelectionListener(selectionListener);
-
-
- // Create and register the broadcasted selection changed event listener
- broadcastedSelectionChangedEventListener = doCreateBroadcastedSelectionChangedEventListener(this);
- if (isListeningToBroadcastedSelectionChangedEvent() && broadcastedSelectionChangedEventListener != null) {
- EventManager.getInstance().addEventListener(broadcastedSelectionChangedEventListener, SelectionChangedBroadcastEvent.class);
- }
}
/**
@@ -285,10 +216,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
public void dispose() {
// Dispose the selection listener
if (getTabFolder() != null && !getTabFolder().isDisposed()) getTabFolder().removeSelectionListener(selectionListener);
- // Remove the broadcasted selection changed event listener from the notification manager
- if (broadcastedSelectionChangedEventListener != null) {
- EventManager.getInstance().removeEventListener(broadcastedSelectionChangedEventListener);
- }
// Dispose the tab command field handler
for (TabCommandFieldHandler handler : commandFieldHandler.values()) {
handler.dispose();
@@ -307,7 +234,7 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
*
* @return The created tab item or <code>null</code> if failed.
*/
- @SuppressWarnings("unused")
+ @SuppressWarnings({ "unused", "unchecked" })
public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data, Map<String, Boolean> flags) {
Assert.isNotNull(title);
Assert.isNotNull(connector);
@@ -342,8 +269,9 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
// Create the terminal control
ITerminalViewControl terminal = TerminalViewControlFactory.makeControl(doCreateTerminalTabTerminalListener(this, item), composite, new ITerminalConnector[] { connector }, true);
- if (terminal instanceof ITerminalControl && data instanceof IPropertiesContainer) {
- boolean noReconnect = ((IPropertiesContainer)data).getBooleanProperty(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT);
+ 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);
}
@@ -410,13 +338,14 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
* @param oldItem The old dragged tab item. Must not be <code>null</code>.
* @return The new dropped tab item.
*/
- public CTabItem cloneTabItemAfterDrop(CTabItem oldItem) {
+ @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$
- IPropertiesContainer properties = (IPropertiesContainer)oldItem.getData("properties"); //$NON-NLS-1$
+ Map<String, Object> properties = (Map<String, Object>)oldItem.getData("properties"); //$NON-NLS-1$
String title = oldItem.getText();
// The result tab item
@@ -804,63 +733,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
for (ISelectionChangedListener listener : selectionChangedListeners) {
listener.selectionChanged(event);
}
-
- // Second, broadcast the event if desired
- if (isBroadcastSelectionChangedEvent()) onBroadcastSelectionChangedEvent(event);
- }
-
- /**
- * Controls if or if not a selection changed event, processed by this tab
- * folder manager shall be broadcasted to via the global Workbench notification
- * mechanism.
- *
- * @return <code>True</code> to broadcast the selection changed event, <code>false</code> otherwise.
- */
- protected boolean isBroadcastSelectionChangedEvent() {
- return false;
- }
-
- /**
- * Broadcasts the given selection changed event via the global Workbench notification mechanism.
- *
- * @param selectionChangedEvent The selection changed event or <code>null</code>.
- */
- protected void onBroadcastSelectionChangedEvent(SelectionChangedEvent selectionChangedEvent) {
- SelectionChangedBroadcastEvent event = doCreateSelectionChangedBroadcastEvent(this, selectionChangedEvent);
- if (event != null) EventManager.getInstance().fireEvent(event);
- }
-
- /**
- * Creates the selection changed broadcast event.
- *
- * @param source The event source. Must not be <code>null</code>.
- * @param selectionChangedEvent The selection changed event or <code>null</code>.
- *
- * @return The selection changed broadcast event or <code>null</code>.
- */
- protected SelectionChangedBroadcastEvent doCreateSelectionChangedBroadcastEvent(TabFolderManager source, SelectionChangedEvent selectionChangedEvent) {
- return new SelectionChangedBroadcastEvent(source, selectionChangedEvent);
- }
-
- /**
- * Returns if or if not this tab folder manager is listening to broadcasted selection
- * changed events. Broadcasted events by the same tab folder manager are ignored independent
- * of the methods return value.
- *
- * @return <code>True</code> to listen to broadcasted selection changed events, <code>false</code> to not listen.
- */
- protected boolean isListeningToBroadcastedSelectionChangedEvent() {
- return false;
- }
-
- /**
- * Creates a new broadcasted selection changed event listener instance.
- *
- * @param parent The parent tab folder manager. Must not be <code>null</code>.
- * @return The event listener instance or <code>null</code>.
- */
- protected BroadcastedSelectionChangedEventListener doCreateBroadcastedSelectionChangedEventListener(TabFolderManager parent) {
- return new BroadcastedSelectionChangedEventListener(parent);
}
/**
@@ -900,19 +772,20 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
*
* @return The string representation.
*/
- protected String state2msg(CTabItem item, TerminalState state) {
+ @SuppressWarnings("unchecked")
+ protected String state2msg(CTabItem item, TerminalState state) {
Assert.isNotNull(item);
Assert.isNotNull(state);
// Determine the terminal properties of the tab folder
- IPropertiesContainer properties = (IPropertiesContainer)item.getData("properties"); //$NON-NLS-1$
+ 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.getStringProperty(key);
+ 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;
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
index 5c3644834..459003c93 100644
--- 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
@@ -11,6 +11,7 @@ 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;
@@ -25,8 +26,7 @@ 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.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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;
@@ -215,7 +215,8 @@ public class TabFolderMenuHandler extends PlatformObject {
// Create and add the paste action
add(new TerminalActionPaste() {
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
public void run() {
// Determine if pasting to the active tab require backslash translation
boolean needsTranslation = false;
@@ -225,9 +226,10 @@ public class TabFolderMenuHandler extends PlatformObject {
// If we have the active tab item, we can get the active terminal control
CTabItem activeTabItem = manager.getActiveTabItem();
if (activeTabItem != null) {
- IPropertiesContainer properties = (IPropertiesContainer)activeTabItem.getData("properties"); //$NON-NLS-1$
+ Map<String, Object> properties = (Map<String, Object>)activeTabItem.getData("properties"); //$NON-NLS-1$
if (properties != null && properties.containsKey(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE)) {
- needsTranslation = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE);
+ Object value = properties.get(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE);
+ needsTranslation = value instanceof Boolean ? ((Boolean)value).booleanValue() : false;
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java
index abc5868c2..c879c6beb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/AbstractConnectorType.java
@@ -9,12 +9,83 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.types;
-import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
+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.IConnectorType;
+import org.eclipse.tcf.te.ui.terminals.nls.Messages;
/**
* Abstract terminal connector type implementation.
*/
-public abstract class AbstractConnectorType extends ExecutableExtension implements IConnectorType {
+public abstract class AbstractConnectorType extends PlatformObject implements IConnectorType {
+ // The mandatory id of the extension
+ private String id = null;
+ /* (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 {
+ Assert.isNotNull(config);
+
+ // 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$
+ }
+ }
+
+ /**
+ * 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.IConnectorType#getId()
+ */
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof AbstractConnectorType) {
+ return id.equals(((AbstractConnectorType)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/types/ConnectorManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java
index 6fd793f9e..23d2b03fe 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/ConnectorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * 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
@@ -10,17 +10,203 @@
package org.eclipse.tcf.te.ui.terminals.types;
import java.util.ArrayList;
-import java.util.Collection;
+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.tcf.te.runtime.extensions.AbstractExtensionPointManager;
-import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+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.osgi.util.NLS;
+import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType;
+import org.eclipse.tcf.te.ui.terminals.nls.Messages;
/**
* Terminal connector type extension point manager implementation.
*/
-public class ConnectorManager extends AbstractExtensionPointManager<IConnectorType> {
+public class ConnectorManager {
+ // 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 IConnectorType 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 terminal connector type 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 IConnectorType getInstance() {
+ if (instance == null) instance = newInstance();
+ return instance;
+ }
+
+ /**
+ * Returns always a new terminal connector type 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 IConnectorType 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 (IConnectorType)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.
@@ -43,22 +229,6 @@ public class ConnectorManager extends AbstractExtensionPointManager<IConnectorTy
super();
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
- */
- @Override
- protected String getExtensionPointId() {
- return "org.eclipse.tcf.te.ui.terminals.connectorTypes"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName()
- */
- @Override
- protected String getConfigurationElementName() {
- return "connectorType"; //$NON-NLS-1$
- }
-
/**
* Returns the list of all contributed terminal connector types.
*
@@ -69,8 +239,7 @@ public class ConnectorManager extends AbstractExtensionPointManager<IConnectorTy
*/
public IConnectorType[] getConnectorTypes(boolean unique) {
List<IConnectorType> contributions = new ArrayList<IConnectorType>();
- Collection<ExecutableExtensionProxy<IConnectorType>> connectorTypes = getExtensions().values();
- for (ExecutableExtensionProxy<IConnectorType> connectorType : connectorTypes) {
+ for (Proxy connectorType : getExtensions().values()) {
IConnectorType instance = unique ? connectorType.newInstance() : connectorType.getInstance();
if (instance != null && !contributions.contains(instance)) {
contributions.add(instance);
@@ -92,11 +261,105 @@ public class ConnectorManager extends AbstractExtensionPointManager<IConnectorTy
public IConnectorType getConnectorType(String id, boolean unique) {
IConnectorType contribution = null;
if (getExtensions().containsKey(id)) {
- ExecutableExtensionProxy<IConnectorType> proxy = getExtensions().get(id);
+ Proxy proxy = getExtensions().get(id);
// Get the extension instance
contribution = unique ? proxy.newInstance() : proxy.getInstance();
}
return contribution;
}
+
+ /**
+ * 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.connectorTypes"); //$NON-NLS-1$
+ if (point != null) {
+ IExtension[] extensions = getExtensionsSorted(point);
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ if ("connectorType".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/types/StreamsConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java
index 349cd2f0f..1969adef8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/types/StreamsConnectorType.java
@@ -11,11 +11,11 @@ package org.eclipse.tcf.te.ui.terminals.types;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Map;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+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.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.streams.StreamsSettings;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
@@ -29,24 +29,25 @@ import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtensi
public class StreamsConnectorType extends AbstractConnectorType {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ @Override
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_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.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDIN);
- InputStream stdout = (InputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT);
- InputStream stderr = (InputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDERR);
- boolean localEcho = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
- String lineSeparator = properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
+ 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();
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
index e1d0a0600..f1824a5ac 100644
--- 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
@@ -13,10 +13,15 @@ package org.eclipse.tcf.te.ui.terminals.view;
import java.util.Iterator;
import java.util.UUID;
-import org.eclipse.core.resources.IResource;
+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;
@@ -41,21 +46,25 @@ 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.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.events.TriggerCommandEvent;
+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.
@@ -650,19 +659,43 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
while (iterator.hasNext() && isValid) {
Object element = iterator.next();
- if (element instanceof IResource) continue;
+ Object adapted = null;
- IResource adapted = element instanceof IAdaptable ? (IResource)((IAdaptable)element).getAdapter(IResource.class) : null;
- if (adapted == null) adapted = (IResource)Platform.getAdapterManager().getAdapter(element, IResource.class);
- if (adapted == null) adapted = (IResource)Platform.getAdapterManager().loadAdapter(element, IResource.class.getName());
+ 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) {
- TriggerCommandEvent event = new TriggerCommandEvent(selection, "org.eclipse.tcf.te.ui.terminals.local.command.launch"); //$NON-NLS-1$
- EventManager.getInstance().fireEvent(event);
+ 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;
}
}
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
index 7ca2c74f0..ee1a46d5f 100644
--- 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
@@ -10,24 +10,23 @@
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.runtime.callback.AsyncCallbackCollector;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.async.UICallbackInvocationDelegate;
-import org.eclipse.tcf.te.ui.swt.DisplayUtil;
+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.
@@ -54,7 +53,8 @@ public class TerminalsViewMementoHandler {
* @param view The terminals view. Must not be <code>null</code>.
* @param memento The memento. Must not be <code>null</code>.
*/
- public void saveState(TerminalsView view, IMemento memento) {
+ @SuppressWarnings("unchecked")
+ public void saveState(TerminalsView view, IMemento memento) {
Assert.isNotNull(view);
Assert.isNotNull(memento);
@@ -77,11 +77,11 @@ public class TerminalsViewMementoHandler {
if (item.isDisposed()) continue;
// Get the original terminal properties associated with the tab item
- IPropertiesContainer properties = (IPropertiesContainer)item.getData("properties"); //$NON-NLS-1$
+ Map<String, Object> properties = (Map<String, Object>)item.getData("properties"); //$NON-NLS-1$
if (properties == null) continue;
// Get the terminal launcher delegate
- String delegateId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
+ 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) {
@@ -91,18 +91,18 @@ public class TerminalsViewMementoHandler {
// Store the common attributes
connectionMemento.putString(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegateId);
- String terminalConnectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
+ String terminalConnectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
if (terminalConnectorId != null) {
connectionMemento.putString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, terminalConnectorId);
}
- String connectorTypeId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID);
+ String connectorTypeId = (String)properties.get(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID);
if (connectorTypeId != null) {
connectionMemento.putString(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, connectorTypeId);
}
- if (properties.getProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW) != null) {
- connectionMemento.putBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW, properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW));
+ 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
@@ -131,12 +131,11 @@ public class TerminalsViewMementoHandler {
final IMemento finMemento = memento;
// Restore the pinned state of the after all connections completed
- AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
+ final Runnable runnable = new Runnable() {
@Override
- protected void internalDone(Object caller, IStatus status) {
- // Restore the pinned state
+ public void run() {
if (finMemento.getBoolean("pinned") != null) { //$NON-NLS-1$
- DisplayUtil.safeAsyncExec(new Runnable() {
+ asyncExec(new Runnable() {
@Override
public void run() {
view.setPinned(finMemento.getBoolean("pinned").booleanValue()); //$NON-NLS-1$
@@ -150,25 +149,31 @@ public class TerminalsViewMementoHandler {
});
}
}
- }, new UICallbackInvocationDelegate());
+ };
+
+ 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
- IPropertiesContainer properties = new PropertiesContainer();
+ Map<String, Object> properties = new HashMap<String, Object>();
// Set the view id attributes
- properties.setProperty(ITerminalsConnectorConstants.PROP_ID, id);
- properties.setProperty(ITerminalsConnectorConstants.PROP_SECONDARY_ID, secondaryId);
+ properties.put(ITerminalsConnectorConstants.PROP_ID, id);
+ properties.put(ITerminalsConnectorConstants.PROP_SECONDARY_ID, secondaryId);
// Restore the common attributes
- properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, connection.getString(ITerminalsConnectorConstants.PROP_DELEGATE_ID));
- properties.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, connection.getString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID));
- properties.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, connection.getString(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID));
- properties.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW));
+ 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));
+ properties.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, connection.getString(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_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 = properties.getStringProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID);
+ 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) {
@@ -178,11 +183,34 @@ public class TerminalsViewMementoHandler {
// Restore the terminal connection
if (delegate != null && !properties.isEmpty()) {
- delegate.execute(properties, new AsyncCallbackCollector.SimpleCollectorCallback(collector));
+ 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);
}
}
- collector.initDone();
+ 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