From 1ad1441f008dc7e03a1da52a8ec73816aaac85c6 Mon Sep 17 00:00:00 2001
From: Martin Oberhuber < martin.oberhuber@windriver.com>
Date: Wed, 16 Apr 2008 20:56:41 +0000
Subject: [PATCH] [226764] Contribute RSE Terminal Subsystem (MontaVista
contribution)
---
.../.classpath | 7 +
.../.cvsignore | 1 +
.../.project | 28 ++
.../.settings/org.eclipse.jdt.core.prefs | 7 +
.../META-INF/MANIFEST.MF | 23 +
.../about.html | 28 ++
.../build.properties | 17 +
.../plugin.properties | 16 +
.../subsystems/terminals/core/Activator.java | 87 ++++
.../core/ITerminalServiceSubSystem.java | 19 +
...TerminalServiceSubSystemConfiguration.java | 23 +
.../core/TerminalServiceSubSystem.java | 136 ++++++
...TerminalServiceSubSystemConfiguration.java | 54 +++
.../core/elements/TerminalElement.java | 44 ++
.../.classpath | 7 +
.../.cvsignore | 1 +
.../.project | 28 ++
.../.settings/org.eclipse.jdt.core.prefs | 7 +
.../META-INF/MANIFEST.MF | 19 +
.../about.html | 28 ++
.../build.properties | 9 +
.../icons/full/obj16/terminalcommands_obj.gif | Bin 0 -> 938 bytes
.../full/obj16/terminalcommandslive_obj.gif | Bin 0 -> 938 bytes
.../plugin.properties | 19 +
.../plugin.xml | 31 ++
.../subsystems/terminals/ssh/Activator.java | 62 +++
.../SshTerminalSubSystemConfiguration.java | 70 +++
.../org.eclipse.rse.terminals.ui/.classpath | 7 +
.../org.eclipse.rse.terminals.ui/.cvsignore | 1 +
.../org.eclipse.rse.terminals.ui/.project | 28 ++
.../.settings/org.eclipse.jdt.core.prefs | 7 +
.../META-INF/MANIFEST.MF | 25 +
.../org.eclipse.rse.terminals.ui/about.html | 28 ++
.../build.properties | 9 +
.../icons/removeterminal.gif | Bin 0 -> 580 bytes
.../icons/terminal_view.gif | Bin 0 -> 938 bytes
.../icons/terminalcommands_obj.gif | Bin 0 -> 938 bytes
.../icons/terminalcommandslive_obj.gif | Bin 0 -> 938 bytes
.../plugin.properties | 25 +
.../org.eclipse.rse.terminals.ui/plugin.xml | 70 +++
.../rse/internal/terminals/ui/Activator.java | 122 +++++
.../terminals/ui/TerminalServiceHelper.java | 91 ++++
.../ui/TerminalUIResources.properties | 22 +
.../ui/actions/LaunchTerminalAction.java | 268 +++++++++++
.../actions/LaunchTerminalActionDelegate.java | 55 +++
.../ui/actions/RemoveTerminalAction.java | 49 ++
.../ui/actions/ShowInTerminalViewAction.java | 49 ++
.../ui/actions/TerminalElementBaseAction.java | 70 +++
...lServiceSubSystemConfigurationAdapter.java | 94 ++++
...eSubSystemConfigurationAdapterFactory.java | 47 ++
.../ui/views/RSETerminalConnectionThread.java | 119 +++++
.../ui/views/RSETerminalConnector.java | 44 ++
.../ui/views/RSETerminalConnectorImpl.java | 89 ++++
.../ui/views/TerminalViewElementAdapter.java | 172 +++++++
.../TerminalViewElementsAdapterFactory.java | 49 ++
.../terminals/ui/views/TerminalViewTab.java | 451 ++++++++++++++++++
.../terminals/ui/views/TerminalViewer.java | 199 ++++++++
.../terminals/ui/views/TerminalsUI.java | 69 +++
58 files changed, 3030 insertions(+)
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/.classpath
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/.cvsignore
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/.project
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/.settings/org.eclipse.jdt.core.prefs
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/META-INF/MANIFEST.MF
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/about.html
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/build.properties
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/plugin.properties
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/internal/subsystems/terminals/core/Activator.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.classpath
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.cvsignore
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.project
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.settings/org.eclipse.jdt.core.prefs
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/META-INF/MANIFEST.MF
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/about.html
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/build.properties
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/icons/full/obj16/terminalcommands_obj.gif
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/icons/full/obj16/terminalcommandslive_obj.gif
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/plugin.properties
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/plugin.xml
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/Activator.java
create mode 100644 rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/SshTerminalSubSystemConfiguration.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/.classpath
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/.cvsignore
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/.project
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/.settings/org.eclipse.jdt.core.prefs
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/META-INF/MANIFEST.MF
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/about.html
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/build.properties
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/icons/removeterminal.gif
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/icons/terminal_view.gif
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/icons/terminalcommands_obj.gif
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/icons/terminalcommandslive_obj.gif
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/plugin.properties
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/plugin.xml
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/Activator.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalUIResources.properties
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/RemoveTerminalAction.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/ShowInTerminalViewAction.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/TerminalElementBaseAction.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapterFactory.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectionThread.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnector.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementAdapter.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementsAdapterFactory.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewer.java
create mode 100644 rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalsUI.java
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.classpath b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.classpath
new file mode 100644
index 00000000000..2fbb7a23e12
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.cvsignore b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.cvsignore
new file mode 100644
index 00000000000..ba077a4031a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.project b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.project
new file mode 100644
index 00000000000..421b86dd130
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.rse.subsystems.terminals.core
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.settings/org.eclipse.jdt.core.prefs b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..5c96d7ee999
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Fri Apr 04 23:25:44 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..e29d4caefd4
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.rse.subsystems.terminals.core;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.rse.internal.subsystems.terminals.core.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)"
+Eclipse-LazyStart: true
+Bundle-Vendor: %providerName
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Export-Package: org.eclipse.rse.internal.subsystems.terminals.core;x-internal:=true,
+ org.eclipse.rse.subsystems.terminals.core;
+ uses:="org.eclipse.rse.services,
+ org.eclipse.rse.core.subsystems,
+ org.eclipse.rse.core.model,
+ org.eclipse.rse.internal.services.terminals",
+ org.eclipse.rse.subsystems.terminals.core.elements
+Bundle-ActivationPolicy: lazy
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/about.html b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/about.html
new file mode 100644
index 00000000000..d4cc693f9f0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.
+
+
+
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/build.properties b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/build.properties
new file mode 100644
index 00000000000..e4cf4a53ba3
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2008 Wind River Systems, Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html
+src.includes = about.html
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/plugin.properties b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/plugin.properties
new file mode 100644
index 00000000000..5e3adf0f8dc
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/plugin.properties
@@ -0,0 +1,16 @@
+################################################################################
+# Copyright (c) 2008 MontaVista Software, Inc.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Yu-Fen Kuo - initial API and implementation
+################################################################################
+
+# NLS_MESSAGEFORMAT_NONE
+# NLS_ENCODING=UTF-8
+
+pluginName = RSE Terminals Core (Incubation)
+providerName = Eclipse.org
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/internal/subsystems/terminals/core/Activator.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/internal/subsystems/terminals/core/Activator.java
new file mode 100644
index 00000000000..b5269b46645
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/internal/subsystems/terminals/core/Activator.java
@@ -0,0 +1,87 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.subsystems.terminals.core;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends SystemBasePlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.rse.subsystems.terminals.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ // make sure that org.eclipse.rse.terminals.ui plugin is loaded
+ // Decouple from the current Thread
+ new Thread("terminals.ui adapter loader") { //$NON-NLS-1$
+ public void run() {
+
+ try {
+ Bundle bundle = Platform
+ .getBundle("org.eclipse.rse.terminals.ui");
+ if (bundle != null) {
+ bundle
+ .loadClass("org.eclipse.rse.terminals.ui.TerminalServiceHelper");
+
+ }
+ } catch (ClassNotFoundException e) {
+ logError(e.getLocalizedMessage(), e);
+ }
+
+ }
+ }.start();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ protected void initializeImageRegistry() {
+
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java
new file mode 100644
index 00000000000..93cf5bf5253
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java
@@ -0,0 +1,19 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.rse.subsystems.terminals.core;
+
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+
+public interface ITerminalServiceSubSystem extends ISubSystem {
+ public void addChild(TerminalElement element);
+
+ public void removeChild(TerminalElement element);
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java
new file mode 100644
index 00000000000..60434e45b04
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java
@@ -0,0 +1,23 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.subsystems.terminals.core;
+
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.internal.services.terminals.ITerminalService;
+
+public interface ITerminalServiceSubSystemConfiguration extends
+ ISubSystemConfiguration {
+ public ITerminalService getTerminalService(IHost host);
+
+ public ITerminalService createTerminalService(IHost host);
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java
new file mode 100644
index 00000000000..d58cf16a8b7
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java
@@ -0,0 +1,136 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.subsystems.terminals.core;
+
+import java.util.ArrayList;
+
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
+import org.eclipse.rse.core.events.SystemResourceChangeEvent;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.subsystems.CommunicationsEvent;
+import org.eclipse.rse.core.subsystems.ICommunicationsListener;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.SubSystem;
+import org.eclipse.rse.internal.services.terminals.ITerminalService;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.swt.widgets.Display;
+
+public final class TerminalServiceSubSystem extends SubSystem implements
+ ITerminalServiceSubSystem, ICommunicationsListener {
+
+ protected ITerminalService _hostService;
+
+ private ArrayList children;
+
+ public class Refresh implements Runnable {
+ private TerminalServiceSubSystem _ss;
+
+ public Refresh(TerminalServiceSubSystem ss) {
+ _ss = ss;
+ }
+
+ public void run() {
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ registry.fireEvent(new SystemResourceChangeEvent(_ss,
+ ISystemResourceChangeEvents.EVENT_REFRESH, _ss));
+ }
+ }
+
+ protected TerminalServiceSubSystem(IHost host,
+ IConnectorService connectorService) {
+ super(host, connectorService);
+ }
+
+ public TerminalServiceSubSystem(IHost host,
+ IConnectorService connectorService, ITerminalService hostService) {
+ super(host, connectorService);
+ _hostService = hostService;
+ }
+
+ public ITerminalService getTerminalService() {
+ return _hostService;
+ }
+
+ public Class getServiceType() {
+ return ITerminalService.class;
+ }
+
+ public void addChild(TerminalElement element) {
+ if (children == null) {
+ children = new ArrayList();
+ // if this is first shell, start listening so that on disconnect, we
+ // persist
+ getConnectorService().addCommunicationsListener(this);
+ }
+ children.add(element);
+ Display.getDefault().asyncExec(new Refresh(this));
+ }
+
+ public void removeChild(TerminalElement element) {
+ if (children != null) {
+ children.remove(element);
+ }
+ if (children == null) {
+ getConnectorService().removeCommunicationsListener(this);
+ }
+ Display.getDefault().asyncExec(new Refresh(this));
+ }
+
+ public Object[] getChildren() {
+ if (children != null)
+ return children.toArray();
+ return null;
+ }
+
+ public boolean hasChildren() {
+ if (children != null && children.size() > 0)
+ return true;
+ return false;
+ }
+
+ public void setTerminalService(ITerminalService service) {
+ _hostService = service;
+ }
+
+ public void communicationsStateChange(CommunicationsEvent e) {
+ switch (e.getState()) {
+ case CommunicationsEvent.AFTER_DISCONNECT:
+ // no longer listen
+ getConnectorService().removeCommunicationsListener(this);
+ // if (_cmdShells != null) _cmdShells.clear();
+ // if (_envVars != null) _envVars.clear();
+ // _defaultShell = null;
+
+ break;
+
+ case CommunicationsEvent.BEFORE_DISCONNECT:
+ case CommunicationsEvent.CONNECTION_ERROR:
+ // remove all shells
+ // saveShellState(_cmdShells);
+ // if (getShells().length > 0)
+ // {
+ // Display.getDefault().asyncExec(new CancelAllShells());
+ // // cancelAllShells();
+ // }
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ public boolean isPassiveCommunicationsListener() {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java
new file mode 100644
index 00000000000..b74083a4179
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java
@@ -0,0 +1,54 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.subsystems.terminals.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
+import org.eclipse.rse.internal.services.terminals.ITerminalService;
+import org.eclipse.rse.services.IService;
+
+
+public abstract class TerminalServiceSubSystemConfiguration extends
+ SubSystemConfiguration implements
+ ITerminalServiceSubSystemConfiguration {
+
+ private Map _services;
+
+ protected TerminalServiceSubSystemConfiguration() {
+ super();
+ _services = new HashMap();
+ }
+
+ public boolean supportsFilters() {
+ return false;
+ }
+
+ public final ITerminalService getTerminalService(IHost host) {
+ ITerminalService service = (ITerminalService) _services.get(host);
+ if (service == null) {
+ service = createTerminalService(host);
+ _services.put(host, service);
+ }
+ return service;
+ }
+
+ public final IService getService(IHost host) {
+ return getTerminalService(host);
+ }
+
+ public Class getServiceType() {
+ return ITerminalService.class;
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java
new file mode 100644
index 00000000000..e445e2164f8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java
@@ -0,0 +1,44 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.rse.subsystems.terminals.core.elements;
+
+import org.eclipse.rse.core.subsystems.AbstractResource;
+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
+
+public class TerminalElement extends AbstractResource {
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public TerminalElement(String name,
+ ITerminalServiceSubSystem terminalServiceSubSystem) {
+ super(terminalServiceSubSystem);
+ this.name = name;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof TerminalElement) {
+ return name.equals(((TerminalElement) obj).getName());
+ }
+ return super.equals(obj);
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.classpath b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.classpath
new file mode 100644
index 00000000000..2fbb7a23e12
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.cvsignore b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.cvsignore
new file mode 100644
index 00000000000..ba077a4031a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.project b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.project
new file mode 100644
index 00000000000..d03300ed99b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.rse.subsystems.terminals.ssh
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.settings/org.eclipse.jdt.core.prefs b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..9c9f492d7fb
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Fri Apr 04 23:26:40 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..c2cfe78a723
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.rse.subsystems.terminals.ssh;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.rse.subsystems.terminals.ssh.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.connectorservice.ssh;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.services.ssh;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.rse.subsystems.terminals.core;bundle-version="[0.1.0,0.2.0)",
+ org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)"
+Eclipse-LazyStart: true
+Bundle-Vendor: %providerName
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-ActivationPolicy: lazy
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/about.html b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/about.html
new file mode 100644
index 00000000000..d4cc693f9f0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.
+
+
+
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/build.properties b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/build.properties
new file mode 100644
index 00000000000..e02737baa78
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html,\
+ plugin.xml,\
+ icons/
+src.includes = about.html
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/icons/full/obj16/terminalcommands_obj.gif b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/icons/full/obj16/terminalcommands_obj.gif
new file mode 100644
index 0000000000000000000000000000000000000000..bbb6a9e153e146f57903aa2b5e0d2bc58cd641c8
GIT binary patch
literal 938
zcmZ?wbhEHb6krfw_|Cxa|NsA)GiL(HKmWeGdG{tQEzQ{2n8nEC$+IgA3}@2L{AWn}
zZ#?sVS{lO{5MTg;pFe-joXIe2)~xRC?%A_v`}+F+{reXrF$zXQV5o(F;!hSvkehWt
z1Sn59aI`Zpa>#gWP&mlIC&%G%V1r^46B`$sK!HM|Yd62LSV6;uMg|TcDTyf>3sO!p
zvT!)4L>4xBvq>`gln5|79hzvws<1?00YeLyg({nbSILTlo$QmedMhU+F|q2;J|?;5|=b=70_{LC}2!?U|_HY0P>7m*#H0l
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/icons/full/obj16/terminalcommandslive_obj.gif b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/icons/full/obj16/terminalcommandslive_obj.gif
new file mode 100644
index 0000000000000000000000000000000000000000..be88df2b43e5048dd5cce649fb34502be599cfe5
GIT binary patch
literal 938
zcmZ?wbhEHb6krfw_|CwvfBt?3h6a24dVBl$_;?^0ykNl+`}qBCerfjg`xzPW#i{s
+
+
+
+
+
+
+
+
+
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/Activator.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/Activator.java
new file mode 100644
index 00000000000..f1574737c66
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/Activator.java
@@ -0,0 +1,62 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.subsystems.terminals.ssh;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.rse.subsystems.terminals.ssh";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/SshTerminalSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/SshTerminalSubSystemConfiguration.java
new file mode 100644
index 00000000000..ae06b63067a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.terminals.ssh/src/org/eclipse/rse/subsystems/terminals/ssh/SshTerminalSubSystemConfiguration.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista)- initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.rse.subsystems.terminals.ssh;
+
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.internal.connectorservice.ssh.SshConnectorService;
+import org.eclipse.rse.internal.connectorservice.ssh.SshConnectorServiceManager;
+import org.eclipse.rse.internal.services.ssh.ISshService;
+import org.eclipse.rse.internal.services.ssh.terminal.SshTerminalService;
+import org.eclipse.rse.internal.services.terminals.ITerminalService;
+import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem;
+import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystemConfiguration;
+
+public class SshTerminalSubSystemConfiguration extends
+ TerminalServiceSubSystemConfiguration {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#isFactoryFor(java.lang.Class)
+ */
+ public boolean isFactoryFor(Class subSystemType) {
+ boolean isFor = TerminalServiceSubSystem.class.equals(subSystemType);
+ return isFor;
+ }
+
+ /**
+ * Instantiate and return an instance of OUR subsystem. Do not populate it
+ * yet though!
+ *
+ * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost)
+ */
+ public ISubSystem createSubSystemInternal(IHost host) {
+ SshConnectorService connectorService = (SshConnectorService) getConnectorService(host);
+ ISubSystem subsys = new TerminalServiceSubSystem(host,
+ connectorService, createTerminalService(host));
+ return subsys;
+ }
+
+ public ITerminalService createTerminalService(IHost host) {
+ SshConnectorService cserv = (SshConnectorService) getConnectorService(host);
+ return new SshTerminalService(cserv);
+ }
+
+ public IConnectorService getConnectorService(IHost host) {
+ return SshConnectorServiceManager.getInstance().getConnectorService(
+ host, ISshService.class);
+ }
+
+ public void setConnectorService(IHost host,
+ IConnectorService connectorService) {
+ SshConnectorServiceManager.getInstance().setConnectorService(host,
+ ISshService.class, connectorService);
+ }
+
+ public Class getServiceImplType() {
+ return ISshService.class;
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/.classpath b/rse/plugins/org.eclipse.rse.terminals.ui/.classpath
new file mode 100644
index 00000000000..2fbb7a23e12
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/.cvsignore b/rse/plugins/org.eclipse.rse.terminals.ui/.cvsignore
new file mode 100644
index 00000000000..ba077a4031a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/.project b/rse/plugins/org.eclipse.rse.terminals.ui/.project
new file mode 100644
index 00000000000..593168ee3af
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.rse.terminals.ui
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/.settings/org.eclipse.jdt.core.prefs b/rse/plugins/org.eclipse.rse.terminals.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..6f2d714961f
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Fri Apr 04 23:28:00 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.terminals.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..e9dc182bb6a
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.rse.terminals.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.rse.internal.terminals.ui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.ui.views,
+ org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.rse.subsystems.terminals.core;bundle-version="[0.1.0,0.2.0)",
+ org.eclipse.tm.terminal,
+ org.eclipse.tm.terminal.view
+Bundle-ActivationPolicy: lazy
+Eclipse-LazyStart: true
+Bundle-Vendor: %providerName
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Export-Package: org.eclipse.rse.internal.terminals.ui;x-internal:=true,
+ org.eclipse.rse.internal.terminals.ui.actions;x-internal:=true,
+ org.eclipse.rse.internal.terminals.ui.configuration.adapter;x-internal:=true,
+ org.eclipse.rse.internal.terminals.ui.views;x-internal:=true
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/about.html b/rse/plugins/org.eclipse.rse.terminals.ui/about.html
new file mode 100644
index 00000000000..d4cc693f9f0
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.
+
+
+
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/build.properties b/rse/plugins/org.eclipse.rse.terminals.ui/build.properties
new file mode 100644
index 00000000000..6c551f66003
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml,\
+ icons/
+src.includes = about.html
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/icons/removeterminal.gif b/rse/plugins/org.eclipse.rse.terminals.ui/icons/removeterminal.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6f6296256e4f6eae3cf6cdd6a60aabdfcef2cb0b
GIT binary patch
literal 580
zcmZ?wbhEHb6krfwc*el+EI034ckiF`7oIC=KhrXLZsqXI+2gpI*N5cv7cK2~>zlu>
zTKinX=!L$;D=X(0PF|lvVt?)4_gqH%g|gvsE%P&aR%c8cPn$Y^U9#%+y3MD}U0gww3>}+dmYiVg|Y;3HrudlAIuB@!AsHi9{EiEZ2
zDK0K9Dk>^0EX>c(&&|!v%*_1%|3AYJ1d2ad7#SFx8FWBy2gL~k`@#n2re)^6g;F5E@f~;-J7J;V^*%!*oeae&(;b5=^
E0IO1-NdN!<
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/icons/terminal_view.gif b/rse/plugins/org.eclipse.rse.terminals.ui/icons/terminal_view.gif
new file mode 100644
index 0000000000000000000000000000000000000000..bbb6a9e153e146f57903aa2b5e0d2bc58cd641c8
GIT binary patch
literal 938
zcmZ?wbhEHb6krfw_|Cxa|NsA)GiL(HKmWeGdG{tQEzQ{2n8nEC$+IgA3}@2L{AWn}
zZ#?sVS{lO{5MTg;pFe-joXIe2)~xRC?%A_v`}+F+{reXrF$zXQV5o(F;!hSvkehWt
z1Sn59aI`Zpa>#gWP&mlIC&%G%V1r^46B`$sK!HM|Yd62LSV6;uMg|TcDTyf>3sO!p
zvT!)4L>4xBvq>`gln5|79hzvws<1?00YeLyg({nbSILTlo$QmedMhU+F|q2;J|?;5|=b=70_{LC}2!?U|_HY0P>7m*#H0l
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/icons/terminalcommands_obj.gif b/rse/plugins/org.eclipse.rse.terminals.ui/icons/terminalcommands_obj.gif
new file mode 100644
index 0000000000000000000000000000000000000000..bbb6a9e153e146f57903aa2b5e0d2bc58cd641c8
GIT binary patch
literal 938
zcmZ?wbhEHb6krfw_|Cxa|NsA)GiL(HKmWeGdG{tQEzQ{2n8nEC$+IgA3}@2L{AWn}
zZ#?sVS{lO{5MTg;pFe-joXIe2)~xRC?%A_v`}+F+{reXrF$zXQV5o(F;!hSvkehWt
z1Sn59aI`Zpa>#gWP&mlIC&%G%V1r^46B`$sK!HM|Yd62LSV6;uMg|TcDTyf>3sO!p
zvT!)4L>4xBvq>`gln5|79hzvws<1?00YeLyg({nbSILTlo$QmedMhU+F|q2;J|?;5|=b=70_{LC}2!?U|_HY0P>7m*#H0l
literal 0
HcmV?d00001
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/icons/terminalcommandslive_obj.gif b/rse/plugins/org.eclipse.rse.terminals.ui/icons/terminalcommandslive_obj.gif
new file mode 100644
index 0000000000000000000000000000000000000000..be88df2b43e5048dd5cce649fb34502be599cfe5
GIT binary patch
literal 938
zcmZ?wbhEHb6krfw_|CwvfBt?3h6a24dVBl$_;?^0ykNl+`}qBCerfjg`xzPW#i{s
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/Activator.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/Activator.java
new file mode 100644
index 00000000000..37fd05c99c2
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/Activator.java
@@ -0,0 +1,122 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends SystemBasePlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.rse.internal.terminals.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ private ResourceBundle resourceBundle;
+
+ public static String ICON_ID_LAUNCH_TERMINAL = "icon_id_launch_terminal"; //$NON-NLS-1$
+ public static String ICON_ID_TERMINAL_SUBSYSTEM = "icon_id_terminal_subsystem"; //$NON-NLS-1$
+ public static String ICON_ID_TERMINAL_SUBSYSTEM_LIVE = "icon_id_terminal_subsystem_live"; //$NON-NLS-1$
+ public static String ICON_ID_REMOVE_TERMINAL = "icon_id_remove_terminal"; //$NON-NLS-1$
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ resourceBundle = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ *
+ * @see java.util.ResourceBundle#getString(String)
+ *
+ * @param key
+ * the key for the desired string
+ * @return the string for the given key
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = Activator.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Return the plugin's Resource bundle.
+ *
+ * @return the Resource bundle
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle
+ .getBundle("org.eclipse.rse.internal.terminals.ui.TerminalUIResources"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
+
+ /**
+ * Initialize the image registry by declaring all of the required graphics.
+ */
+ protected void initializeImageRegistry() {
+ String path = getIconPath();
+ putImageInRegistry(ICON_ID_LAUNCH_TERMINAL, path + "terminal_view.gif"); //$NON-NLS-1$
+ putImageInRegistry(ICON_ID_TERMINAL_SUBSYSTEM, path
+ + "terminalcommands_obj.gif"); //$NON-NLS-1$
+ putImageInRegistry(ICON_ID_TERMINAL_SUBSYSTEM_LIVE, path
+ + "terminalcommandslive_obj.gif"); //$NON-NLS-1$
+ putImageInRegistry(ICON_ID_REMOVE_TERMINAL, path + "removeterminal.gif"); //$NON-NLS-1$
+
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java
new file mode 100644
index 00000000000..3f8b7b343aa
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalServiceHelper.java
@@ -0,0 +1,91 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.swt.custom.CTabItem;
+
+public class TerminalServiceHelper {
+
+ /**
+ * Constructor for TerminalServiceHelper.
+ */
+ public TerminalServiceHelper() {
+ super();
+ }
+
+ /**
+ * Helper method to return the path to change-directory to, given a selected
+ * remote file object
+ */
+ public static String getWorkingDirectory(IRemoteFile selectedFile) {
+ String path = null;
+ if (selectedFile.isDirectory())
+ path = selectedFile.getAbsolutePath();
+ else
+ path = selectedFile.getParentPath();
+ return path;
+ }
+
+ public static ITerminalServiceSubSystem getTerminalSubSystem(
+ IHost connection) {
+ ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
+ ISubSystem[] subsystems = systemRegistry.getSubSystems(connection);
+ for (int i = 0; i < subsystems.length; i++) {
+ if ("ssh.terminals".equals(subsystems[i].getSubSystemConfiguration().getId())) {
+ ITerminalServiceSubSystem subSystem = (ITerminalServiceSubSystem) subsystems[i];
+ return subSystem;
+ }
+ }
+ return null;
+ }
+
+ public static ITerminalServiceSubSystem[] getTerminalSubSystems(
+ IHost connection) {
+ List results = new ArrayList();
+ ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
+ ISubSystem[] subsystems = systemRegistry.getSubSystems(connection);
+ for (int i = 0; i < subsystems.length; i++) {
+ if (subsystems[i] instanceof ITerminalServiceSubSystem) {
+ ITerminalServiceSubSystem subSystem = (ITerminalServiceSubSystem) subsystems[i];
+ results.add(subSystem);
+ }
+ }
+ return (ITerminalServiceSubSystem[]) results
+ .toArray(new ITerminalServiceSubSystem[results.size()]);
+ }
+
+ public static TerminalElement createTerminalElement(CTabItem item,
+ ITerminalServiceSubSystem terminalServiceSubSystem) {
+ TerminalElement element = new TerminalElement(item.getText(),
+ terminalServiceSubSystem);
+ return element;
+ }
+
+ public static void removeTerminalElementFromHost(CTabItem item, IHost host) {
+ ITerminalServiceSubSystem terminalServiceSubSystem = getTerminalSubSystem(host);
+ if (terminalServiceSubSystem != null) {
+ TerminalElement element = new TerminalElement(item.getText(),
+ terminalServiceSubSystem);
+ terminalServiceSubSystem.removeChild(element);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalUIResources.properties b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalUIResources.properties
new file mode 100644
index 00000000000..8305e91bf6d
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/TerminalUIResources.properties
@@ -0,0 +1,22 @@
+################################################################################
+# Copyright (c) 2008 MontaVista Software, Inc..
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Yu-Fen Kuo (MontaVista) - initial API and implementation
+################################################################################
+
+# NLS_MESSAGEFORMAT_VAR
+# NLS_ENCODING=UTF-8
+
+LaunchTerminalAction.title=Launch Terminal
+LaunchTerminalAction.tooltip=Launch Terminal view
+TerminalsUI.cannotOpenView.error=Can not open remote terminals view
+
+RemoveTerminalAction.label=Remove Terminal
+RemoveTerminalAction.tooltip=Remove current terminal from terminals view
+ShowInTerminalViewAction.label=Show In Terminals View
+ShowInTerminalViewAction.tooltip=Show current terminal in Terminals view
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java
new file mode 100644
index 00000000000..ea598d2fbca
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalAction.java
@@ -0,0 +1,268 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name
+ * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
+ * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
+ * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
+ * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
+ * Kevin Doyle (IBM) - [187083] Launch Shell action available on folders inside virtual files
+ * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
+ * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
+ * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandAction
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.filters.ISystemFilterReference;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.internal.terminals.ui.Activator;
+import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
+import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer;
+import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI;
+import org.eclipse.rse.services.clientserver.PathUtility;
+import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * action to launch a terminal from either the terminal subsystem or selected
+ * directory
+ *
+ */
+public class LaunchTerminalAction extends SystemBaseAction {
+
+ private ITerminalServiceSubSystem subSystem;
+ private IRemoteFile selected;
+ private ISystemFilterReference selectedFilterRef;
+
+ public LaunchTerminalAction(String text, ImageDescriptor image, Shell shell) {
+ super(text, image, shell);
+ }
+
+ /**
+ * Constructor for LaunchTerminalAction
+ *
+ * @param parent
+ * @param subSystem
+ * the terminal subsystem to use if launching a terminal
+ */
+ public LaunchTerminalAction(Shell parent,
+ ITerminalServiceSubSystem subSystem) {
+ this(Activator.getResourceString("LaunchTerminalAction.title"), //$NON-NLS-1$
+ Activator.getResourceString("LaunchTerminalAction.tooltip"), //$NON-NLS-1$
+ parent, subSystem);
+ }
+
+ /**
+ * Constructor for LaunchTerminalAction
+ *
+ * @param title
+ * title of the action
+ * @param tooltip
+ * tooltip of the action
+ * @param parent
+ * @param subSystem
+ * the terminal subsystem to use if launching a terminal
+ */
+ public LaunchTerminalAction(String title, String tooltip, Shell parent,
+ ITerminalServiceSubSystem subSystem) {
+ this(title, tooltip, Activator.getDefault().getImageDescriptor(
+ Activator.ICON_ID_LAUNCH_TERMINAL), parent,
+
+ subSystem);
+ }
+
+ /**
+ * Constructor for LaunchTerminalAction
+ *
+ * @param title
+ * title of the action
+ * @param tooltip
+ * tooltip of the action
+ * @param descriptor
+ * image descriptor to be displayed for this action
+ * @param parent
+ * @param subSystem
+ * the terminal subsystem to use if launching a terminal
+ */
+ public LaunchTerminalAction(String title, String tooltip,
+ ImageDescriptor descriptor, Shell parent,
+ ITerminalServiceSubSystem subSystem) {
+ super(title, tooltip, descriptor, parent);
+ this.subSystem = subSystem;
+
+ }
+
+ /**
+ * @return the terminal subsystem
+ */
+ public ITerminalServiceSubSystem getSubSystem() {
+ return subSystem;
+ }
+
+ /**
+ * settor for the terminal subsystem
+ *
+ * @param subSystem
+ * terminal subsystem
+ */
+ public void setSubSystem(ITerminalServiceSubSystem subSystem) {
+ this.subSystem = subSystem;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public boolean updateSelection(IStructuredSelection selection) {
+ boolean enable = false;
+
+ Iterator e = selection.iterator();
+ Object selectedObject = e.next();
+
+ if (selectedObject != null) {
+ if (selectedObject instanceof ISystemFilterReference) {
+ selectedFilterRef = (ISystemFilterReference) selectedObject;
+ selected = null;
+ enable = true;
+ }
+ if (selectedObject instanceof IRemoteFile) {
+ selected = (IRemoteFile) selectedObject;
+ selectedFilterRef = null;
+ IHost host = selected.getParentRemoteFileSubSystem().getHost();
+ subSystem = TerminalServiceHelper.getTerminalSubSystem(host);
+ // If the selected object is a virtual folder then we need to
+ // select the parent
+ // of the archive
+ if (ArchiveHandlerManager.isVirtual(selected.getAbsolutePath())) {
+ IRemoteFileSubSystem rfss = selected
+ .getParentRemoteFileSubSystem();
+ String file = selected.getAbsolutePath();
+ // Get the archive's path
+ file = file.substring(0, file
+ .indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR));
+ // Get the parent of the archive's path
+ file = file.substring(0, file.lastIndexOf(selected
+ .getSeparator()));
+ try {
+ selected = rfss.getRemoteFileObject(file, null);
+ } catch (SystemMessageException exc) {
+ }
+ }
+ if (!selected.isFile()) {
+ enable = checkObjectType(selected);
+ }
+ } else if (selectedObject instanceof ITerminalServiceSubSystem) {
+ subSystem = (ITerminalServiceSubSystem) selectedObject;
+ enable = true;
+ }
+ }
+
+ return enable;
+ }
+
+ private ITerminalServiceSubSystem getTerminalSubSystem() {
+ IHost currentHost = null;
+
+ if (selectedFilterRef != null) {
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) selectedFilterRef)
+ .getAdapter(ISystemViewElementAdapter.class);
+ if (adapter != null) {
+ ISubSystem ss = adapter.getSubSystem(selectedFilterRef);
+ if (ss != null) {
+ currentHost = ss.getHost();
+ }
+ }
+ } else if (selected != null) {
+ currentHost = selected.getSystemConnection();
+ }
+ if (currentHost != null) {
+ return TerminalServiceHelper.getTerminalSubSystem(currentHost);
+
+ }
+
+ return getSubSystem();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.rse.ui.actions.SystemBaseAction#run()
+ */
+ public void run() {
+ if (selectedFilterRef != null) {
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) selectedFilterRef)
+ .getAdapter(ISystemViewElementAdapter.class);
+ if (adapter != null) {
+ ISubSystem ss = adapter.getSubSystem(selectedFilterRef);
+ if (ss != null) {
+ Object target = ss.getTargetForFilter(selectedFilterRef);
+ if (target != null && target instanceof IRemoteFile) {
+ selected = (IRemoteFile) target;
+ }
+ }
+ }
+ }
+
+ ITerminalServiceSubSystem terminalSubSystem = getTerminalSubSystem();
+ if (terminalSubSystem != null) {
+ TerminalsUI terminalsUI = TerminalsUI.getInstance();
+ TerminalViewer viewer = terminalsUI.activateTerminalsView();
+ if (!terminalSubSystem.isConnected()) {
+ try {
+ terminalSubSystem.connect(new NullProgressMonitor(), false);
+
+ } catch (Exception e) {
+ Activator.logError(e.getLocalizedMessage(), e);
+ }
+ }
+ if (terminalSubSystem.isConnected()) {
+ CTabItem tab = viewer.getTabFolder().createTabItem(
+ terminalSubSystem.getHost(), getInitialDirectoryCmd());
+ TerminalElement element = TerminalServiceHelper
+ .createTerminalElement(tab, terminalSubSystem);
+ terminalSubSystem.addChild(element);
+
+ }
+ }
+ }
+
+ private String getInitialDirectoryCmd() {
+ if (selected == null)
+ return null;
+ String path = TerminalServiceHelper.getWorkingDirectory(selected);
+
+ String cdCmd = "cd " + PathUtility.enQuoteUnix(path); //$NON-NLS-1$
+ if (getTerminalSubSystem().getHost().getSystemType().isWindows()) {
+ cdCmd = "cd /d \"" + path + '\"'; //$NON-NLS-1$
+ }
+ return cdCmd + "\r"; //$NON-NLS-1$
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java
new file mode 100644
index 00000000000..e041485e61b
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/LaunchTerminalActionDelegate.java
@@ -0,0 +1,55 @@
+/********************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
+ * Yu-Fen Kuo (MontaVista) - Adapted from LaunchShellActionDelegate
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.actions.ActionDelegate;
+
+public class LaunchTerminalActionDelegate extends ActionDelegate implements
+ IActionDelegate {
+
+ private LaunchTerminalAction launchTerminalAction;
+ private ISelection selection;
+
+ public void run(IAction action) {
+ if (launchTerminalAction == null) {
+ launchTerminalAction = new LaunchTerminalAction(SystemBasePlugin
+ .getActiveWorkbenchShell(), null);
+ }
+ launchTerminalAction.updateSelection((IStructuredSelection) selection);
+ launchTerminalAction.run();
+ }
+
+ public void runWithEvent(IAction action, Event event) {
+ super.runWithEvent(action, event);
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ super.selectionChanged(action, selection);
+ this.selection = selection;
+ }
+
+ public LaunchTerminalActionDelegate() {
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/RemoveTerminalAction.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/RemoveTerminalAction.java
new file mode 100644
index 00000000000..b9ec85fa6ee
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/RemoveTerminalAction.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
+ * Anna Dushistova (MontaVista) - Adapted from SystemShowInShellViewAction
+ * Anna Dushistova (MontaVista) - Adapted from ShowInTerminalViewAction
+ *******************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.internal.terminals.ui.Activator;
+import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer;
+import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.swt.widgets.Shell;
+
+public class RemoveTerminalAction extends TerminalElementBaseAction {
+ public RemoveTerminalAction(Shell parent) {
+ this(Activator.getResourceString("RemoveTerminalAction.label"), //$NON-NLS-1$
+ Activator.getResourceString("RemoveTerminalAction.tooltip"), //$NON-NLS-1$
+ Activator.getDefault().getImageDescriptor(
+ Activator.ICON_ID_REMOVE_TERMINAL), parent);
+ }
+
+ public RemoveTerminalAction(String label, String tooltip,
+ ImageDescriptor image, Shell parent) {
+ super(label, tooltip, image, parent);
+ }
+
+ public void run() {
+ TerminalsUI terminalsUI = TerminalsUI.getInstance();
+ TerminalViewer viewPart = terminalsUI.activateTerminalsView();
+ for (int i = 0; i < selected.size(); i++) {
+ TerminalElement element = (TerminalElement) selected.get(i);
+ viewPart.getTabFolder().disposePageFor(element.getName());
+ }
+ }
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/ShowInTerminalViewAction.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/ShowInTerminalViewAction.java
new file mode 100644
index 00000000000..7729eac7e27
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/ShowInTerminalViewAction.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
+ * Anna Dushistova (MontaVista) - Adapted from SystemShowInShellViewAction
+ *******************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.actions;
+
+import org.eclipse.rse.internal.terminals.ui.Activator;
+import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer;
+import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.swt.widgets.Shell;
+
+public class ShowInTerminalViewAction extends TerminalElementBaseAction {
+
+ public ShowInTerminalViewAction(Shell parent) {
+ super(
+ Activator.getResourceString("ShowInTerminalViewAction.label"), //$NON-NLS-1$
+ Activator.getResourceString("ShowInTerminalViewAction.tooltip"), //$NON-NLS-1$
+ Activator.getDefault().getImageDescriptor(
+ Activator.ICON_ID_LAUNCH_TERMINAL), parent);
+ allowOnMultipleSelection(false);
+ }
+
+ /**
+ * Called when this action is selected from the popup menu.
+ */
+ public void run() {
+ TerminalsUI terminalsUI = TerminalsUI.getInstance();
+ TerminalViewer viewPart = terminalsUI.activateTerminalsView();
+ for (int i = 0; i < selected.size(); i++) {
+ TerminalElement element = (TerminalElement) selected.get(i);
+ viewPart.getTabFolder().showPageFor(element.getName());
+ }
+ }
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/TerminalElementBaseAction.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/TerminalElementBaseAction.java
new file mode 100644
index 00000000000..8e771c164e1
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/actions/TerminalElementBaseAction.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Anna Dushistova (MontaVista) - Adapted from SystemBaseShellAction
+ * Yu-Fen Kuo (MontaVista) - Adapted from SystemBaseShellAction
+ *******************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.rse.ui.actions.SystemBaseAction;
+import org.eclipse.swt.widgets.Shell;
+
+public abstract class TerminalElementBaseAction extends SystemBaseAction {
+ protected List selected;
+
+ public TerminalElementBaseAction(String name, String tooltip,
+ ImageDescriptor image, Shell parent) {
+ super(name, tooltip, image, parent);
+ setAvailableOffline(true);
+ allowOnMultipleSelection(true);
+ selected = new ArrayList();
+ }
+
+ /**
+ * Called when the selection changes. The selection is checked to make sure
+ * this action can be performed on the selected object.
+ */
+ public boolean updateSelection(IStructuredSelection selection) {
+ boolean enable = false;
+ Iterator e = selection.iterator();
+ selected.clear();
+ while (e.hasNext()) {
+ Object object = e.next();
+ if (object instanceof TerminalElement) {
+ if (isApplicable((TerminalElement) object)) {
+ selected.add(object);
+ enable = true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ return enable;
+ }
+
+ protected boolean isApplicable(TerminalElement element) {
+ return true;
+ }
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java
new file mode 100644
index 00000000000..73e72f880e8
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapter.java
@@ -0,0 +1,94 @@
+/********************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - Adapted from ShellServiceSubSystemConfigurationAdapter
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.configuration.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.internal.terminals.ui.Activator;
+import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
+import org.eclipse.rse.internal.terminals.ui.actions.LaunchTerminalAction;
+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
+import org.eclipse.swt.widgets.Shell;
+
+public class TerminalServiceSubSystemConfigurationAdapter extends
+ SubSystemConfigurationAdapter {
+ protected LaunchTerminalAction terminalAction;
+ protected ImageDescriptor activeImageDescriptor;
+ protected ImageDescriptor inactiveImageDescriptor;
+
+ public IAction[] getSubSystemActions(SystemMenuManager menu,
+ IStructuredSelection selection, Shell shell, String menuGroup,
+ ISubSystemConfiguration factory, ISubSystem selectedSubSystem) {
+ List allActions = new ArrayList();
+ IAction[] baseActions = super.getSubSystemActions(menu, selection,
+ shell, menuGroup, factory, selectedSubSystem);
+ for (int i = 0; i < baseActions.length; i++) {
+ allActions.add(baseActions[i]);
+ }
+
+ // launching terminals and finding files
+ if (selectedSubSystem instanceof IRemoteFileSubSystem) {
+ IRemoteFileSubSystem fs = (IRemoteFileSubSystem) selectedSubSystem;
+ ITerminalServiceSubSystem cmdSubSystem = TerminalServiceHelper
+ .getTerminalSubSystem(fs.getHost());
+ if (cmdSubSystem != null) {
+ allActions.add(getTerminalAction(cmdSubSystem, shell));
+ }
+ } else if (selectedSubSystem instanceof ITerminalServiceSubSystem) {
+ allActions.add(getTerminalAction(
+ (ITerminalServiceSubSystem) selectedSubSystem, shell));
+ }
+
+ return (IAction[]) allActions.toArray(new IAction[allActions.size()]);
+ }
+
+ public IAction getTerminalAction(
+ ITerminalServiceSubSystem selectedSubSystem, Shell shell) {
+ if (terminalAction == null) {
+ terminalAction = new LaunchTerminalAction(shell, selectedSubSystem);
+ } else {
+ terminalAction.setSubSystem(selectedSubSystem);
+ }
+ return terminalAction;
+ }
+
+ public ImageDescriptor getImage(ISubSystemConfiguration config) {
+ if (inactiveImageDescriptor == null) {
+ inactiveImageDescriptor = Activator.getDefault()
+ .getImageDescriptor(Activator.ICON_ID_TERMINAL_SUBSYSTEM);
+ }
+ return inactiveImageDescriptor;
+ }
+
+ public ImageDescriptor getLiveImage(ISubSystemConfiguration config) {
+ if (activeImageDescriptor == null) {
+ activeImageDescriptor = Activator.getDefault().getImageDescriptor(
+ Activator.ICON_ID_TERMINAL_SUBSYSTEM_LIVE);
+ }
+ return activeImageDescriptor;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapterFactory.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapterFactory.java
new file mode 100644
index 00000000000..cfb34b94299
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/configuration/adapter/TerminalServiceSubSystemConfigurationAdapterFactory.java
@@ -0,0 +1,47 @@
+/********************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - [180519][api] declaratively register adapter factories
+ * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
+ * Yu-Fen Kuo (MontaVista) - Adapted from ShellServiceSubSystemConfigurationAdapterFactory
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.configuration.adapter;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystemConfiguration;
+import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
+
+public class TerminalServiceSubSystemConfigurationAdapterFactory implements
+ IAdapterFactory {
+
+ private ISubSystemConfigurationAdapter factoryAdapter;
+
+ public TerminalServiceSubSystemConfigurationAdapterFactory() {
+ super();
+ factoryAdapter = new TerminalServiceSubSystemConfigurationAdapter();
+ }
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ Object adapter = null;
+ if (adaptableObject instanceof TerminalServiceSubSystemConfiguration)
+ adapter = factoryAdapter;
+
+ return adapter;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { ISubSystemConfigurationAdapter.class };
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectionThread.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectionThread.java
new file mode 100644
index 00000000000..17892c3cc08
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectionThread.java
@@ -0,0 +1,119 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.rse.internal.services.terminals.ITerminalShell;
+import org.eclipse.rse.internal.services.terminals.ITerminalService;
+import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
+import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem;
+import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
+import org.eclipse.tm.internal.terminal.provisional.api.Logger;
+import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
+
+public class RSETerminalConnectionThread extends Thread {
+ private final ITerminalControl fControl;
+ private final RSETerminalConnectorImpl fConn;
+ private ITerminalShell shell;
+
+ public RSETerminalConnectionThread(RSETerminalConnectorImpl conn,
+ ITerminalControl control) {
+ super();
+ fControl = control;
+ fConn = conn;
+ fControl.setState(TerminalState.CONNECTING);
+ }
+
+ public void run() {
+ ITerminalServiceSubSystem subsystem = TerminalServiceHelper
+ .getTerminalSubSystem(fConn.host);
+
+ try {
+ subsystem.connect(new NullProgressMonitor(), false);
+ } catch (Exception e1) {
+ connectFailed(e1.getMessage(), e1.getMessage());
+ }
+ try {
+ if (subsystem instanceof TerminalServiceSubSystem) {
+ ITerminalService ts = ((TerminalServiceSubSystem) subsystem).getTerminalService();
+ shell = ts.launchTerminal("ansi", null, null, "/", null, new NullProgressMonitor());
+ }
+ fConn.setInputStream(shell.getInputStream());
+ fConn.setOutputStream(shell.getOutputStream());
+ } catch (SystemMessageException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ fConn.setTerminalHostShell(shell);
+ fControl.setState(TerminalState.CONNECTED);
+ try {
+ // this is the workaround to delay read data
+ // otherwise we might end of with race condition to processText
+ // before dimension is set.
+ Thread.sleep(500);
+ // read data until the connection gets terminated
+ readDataForever(fConn.getInputStream());
+ } catch (InterruptedIOException e) {
+ // we got interrupted: we are done...
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ }
+ // when reading is done, we set the state to closed
+ fControl.setState(TerminalState.CLOSED);
+ }
+
+ /**
+ * disconnect the ssh session
+ */
+ void disconnect() {
+ interrupt();
+ synchronized (this) {
+ try {
+ // do not close the connection
+ // TerminalServiceHelper.getTerminalSubSystem(fConn.host)
+ // .disconnect();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Read the data from the connection and display it in the terminal.
+ *
+ * @param in
+ * @throws IOException
+ */
+ private void readDataForever(InputStream in) throws IOException {
+ // read the data
+ byte bytes[] = new byte[32 * 1024];
+ int n;
+ // read until the thread gets interrupted....
+ while ((n = in.read(bytes)) != -1) {
+ fControl.getRemoteToTerminalOutputStream().write(bytes, 0, n);
+ }
+ }
+
+ private void connectFailed(String terminalText, String msg) {
+ Logger.log(terminalText);
+ fControl.displayTextInTerminal(terminalText);
+ fControl.setState(TerminalState.CLOSED);
+ fControl.setMsg(msg);
+ }
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnector.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnector.java
new file mode 100644
index 00000000000..8ec8dff7c14
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnector.java
@@ -0,0 +1,44 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
+
+public class RSETerminalConnector extends RSETerminalConnectorImpl implements ITerminalConnector {
+
+ public RSETerminalConnector(IHost host) {
+ super(host);
+ }
+
+ public String getId() {
+ return "rse_internal_connector"; //$NON-NLS-1$
+ }
+
+ public String getInitializationErrorMessage() {
+ return null;
+ }
+
+ public String getName() {
+ return "rse_internal_connector";
+ }
+
+ public boolean isInitialized() {
+ return true;
+ }
+
+ public Object getAdapter(Class adapterType) {
+ if (adapterType.isInstance(this))
+ return this;
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java
new file mode 100644
index 00000000000..f00296a11ec
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java
@@ -0,0 +1,89 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.internal.services.terminals.ITerminalShell;
+import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
+import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl;
+
+public class RSETerminalConnectorImpl extends TerminalConnectorImpl {
+ private OutputStream fOutputStream;
+ private InputStream fInputStream;
+ IHost host;
+ private RSETerminalConnectionThread fConnection;
+ private ITerminalShell shell;
+
+ public RSETerminalConnectorImpl(IHost host) {
+ super();
+ this.host = host;
+ }
+
+ public void connect(ITerminalControl control) {
+ super.connect(control);
+ fConnection = new RSETerminalConnectionThread(this, control);
+ fConnection.start();
+ }
+
+ public void doDisconnect() {
+ fConnection.disconnect();
+ if (getInputStream() != null) {
+ try {
+ getInputStream().close();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+
+ if (getTerminalToRemoteStream() != null) {
+ try {
+ getTerminalToRemoteStream().close();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ }
+
+ public OutputStream getTerminalToRemoteStream() {
+ return fOutputStream;
+ }
+
+ public String getSettingsSummary() {
+ return "RSE: " + host.getName();
+ }
+
+ public boolean isLocalEcho() {
+ return shell.isLocalEcho();
+ }
+
+ public void setTerminalSize(int newWidth, int newHeight) {
+ shell.setTerminalSize(newWidth, newHeight);
+ }
+
+ public InputStream getInputStream() {
+ return fInputStream;
+ }
+
+ public void setOutputStream(OutputStream outputStream) {
+ fOutputStream = outputStream;
+ }
+
+ public void setInputStream(InputStream inputStream) {
+ fInputStream = inputStream;
+ }
+
+ public void setTerminalHostShell(ITerminalShell shell) {
+ this.shell = shell;
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementAdapter.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementAdapter.java
new file mode 100644
index 00000000000..ca8b86dbe38
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementAdapter.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - [180562] dont implement ISystemOutputRemoteTypes
+ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
+ * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
+ * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
+ * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
+ * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
+ * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
+ * David McKnight (IBM) - [196842] Don't have open menu for folders
+ * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
+ * David McKnight (IBM) - [189873] Improve remote shell editor open action with background jobs
+ * David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
+ * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
+ * Yu-Fen Kuo (MontaVista) - Adopted from SystemViewRemoteOutputAdapter
+ * Anna Dushistova (MontaVista) - Adopted from SystemViewRemoteOutputAdapter
+ *******************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.internal.terminals.ui.Activator;
+import org.eclipse.rse.internal.terminals.ui.actions.RemoveTerminalAction;
+import org.eclipse.rse.internal.terminals.ui.actions.ShowInTerminalViewAction;
+import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystemConfiguration;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.rse.ui.ISystemContextMenuConstants;
+import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+public class TerminalViewElementAdapter extends AbstractSystemViewAdapter
+ implements ISystemRemoteElementAdapter {
+ private List actions = null;
+ private ShowInTerminalViewAction showInTerminalViewAction;
+ private RemoveTerminalAction closeTerminalAction;
+
+ public TerminalViewElementAdapter() {
+ actions = new ArrayList();
+ }
+
+ public void addActions(SystemMenuManager menu,
+ IStructuredSelection selection, Shell parent, String menuGroup) {
+ Object firstSelection = selection.getFirstElement();
+
+ if (firstSelection != null) {
+ if (firstSelection instanceof TerminalElement) {
+ TerminalElement cmdShell = (TerminalElement) firstSelection;
+ if (showInTerminalViewAction == null) {
+ showInTerminalViewAction = new ShowInTerminalViewAction(
+ shell);
+
+ }
+ menu.add(ISystemContextMenuConstants.GROUP_OPEN,
+ showInTerminalViewAction);
+
+ getTerminalActions((ITerminalServiceSubSystemConfiguration) cmdShell
+ .getSubSystem().getSubSystemConfiguration());
+
+ menu.add(ISystemContextMenuConstants.GROUP_CHANGE,
+ closeTerminalAction);
+ }
+ } else {
+ return;
+ }
+ }
+
+ public List getTerminalActions(ITerminalServiceSubSystemConfiguration factory) {
+ actions.clear();
+ if (actions.size() == 0) {
+ if (closeTerminalAction == null) {
+ closeTerminalAction = new RemoveTerminalAction(shell);
+ }
+ actions.add(closeTerminalAction);
+ }
+ return actions;
+ }
+
+ public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
+ return null;
+ }
+
+ public ImageDescriptor getImageDescriptor(Object element) {
+ // TODO different image for different state?
+ return Activator.getDefault().getImageDescriptor(
+ Activator.ICON_ID_TERMINAL_SUBSYSTEM_LIVE);
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public String getType(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean hasChildren(IAdaptable element) {
+ return false;
+ }
+
+ protected IPropertyDescriptor[] internalGetPropertyDescriptors() {
+ return null;
+ }
+
+ protected Object internalGetPropertyValue(Object key) {
+ return null;
+ }
+
+ public String getAbsoluteParentName(Object element) {
+ return null;
+ }
+
+ public Object getRemoteParent(Object element, IProgressMonitor monitor)
+ throws Exception {
+ return null;
+ }
+
+ public String[] getRemoteParentNamesInUse(Object element,
+ IProgressMonitor monitor) throws Exception {
+ return null;
+ }
+
+ public boolean refreshRemoteObject(Object oldElement, Object newElement) {
+ return false;
+ }
+
+ public String getRemoteSubType(Object element) {
+ return null;
+ }
+
+ public String getRemoteType(Object element) {
+ return null;
+ }
+
+ public String getRemoteTypeCategory(Object element) {
+ return null;
+ }
+
+ public String getSubSystemConfigurationId(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return element.toString();
+ }
+
+ public String getAbsoluteName(Object object) {
+ return object.toString();
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementsAdapterFactory.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementsAdapterFactory.java
new file mode 100644
index 00000000000..4692fd31970
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewElementsAdapterFactory.java
@@ -0,0 +1,49 @@
+/********************************************************************************
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yu-Fen Kuo (MontaVista) - initial API and implementation
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ ********************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
+import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
+import org.eclipse.rse.ui.SystemBasePlugin;
+import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class TerminalViewElementsAdapterFactory implements IAdapterFactory {
+
+ private TerminalViewElementAdapter elementAdapter = new TerminalViewElementAdapter();
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ Object adapter = null;
+ if (adaptableObject instanceof TerminalElement)
+ adapter = elementAdapter;
+
+ if ((adapter != null) && (adapterType == IPropertySource.class)) {
+ ((ISystemViewElementAdapter) adapter)
+ .setPropertySourceInput(adaptableObject);
+ } else if (adapter == null) {
+ SystemBasePlugin
+ .logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
+ }
+ return adapter;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { ISystemViewElementAdapter.class,
+ ISystemDragDropAdapter.class,
+ ISystemRemoteElementAdapter.class, IPropertySource.class,
+ IWorkbenchAdapter.class, IActionFilter.class };
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java
new file mode 100644
index 00000000000..cbe2dc39fcd
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java
@@ -0,0 +1,451 @@
+/*******************************************************************************
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
+ * Yu-Fen Kuo (MontaVista) - Adapted from CommandsViewWorkbook
+ * Anna Dushistova (MontaVista) - Adapted from CommandsViewWorkbook
+ ********************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.tm.internal.terminal.actions.TerminalAction;
+import org.eclipse.tm.internal.terminal.actions.TerminalActionClearAll;
+import org.eclipse.tm.internal.terminal.actions.TerminalActionCopy;
+import org.eclipse.tm.internal.terminal.actions.TerminalActionCut;
+import org.eclipse.tm.internal.terminal.actions.TerminalActionPaste;
+import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectAll;
+import org.eclipse.tm.internal.terminal.control.ITerminalListener;
+import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
+import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
+import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
+import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
+import org.eclipse.tm.internal.terminal.view.ITerminalView;
+
+/**
+ * This is the desktop view wrapper of the System View viewer.
+ */
+public class TerminalViewTab extends Composite implements ITerminalListener,
+ ITerminalView {
+
+ public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$
+ private CTabFolder tabFolder;
+ private Menu menu;
+ private TerminalViewer viewer;
+ private boolean fMenuAboutToShow;
+ private TerminalAction fActionEditCopy;
+
+ private TerminalAction fActionEditCut;
+
+ private TerminalAction fActionEditPaste;
+
+ private TerminalAction fActionEditClearAll;
+
+ private TerminalAction fActionEditSelectAll;
+
+ protected class TerminalContextMenuHandler implements MenuListener,
+ IMenuListener {
+ public void menuHidden(MenuEvent event) {
+ fMenuAboutToShow = false;
+ updateEditCopy();
+ }
+
+ public void menuShown(MenuEvent e) {
+ //
+ }
+
+ public void menuAboutToShow(IMenuManager menuMgr) {
+ fMenuAboutToShow = true;
+ updateEditCopy();
+ updateEditCut();
+ updateEditSelectAll();
+ updateEditPaste();
+ updateEditClearAll();
+ }
+ }
+
+ public TerminalViewTab(final Composite parent, TerminalViewer viewer) {
+ super(parent, SWT.NONE);
+ tabFolder = new CTabFolder(this, SWT.NONE);
+ tabFolder.setLayout(new FillLayout());
+ tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ setLayout(new FillLayout());
+ this.viewer = viewer;
+ tabFolder.setBackground(parent.getBackground());
+ tabFolder.setSimple(false);
+ tabFolder.setUnselectedImageVisible(false);
+ tabFolder.setUnselectedCloseVisible(false);
+
+ tabFolder.setMinimizeVisible(false);
+ tabFolder.setMaximizeVisible(false);
+ setupActions();
+ }
+
+ public void dispose() {
+ if (!tabFolder.isDisposed()) {
+ tabFolder.dispose();
+ }
+ super.dispose();
+ }
+
+ public CTabFolder getFolder() {
+ return tabFolder;
+ }
+
+ public void remove(Object root) {
+
+ }
+
+ public CTabItem getSelectedTab() {
+ if (tabFolder.getItemCount() > 0) {
+ int index = tabFolder.getSelectionIndex();
+ CTabItem item = tabFolder.getItem(index);
+ return item;
+ }
+
+ return null;
+ }
+
+ public void showCurrentPage() {
+ tabFolder.setFocus();
+ }
+
+ public void showPageFor(Object root) {
+ for (int i = 0; i < tabFolder.getItemCount(); i++) {
+ CTabItem item = tabFolder.getItem(i);
+ if (item.getData() == root) {
+ tabFolder.setSelection(item);
+ }
+
+ }
+ }
+
+ public void showPageFor(String tabName) {
+ for (int i = 0; i < tabFolder.getItemCount(); i++) {
+ CTabItem item = tabFolder.getItem(i);
+ if (item.getText().equals(tabName)) {
+ tabFolder.setSelection(item);
+ return;
+ }
+
+ }
+ }
+
+ public void disposePageFor(String tabName) {
+ for (int i = 0; i < tabFolder.getItemCount(); i++) {
+ CTabItem item = tabFolder.getItem(i);
+ if (item.getText().equals(tabName)) {
+ item.dispose();
+ return;
+ }
+
+ }
+ }
+
+ public CTabItem createTabItem(IAdaptable root, String initialWorkingDirCmd) {
+
+ CTabItem item = new CTabItem(tabFolder, SWT.CLOSE);
+ setTabTitle(root, item);
+
+ item.setData(root);
+ Composite c = new Composite(tabFolder, SWT.NONE);
+ c.setLayout(new FillLayout());
+
+ tabFolder.getParent().layout(true);
+ if (root instanceof IHost) {
+ IHost host = (IHost) root;
+
+ ITerminalConnector connector = new RSETerminalConnector(host);
+ ITerminalViewControl terminalControl = TerminalViewControlFactory
+ .makeControl(this, c,
+ new ITerminalConnector[] { connector });
+ // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=204796
+ // Specify Encoding for Terminal
+ // try {
+ // terminalControl.setEncoding(host.getDefaultEncoding(true));
+ // } catch (UnsupportedEncodingException e) {
+ // /* ignore and allow fallback to default encoding */
+ // }
+ terminalControl.setConnector(connector);
+ terminalControl.connectTerminal();
+ if (initialWorkingDirCmd != null) {
+ while (!terminalControl.pasteString(initialWorkingDirCmd))
+ ;
+ }
+ item.setData(DATA_KEY_CONTROL, terminalControl);
+
+ }
+ item.setControl(c);
+ tabFolder.setSelection(item);
+ item.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ Object source = e.getSource();
+ if (source instanceof CTabItem) {
+ CTabItem currentItem = (CTabItem) source;
+ Object data = currentItem.getData(DATA_KEY_CONTROL);
+ if (data instanceof ITerminalViewControl) {
+ ((ITerminalViewControl) data).disposeTerminal();
+ }
+ data = currentItem.getData();
+ if (data instanceof IHost) {
+ TerminalServiceHelper.removeTerminalElementFromHost(
+ currentItem, (IHost) data);
+ }
+ }
+
+ }
+
+ });
+
+ setupContextMenus();
+ return item;
+
+ }
+
+ protected void setupActions() {
+ fActionEditCopy = new TerminalActionCopy(this);
+ fActionEditCut = new TerminalActionCut(this);
+ fActionEditPaste = new TerminalActionPaste(this);
+ fActionEditClearAll = new TerminalActionClearAll(this);
+ fActionEditSelectAll = new TerminalActionSelectAll(this);
+ }
+
+ protected void setupContextMenus() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+
+ if (menu == null) {
+ MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ menu = menuMgr.createContextMenu(tabFolder);
+ loadContextMenus(menuMgr);
+ TerminalContextMenuHandler contextMenuHandler = new TerminalContextMenuHandler();
+ menuMgr.addMenuListener(contextMenuHandler);
+ menu.addMenuListener(contextMenuHandler);
+ }
+ Control ctlText = terminalViewControl.getControl();
+ ctlText.setMenu(menu);
+ }
+
+ protected void loadContextMenus(IMenuManager menuMgr) {
+ menuMgr.add(fActionEditCopy);
+ menuMgr.add(fActionEditPaste);
+ menuMgr.add(new Separator());
+ menuMgr.add(fActionEditClearAll);
+ menuMgr.add(fActionEditSelectAll);
+ menuMgr.add(new Separator());
+
+ // Other plug-ins can contribute there actions here
+ menuMgr.add(new Separator("Additions")); //$NON-NLS-1$
+ }
+
+ public void onEditCopy() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ String selection = terminalViewControl.getSelection();
+
+ if (!selection.equals("")) {//$NON-NLS-1$
+ terminalViewControl.copy();
+ } else {
+ terminalViewControl.sendKey('\u0003');
+ }
+ }
+
+ public void updateEditCopy() {
+ boolean bEnabled = true;
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ if (fMenuAboutToShow) {
+ bEnabled = terminalViewControl.getSelection().length() > 0;
+ }
+
+ fActionEditCopy.setEnabled(bEnabled);
+ }
+
+ public void onEditCut() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ terminalViewControl.sendKey('\u0018');
+ }
+
+ public void updateEditCut() {
+ boolean bEnabled;
+
+ bEnabled = !fMenuAboutToShow;
+ fActionEditCut.setEnabled(bEnabled);
+ }
+
+ public void onEditPaste() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ terminalViewControl.paste();
+ }
+
+ public void updateEditPaste() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ String strText = (String) terminalViewControl.getClipboard()
+ .getContents(TextTransfer.getInstance());
+
+ boolean bEnabled = ((strText != null) && (!strText.equals("")));//$NON-NLS-1$
+
+ fActionEditPaste.setEnabled(bEnabled);
+ }
+
+ public void onEditClearAll() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ terminalViewControl.clearTerminal();
+ }
+
+ public void updateEditClearAll() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ fActionEditClearAll.setEnabled(!terminalViewControl.isEmpty());
+ }
+
+ public void onEditSelectAll() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ terminalViewControl.selectAll();
+ }
+
+ public void updateEditSelectAll() {
+ ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
+ if (terminalViewControl == null)
+ return;
+ fActionEditSelectAll.setEnabled(!terminalViewControl.isEmpty());
+ }
+
+ private void setTabTitle(IAdaptable root, CTabItem titem) {
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
+ .getAdapter(ISystemViewElementAdapter.class);
+ if (va != null) {
+ updateWithUniqueTitle(va.getName(root), titem);
+ titem.setImage(va.getImageDescriptor(root).createImage());
+ }
+ }
+
+ public void setState(TerminalState state) {
+ // terminalControl.setState(state);
+ }
+
+ public void setTerminalTitle(String title) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean hasCommandInputField() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isScrollLock() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void onTerminalConnect() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onTerminalDisconnect() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onTerminalFontChanged() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onTerminalNewTerminal() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onTerminalSettings() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCommandInputField(boolean on) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setScrollLock(boolean b) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void updateWithUniqueTitle(String title, CTabItem currentItem) {
+ CTabItem[] items = tabFolder.getItems();
+ int increment = 1;
+ String temp = title;
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] != currentItem) {
+ String name = items[i].getText();
+ if (name != null) {
+ if (name.equals(temp)) {
+ temp = title + " " + increment++; //$NON-NLS-1$
+ }
+ }
+
+ }
+ }
+ currentItem.setText(temp);
+ }
+
+ private ITerminalViewControl getCurrentTerminalViewControl() {
+ if (tabFolder != null && !tabFolder.isDisposed()) {
+ CTabItem item = tabFolder.getSelection();
+ if (item != null && !item.isDisposed()) {
+ Object data = item.getData(DATA_KEY_CONTROL);
+ if (data instanceof ITerminalViewControl)
+ return ((ITerminalViewControl) data);
+ }
+ }
+ return null;
+ }
+}
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewer.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewer.java
new file mode 100644
index 00000000000..29e32607a3e
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewer.java
@@ -0,0 +1,199 @@
+/********************************************************************************
+ * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
+ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
+ * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
+ * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
+ * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
+ * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
+ * Kevin Doyle (IBM) - [198534] Shell Menu Enablement Issue's
+ * Radoslav Gerganov(ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist
+ * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsViewPart
+ * Anna Dushistova (MontaVista) - Adapted from SystemCommandsViewPart
+ ********************************************************************************/
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
+import org.eclipse.rse.core.events.ISystemResourceChangeListener;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
+import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemWidgetHelpers;
+import org.eclipse.rse.ui.messages.ISystemMessageLine;
+import org.eclipse.rse.ui.model.ISystemShellProvider;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.ViewPart;
+
+public class TerminalViewer extends ViewPart implements ISelectionListener,
+ SelectionListener, ISelectionChangedListener,
+ ISystemResourceChangeListener, ISystemShellProvider, IRSEViewPart,
+ IMenuListener, ISystemMessageLine {
+
+ private TerminalViewTab tabFolder;
+
+ public static String VIEW_ID = "org.eclipse.rse.terminals.ui.view.TerminalView"; //$NON-NLS-1$
+
+ public void createPartControl(Composite parent) {
+ tabFolder = new TerminalViewTab(parent, this);
+ tabFolder.getFolder().addSelectionListener(this);
+
+ ISelectionService selectionService = getSite().getWorkbenchWindow()
+ .getSelectionService();
+ selectionService.addSelectionListener(this);
+
+ SystemWidgetHelpers.setHelp(tabFolder, RSEUIPlugin.HELPPREFIX
+ + "ucmd0000"); //$NON-NLS-1$
+
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+
+ registry.addSystemResourceChangeListener(this);
+
+ fillLocalToolBar();
+
+ }
+
+ public void setFocus() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void systemResourceChanged(ISystemResourceChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Shell getShell() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Viewer getRSEViewer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void menuAboutToShow(IMenuManager manager) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void clearErrorMessage() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void clearMessage() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getErrorMessage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getMessage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SystemMessage getSystemErrorMessage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setErrorMessage(String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setErrorMessage(SystemMessage message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setErrorMessage(Throwable exc) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMessage(String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMessage(SystemMessage message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void fillLocalToolBar() {
+ if (tabFolder != null) {
+ // IActionBars actionBars = getViewSite().getActionBars();
+ //
+ // if (_shellActions == null || _shellActions.size() == 0)
+ // {
+ // updateShellActions();
+ // _clearAction = new ClearAction();
+ // _printTableAction = new SystemTablePrintAction(getTitle(), null);
+ // IMenuManager menuManager = actionBars.getMenuManager();
+ // addMenuItems(menuManager);
+ // _statusLine = actionBars.getStatusLineManager();
+ // }
+ // IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ // addToolBarItems(toolBarManager);
+ //
+ // updateActionStates();
+ }
+ }
+
+ public TerminalViewTab getTabFolder() {
+ return tabFolder;
+ }
+
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalsUI.java b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalsUI.java
new file mode 100644
index 00000000000..b002f679125
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalsUI.java
@@ -0,0 +1,69 @@
+/********************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ * The following IBM employees contributed to the Remote System Explorer
+ * component that contains this file: David McKnight, Kushal Munir,
+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
+ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
+ * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsUI
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.terminals.ui.views;
+
+import org.eclipse.rse.internal.terminals.ui.Activator;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A singleton class which has handle to the terminals view
+ */
+public class TerminalsUI {
+
+ // singleton instance
+ private static TerminalsUI instance;
+ private static TerminalViewer viewer;
+
+ private TerminalsUI() {
+ super();
+ }
+
+ /**
+ * Get the singleton instance.
+ *
+ * @return the singleton object of this type
+ */
+ public static TerminalsUI getInstance() {
+ if (instance == null) {
+ instance = new TerminalsUI();
+ }
+
+ return instance;
+ }
+
+ public TerminalViewer activateTerminalsView() {
+ try {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ viewer = (TerminalViewer) page.showView(TerminalViewer.VIEW_ID);
+ page.bringToTop(viewer);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ Activator.logError(Activator
+ .getResourceString("TerminalsUI.cannotOpenView.error"), e); //$NON-NLS-1$
+ }
+
+ return viewer;
+ }
+
+ public static TerminalViewer getTerminalsView() {
+ return viewer;
+ }
+}
\ No newline at end of file