Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse')
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/AbstractAction.java184
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/TabScrollLockAction.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/activator/UIPlugin.java143
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConfigurationPanel.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConnectorType.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IPreferenceKeys.java25
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ITerminalsView.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IUIConstants.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ImageConsts.java65
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PreferenceInitializer.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PropertyTester.java34
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/SettingsStore.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java334
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java74
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/tracing/ITraceIds.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java156
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/manager/ConsoleManager.java304
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java52
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties25
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/panels/AbstractConfigurationPanel.java50
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/services/TerminalService.java205
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/AbstractStreamsConnector.java138
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/InputStreamMonitor.java344
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/OutputStreamMonitor.java262
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsConnector.java113
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsSettings.java157
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabDisposeListener.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderManager.java720
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderMenuHandler.java297
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderSelectionListener.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderToolbarHandler.java304
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabPropertyChangeListener.java84
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabTerminalListener.java112
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/AbstractConnectorType.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java102
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/StreamsConnectorType.java72
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/TelnetConnectorType.java101
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/view/TerminalsView.java309
42 files changed, 0 insertions, 5409 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/AbstractAction.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/AbstractAction.java
deleted file mode 100644
index 54d2ecee4..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/AbstractAction.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.actions;
-
-import java.util.Collections;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderToolbarHandler;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-
-/**
- * Abstract terminal action wrapper implementation.
- */
-@SuppressWarnings("restriction")
-public abstract class AbstractAction extends AbstractTerminalAction {
- // Reference to the parent toolbar handler
- private final TabFolderToolbarHandler parent;
-
- /**
- * Constructor.
- *
- * @param parent
- * The parent toolbar handler instance. Must not be
- * <code>null</code>.
- * @param id
- * The terminal action id. Must not be <code>null</code>.
- */
- public AbstractAction(TabFolderToolbarHandler parent, String id) {
- super(id);
-
- Assert.isNotNull(parent);
- this.parent = parent;
- }
-
- /**
- * Returns the parent toolbar handler.
- *
- * @return The parent toolbar handler.
- */
- protected final TabFolderToolbarHandler getParent() {
- return parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getParent().getActiveTerminalViewControl();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#run()
- */
- @Override
- public void run() {
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParent().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- // And execute the command
- executeCommand(activeTabItem.getData("customData")); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Executes the command for the given data node as current and active menu selection.
- * <p>
- * <b>Node:</b> If the provided data node is <code>null</code>, the method will trigger
- * the command with an empty selection.
- *
- * @param data The terminal custom data node or <code>null</code>.
- */
- protected void executeCommand(Object data) {
- // Get the command service from the workbench
- ICommandService service = (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
- if (service != null && getCommandId() != null) {
- // Get the command
- final Command command = service.getCommand(getCommandId());
- if (command != null && command.isDefined()) {
- // Construct a selection element
- IStructuredSelection selection = data != null ? new StructuredSelection(data) : new StructuredSelection();
- // Construct the application context
- EvaluationContext context = new EvaluationContext(null, selection);
- // Apply the selection to the "activeMenuSelection" and "selection" variable too
- context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- context.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
- // Construct the execution event
- ExecutionEvent execEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, this, context);
- // And execute the event
- try {
- command.executeWithChecks(execEvent);
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.AbstractAction_error_commandExecutionFailed, getCommandId(), e.getLocalizedMessage()),
- e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
- }
-
- /**
- * Returns the command id of the command to execute.
- *
- * @return The command id. Must be never <code>null</code>.
- */
- protected abstract String getCommandId();
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- // Ignore the flag given from outside. We have to decide ourself
- // what the enabled state of the action is
- boolean enabled = getTarget() != null;
-
- // If a target terminal control is available, we need to find the corresponding
- // VLM target object which we need to trigger the handler
- if (enabled) {
- // The action will be enabled if we can determine the VLM target object
- enabled = false;
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParent().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- enabled = checkEnableAction(activeTabItem.getData("customData")); //$NON-NLS-1$
- }
- }
- }
-
- setEnabled(enabled);
- }
-
- /**
- * Checks if the action should be enabled based on the given terminal data object.
- *
- * @param data The terminal data node or <code>null</code>.
- * @return <code>True</code> to enable the action, <code>false</code> otherwise.
- */
- protected boolean checkEnableAction(Object data) {
- return data != null;
- }
-
- /**
- * Returns if the action is a separator. Returning <code>true</code> here
- * means that an additional separator toolbar element is added right or
- * above of the action.
- *
- * @return <code>True</code> if the action is separating the parent contribution manager, <code>false</code> otherwise.
- */
- public boolean isSeparator() {
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/TabScrollLockAction.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/TabScrollLockAction.java
deleted file mode 100644
index 73d9fd237..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/actions/TabScrollLockAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.tm.internal.terminal.actions.ActionMessages;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.interfaces.ImageConsts;
-
-/**
- * Terminal console tab scroll lock action.
- */
-@SuppressWarnings("restriction")
-public class TabScrollLockAction extends AbstractTerminalAction {
-
- /**
- * Constructor.
- */
- public TabScrollLockAction() {
- super(null, TabScrollLockAction.class.getName(), IAction.AS_RADIO_BUTTON);
-
- setupAction(ActionMessages.SCROLL_LOCK_0,
- ActionMessages.SCROLL_LOCK_1,
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Hover),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Enabled),
- UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Disabled),
- true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#run()
- */
- @Override
- public void run() {
- ITerminalViewControl target = getTarget();
- if (target != null) {
- target.setScrollLock(!target.isScrollLock());
- setChecked(target.isScrollLock());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean)
- */
- @Override
- public void updateAction(boolean aboutToShow) {
- setEnabled(getTarget() != null && aboutToShow);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/activator/UIPlugin.java
deleted file mode 100644
index f746882b0..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/activator/UIPlugin.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.activator;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tm.te.runtime.preferences.ScopedEclipsePreferences;
-import org.eclipse.tm.te.runtime.tracing.TraceHandler;
-import org.eclipse.tm.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class UIPlugin extends AbstractUIPlugin {
- // The shared instance
- private static UIPlugin plugin;
-
- private static ScopedEclipsePreferences scopedPreferences = null;
- // The trace handler instance
- private static TraceHandler traceHandler;
-
- /**
- * The constructor
- */
- public UIPlugin() {
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static UIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() != null && getDefault().getBundle() != null) {
- return getDefault().getBundle().getSymbolicName();
- }
- return null;
- }
-
- /**
- * Return the scoped preferences for this plugin.
- */
- public static ScopedEclipsePreferences getScopedPreferences() {
- if (scopedPreferences == null) {
- scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier());
- }
- return scopedPreferences;
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- scopedPreferences = null;
- traceHandler = null;
- super.stop(context);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
- */
- @Override
- protected void initializeImageRegistry(ImageRegistry registry) {
- Bundle bundle = Platform.getBundle("org.eclipse.ui.console"); //$NON-NLS-1$
- if (bundle != null) {
- URL url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_EVIEW + "console_view.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.VIEW_Terminals, ImageDescriptor.createFromURL(url));
-
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_CLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_ScrollLock_Hover, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_ELCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_ScrollLock_Enabled, ImageDescriptor.createFromURL(url));
- url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
- registry.put(ImageConsts.ACTION_ScrollLock_Disabled, ImageDescriptor.createFromURL(url));
- }
- }
-
- /**
- * Loads the image registered under the specified key from the image
- * registry and returns the <code>Image</code> object instance.
- *
- * @param key The key the image is registered with.
- * @return The <code>Image</code> object instance or <code>null</code>.
- */
- public static Image getImage(String key) {
- return getDefault().getImageRegistry().get(key);
- }
-
- /**
- * Loads the image registered under the specified key from the image
- * registry and returns the <code>ImageDescriptor</code> object instance.
- *
- * @param key The key the image is registered with.
- * @return The <code>ImageDescriptor</code> object instance or <code>null</code>.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- return getDefault().getImageRegistry().getDescriptor(key);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
deleted file mode 100644
index 1eb267f5d..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.events;
-
-import java.util.EventObject;
-
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.tm.te.runtime.events.EventManager;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderManager;
-
-/**
- * Terminal console selection changed broadcast event. The event is typically fired
- * by a terminal console tab folder manager to signal a tab switch to all listeners.
- */
-public class SelectionChangedBroadcastEvent extends EventObject {
- private static final long serialVersionUID = -4970244776543572896L;
-
- // The selection changed event to broadcast
- private final SelectionChangedEvent selectionChangedEvent;
-
- /**
- * Constructor.
- *
- * @param source The event source. Must not be <code>null</code>.
- * @param selectionChangedEvent The selection changed event or <code>null</code>.
- */
- public SelectionChangedBroadcastEvent(TabFolderManager source, SelectionChangedEvent selectionChangedEvent) {
- super(source);
- this.selectionChangedEvent = selectionChangedEvent;
- }
-
- /**
- * Convenience method to return the source tab folder manager.
- *
- * @return The source tab folder manager.
- */
- public TabFolderManager getSourceTabFolderManager() {
- return (TabFolderManager)getSource();
- }
-
- /**
- * Returns the broadcasted selection changed event.
- *
- * @return The broadcasted selection changed event or <code>null</code>.
- */
- public SelectionChangedEvent getSelectionChangedEvent() {
- return selectionChangedEvent;
- }
-
- /* (non-Javadoc)
- * @see java.util.EventObject#toString()
- */
- @Override
- public String toString() {
- StringBuilder toString = new StringBuilder(getClass().getName());
-
- String prefix = ""; //$NON-NLS-1$
- // if debugging the event, formating them a little bit better readable.
- if (EventManager.isTracingEnabled())
- prefix = "\n\t\t"; //$NON-NLS-1$
-
- toString.append(prefix + "source="); //$NON-NLS-1$
- toString.append(source);
- toString.append("," + prefix + "selectionChangedEvent="); //$NON-NLS-1$ //$NON-NLS-2$
- toString.append(selectionChangedEvent);
- toString.append("}"); //$NON-NLS-1$
-
- return toString.toString();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java
deleted file mode 100644
index c5aa435ad..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/help/IContextHelpIds.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.help;
-
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-
-
-/**
- * UI Context help id definitions.
- */
-public interface IContextHelpIds {
-
- /**
- * UI plug-in common context help id prefix.
- */
- public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
-
- /**
- * Launch terminal settings dialog.
- */
- public final static String LAUNCH_TERMINAL_SETTINGS_DIALOG = PREFIX + "LaunchTerminalSettingsDialog"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConfigurationPanel.java
deleted file mode 100644
index e9de5c79e..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConfigurationPanel.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
-
-/**
- * Terminal launcher configuration panel.
- */
-public interface IConfigurationPanel extends IWizardConfigurationPanel {
-
- /**
- * Set the selection to the configuration panel.
- *
- * @param selection The selection or <code>null</code>.
- */
- public void setSelection(ISelection selection);
-
- /**
- * Returns the selection associated with the configuration panel.
- *
- * @return The selection or <code>null</code>.
- */
- public ISelection getSelection();
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConnectorType.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConnectorType.java
deleted file mode 100644
index 0e0a6edf0..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IConnectorType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.te.runtime.interfaces.extensions.IExecutableExtension;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-
-/**
- * Terminal connector type.
- */
-@SuppressWarnings("restriction")
-public interface IConnectorType extends IExecutableExtension {
-
- /**
- * Creates the terminal connector for this terminal connector type
- * based on the given properties.
- *
- * @param properties The terminal properties. Must not be <code>null</code>.
- * @return The terminal connector or <code>null</code>.
- */
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties);
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java
deleted file mode 100644
index f28f8bb4b..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ILauncherDelegate.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tm.te.runtime.interfaces.extensions.IExecutableExtension;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
-
-/**
- * Terminal launcher delegate.
- */
-public interface ILauncherDelegate extends IExecutableExtension {
-
- /**
- * Returns the enablement expression.
- *
- * @return The enablement expression or <code>null</code>.
- */
- public Expression getEnablement();
-
- /**
- * Returns if or if not the user needs to set configuration details for this launcher to work.
- * The settings to configure are provided to the user through the configuration panel returned
- * by {@link #getPanel(BaseDialogPageControl)}.
- *
- * @return <code>True</code> if a user configuration is required, <code>false</code> otherwise.
- */
- public boolean needsUserConfiguration();
-
- /**
- * Returns the configuration panel instance to present to the user. The instance must be always
- * the same on subsequent calls until disposed.
- * <p>
- * The method may return <code>null</code> if the launcher does not provide any user
- * configurable settings. In this case, {@link #needsUserConfiguration()} should return
- * <code>false</code>.
- *
- * @param parentControl The parent control. Must not be <code>null</code>.
- * @return The configuration panel instance or <code>null</code>
- */
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl);
-
- /**
- * Execute the terminal launch.
- *
- * @param properties The properties. Must not be <code>null</code>.
- * @param callback The callback or <code>null</code>.
- */
- public void execute(IPropertiesContainer properties, ICallback callback);
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IPreferenceKeys.java
deleted file mode 100644
index b07359704..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IPreferenceKeys.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-/**
- * Terminals plug-in preference key definitions.
- */
-public interface IPreferenceKeys {
- /**
- * Preference keys family prefix.
- */
- public final String PREF_TERMINAL = "terminals"; //$NON-NLS-1$
-
- /**
- * Preference key: Remove terminated terminals when a new terminal is created.
- */
- public final String PREF_REMOVE_TERMINATED_TERMINALS = PREF_TERMINAL + ".removeTerminatedTerminals"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ITerminalsView.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ITerminalsView.java
deleted file mode 100644
index 3c856f0c1..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ITerminalsView.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-import org.eclipse.ui.IViewPart;
-
-/**
- * Terminals view public interface.
- */
-public interface ITerminalsView extends IViewPart {
-
- /**
- * Switch to the empty page control.
- */
- public void switchToEmptyPageControl();
-
- /**
- * Switch to the tab folder control.
- */
- public void switchToTabFolderControl();
-
- /**
- * Returns the context help id associated with the terminal
- * console view instance.
- *
- * @return The context help id or <code>null</code> if none is associated.
- */
- public String getContextHelpId();
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IUIConstants.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IUIConstants.java
deleted file mode 100644
index 87fc1307c..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/IUIConstants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-/**
- * Terminals common UI constants.
- */
-public interface IUIConstants {
- /**
- * The view id of the terminals view.
- */
- public static final String ID = "org.eclipse.tm.te.ui.terminals.TerminalsView"; //$NON-NLS-1$
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ImageConsts.java
deleted file mode 100644
index 1fc78077c..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/interfaces/ImageConsts.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.interfaces;
-
-/**
- * Image registry constants.
- */
-public interface ImageConsts {
- /**
- * The root directory where to load the images from, relative to
- * the bundle directory.
- */
- public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
-
- /**
- * The directory where to load colored local toolbar images from,
- * relative to the image root directory.
- */
- public final static String IMAGE_DIR_CLCL = "clcl16/"; //$NON-NLS-1$
-
- /**
- * The directory where to load disabled local toolbar images from,
- * relative to the image root directory.
- */
- public final static String IMAGE_DIR_DLCL = "dlcl16/"; //$NON-NLS-1$
-
- /**
- * The directory where to load enabled local toolbar images from,
- * relative to the image root directory.
- */
- public final static String IMAGE_DIR_ELCL = "elcl16/"; //$NON-NLS-1$
-
- /**
- * The directory where to load view related images from, relative to
- * the image root directory.
- */
- public final static String IMAGE_DIR_EVIEW = "eview16/"; //$NON-NLS-1$
-
- /**
- * The key to access the terminal consoles view image.
- */
- public static final String VIEW_Terminals = "TerminalsView"; //$NON-NLS-1$
-
- /**
- * The key to access the scroll lock action image (enabled).
- */
- public static final String ACTION_ScrollLock_Enabled = "ScrollLockAction_enabled"; //$NON-NLS-1$
-
- /**
- * The key to access the scroll lock action image (disabled).
- */
- public static final String ACTION_ScrollLock_Disabled = "ScrollLockAction_disabled"; //$NON-NLS-1$
-
- /**
- * The key to access the scroll lock action image (hover).
- */
- public static final String ACTION_ScrollLock_Hover = "ScrollLockAction_hover"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PreferenceInitializer.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PreferenceInitializer.java
deleted file mode 100644
index 8cb06cc34..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PreferenceInitializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.internal;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.tm.te.runtime.preferences.ScopedEclipsePreferences;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.interfaces.IPreferenceKeys;
-
-/**
- * Terminals default preferences initializer.
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
- /**
- * Constructor.
- */
- public PreferenceInitializer() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- @Override
- public void initializeDefaultPreferences() {
- ScopedEclipsePreferences prefs = UIPlugin.getScopedPreferences();
-
- prefs.putDefaultBoolean(IPreferenceKeys.PREF_REMOVE_TERMINATED_TERMINALS, true);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PropertyTester.java
deleted file mode 100644
index 545802bb1..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/PropertyTester.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.internal;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.tm.te.ui.terminals.launcher.LauncherDelegateManager;
-
-
-/**
- * Terminals property tester implementation.
- */
-public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if ("hasApplicableLauncherDelegates".equals(property)) { //$NON-NLS-1$
- ISelection selection = receiver instanceof ISelection ? (ISelection)receiver : new StructuredSelection(receiver);
- return expectedValue.equals(Boolean.valueOf(LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection).length > 0));
- }
- return false;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/SettingsStore.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/SettingsStore.java
deleted file mode 100644
index 250776a6d..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/SettingsStore.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.internal;
-
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.te.runtime.properties.PropertiesContainer;
-
-/**
- * Simple default Terminal settings store implementation keeping the settings
- * within memory.
- */
-@SuppressWarnings("restriction")
-public class SettingsStore extends PropertiesContainer implements ISettingsStore {
-
- /**
- * Constructor.
- */
- public SettingsStore() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String, java.lang.String)
- */
- @Override
- public String get(String key, String defaultValue) {
- String value = getStringProperty(key);
- return value != null ? value : defaultValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String)
- */
- @Override
- public String get(String key) {
- return getStringProperty(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#put(java.lang.String, java.lang.String)
- */
- @Override
- public void put(String key, String value) {
- setProperty(key, value);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
deleted file mode 100644
index 023d19875..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.internal.dialogs;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.internal.terminal.view.ViewMessages;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tm.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tm.te.ui.controls.BaseWizardConfigurationPanelControl;
-import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
-import org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog;
-import org.eclipse.tm.te.ui.swt.SWTControlUtil;
-import org.eclipse.tm.te.ui.terminals.help.IContextHelpIds;
-import org.eclipse.tm.te.ui.terminals.interfaces.IConfigurationPanel;
-import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tm.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.tm.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.te.ui.terminals.panels.AbstractConfigurationPanel;
-import org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Launch terminal settings dialog implementation.
- */
-@SuppressWarnings("restriction")
-public class LaunchTerminalSettingsDialog extends CustomTrayDialog {
- // The parent selection
- private ISelection selection = null;
-
- // The subcontrols
- /* default */ Combo terminals;
- /* default */ SettingsPanelControl settings;
-
- // Map the label added to the combobox to the corresponding launcher delegate.
- private final Map<String, ILauncherDelegate> label2delegate = new HashMap<String, ILauncherDelegate>();
-
- // The data object containing the currently selected settings
- private IPropertiesContainer data = null;
-
- /**
- * The control managing the terminal setting panels.
- */
- protected class SettingsPanelControl extends BaseWizardConfigurationPanelControl {
-
- /**
- * Constructor.
- *
- * @param parentPage The parent dialog page this control is embedded in.
- * Might be <code>null</code> if the control is not associated with a page.
- */
- public SettingsPanelControl(IDialogPage parentPage) {
- super(parentPage);
- setPanelIsGroup(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.controls.BaseWizardConfigurationPanelControl#getGroupLabel()
- */
- @Override
- public String getGroupLabel() {
- return Messages.LaunchTerminalSettingsDialog_group_label;
- }
- }
-
- /**
- * An empty terminal settings panel.
- */
- protected class EmptySettingsPanel extends AbstractConfigurationPanel {
-
- /**
- * Constructor.
- *
- * @param parentControl The parent control. Must not be <code>null</code>!
- */
- public EmptySettingsPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.tm.te.ui.controls.interfaces.FormToolkit)
- */
- @SuppressWarnings("synthetic-access")
- @Override
- public void setupPanel(Composite parent, FormToolkit toolkit) {
- Composite panel = new Composite(parent, SWT.NONE);
- panel.setLayout(new GridLayout());
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.widthHint = convertWidthInCharsToPixels(30);
- layoutData.heightHint = convertHeightInCharsToPixels(5);
- label.setLayoutData(layoutData);
-
- setControl(panel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
- }
-
- /**
- * Constructor.
- *
- * @param shell The parent shell or <code>null</code>.
- */
- public LaunchTerminalSettingsDialog(Shell shell) {
- super(shell, IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG);
- }
-
- /**
- * Sets the parent selection.
- *
- * @param selection The parent selection or <code>null</code>.
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- /**
- * Returns the parent selection.
- *
- * @return The parent selection or <code>null</code>.
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#dispose()
- */
- @Override
- protected void dispose() {
- if (settings != null) { settings.dispose(); settings = null; }
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- setDialogTitle(Messages.LaunchTerminalSettingsDialog_title);
-
- Composite composite = (Composite)super.createDialogArea(parent);
-
- Composite panel = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
-
- Label label = new Label(panel, SWT.HORIZONTAL);
- label.setText(Messages.LaunchTerminalSettingsDialog_combo_label);
-
- terminals = new Combo(panel, SWT.READ_ONLY);
- terminals.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- terminals.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- settings.showConfigurationPanel(terminals.getText());
- }
- });
-
- // fill the combo with content
- fillCombo(terminals);
-
- // Create the settings panel control
- settings = new SettingsPanelControl(null);
-
- // Create and add the panels
- for (String terminalLabel : terminals.getItems()) {
- // Get the corresponding delegate
- ILauncherDelegate delegate = label2delegate.get(terminalLabel);
- Assert.isNotNull(delegate);
- // Get the wizard configuration panel instance
- IConfigurationPanel configPanel = delegate.getPanel(settings);
- if (configPanel == null) configPanel = new EmptySettingsPanel(settings);
- // Push the selection to the configuration panel
- Assert.isNotNull(configPanel);
- configPanel.setSelection(getSelection());
- // Add it
- settings.addConfigurationPanel(terminalLabel, configPanel);
- }
-
- // Setup the panel control
- settings.setupPanel(panel, terminals.getItems(), new FormToolkit(panel.getDisplay()));
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.horizontalSpan = 2;
- settings.getPanel().setLayoutData(layoutData);
-
- // Preselect the first terminal launcher
- terminals.select(0);
- settings.showConfigurationPanel(terminals.getText());
-
- SWTControlUtil.setEnabled(terminals, terminals.getItemCount() > 1);
-
- restoreWidgetValues();
-
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- * Fill the given combo with content. The content are the terminal
- * launcher delegate labels.
- *
- * @param combo The combo. Must not be <code>null</code>.
- */
- protected void fillCombo(Combo combo) {
- Assert.isNotNull(combo);
-
- List<String> items = new ArrayList<String>();
-
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
- for (ILauncherDelegate delegate : delegates) {
- String label = delegate.getLabel();
- if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$
- label2delegate.put(label, delegate);
- items.add(label);
- }
-
- Collections.sort(items);
- combo.setItems(items.toArray(new String[items.size()]));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#saveWidgetValues()
- */
- @Override
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- settings.put("terminalLabel", SWTControlUtil.getText(terminals)); //$NON-NLS-1$
- this.settings.saveWidgetValues(settings, null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#restoreWidgetValues()
- */
- @Override
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String terminalLabel = settings.get("terminalLabel"); //$NON-NLS-1$
- int index = terminalLabel != null ? Arrays.asList(terminals.getItems()).indexOf(terminalLabel) : -1;
- if (index != -1) {
- terminals.select(index);
- this.settings.showConfigurationPanel(terminals.getText());
- }
-
- this.settings.restoreWidgetValues(settings, null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTrayDialog#okPressed()
- */
- @Override
- protected void okPressed() {
- IWizardConfigurationPanel panel = this.settings.getConfigurationPanel(terminals.getText());
-
- if(!panel.isValid()){
- String strTitle = ViewMessages.TERMINALSETTINGS;
- MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
- mb.setText(strTitle);
- mb.setMessage(ViewMessages.INVALID_SETTINGS);
- mb.open();
- return;
- }
- data = new PropertiesContainer();
-
- // Store the id of the selected delegate
- data.setProperty("delegateId", label2delegate.get(terminals.getText()).getId()); //$NON-NLS-1$
- // Store the selection
- data.setProperty("selection", selection); //$NON-NLS-1$
-
- // Store the delegate specific settings
- if (panel instanceof ISharedDataWizardPage) {
- ((ISharedDataWizardPage)panel).extractData(data);
- }
-
- super.okPressed();
- }
-
- /**
- * Returns the configured terminal launcher settings.
- * <p>
- * The settings are extracted from the UI widgets once
- * OK got pressed.
- *
- * @return The configured terminal launcher settings or <code>null</code>.
- */
- public IPropertiesContainer getSettings() {
- return data;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
deleted file mode 100644
index c83ba4136..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.internal.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tm.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.tm.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog;
-import org.eclipse.tm.te.ui.terminals.launcher.LauncherDelegateManager;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Launch terminal command handler implementation.
- */
-public class LaunchTerminalCommandHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // Get the active shell
- Shell shell = HandlerUtil.getActiveShell(event);
- // Get the current selection
- ISelection selection = HandlerUtil.getCurrentSelection(event);
-
- // Check if the dialog needs to be shown at all
- ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection);
- if (delegates.length > 1 || (delegates.length == 1 && delegates[0].needsUserConfiguration())) {
- // Create the launch terminal settings dialog
- LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell);
- dialog.setSelection(selection);
- if (dialog.open() == Window.OK) {
- // Get the terminal settings from the dialog
- IPropertiesContainer properties = dialog.getSettings();
- if (properties != null) {
- String delegateId = properties.getStringProperty("delegateId"); //$NON-NLS-1$
- Assert.isNotNull(delegateId);
- ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false);
- Assert.isNotNull(delegateId);
- delegate.execute(properties, null);
- }
- }
- } else if (delegates.length == 1) {
- ILauncherDelegate delegate = delegates[0];
- IPropertiesContainer properties = new PropertiesContainer();
-
- // Store the id of the selected delegate
- properties.setProperty("delegateId", delegate.getId()); //$NON-NLS-1$
- // Store the selection
- properties.setProperty("selection", selection); //$NON-NLS-1$
-
- // Execute
- delegate.execute(properties, null);
- }
-
- return null;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/tracing/ITraceIds.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/tracing/ITraceIds.java
deleted file mode 100644
index 8d05b627f..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/internal/tracing/ITraceIds.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.internal.tracing;
-
-/**
- * Core plug-in trace slot identifiers.
- */
-public interface ITraceIds {
-
- /**
- * If activated, tracing information about the terminals output stream monitor is printed out.
- */
- public static final String TRACE_OUTPUT_STREAM_MONITOR = "trace/outputStreamMonitor"; //$NON-NLS-1$
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java
deleted file mode 100644
index ececb356e..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/AbstractLauncherDelegate.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.launcher;
-
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.tm.te.runtime.extensions.ExecutableExtension;
-import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
-
-/**
- * Abstract launcher delegate implementation.
- */
-public abstract class AbstractLauncherDelegate extends ExecutableExtension implements ILauncherDelegate {
- // The converted expression
- private Expression expression;
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.extensions.ExecutableExtension#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- @Override
- public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- super.doSetInitializationData(config, propertyName, data);
-
- // Read the sub elements of the extension
- IConfigurationElement[] children = config != null ? config.getChildren() : null;
- // The "enablement" element is the only expected one
- if (children != null && children.length > 0) {
- expression = ExpressionConverter.getDefault().perform(children[0]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate#getEnablement()
- */
- @Override
- public Expression getEnablement() {
- return expression;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java
deleted file mode 100644
index 384de99b1..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/launcher/LauncherDelegateManager.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.launcher;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager;
-import org.eclipse.tm.te.runtime.extensions.ExecutableExtensionProxy;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.interfaces.ILauncherDelegate;
-import org.eclipse.ui.ISources;
-
-/**
- * Terminal launcher delegate manager implementation.
- */
-public class LauncherDelegateManager extends AbstractExtensionPointManager<ILauncherDelegate> {
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static LauncherDelegateManager instance = new LauncherDelegateManager();
- }
-
- /**
- * Returns the singleton instance.
- */
- public static LauncherDelegateManager getInstance() {
- return LazyInstanceHolder.instance;
- }
-
- /**
- * Constructor.
- */
- LauncherDelegateManager() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
- */
- @Override
- protected String getExtensionPointId() {
- return "org.eclipse.tm.te.ui.terminals.launcherDelegates"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName()
- */
- @Override
- protected String getConfigurationElementName() {
- return "delegate"; //$NON-NLS-1$
- }
-
- /**
- * Returns the list of all contributed terminal launcher delegates.
- *
- * @param unique If <code>true</code>, the method returns new instances for each
- * contributed terminal launcher delegate.
- *
- * @return The list of contributed terminal launcher delegates, or an empty array.
- */
- public ILauncherDelegate[] getLauncherDelegates(boolean unique) {
- List<ILauncherDelegate> contributions = new ArrayList<ILauncherDelegate>();
- Collection<ExecutableExtensionProxy<ILauncherDelegate>> launcherDelegates = getExtensions().values();
- for (ExecutableExtensionProxy<ILauncherDelegate> launcherDelegate : launcherDelegates) {
- ILauncherDelegate instance = unique ? launcherDelegate.newInstance() : launcherDelegate.getInstance();
- if (instance != null && !contributions.contains(instance)) {
- contributions.add(instance);
- }
- }
-
- return contributions.toArray(new ILauncherDelegate[contributions.size()]);
- }
-
- /**
- * Returns the terminal launcher delegate identified by its unique id. If no terminal
- * launcher delegate with the specified id is registered, <code>null</code> is returned.
- *
- * @param id The unique id of the terminal launcher delegate or <code>null</code>
- * @param unique If <code>true</code>, the method returns new instances of the terminal launcher delegate contribution.
- *
- * @return The terminal launcher delegate instance or <code>null</code>.
- */
- public ILauncherDelegate getLauncherDelegate(String id, boolean unique) {
- ILauncherDelegate contribution = null;
- if (getExtensions().containsKey(id)) {
- ExecutableExtensionProxy<ILauncherDelegate> proxy = getExtensions().get(id);
- // Get the extension instance
- contribution = unique ? proxy.newInstance() : proxy.getInstance();
- }
-
- return contribution;
- }
-
- /**
- * Returns the applicable terminal launcher delegates for the given selection.
- *
- * @param selection The selection or <code>null</code>.
- * @return The list of applicable terminal launcher delegates or an empty array.
- */
- public ILauncherDelegate[] getApplicableLauncherDelegates(ISelection selection) {
- List<ILauncherDelegate> applicable = new ArrayList<ILauncherDelegate>();
-
- for (ILauncherDelegate delegate : getLauncherDelegates(false)) {
- Expression enablement = delegate.getEnablement();
-
- // The launcher delegate is applicable by default if
- // no expression is specified.
- boolean isApplicable = enablement == null;
-
- if (enablement != null) {
- if (selection != null) {
- // Set the default variable to selection.
- EvaluationContext context = new EvaluationContext(null, selection);
- // Set the "selection" variable to the selection.
- context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- // Evaluate the expression
- try {
- isApplicable = enablement.evaluate(context).equals(EvaluationResult.TRUE);
- } catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- e.getLocalizedMessage(), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- } else {
- // The enablement is false by definition if
- // there is no selection.
- isApplicable = false;
- }
- }
-
- // Add the page if applicable
- if (isApplicable) applicable.add(delegate);
- }
-
- return applicable.toArray(new ILauncherDelegate[applicable.size()]);
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/manager/ConsoleManager.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/manager/ConsoleManager.java
deleted file mode 100644
index b016d684c..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/manager/ConsoleManager.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.manager;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.interfaces.IPreferenceKeys;
-import org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tm.te.ui.terminals.interfaces.IUIConstants;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tm.te.ui.terminals.view.TerminalsView;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PerspectiveAdapter;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Terminals console manager.
- */
-@SuppressWarnings("restriction")
-public class ConsoleManager {
- // Reference to the perspective listener instance
- private final IPerspectiveListener perspectiveListener;
-
- // Internal perspective listener implementation
- static class ConsoleManagerPerspectiveListener extends PerspectiveAdapter {
- private final List<IViewReference> references = new ArrayList<IViewReference>();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.PerspectiveAdapter#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- @Override
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- // If the old references list is empty, just return
- if (references.isEmpty()) return;
- // Create a copy of the old view references list
- List<IViewReference> oldReferences = new ArrayList<IViewReference>(references);
-
- // Get the current list of view references
- List<IViewReference> references = new ArrayList<IViewReference>(Arrays.asList(page.getViewReferences()));
- for (IViewReference reference : oldReferences) {
- if (references.contains(reference)) continue;
- // Previous visible terminal console view reference, make visible again
- try {
- page.showView(reference.getId(), reference.getSecondaryId(), IWorkbenchPage.VIEW_VISIBLE);
- } catch (PartInitException e) { /* Failure on part instantiation is ignored */ }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.PerspectiveAdapter#perspectivePreDeactivate(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- @Override
- public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- references.clear();
- for (IViewReference reference : page.getViewReferences()) {
- IViewPart part = reference.getView(false);
- if (part instanceof TerminalsView && !references.contains(reference)) {
- references.add(reference);
- }
- }
- }
- }
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static ConsoleManager fInstance = new ConsoleManager();
- }
-
- /**
- * Returns the singleton instance for the console manager.
- */
- public static ConsoleManager getInstance() {
- return LazyInstanceHolder.fInstance;
- }
-
- /**
- * Constructor.
- */
- ConsoleManager() {
- super();
-
- // Attach the perspective listener
- perspectiveListener = new ConsoleManagerPerspectiveListener();
- if (PlatformUI.isWorkbenchRunning() && PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(perspectiveListener);
- }
- }
-
- /**
- * Returns the active workbench window page if the workbench is still running.
- *
- * @return The active workbench window page or <code>null</code>
- */
- private final IWorkbenchPage getActiveWorkbenchPage() {
- // To lookup the console view, the workbench must be still running
- if (PlatformUI.isWorkbenchRunning() && PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- }
- return null;
- }
-
- /**
- * Returns the console view if available within the active workbench window page.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminal console view id or <code>null</code> to show the default terminal console view.
- * @return The console view instance if available or <code>null</code> otherwise.
- */
- public ITerminalsView findConsoleView(String id) {
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- ITerminalsView view = null;
-
- // Get the active workbench page
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- // Look for the view
- IViewPart part = page.findView(id != null ? id : IUIConstants.ID);
- // Check the interface
- if (part instanceof ITerminalsView) {
- view = (ITerminalsView)part;
- }
- }
-
- return view;
- }
-
- /**
- * Show the terminal console view specified by the given id.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminal console view id or <code>null</code> to show the default terminal console view.
- */
- public void showConsoleView(String id) {
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Get the active workbench page
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- try {
- // show the view
- IViewPart part = page.showView(id != null ? id : IUIConstants.ID);
- // and force the view to the foreground
- page.bringToTop(part);
- } catch (PartInitException e) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- e.getLocalizedMessage(), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
-
- /**
- * Bring the terminal console view, specified by the given id, to the top of the view stack.
- *
- * @param id The terminal console view id or <code>null</code> to show the default terminal console view.
- * @param activate If <code>true</code> activate the console view.
- */
- private void bringToTop(String id, boolean activate) {
- // Get the active workbench page
- IWorkbenchPage page = getActiveWorkbenchPage();
- if (page != null) {
- // Look for the view
- IViewPart part = page.findView(id != null ? id : IUIConstants.ID);
- if (part != null) {
- if (activate) {
- page.activate(part);
- }
- else {
- page.bringToTop(part);
- }
- } else if (activate) showConsoleView(id != null ? id : IUIConstants.ID);
- }
- }
-
- /**
- * Opens the console with the given title and connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- *
- * @param id The terminal console view id or <code>null</code> to show the default terminal console view.
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- * @param activate If <code>true</code> activate the console view.
- */
- public void openConsole(String id, String title, ITerminalConnector connector, Object data, boolean activate) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // make the consoles view visible
- bringToTop(id, activate);
-
- // Get the console view
- ITerminalsView view = findConsoleView(id);
- if (view == null) return;
-
- // Get the tab folder manager associated with the view
- TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class);
- if (manager == null) return;
-
- // Lookup an existing console first
- CTabItem item = findConsole(id, title, connector, data);
-
- // If no existing console exist -> Create the tab item
- if (item == null) {
- // If configured, check all existing tab items if they are associated
- // with terminated consoles
- if (UIPlugin.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_REMOVE_TERMINATED_TERMINALS)) {
- manager.removeTerminatedItems();
- }
-
- // Create a new tab item
- item = manager.createTabItem(title, connector, data);
- }
- // If still null, something went wrong
- if (item == null) {
- return;
- }
-
- // Make the item the active console
- manager.bringToTop(item);
-
- // Show the tab folder page
- view.switchToTabFolderControl();
- }
-
- /**
- * Lookup a console with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- * <b>Note:</b> The method will handle unified console titles itself.
- *
- * @param id The terminal console view id or <code>null</code> to show the default terminal console view.
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The corresponding console tab item or <code>null</code>.
- */
- public CTabItem findConsole(String id, String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Get the console view
- ITerminalsView view = findConsoleView(id);
- if (view == null) return null;
-
- // Get the tab folder manager associated with the view
- TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class);
- if (manager == null) return null;
-
- return manager.findTabItem(title, connector, data);
- }
-
- /**
- * Close the console with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method must be called within the UI thread.
- * <b>Note:</b> The method will handle unified console titles itself.
- *
- * @param title The console title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- */
- public void closeConsole(String id, String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // Lookup the console
- CTabItem console = findConsole(id, title, connector, data);
- // If found, dispose the console
- if (console != null) console.dispose();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java
deleted file mode 100644
index af8552000..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.nls;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Terminals plug-in externalized strings management.
- */
-public class Messages extends NLS {
-
- // The plug-in resource bundle name
- private static final String BUNDLE_NAME = "org.eclipse.tm.te.ui.terminals.nls.Messages"; //$NON-NLS-1$
-
- /**
- * Static constructor.
- */
- static {
- // Load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- // **** Declare externalized string id's down here *****
-
- public static String AbstractAction_error_commandExecutionFailed;
-
- public static String TabTerminalListener_consoleTerminated;
-
- public static String ProcessSettingsPage_dialogTitle;
- public static String ProcessSettingsPage_processImagePathSelectorControl_label;
- public static String ProcessSettingsPage_processImagePathSelectorControl_button;
- public static String ProcessSettingsPage_processArgumentsControl_label;
- public static String ProcessSettingsPage_localEchoSelectorControl_label;
-
- public static String OutputStreamMonitor_error_readingFromStream;
-
- public static String InputStreamMonitor_error_writingToStream;
-
- public static String TerminalService_error_cannotCreateConnector;
- public static String TerminalService_defaultTitle;
-
- public static String LaunchTerminalSettingsDialog_title;
- public static String LaunchTerminalSettingsDialog_combo_label;
- public static String LaunchTerminalSettingsDialog_group_label;
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties
deleted file mode 100644
index 6e86cfb30..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/nls/Messages.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# org.eclipse.tm.te.ui.terminals
-# Externalized Strings.
-#
-
-AbstractAction_error_commandExecutionFailed="Failed to execute command (id = {0}). Possibly caused by: {1}
-
-TabTerminalListener_consoleTerminated=<terminated> {0}
-
-ProcessSettingsPage_dialogTitle=Select Process Image
-ProcessSettingsPage_processImagePathSelectorControl_label=Image Path:
-ProcessSettingsPage_processImagePathSelectorControl_button=Browse
-ProcessSettingsPage_processArgumentsControl_label=Arguments:
-ProcessSettingsPage_localEchoSelectorControl_label=Local Echo
-
-OutputStreamMonitor_error_readingFromStream=Exception when reading from stream. Possibly caused by: {0}
-
-InputStreamMonitor_error_writingToStream=Exception when writing to stream. Possibly caused by: {0}
-
-TerminalService_error_cannotCreateConnector=Cannot create a valid terminal connector instance from the provided terminal properties.
-TerminalService_defaultTitle=Console
-
-LaunchTerminalSettingsDialog_title=Launch Terminal
-LaunchTerminalSettingsDialog_combo_label=Choose terminal:
-LaunchTerminalSettingsDialog_group_label=Settings
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/panels/AbstractConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/panels/AbstractConfigurationPanel.java
deleted file mode 100644
index caa239469..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/panels/AbstractConfigurationPanel.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.panels;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel;
-import org.eclipse.tm.te.ui.terminals.interfaces.IConfigurationPanel;
-
-/**
- * Abstract terminal configuration panel implementation.
- */
-public abstract class AbstractConfigurationPanel extends AbstractWizardConfigurationPanel implements IConfigurationPanel {
- // The selection
- private ISelection selection;
-
- /**
- * Constructor.
- *
- * @param parentControl The parent control. Must not be <code>null</code>!
- */
- public AbstractConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.IConfigurationPanel#getSelection()
- */
- @Override
- public ISelection getSelection() {
- return selection;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/services/TerminalService.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/services/TerminalService.java
deleted file mode 100644
index 8f86cea55..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/services/TerminalService.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.services;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tm.te.runtime.services.AbstractService;
-import org.eclipse.tm.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tm.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tm.te.runtime.utils.StatusHelper;
-import org.eclipse.tm.te.ui.swt.DisplayUtil;
-import org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType;
-import org.eclipse.tm.te.ui.terminals.interfaces.IUIConstants;
-import org.eclipse.tm.te.ui.terminals.manager.ConsoleManager;
-import org.eclipse.tm.te.ui.terminals.nls.Messages;
-import org.eclipse.tm.te.ui.terminals.types.ConnectorManager;
-
-/**
- * Terminal service implementation.
- */
-@SuppressWarnings("restriction")
-public class TerminalService extends AbstractService implements ITerminalService {
-
- /**
- * Common terminal service runnable implementation.
- */
- protected static abstract class TerminalServiceRunnable {
-
- /**
- * Invoked to execute the terminal service runnable.
- *
- * @param id The terminals view id or <code>null</code>.
- * @param title The terminal tab title. Must not be <code>null</code>.
- * @param connector The terminal connector. Must not be <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- * @param callback The target callback to invoke if the operation finished or <code>null</code>.
- */
- public abstract void run(String id, String title, ITerminalConnector connector, Object data, ICallback callback);
-
- /**
- * Returns if or if not to execute the runnable asynchronously.
- * <p>
- * The method returns per default <code>true</code>. Overwrite to
- * modify the behavior.
- *
- * @return <code>True</code> to execute the runnable asynchronously, <code>false</code> otherwise.
- */
- public boolean isExecuteAsync() { return true; }
- }
-
- /**
- * Executes the given runnable operation and invokes the given callback, if any,
- * after the operation finished.
- *
- * @param properties The terminal properties. Must be not <code>null</code>.
- * @param runnable The terminal service runnable. Must be not <code>null</code>.
- * @param callback The target callback to invoke if the operation has been finished or <code>null</code>.
- */
- protected final void executeServiceOperation(final IPropertiesContainer properties, final TerminalServiceRunnable runnable, final ICallback callback) {
- Assert.isNotNull(properties);
- Assert.isNotNull(runnable);
-
- // Extract the properties
- String id = properties.getStringProperty(ITerminalsConnectorConstants.PROP_ID);
- String title = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TITLE);
- Object data = properties.getProperty(ITerminalsConnectorConstants.PROP_DATA);
-
- // Normalize the terminal console view id
- id = normalizeId(id, data);
- // Normalize the terminal console tab title
- title = normalizeTitle(title, data);
-
- // Create the terminal connector instance
- final ITerminalConnector connector = createTerminalConnector(properties);
- if (connector == null) {
- // Properties contain invalid connector arguments
- if (callback != null) {
- callback.done(this, StatusHelper.getStatus(new IllegalArgumentException(Messages.TerminalService_error_cannotCreateConnector)));
- }
- return;
- }
-
- // Finalize the used variables
- final String finId = id;
- final String finTitle = title;
- final Object finData = data;
-
- // Execute the operation
- if (!runnable.isExecuteAsync()) {
- runnable.run(finId, finTitle, connector, finData, callback);
- }
- else {
- DisplayUtil.safeAsyncExec(new Runnable() {
- @Override
- public void run() {
- runnable.run(finId, finTitle, connector, finData, callback);
- }
- });
- }
- }
-
- /**
- * Normalize the terminals view id.
- *
- * @param id The terminals view id or <code>null</code>.
- * @param data The custom data object or <code>null</code>.
- *
- * @return The normalized terminal console view id.
- */
- protected String normalizeId(String id, Object data) {
- return id != null ? id : IUIConstants.ID;
- }
-
- /**
- * Normalize the terminal tab title.
- *
- * @param title The terminal tab title or <code>null</code>.
- * @param data The custom data object or <code>null</code>.
- *
- * @return The normalized terminal tab title.
- */
- protected String normalizeTitle(String title, Object data) {
- // If the title is explicitly specified, return as is
- if (title != null) return title;
-
- // Return the default console title in all other cases
- return Messages.TerminalService_defaultTitle;
- }
-
- /**
- * Creates the terminal connector configured within the given properties.
- *
- * @param properties The terminal console properties. Must be not <code>null</code>.
- * @return The terminal connector or <code>null</code>.
- */
- protected ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
- Assert.isNotNull(properties);
-
- // The terminal connector result object
- ITerminalConnector connector = null;
-
- // Get the connector type id from the properties
- String connectorTypeId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID);
- if (connectorTypeId != null) {
- // Get the connector type
- IConnectorType connectorType = ConnectorManager.getInstance().getConnectorType(connectorTypeId, false);
- if (connectorType != null) {
- // Create the connector
- connector = connectorType.createTerminalConnector(properties);
- }
- }
-
- return connector;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.services.interfaces.ITerminalService#openConsole(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tm.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- public void openConsole(final IPropertiesContainer properties, final ICallback callback) {
- Assert.isNotNull(properties);
-
- executeServiceOperation(properties, new TerminalServiceRunnable() {
- @Override
- public void run(String id, String title, ITerminalConnector connector, Object data, ICallback callback) {
- // Open the new console
- ConsoleManager.getInstance().openConsole(id, title, connector, data, true);
- // Invoke the callback
- if (callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- }
- }, callback);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.services.interfaces.ITerminalService#closeConsole(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tm.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- public void closeConsole(final IPropertiesContainer properties, final ICallback callback) {
- Assert.isNotNull(properties);
-
- executeServiceOperation(properties, new TerminalServiceRunnable() {
- @Override
- public void run(String id, String title, ITerminalConnector connector, Object data, ICallback callback) {
- // Close the console
- ConsoleManager.getInstance().closeConsole(id, title, connector, data);
- // Invoke the callback
- if (callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- }
- }, callback);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/AbstractStreamsConnector.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/AbstractStreamsConnector.java
deleted file mode 100644
index 5f4025d67..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/AbstractStreamsConnector.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.streams;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Streams connector implementation.
- */
-@SuppressWarnings("restriction")
-public abstract class AbstractStreamsConnector extends TerminalConnectorImpl {
- // Reference to the stdin monitor
- private InputStreamMonitor stdInMonitor;
- // Reference to the stdout monitor
- private OutputStreamMonitor stdOutMonitor;
- // Reference to the stderr monitor
- private OutputStreamMonitor stdErrMonitor;
-
- /**
- * Connect the given streams. The streams connector will wrap each stream
- * with a corresponding terminal stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stdin The stdin stream or <code>null</code>.
- * @param stdout The stdout stream or <code>null</code>.
- * @param stderr The stderr stream or <code>null</code>.
- * @param localEcho Local echo on or off.
- * @param lineSeparator The line separator used by the stream.
- */
- protected void connectStreams(ITerminalControl terminalControl, OutputStream stdin, InputStream stdout, InputStream stderr, boolean localEcho, String lineSeparator) {
- Assert.isNotNull(terminalControl);
-
- // Create the input stream monitor
- if (stdin != null) {
- stdInMonitor = createStdInMonitor(terminalControl, stdin, localEcho, lineSeparator);
- // Register the connector if it implements IDisposable and stdout/stderr are not monitored
- if (stdout == null && stderr == null && this instanceof IDisposable) stdInMonitor.addDisposable((IDisposable)this);
- // Start the monitoring
- stdInMonitor.startMonitoring();
- }
-
- // Create the output stream monitor
- if (stdout != null) {
- stdOutMonitor = createStdOutMonitor(terminalControl, stdout, lineSeparator);
- // Register the connector if it implements IDisposable
- if (this instanceof IDisposable) stdOutMonitor.addDisposable((IDisposable)this);
- // Start the monitoring
- stdOutMonitor.startMonitoring();
- }
-
- // Create the error stream monitor
- if (stderr != null) {
- stdErrMonitor = createStdErrMonitor(terminalControl, stderr, lineSeparator);
- // Register the connector if it implements IDisposable and stdout is not monitored
- if (stdout == null && this instanceof IDisposable) stdErrMonitor.addDisposable((IDisposable)this);
- // Start the monitoring
- stdErrMonitor.startMonitoring();
- }
- }
-
- /**
- * Creates an stdin monitor for the given terminal control and stdin stream.
- * Subclasses may override to create a specialized stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stdin The stdin stream or <code>null</code>.
- * @param localEcho Local echo on or off.
- * @param lineSeparator The line separator used by the stream.
- *
- * @return input stream monitor
- */
- protected InputStreamMonitor createStdInMonitor(ITerminalControl terminalControl, OutputStream stdin, boolean localEcho, String lineSeparator) {
- return new InputStreamMonitor(terminalControl, stdin, localEcho, lineSeparator);
- }
-
- /**
- * Creates an stdout monitor for the given terminal control and stdout stream.
- * Subclasses may override to create a specialized stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stdout The stdout stream or <code>null</code>.
- * @param lineSeparator The line separator used by the stream.
- *
- * @return output stream monitor
- */
- protected OutputStreamMonitor createStdOutMonitor(ITerminalControl terminalControl, InputStream stdout, String lineSeparator) {
- return new OutputStreamMonitor(terminalControl, stdout, lineSeparator);
- }
-
- /**
- * Creates an stderr monitor for the given terminal control and stderr stream.
- * Subclasses may override to create a specialized stream monitor.
- *
- * @param terminalControl The terminal control. Must not be <code>null</code>.
- * @param stderr The stderr stream or <code>null</code>.
- * @param lineSeparator The line separator used by the stream.
- *
- * @return output stream monitor
- */
- protected OutputStreamMonitor createStdErrMonitor(ITerminalControl terminalControl, InputStream stderr, String lineSeparator) {
- return new OutputStreamMonitor(terminalControl, stderr, lineSeparator);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect()
- */
- @Override
- protected void doDisconnect() {
- // Dispose the streams
- if (stdInMonitor != null) { stdInMonitor.dispose(); stdInMonitor = null; }
- if (stdOutMonitor != null) { stdOutMonitor.dispose(); stdOutMonitor = null; }
- if (stdErrMonitor != null) { stdErrMonitor.dispose(); stdErrMonitor = null; }
-
- super.doDisconnect();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getTerminalToRemoteStream()
- */
- @Override
- public OutputStream getTerminalToRemoteStream() {
- return stdInMonitor;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/InputStreamMonitor.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/InputStreamMonitor.java
deleted file mode 100644
index 19d7aa877..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/InputStreamMonitor.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.streams;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Input stream monitor implementation.
- * <p>
- * <b>Note:</b> The input is coming <i>from</i> the terminal. Therefore, the input
- * stream monitor is attached to the stdin stream of the monitored (remote) process.
- */
-@SuppressWarnings("restriction")
-public class InputStreamMonitor extends OutputStream implements IDisposable {
- // Reference to the parent terminal control
- @SuppressWarnings("unused")
- private final ITerminalControl terminalControl;
-
- // Reference to the monitored (output) stream
- private final OutputStream stream;
-
- // Reference to the thread writing the stream
- private Thread thread;
-
- // Flag to mark the monitor disposed. When disposed,
- // no further data is written from the monitored stream.
- private boolean disposed;
-
- // A list of object to dispose if this monitor is disposed
- private final List<IDisposable> disposables = new ArrayList<IDisposable>();
-
- // Queue to buffer the data to write to the output stream
- private final Queue<byte[]> queue = new LinkedList<byte[]>();
-
- // ***** Line separator replacement logic *****
- // ***** Adapted from org.eclipse.tm.internal.terminal.local.LocalTerminalOutputStream *****
-
- private final static int TERMINAL_SENDS_CR = 0;
- private final static int TERMINAL_SENDS_CRLF = 1;
- private final static int PROGRAM_EXPECTS_LF = 0;
- private final static int PROGRAM_EXPECTS_CRLF = 1;
- private final static int PROGRAM_EXPECTS_CR = 2;
- private final static int NO_CHANGE = 0;
- private final static int CHANGE_CR_TO_LF = 1;
- private final static int INSERT_LF_AFTER_CR = 2;
- private final static int REMOVE_CR = 3;
- private final static int REMOVE_LF = 4;
-
- // CRLF conversion table:
- //
- // Expected line separator --> | LF | CRLF | CR |
- // ------------------------------------+-----------------+--------------------+----------------+
- // Local echo off - control sends CR | change CR to LF | insert LF after CR | no change |
- // ------------------------------------+-----------------+--------------------+----------------+
- // Local echo on - control sends CRLF | remove CR | no change | remove LF |
- //
- private final static int[][] CRLF_REPLACEMENT = {
-
- {CHANGE_CR_TO_LF, INSERT_LF_AFTER_CR, NO_CHANGE},
- {REMOVE_CR, NO_CHANGE, REMOVE_LF}
- };
-
- private int replacement;
-
- /**
- * Constructor.
- *
- * @param terminalControl The parent terminal control. Must not be <code>null</code>.
- * @param stream The stream. Must not be <code>null</code>.
- * @param localEcho Local echo on or off.
- * @param lineSeparator The line separator used by the stream.
- */
- public InputStreamMonitor(ITerminalControl terminalControl, OutputStream stream, boolean localEcho, String lineSeparator) {
- super();
-
- Assert.isNotNull(terminalControl);
- this.terminalControl = terminalControl;
- Assert.isNotNull(stream);
- this.stream = stream;
-
- // Determine the line separator replacement setting
- int terminalSends = localEcho ? TERMINAL_SENDS_CRLF : TERMINAL_SENDS_CR;
- if (lineSeparator == null) {
- replacement = NO_CHANGE;
- } else {
- int programExpects;
- if (lineSeparator.equals(ILineSeparatorConstants.LINE_SEPARATOR_LF)) {
- programExpects = PROGRAM_EXPECTS_LF;
- }
- else if (lineSeparator.equals(ILineSeparatorConstants.LINE_SEPARATOR_CR)) {
- programExpects = PROGRAM_EXPECTS_CR;
- }
- else {
- programExpects = PROGRAM_EXPECTS_CRLF;
- }
- replacement = CRLF_REPLACEMENT[terminalSends][programExpects];
- }
-
- }
-
- /**
- * Adds the given disposable object to the list. The method will do nothing
- * if either the disposable object is already part of the list or the monitor
- * is disposed.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void addDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- if (!disposed && !disposables.contains(disposable)) disposables.add(disposable);
- }
-
- /**
- * Removes the disposable object from the list.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void removeDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- disposables.remove(disposable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- // If already disposed --> return immediately
- if (disposed) return;
-
- // Mark the monitor disposed
- disposed = true;
-
- // Close the stream (ignore exceptions on close)
- try { stream.close(); } catch (IOException e) { /* ignored on purpose */ }
- // And interrupt the thread
- close();
-
- // Dispose all registered disposable objects
- for (IDisposable disposable : disposables) disposable.dispose();
- // Clear the list
- disposables.clear();
- }
-
- /**
- * Close the terminal input stream monitor.
- */
- @Override
- public void close() {
- // Not initialized -> return immediately
- if (thread == null) return;
-
- // Copy the reference
- final Thread oldThread = thread;
- // Unlink the monitor from the thread
- thread = null;
- // And interrupt the writer thread
- oldThread.interrupt();
- }
-
- /**
- * Starts the terminal output stream monitor.
- */
- public void startMonitoring() {
- // If already initialized -> return immediately
- if (thread != null) return;
-
- // Create a new runnable which is constantly reading from the stream
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- writeStream();
- }
- };
-
- // Create the writer thread
- thread = new Thread(runnable, "Terminal Input Stream Monitor Thread"); //$NON-NLS-1$
-
- // Configure the writer thread
- thread.setDaemon(true);
-
- // Start the processing
- thread.start();
- }
-
-
- /**
- * Reads from the queue and writes the read content to the stream.
- */
- protected void writeStream() {
- // Read from the queue and write to the stream until disposed
- while (thread != null && !disposed) {
- // If the queue is empty, wait until notified
- if (queue.isEmpty()) {
- synchronized(queue) {
- try { queue.wait(); } catch (InterruptedException e) { /* ignored on purpose */ }
- }
- }
-
- // If the queue is not empty, take the first element
- // and write the data to the stream
- while (!queue.isEmpty() && !disposed) {
- // Retrieves the queue head (is null if queue is empty (should never happen))
- byte[] data = queue.poll();
- if (data != null) {
- try {
- // Write the data to the stream
- stream.write(data);
- // Flush the stream immediately
- stream.flush();
- } catch (IOException e) {
- // IOException received. If this is happening when already disposed -> ignore
- if (!disposed) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.InputStreamMonitor_error_writingToStream, e.getLocalizedMessage()), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
- }
- }
-
- // Dispose the stream
- dispose();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- @Override
- public void write(int b) throws IOException {
- synchronized(queue) {
- queue.add(new byte[] { (byte)b });
- queue.notifyAll();
- }
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- // Write the whole block to the queue to avoid synchronization
- // to happen for every byte. To do so, we have to avoid calling
- // the super method. Therefore we have to do the same checking
- // here as the base class does.
-
- // Null check. See the implementation in OutputStream.
- if (b == null) throw new NullPointerException();
-
- // Boundary check. See the implementation in OutputStream.
- if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
- throw new IndexOutOfBoundsException();
- }
- else if (len == 0) {
- return;
- }
-
- // Make sure that the written block is not interlaced with other input.
- synchronized(queue) {
- // Preprocess the block to be written
- byte[] processedBytes = onWriteContentToStream(b, off, len);
- // If the returned array is not the original one, adjust offset and length
- if (processedBytes != b) {
- off = 0; len = processedBytes.length;
- }
-
- // Get the content from the byte buffer specified by offset and length
- byte[] bytes = new byte[len];
- int j = 0;
- for (int i = 0 ; i < len ; i++) {
- bytes[j++] = b[off + i];
- }
-
- queue.add(bytes);
- queue.notifyAll();
- }
- }
-
- /**
- * Allow for processing of data from byte stream from the terminal before
- * it is written to the output stream. If the returned byte array is different
- * than the one that was passed in with the bytes argument, then the
- * length value will be adapted.
- *
- * @param bytes The byte stream. Must not be <code>null</code>.
- * @param off The offset.
- * @param len the length.
- *
- * @return The processed byte stream.
- *
- */
- protected byte[] onWriteContentToStream(byte[] bytes, int off, int len) {
- Assert.isNotNull(bytes);
-
- if (replacement != NO_CHANGE && len > 0) {
- String text = new String(bytes, off, len);
- //
- // TODO: check whether this is correct! new String(byte[], int, int) always uses the default
- // encoding!
-
- if (replacement == CHANGE_CR_TO_LF) {
- text = text.replace('\r', '\n');
- }
- else if (replacement == INSERT_LF_AFTER_CR) {
- text = text.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_CR, "\r\n"); //$NON-NLS-1$
- }
- else if (replacement == REMOVE_CR) {
- text = text.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_CR, ""); //$NON-NLS-1$
- }
- else if (replacement == REMOVE_LF) {
- text = text.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_LF, ""); //$NON-NLS-1$
- }
-
- if (text.length() > 0) {
- bytes = text.getBytes();
- }
- }
-
- return bytes;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/OutputStreamMonitor.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/OutputStreamMonitor.java
deleted file mode 100644
index 31bcf2e07..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/OutputStreamMonitor.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.streams;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.internal.tracing.ITraceIds;
-import org.eclipse.tm.te.ui.terminals.nls.Messages;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Output stream monitor implementation.
- * <p>
- * <b>Note:</b> The output is going <i>to</i> the terminal. Therefore, the output
- * stream monitor is attached to the stdout and/or stderr stream of the monitored
- * (remote) process.
- */
-@SuppressWarnings("restriction")
-public class OutputStreamMonitor implements IDisposable {
- // The default buffer size to use
- private static final int BUFFER_SIZE = 8192;
-
- // Reference to the parent terminal control
- private final ITerminalControl terminalControl;
-
- // Reference to the monitored (input) stream
- private final InputStream stream;
-
- // The line separator used by the monitored (input) stream
- private final String lineSeparator;
-
- // Reference to the thread reading the stream
- private Thread thread;
-
- // Flag to mark the monitor disposed. When disposed,
- // no further data is read from the monitored stream.
- private boolean disposed;
-
- // A list of object to dispose if this monitor is disposed
- private final List<IDisposable> disposables = new ArrayList<IDisposable>();
-
- /**
- * Constructor.
- *
- * @param terminalControl The parent terminal control. Must not be <code>null</code>.
- * @param stream The stream. Must not be <code>null</code>.
- * @param lineSeparator The line separator used by the stream.
- */
- public OutputStreamMonitor(ITerminalControl terminalControl, InputStream stream, String lineSeparator) {
- super();
-
- Assert.isNotNull(terminalControl);
- this.terminalControl = terminalControl;
- Assert.isNotNull(stream);
- this.stream = new BufferedInputStream(stream, BUFFER_SIZE);
-
- this.lineSeparator = lineSeparator;
- }
-
- /**
- * Adds the given disposable object to the list. The method will do nothing
- * if either the disposable object is already part of the list or the monitor
- * is disposed.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void addDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- if (!disposed && !disposables.contains(disposable)) disposables.add(disposable);
- }
-
- /**
- * Removes the disposable object from the list.
- *
- * @param disposable The disposable object. Must not be <code>null</code>.
- */
- public final void removeDisposable(IDisposable disposable) {
- Assert.isNotNull(disposable);
- disposables.remove(disposable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- // If already disposed --> return immediately
- if (disposed) return;
-
- // Mark the monitor disposed
- disposed = true;
-
- // Close the stream (ignore exceptions on close)
- try { stream.close(); } catch (IOException e) { /* ignored on purpose */ }
-
- // Dispose all registered disposable objects
- for (IDisposable disposable : disposables) disposable.dispose();
- // Clear the list
- disposables.clear();
- }
-
- /**
- * Starts the terminal output stream monitor.
- */
- protected void startMonitoring() {
- // If already initialized -> return immediately
- if (thread != null) return;
-
- // Create a new runnable which is constantly reading from the stream
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- readStream();
- }
- };
-
- // Create the reader thread
- thread = new Thread(runnable, "Terminal Output Stream Monitor Thread"); //$NON-NLS-1$
-
- // Configure the reader thread
- thread.setDaemon(true);
- thread.setPriority(Thread.MIN_PRIORITY);
-
- // Start the processing
- thread.start();
- }
-
- /**
- * Returns the terminal control that this stream monitor is associated with.
- */
- protected ITerminalControl getTerminalControl() {
- return terminalControl;
- }
-
- /**
- * Reads from the output stream and write the read content
- * to the terminal control output stream.
- */
- void readStream() {
- // Creates the read buffer
- byte[] readBuffer = new byte[BUFFER_SIZE];
-
- // We need to maintain UI responsiveness but still stream the content
- // to the terminal control fast. Put the thread to a short sleep each second.
- long sleepMarker = System.currentTimeMillis();
-
- // Read from the stream until EOS is reached or the
- // monitor is marked disposed.
- int read = 0;
- while (read >= 0 && !disposed) {
- try {
- // Read from the stream
- read = stream.read(readBuffer);
- // If some data has been read, append to the terminal
- // control output stream
- if (read > 0) {
- // Allow for post processing the read content before appending
- byte[] processedReadBuffer = onContentReadFromStream(readBuffer, read);
- if (processedReadBuffer != readBuffer) {
- read = processedReadBuffer.length;
- }
- terminalControl.getRemoteToTerminalOutputStream().write(processedReadBuffer, 0, read);
- }
- } catch (IOException e) {
- // IOException received. If this is happening when already disposed -> ignore
- if (!disposed) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.OutputStreamMonitor_error_readingFromStream, e.getLocalizedMessage()), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- break;
- } catch (NullPointerException e) {
- // killing the stream monitor while reading can cause an NPE
- // when reading from the stream
- if (!disposed && thread != null) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- NLS.bind(Messages.OutputStreamMonitor_error_readingFromStream, e.getLocalizedMessage()), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- break;
- }
-
- // See above -> Thread will go to sleep each second
- if (System.currentTimeMillis() - sleepMarker > 1000) {
- sleepMarker = System.currentTimeMillis();
- try { Thread.sleep(1); } catch (InterruptedException e) { /* ignored on purpose */ }
- }
- }
-
- // Dispose ourself
- dispose();
- }
-
- /**
- * Allow for processing of data from byte stream after it is read from
- * client but before it is appended to the terminal. If the returned byte
- * array is different than the one that was passed in with the byteBuffer
- * argument, then the bytesRead value will be ignored and the full
- * returned array will be written out.
- *
- * @param byteBuffer The byte stream. Must not be <code>null</code>.
- * @param bytesRead The number of bytes that were read into the read buffer.
- * @return The processed byte stream.
- *
- */
- protected byte[] onContentReadFromStream(byte[] byteBuffer, int bytesRead) {
- Assert.isNotNull(byteBuffer);
-
- // If tracing is enabled, print out the decimal byte values read
- if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_OUTPUT_STREAM_MONITOR)) {
- StringBuilder debug = new StringBuilder("byteBuffer [decimal, " + bytesRead + " bytes] : "); //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < bytesRead; i++) {
- debug.append(Byte.valueOf(byteBuffer[i]).intValue());
- debug.append(' ');
- }
- System.out.println(debug.toString());
- }
-
- // Remember if the text got changed.
- boolean changed = false;
-
- // How can me make sure that we don't mess with the encoding here?
- String text = new String(byteBuffer, 0, bytesRead);
-
- // Shift-In (14) and Shift-Out(15) confuses the terminal widget
- if (text.indexOf(14) != -1 || text.indexOf(15) != -1) {
- text = text.replaceAll("\\x0e", "").replaceAll("\\x0f", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- changed = true;
- }
-
- // Check on the line separator setting
- if (lineSeparator != null
- && !ILineSeparatorConstants.LINE_SEPARATOR_CRLF.equals(lineSeparator)
- && text.contains(lineSeparator)) {
- text = text.replaceAll(lineSeparator, "\r\n"); //$NON-NLS-1$
- changed = true;
- }
-
- // If changed, get the new bytes array
- if (changed) byteBuffer = text.getBytes();
-
- return byteBuffer;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsConnector.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsConnector.java
deleted file mode 100644
index 119a3f911..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsConnector.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.streams;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * Streams connector implementation.
- */
-@SuppressWarnings("restriction")
-public class StreamsConnector extends AbstractStreamsConnector implements IDisposable {
- // Reference to the streams settings
- private final StreamsSettings settings;
-
- /**
- * Constructor.
- */
- public StreamsConnector() {
- this(new StreamsSettings());
- }
-
- /**
- * Constructor.
- *
- * @param settings The streams settings. Must not be <code>null</code>
- */
- public StreamsConnector(StreamsSettings settings) {
- super();
-
- Assert.isNotNull(settings);
- this.settings = settings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#connect(org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl)
- */
- @Override
- public void connect(ITerminalControl control) {
- Assert.isNotNull(control);
- super.connect(control);
-
- // connect the streams
- connectStreams(control, settings.getStdinStream(), settings.getStdoutStream(), settings.getStderrStream(), settings.isLocalEcho(), settings.getLineSeparator());
-
- // Set the terminal control state to CONNECTED
- control.setState(TerminalState.CONNECTED);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#isLocalEcho()
- */
- @Override
- public boolean isLocalEcho() {
- return settings.isLocalEcho();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
- */
- @Override
- public void dispose() {
- disconnect();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect()
- */
- @Override
- public void doDisconnect() {
- // Dispose the streams
- super.doDisconnect();
-
- // Set the terminal control state to CLOSED.
- fControl.setState(TerminalState.CLOSED);
- }
-
- // ***** Process Connector settings handling *****
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getSettingsSummary()
- */
- @Override
- public String getSettingsSummary() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#load(org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore)
- */
- @Override
- public void load(ISettingsStore store) {
- settings.load(store);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl#save(org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore)
- */
- @Override
- public void save(ISettingsStore store) {
- settings.save(store);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsSettings.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsSettings.java
deleted file mode 100644
index 66118342c..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/streams/StreamsSettings.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.streams;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-
-/**
- * Streams connector settings implementation.
- */
-@SuppressWarnings("restriction")
-public class StreamsSettings {
- // Reference to the stdin stream
- private OutputStream stdin;
- // Reference to the stdout stream
- private InputStream stdout;
- // Reference to the stderr stream
- private InputStream stderr;
- // Flag to control the local echo
- private boolean localEcho = true;
- // The line separator setting
- private String lineSeparator = null;
-
- /**
- * Sets the stdin stream instance.
- *
- * @param stdin The stream instance or <code>null</code>.
- */
- public void setStdinStream(OutputStream stdin) {
- this.stdin = stdin;
- }
-
- /**
- * Returns the stdin stream instance.
- *
- * @return The stream instance or <code>null</code>.
- */
- public OutputStream getStdinStream() {
- return stdin;
- }
-
- /**
- * Sets the stdout stream instance.
- *
- * @param stdout The stream instance or <code>null</code>.
- */
- public void setStdoutStream(InputStream stdout) {
- this.stdout = stdout;
- }
-
- /**
- * Returns the stdout stream instance.
- *
- * @return The stream instance or <code>null</code>.
- */
- public InputStream getStdoutStream() {
- return stdout;
- }
-
- /**
- * Sets the stderr stream instance.
- *
- * @param stderr The stream instance or <code>null</code>.
- */
- public void setStderrStream(InputStream stderr) {
- this.stderr = stderr;
- }
-
- /**
- * Returns the stderr stream instance.
- *
- * @return The stream instance or <code>null</code>.
- */
- public InputStream getStderrStream() {
- return stderr;
- }
-
- /**
- * Sets if the process requires a local echo from the terminal widget.
- *
- * @param value Specify <code>true</code> to enable the local echo, <code>false</code> otherwise.
- */
- public void setLocalEcho(boolean value) {
- this.localEcho = value;
- }
-
- /**
- * Returns <code>true</code> if the process requires a local echo
- * from the terminal widget.
- *
- * @return <code>True</code> if local echo is enabled, <code>false</code> otherwise.
- */
- public boolean isLocalEcho() {
- return localEcho;
- }
-
- /**
- * Sets the stream line separator.
- *
- * @param separator The stream line separator <code>null</code>.
- */
- public void setLineSeparator(String separator) {
- this.lineSeparator = separator;
- }
-
- /**
- * Returns the stream line separator.
- *
- * @return The stream line separator or <code>null</code>.
- */
- public String getLineSeparator() {
- return lineSeparator;
- }
-
- /**
- * Loads the streams settings from the given settings store.
- *
- * @param store The settings store. Must not be <code>null</code>.
- */
- public void load(ISettingsStore store) {
- Assert.isNotNull(store);
- localEcho = Boolean.parseBoolean(store.get("LocalEcho", Boolean.FALSE.toString())); //$NON-NLS-1$
- lineSeparator = store.get("LineSeparator", null); //$NON-NLS-1$
- if (store instanceof IPropertiesContainer) {
- stdin = (OutputStream)((IPropertiesContainer)store).getProperty("stdin"); //$NON-NLS-1$
- stdout = (InputStream)((IPropertiesContainer)store).getProperty("stdout"); //$NON-NLS-1$
- stderr = (InputStream)((IPropertiesContainer)store).getProperty("stderr"); //$NON-NLS-1$
- }
- }
-
- /**
- * Saves the process settings to the given settings store.
- *
- * @param store The settings store. Must not be <code>null</code>.
- */
- public void save(ISettingsStore store) {
- Assert.isNotNull(store);
- store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$
- store.put("LineSeparator", lineSeparator); //$NON-NLS-1$
- if (store instanceof IPropertiesContainer) {
- ((IPropertiesContainer)store).setProperty("stdin", stdin); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("stdout", stdout); //$NON-NLS-1$
- ((IPropertiesContainer)store).setProperty("stderr", stderr); //$NON-NLS-1$
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabDisposeListener.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabDisposeListener.java
deleted file mode 100644
index 09f7783a8..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabDisposeListener.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.te.runtime.events.DisposedEvent;
-import org.eclipse.tm.te.runtime.events.EventManager;
-
-/**
- * Terminals tab default dispose listener implementation.
- */
-@SuppressWarnings("restriction")
-public class TabDisposeListener implements DisposeListener {
- private final TabFolderManager parentTabFolderManager;
-
- /**
- * Constructor.
- *
- * @param parentTabFolderManager The parent tab folder manager. Must be not <code>null</code>
- */
- public TabDisposeListener(TabFolderManager parentTabFolderManager) {
- Assert.isNotNull(parentTabFolderManager);
- this.parentTabFolderManager = parentTabFolderManager;
- }
-
- /**
- * Returns the parent terminal console tab folder manager instance.
- *
- * @return The parent terminal console tab folder manager instance.
- */
- protected final TabFolderManager getParentTabFolderManager() {
- return parentTabFolderManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
- */
- @Override
- public void widgetDisposed(DisposeEvent e) {
- // If a tab item gets disposed, we have to dispose the terminal as well
- if (e.getSource() instanceof CTabItem) {
- // Get the terminal control (if any) from the tab item
- Object candidate = ((CTabItem)e.getSource()).getData();
- if (candidate instanceof ITerminalViewControl) ((ITerminalViewControl)candidate).disposeTerminal();
-
- // If all items got removed, we have to switch back to the empty page control
- if (parentTabFolderManager.getTabFolder() != null && parentTabFolderManager.getTabFolder().getItemCount() == 0) {
- parentTabFolderManager.getParentView().switchToEmptyPageControl();
- }
- // Fire selection changed event
- parentTabFolderManager.fireSelectionChanged();
- // Fire the terminal console disposed event
- EventManager.getInstance().fireEvent(new DisposedEvent(e.getSource(), ((CTabItem)e.getSource()).getData("customData"))); //$NON-NLS-1$
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderManager.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderManager.java
deleted file mode 100644
index 491548ec4..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderManager.java
+++ /dev/null
@@ -1,720 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.EventObject;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-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.te.runtime.events.EventManager;
-import org.eclipse.tm.te.ui.events.AbstractEventListener;
-import org.eclipse.tm.te.ui.swt.DisplayUtil;
-import org.eclipse.tm.te.ui.terminals.activator.UIPlugin;
-import org.eclipse.tm.te.ui.terminals.events.SelectionChangedBroadcastEvent;
-import org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tm.te.ui.terminals.interfaces.ImageConsts;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDEEncoding;
-
-/**
- * Terminals tab folder manager.
- */
-@SuppressWarnings("restriction")
-public class TabFolderManager extends PlatformObject implements ISelectionProvider {
- // Reference to the parent terminal consoles view
- private final ITerminalsView parentView;
- // Reference to the selection listener instance
- private final SelectionListener selectionListener;
- // Reference to the broadcasted selection changed event listener instance
- private final BroadcastedSelectionChangedEventListener broadcastedSelectionChangedEventListener;
-
- /**
- * List of selection changed listeners.
- */
- private final List<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
-
- /**
- * The terminal control selection listener implementation.
- */
- private class TerminalControlSelectionListener implements DisposeListener, MouseListener {
- private final ITerminalViewControl terminal;
- private boolean selectMode;
-
- /**
- * Constructor.
- *
- * @param terminal The terminal control. Must be not <code>null</code>.
- */
- public TerminalControlSelectionListener(ITerminalViewControl terminal) {
- Assert.isNotNull(terminal);
- this.terminal = terminal;
-
- // Register ourself as the required listener
- terminal.getControl().addDisposeListener(this);
- terminal.getControl().addMouseListener(this);
- }
-
- /**
- * Returns the associated terminal view control.
- *
- * @return The terminal view control.
- */
- protected final ITerminalViewControl getTerminal() {
- return terminal;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
- */
- @Override
- public void widgetDisposed(DisposeEvent e) {
- // Widget got disposed, check if it is ours
- // If a tab item gets disposed, we have to dispose the terminal as well
- if (e.getSource().equals(terminal.getControl())) {
- // Remove as listener
- getTerminal().getControl().removeDisposeListener(this);
- getTerminal().getControl().removeMouseListener(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- @Override
- public void mouseDown(MouseEvent e) {
- // Left button down -> select mode starts
- if (e.button == 1) selectMode = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- @Override
- public void mouseUp(MouseEvent e) {
- if (e.button == 1 && selectMode) {
- selectMode = false;
- // Fire a selection changed event with the terminal controls selection
- DisplayUtil.safeAsyncExec(new Runnable() {
- @Override
- public void run() {
- fireSelectionChanged(new StructuredSelection(getTerminal().getSelection()));
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- }
-
- /**
- * The event listener to process broadcasted selection changed events
- */
- private class BroadcastedSelectionChangedEventListener extends AbstractEventListener {
- private final TabFolderManager parent;
-
- /**
- * Constructor.
- *
- * @param parent The parent tab folder manager. Must not be <code>null</code>.
- */
- public BroadcastedSelectionChangedEventListener(TabFolderManager parent) {
- super();
-
- Assert.isNotNull(parent);
- this.parent = parent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
- */
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof SelectionChangedBroadcastEvent && !event.getSource().equals(parent)) {
- // Don't need to do anything if the parent tab folder is disposed or does not have a open tab
- CTabFolder tabFolder = parent.getTabFolder();
- if (tabFolder == null || tabFolder.isDisposed() || tabFolder.getItemCount() == 0) return;
-
- // Received a broadcasted selection changed event from another tab folder manager.
- SelectionChangedEvent selectionChangedEvent = ((SelectionChangedBroadcastEvent)event).getSelectionChangedEvent();
- if (selectionChangedEvent != null && selectionChangedEvent.getSelection() instanceof IStructuredSelection && !selectionChangedEvent.getSelection().isEmpty()) {
- // Extract the selection from the selection changed event
- IStructuredSelection selection = (IStructuredSelection)selectionChangedEvent.getSelection();
- // Determine the first element in the selection being a CTabItem
- CTabItem item = null;
- Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (candidate instanceof CTabItem) { item = (CTabItem)candidate; break; }
- }
- // If we got an CTabItem from the selection, try to find a CTabItem in our own tab folder manager
- // which is associated with the exact same data object.
- if (item != null && item.getData("customData") != null) { //$NON-NLS-1$
- Object data = item.getData("customData"); //$NON-NLS-1$
-
- CTabItem[] ourItems = tabFolder.getItems();
- for (CTabItem ourItem : ourItems) {
- Object ourData = ourItem.getData("customData"); //$NON-NLS-1$
- if (data.equals(ourData) && !ourItem.equals(parent.getActiveTabItem())) {
- // Select this item and we are done
- parent.setSelection(new StructuredSelection(ourItem));
- break;
- }
- }
- }
- }
- }
- }
-
- }
-
- /**
- * Constructor.
- *
- * @param parentView The parent terminal console view. Must be not <code>null</code>.
- */
- public TabFolderManager(ITerminalsView parentView) {
- super();
- Assert.isNotNull(parentView);
- this.parentView = parentView;
-
- // Attach a selection listener to the tab folder
- selectionListener = doCreateTabFolderSelectionListener(this);
- if (getTabFolder() != null) getTabFolder().addSelectionListener(selectionListener);
-
-
- // Create and register the broadcasted selection changed event listener
- broadcastedSelectionChangedEventListener = doCreateBroadcastedSelectionChangedEventListener(this);
- if (isListeningToBroadcastedSelectionChangedEvent() && broadcastedSelectionChangedEventListener != null) {
- EventManager.getInstance().addEventListener(broadcastedSelectionChangedEventListener, SelectionChangedBroadcastEvent.class);
- }
- }
-
- /**
- * Creates the terminal console tab folder selection listener instance.
- *
- * @param parent The parent terminal console tab folder manager. Must be not <code>null</code>.
- * @return The selection listener instance.
- */
- protected TabFolderSelectionListener doCreateTabFolderSelectionListener(TabFolderManager parent) {
- Assert.isNotNull(parent);
- return new TabFolderSelectionListener(parent);
- }
-
- /**
- * Returns the parent terminal consoles view.
- *
- * @return The terminal consoles view instance.
- */
- protected final ITerminalsView getParentView() {
- return parentView;
- }
-
- /**
- * Returns the tab folder associated with the parent view.
- *
- * @return The tab folder or <code>null</code>.
- */
- protected final CTabFolder getTabFolder() {
- return (CTabFolder)getParentView().getAdapter(CTabFolder.class);
- }
-
- /**
- * Returns the selection changed listeners currently registered.
- *
- * @return The registered selection changed listeners or an empty array.
- */
- protected final ISelectionChangedListener[] getSelectionChangedListeners() {
- return selectionChangedListeners.toArray(new ISelectionChangedListener[selectionChangedListeners.size()]);
- }
-
- /**
- * Dispose the tab folder manager instance.
- */
- public void dispose() {
- // Dispose the selection listener
- if (getTabFolder() != null && !getTabFolder().isDisposed()) getTabFolder().removeSelectionListener(selectionListener);
- // Remove the broadcasted selection changed event listener from the notification manager
- if (broadcastedSelectionChangedEventListener != null) {
- EventManager.getInstance().removeEventListener(broadcastedSelectionChangedEventListener);
- }
- }
-
- /**
- * Creates a new tab item with the given title and connector.
- *
- * @param title The tab title. Must be not <code>null</code>.
- * @param connector The terminal connector. Must be not <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The created tab item or <code>null</code> if failed.
- */
- @SuppressWarnings("unused")
- public CTabItem createTabItem(String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
-
- // The result tab item
- CTabItem item = null;
-
- // Get the tab folder from the parent viewer
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder != null) {
- // Generate a unique title string for the new tab item (must be called before creating the item itself)
- title = makeUniqueTitle(title, tabFolder);
- // Create the tab item
- item = new CTabItem(tabFolder, SWT.CLOSE);
- // Set the tab item title
- item.setText(title);
- // Set the tab icon
- Image image = getTabItemImage(connector, data);
- if (image != null) item.setImage(image);
-
- // Setup the tab item listeners
- setupTerminalTabListeners(item);
-
- // Create the composite to create the terminal control within
- Composite composite = new Composite(tabFolder, SWT.NONE);
- composite.setLayout(new FillLayout());
- // Associate the composite with the tab item
- item.setControl(composite);
-
- // Refresh the layout
- tabFolder.getParent().layout(true);
-
- // Create the terminal control
- ITerminalViewControl terminal = TerminalViewControlFactory.makeControl(doCreateTerminalTabTerminalListener(item), composite, new ITerminalConnector[] { connector });
- // Add the "selection" listener to the terminal control
- new TerminalControlSelectionListener(terminal);
- // Use the default Eclipse IDE encoding setting to configure the terminals encoding
- try { terminal.setEncoding(IDEEncoding.getResourceEncoding()); } catch (UnsupportedEncodingException e) { /* ignored on purpose */ }
- // Associated the terminal with the tab item
- item.setData(terminal);
- // Associated the custom data node with the tab item (if any)
- if (data != null) item.setData("customData", data); //$NON-NLS-1$
-
- // Overwrite the text canvas help id
- String contextHelpId = getParentView().getContextHelpId();
- if (contextHelpId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(terminal.getControl(), contextHelpId);
- }
-
- // Set the context menu
- TabFolderMenuHandler menuHandler = (TabFolderMenuHandler)getParentView().getAdapter(TabFolderMenuHandler.class);
- if (menuHandler != null) {
- Menu menu = (Menu)menuHandler.getAdapter(Menu.class);
- if (menu != null) {
- // One weird occurrence of IllegalArgumentException: Widget has wrong parent.
- // Inspecting the code, this seem extremely unlikely. The terminal is created
- // from a composite parent, the composite parent from the tab folder and the menu
- // from the tab folder. Means, at the end all should have the same menu shell, shouldn't they?
- try {
- terminal.getControl().setMenu(menu);
- } catch (IllegalArgumentException e) {
- // Log exception only if debug mode is set to 1.
- if (UIPlugin.getTraceHandler().isSlotEnabled(1, null)) {
- e.printStackTrace();
- }
- }
- }
- }
-
- // Select the created item within the tab folder
- tabFolder.setSelection(item);
-
- // Set the connector
- terminal.setConnector(connector);
-
- // And connect the terminal
- terminal.connectTerminal();
-
- // Fire selection changed event
- fireSelectionChanged();
- }
-
- // Return the create tab item finally.
- return item;
- }
-
- /**
- * Generate a unique title string based on the given proposal.
- *
- * @param proposal The proposal. Must be not <code>null</code>.
- * @return The unique title string.
- */
- protected String makeUniqueTitle(String proposal, CTabFolder tabFolder) {
- Assert.isNotNull(proposal);
- Assert.isNotNull(tabFolder);
-
- String title = proposal;
- int index = 0;
-
- // Loop all existing tab items and check the titles. We have to remember
- // all found titles as modifying the proposal might in turn conflict again
- // with the title of a tab already checked.
- List<String> titles = new ArrayList<String>();
- for (CTabItem item : tabFolder.getItems()) {
- // Get the tab item title
- titles.add(item.getText());
- // Make the proposal unique be appending (<n>) against all known titles.
- while (titles.contains(title)) title = proposal + " (" + index++ + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return title;
- }
-
- /**
- * Setup the terminal console tab item listeners.
- *
- * @param item The tab item. Must be not <code>null</code>.
- */
- protected void setupTerminalTabListeners(CTabItem item) {
- Assert.isNotNull(item);
-
- // Create and associate the disposal listener
- item.addDisposeListener(doCreateTerminalTabDisposeListener(this));
-
- // Create and register the property change listener
- final IPropertyChangeListener propertyChangeListener = doCreateTerminalTabPropertyChangeListener(item);
- // Register to the JFace font registry
- JFaceResources.getFontRegistry().addListener(propertyChangeListener);
- // Remove the listener from the JFace font registry if the tab gets disposed
- item.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- JFaceResources.getFontRegistry().removeListener(propertyChangeListener);
- }
- });
- }
-
- /**
- * Creates a new terminal console tab terminal listener instance.
- *
- * @param item The tab item. Must be not <code>null</code>.
- * @return The terminal listener instance.
- */
- protected ITerminalListener doCreateTerminalTabTerminalListener(CTabItem item) {
- Assert.isNotNull(item);
- return new TabTerminalListener(item);
- }
-
- /**
- * Creates a new terminal console tab dispose listener instance.
- *
- * @param parent The parent terminal console tab folder manager. Must be not <code>null</code>.
- * @return The dispose listener instance.
- */
- protected DisposeListener doCreateTerminalTabDisposeListener(TabFolderManager parent) {
- Assert.isNotNull(parent);
- return new TabDisposeListener(parent);
- }
-
- /**
- * Creates a new terminal console tab property change listener instance.
- *
- * @param item The tab item. Must be not <code>null</code>.
- * @return The property change listener instance.
- */
- protected IPropertyChangeListener doCreateTerminalTabPropertyChangeListener(CTabItem item) {
- Assert.isNotNull(item);
- return new TabPropertyChangeListener(item);
- }
-
- /**
- * Returns the tab item image.
- *
- * @param connector The terminal connector. Must be not <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The tab item image or <code>null</code>.
- */
- protected Image getTabItemImage(ITerminalConnector connector, Object data) {
- Assert.isNotNull(connector);
- return UIPlugin.getImage(ImageConsts.VIEW_Terminals);
- }
-
- /**
- * Lookup a tab item with the given title and the given terminal connector.
- * <p>
- * <b>Note:</b> The method will handle unified tab item titles itself.
- *
- * @param title The tab item title. Must be not <code>null</code>.
- * @param connector The terminal connector. Must be not <code>null</code>.
- * @param data The custom terminal data node or <code>null</code>.
- *
- * @return The corresponding tab item or <code>null</code>.
- */
- public CTabItem findTabItem(String title, ITerminalConnector connector, Object data) {
- Assert.isNotNull(title);
- Assert.isNotNull(connector);
-
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return null;
-
- // Loop all existing tab items and try to find a matching title
- for (CTabItem item : tabFolder.getItems()) {
- // Disposed items cannot be matched
- if (item.isDisposed()) continue;
- // Get the title from the current tab item
- String itemTitle = item.getText();
- // The terminal console state might be signaled to the user via the
- // terminal console tab title. Filter out any prefix "<.*>\s*".
- itemTitle = itemTitle.replaceFirst("^<.*>\\s*", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (itemTitle.startsWith(title)) {
- // The title string matches -> double check with the terminal connector
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- ITerminalConnector connector2 = terminal.getTerminalConnector();
- // If the connector id and name matches -> check on the settings
- if (connector.getId().equals(connector2.getId()) && connector.getName().equals(connector2.getName())) {
- if (!connector.isInitialized()) {
- // an uninitialized connector does not yield a sensible summary
- return item;
- }
- String summary = connector.getSettingsSummary();
- String summary2 = connector2.getSettingsSummary();
- // If we have matching settings -> we've found the matching item
- if (summary.equals(summary2)) return item;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Make the given tab item the active tab and bring the tab to the top.
- *
- * @param item The tab item. Must be not <code>null</code>.
- */
- public void bringToTop(CTabItem item) {
- Assert.isNotNull(item);
-
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return;
-
- // Set the given tab item as selection to the tab folder
- tabFolder.setSelection(item);
- // Fire selection changed event
- fireSelectionChanged();
- }
-
- /**
- * Returns the currently active tab.
- *
- * @return The active tab item or <code>null</code> if none.
- */
- public CTabItem getActiveTabItem() {
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return null;
-
- return tabFolder.getSelection();
- }
-
- /**
- * Remove all terminated tab items.
- */
- public void removeTerminatedItems() {
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) return;
-
- // Loop the items and check for terminated status
- for (CTabItem item: tabFolder.getItems()) {
- // Disposed items cannot be matched
- if (item.isDisposed()) continue;
- // Check if the item is terminated
- if (isTerminatedTabItem(item)) {
- // item is terminated -> dispose
- item.dispose();
- }
- }
- }
-
- /**
- * Checks if the given tab item represents a terminated console. Subclasses may
- * overwrite this method to extend the definition of terminated.
- *
- * @param item The tab item or <code>null</code>.
- * @return <code>True</code> if the tab item represents a terminated console, <code>false</code> otherwise.
- */
- protected boolean isTerminatedTabItem(CTabItem item) {
- // Null items or disposed items cannot be matched
- if (item == null || item.isDisposed()) return false;
-
- // First, match the item title. If it contains "<terminated>", the item can be removed
- String itemTitle = item.getText();
- if (itemTitle != null && itemTitle.contains("<terminated>")) { //$NON-NLS-1$
- return true;
- }
- // Second, check if the associated terminal control is closed
- // The title string matches -> double check with the terminal connector
- ITerminalViewControl terminal = (ITerminalViewControl)item.getData();
- if (terminal != null && terminal.getState() == TerminalState.CLOSED) {
- return true;
- }
-
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- @Override
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- if (listener != null && !selectionChangedListeners.contains(listener)) selectionChangedListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- @Override
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- if (listener != null) selectionChangedListeners.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- @Override
- public ISelection getSelection() {
- CTabItem activeTabItem = getActiveTabItem();
- return activeTabItem != null ? new StructuredSelection(activeTabItem) : new StructuredSelection();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void setSelection(ISelection selection) {
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- // The first selection element which is a CTabItem will become the active item
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (candidate instanceof CTabItem) { bringToTop((CTabItem)candidate); return; }
- }
- }
- // fire a changed event in any case
- fireSelectionChanged(selection);
- }
-
- /**
- * Fire the selection changed event to the registered listeners.
- */
- protected void fireSelectionChanged() {
- fireSelectionChanged(getSelection());
- }
-
- /**
- * Fire the selection changed event to the registered listeners.
- */
- protected final void fireSelectionChanged(ISelection selection) {
- // Create the selection changed event
- SelectionChangedEvent event = new SelectionChangedEvent(TabFolderManager.this, selection);
-
- // First, invoke the registered listeners and let them do their job
- for (ISelectionChangedListener listener : selectionChangedListeners) {
- listener.selectionChanged(event);
- }
-
- // Second, broadcast the event if desired
- if (isBroadcastSelectionChangedEvent()) onBroadcastSelectionChangedEvent(event);
- }
-
- /**
- * Controls if or if not a selection changed event, processed by this tab
- * folder manager shall be broadcasted to via the global Workbench notification
- * mechanism.
- *
- * @return <code>True</code> to broadcast the selection changed event, <code>false</code> otherwise.
- */
- protected boolean isBroadcastSelectionChangedEvent() {
- return false;
- }
-
- /**
- * Broadcasts the given selection changed event via the global Workbench notification mechanism.
- *
- * @param selectionChangedEvent The selection changed event or <code>null</code>.
- */
- protected void onBroadcastSelectionChangedEvent(SelectionChangedEvent selectionChangedEvent) {
- SelectionChangedBroadcastEvent event = doCreateSelectionChangedBroadcastEvent(this, selectionChangedEvent);
- if (event != null) EventManager.getInstance().fireEvent(event);
- }
-
- /**
- * Creates the selection changed broadcast event.
- *
- * @param source The event source. Must not be <code>null</code>.
- * @param selectionChangedEvent The selection changed event or <code>null</code>.
- *
- * @return The selection changed broadcast event or <code>null</code>.
- */
- protected SelectionChangedBroadcastEvent doCreateSelectionChangedBroadcastEvent(TabFolderManager source, SelectionChangedEvent selectionChangedEvent) {
- return new SelectionChangedBroadcastEvent(source, selectionChangedEvent);
- }
-
- /**
- * Returns if or if not this tab folder manager is listening to broadcasted selection
- * changed events. Broadcasted events by the same tab folder manager are ignored independent
- * of the methods return value.
- *
- * @return <code>True</code> to listen to broadcasted selection changed events, <code>false</code> to not listen.
- */
- protected boolean isListeningToBroadcastedSelectionChangedEvent() {
- return false;
- }
-
- /**
- * Creates a new broadcasted selection changed event listener instance.
- *
- * @param parent The parent tab folder manager. Must not be <code>null</code>.
- * @return The event listener instance or <code>null</code>.
- */
- protected BroadcastedSelectionChangedEventListener doCreateBroadcastedSelectionChangedEventListener(TabFolderManager parent) {
- return new BroadcastedSelectionChangedEventListener(parent);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderMenuHandler.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderMenuHandler.java
deleted file mode 100644
index 0d1bbe8a9..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderMenuHandler.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.action.IMenuListener2;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll;
-import org.eclipse.tm.te.ui.terminals.actions.TabScrollLockAction;
-import org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-/**
- * Terminals tab folder menu handler.
- */
-@SuppressWarnings("restriction")
-public class TabFolderMenuHandler extends PlatformObject {
- // Reference to the parent terminal console view
- private final ITerminalsView parentView;
- // Reference to the tab folder context menu manager
- private MenuManager contextMenuManager;
- // Reference to the tab folder context menu
- private Menu contextMenu;
- // The list of actions available within the context menu
- private final List<AbstractTerminalAction> contextMenuActions = new ArrayList<AbstractTerminalAction>();
-
- /**
- * Default menu listener implementation.
- */
- protected class MenuListener implements IMenuListener2 {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuListener2#menuAboutToHide(org.eclipse.jface.action.IMenuManager)
- */
- @Override
- public void menuAboutToHide(IMenuManager manager) {
- // CQ:WIND00192293 and CQ:WIND194204 - don't update actions on menuAboutToHide
- // See also http://bugs.eclipse.org/296212
- // updateMenuItems(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- updateMenuItems(true);
- }
-
- }
-
- /**
- * Constructor.
- *
- * @param parentView The parent terminal console view. Must not be <code>null</code>.
- */
- public TabFolderMenuHandler(ITerminalsView parentView) {
- super();
- Assert.isNotNull(parentView);
- this.parentView = parentView;
- }
-
- /**
- * Returns the parent terminal console view.
- *
- * @return The parent terminal console view instance.
- */
- protected final ITerminalsView getParentView() {
- return parentView;
- }
-
- /**
- * Returns the tab folder associated with the parent view.
- *
- * @return The tab folder or <code>null</code>.
- */
- protected final CTabFolder getTabFolder() {
- return (CTabFolder)getParentView().getAdapter(CTabFolder.class);
- }
-
- /**
- * Dispose the tab folder menu handler instance.
- */
- public void dispose() {
- // Dispose the context menu
- if (contextMenu != null) { contextMenu.dispose(); contextMenu = null; }
- // Dispose the context menu manager
- if (contextMenuManager != null) { contextMenuManager.dispose(); contextMenuManager = null; }
- // Clear all actions
- contextMenuActions.clear();
- }
-
- /**
- * Setup the context menu for the tab folder. The method will return
- * immediately if the menu handler had been initialized before.
- *
- * @param tabFolder The tab folder control. Must not be <code>null</code>.
- */
- public void initialize() {
- // Return immediately if the menu manager and menu got initialized already
- if (contextMenuManager != null && contextMenu != null) {
- return;
- }
-
- // Get the tab folder
- CTabFolder tabFolder = getTabFolder();
- if (tabFolder == null) {
- return;
- }
-
- // Create the menu manager if not done before
- contextMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- // Create and associated the menu listener
- contextMenuManager.addMenuListener(new MenuListener());
- // Create the context menu
- contextMenu = contextMenuManager.createContextMenu(tabFolder);
-
- // Create the context menu action instances
- doCreateContextMenuActions();
-
- // Fill the context menu
- doFillContextMenu(contextMenuManager);
-
- // Register to the view site to open the menu for contributions
- getParentView().getSite().registerContextMenu(contextMenuManager, getParentView().getSite().getSelectionProvider());
- }
-
- /**
- * Adds the given action to the context menu actions list.
- *
- * @param action The action instance. Must be not <code>null</code>.
- */
- protected final void add(AbstractTerminalAction action) {
- Assert.isNotNull(action);
- contextMenuActions.add(action);
- }
-
- /**
- * Create the context menu actions.
- */
- protected void doCreateContextMenuActions() {
- // Create and add the copy action
- add(new TerminalActionCopy() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the paste action
- add(new TerminalActionPaste() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the clear all action
- add(new TerminalActionClearAll() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the select all action
- add(new TerminalActionSelectAll() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the scroll lock action
- add (new TabScrollLockAction() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
- }
-
- /**
- * Returns the currently active terminal control.
- *
- * @return The currently active terminal control or <code>null</code>.
- */
- protected ITerminalViewControl getActiveTerminalViewControl() {
- ITerminalViewControl terminal = null;
-
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null) {
- terminal = (ITerminalViewControl)activeTabItem.getData();
- }
- }
-
- return terminal;
- }
-
- /**
- * Fill in the context menu content within the given manager.
- *
- * @param manager The menu manager. Must not be <code>null</code>.
- */
- protected void doFillContextMenu(MenuManager manager) {
- Assert.isNotNull(manager);
-
- // Loop all actions and add them to the menu manager
- for (AbstractTerminalAction action : contextMenuActions) {
- manager.add(action);
- // Add a separator after the paste action
- if (action instanceof TerminalActionPaste) {
- manager.add(new Separator());
- }
- // Add a separator after the select all action
- if (action instanceof TerminalActionSelectAll) {
- manager.add(new Separator());
- }
- }
-
- // Menu contributions will end up here
- manager.add(new Separator());
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /**
- * Update the context menu items on showing or hiding the context menu.
- *
- * @param aboutToShow <code>True</code> if the menu is about to show, <code>false</code> otherwise.
- */
- protected void updateMenuItems(boolean aboutToShow) {
- // Loop all actions and update the status
- for (AbstractTerminalAction action : contextMenuActions) {
- action.updateAction(aboutToShow);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (MenuManager.class.isAssignableFrom(adapter)) {
- return contextMenuManager;
- } else if (Menu.class.isAssignableFrom(adapter)) {
- return contextMenu;
- }
-
- // Try the parent view
- Object adapted = getParentView().getAdapter(adapter);
- if (adapted != null) {
- return adapted;
- }
-
- return super.getAdapter(adapter);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderSelectionListener.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderSelectionListener.java
deleted file mode 100644
index de25ec3ea..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderSelectionListener.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-
-/**
- * Terminals tab folder default selection listener implementation.
- */
-public class TabFolderSelectionListener implements SelectionListener {
- private final TabFolderManager parentTabFolderManager;
-
- /**
- * Constructor.
- *
- * @param parentTabFolderManager The parent tab folder manager. Must be not <code>null</code>
- */
- public TabFolderSelectionListener(TabFolderManager parentTabFolderManager) {
- Assert.isNotNull(parentTabFolderManager);
- this.parentTabFolderManager = parentTabFolderManager;
- }
-
- /**
- * Returns the parent terminal console tab folder manager instance.
- *
- * @return The parent terminal console tab folder manager instance.
- */
- protected final TabFolderManager getParentTabFolderManager() {
- return parentTabFolderManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- parentTabFolderManager.fireSelectionChanged();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderToolbarHandler.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderToolbarHandler.java
deleted file mode 100644
index a291f00f8..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabFolderToolbarHandler.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
-import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
-import org.eclipse.tm.te.ui.terminals.actions.AbstractAction;
-import org.eclipse.tm.te.ui.terminals.actions.TabScrollLockAction;
-import org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-
-/**
- * Terminals tab folder toolbar handler.
- */
-@SuppressWarnings("restriction")
-public class TabFolderToolbarHandler extends PlatformObject {
- // Reference to the parent terminal console view
- private final ITerminalsView parentView;
- // Reference to the toolbar manager
- private IToolBarManager toolbarManager;
- // Reference to the selection listener
- private ToolbarSelectionChangedListener selectionChangedListener;
- // The list of actions available within the toolbar
- private final List<AbstractTerminalAction> toolbarActions = new ArrayList<AbstractTerminalAction>();
-
- /**
- * Default selection listener implementation.
- */
- protected class ToolbarSelectionChangedListener implements ISelectionChangedListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- boolean enable = event != null;
-
- // The VlmConsoleTabFolderManager is listening to the selection changes of the
- // TabFolder and fires selection changed events.
- if (enable && event.getSource() instanceof TabFolderManager) {
- enable = event.getSelection() instanceof StructuredSelection
- && !event.getSelection().isEmpty()
- && (((StructuredSelection)event.getSelection()).getFirstElement() instanceof CTabItem
- || ((StructuredSelection)event.getSelection()).getFirstElement() instanceof String);
- }
-
- updateToolbarItems(enable);
- }
- }
-
- /**
- * Constructor.
- *
- * @param parentView The parent terminal console view. Must not be <code>null</code>.
- */
- public TabFolderToolbarHandler(ITerminalsView parentView) {
- super();
- Assert.isNotNull(parentView);
- this.parentView = parentView;
- }
-
- /**
- * Returns the parent terminal console view.
- *
- * @return The terminal console view instance.
- */
- protected final ITerminalsView getParentView() {
- return parentView;
- }
-
- /**
- * Returns the tab folder associated with the parent view.
- *
- * @return The tab folder or <code>null</code>.
- */
- protected final CTabFolder getTabFolder() {
- return (CTabFolder)getParentView().getAdapter(CTabFolder.class);
- }
-
- /**
- * Returns the currently active terminal control.
- *
- * @return The currently active terminal control or <code>null</code>.
- */
- public ITerminalViewControl getActiveTerminalViewControl() {
- ITerminalViewControl terminal = null;
-
- // Get the active tab item from the tab folder manager
- TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class);
- if (manager != null) {
- // If we have the active tab item, we can get the active terminal control
- CTabItem activeTabItem = manager.getActiveTabItem();
- if (activeTabItem != null && !activeTabItem.isDisposed()) {
- terminal = (ITerminalViewControl)activeTabItem.getData();
- }
- }
-
- return terminal;
- }
-
- /**
- * Dispose the tab folder menu handler instance.
- */
- public void dispose() {
- // Dispose the selection changed listener
- if (selectionChangedListener != null) {
- getParentView().getViewSite().getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
- selectionChangedListener = null;
- }
-
- // Clear all actions
- toolbarActions.clear();
- }
-
- /**
- * Setup the context menu for the tab folder. The method will return
- * immediately if the toolbar handler had been initialized before.
- *
- * @param tabFolder The tab folder control. Must not be <code>null</code>.
- */
- public void initialize() {
- // Return immediately if the toolbar manager got initialized already
- if (toolbarManager != null) {
- return;
- }
-
- // Register ourself as selection listener to the tab folder
- selectionChangedListener = doCreateSelectionChangedListener();
- Assert.isNotNull(selectionChangedListener);
- getParentView().getViewSite().getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
-
- // Get the parent view action bars
- IActionBars bars = getParentView().getViewSite().getActionBars();
-
- // From the action bars, get the toolbar manager
- toolbarManager = bars.getToolBarManager();
-
- // Create the toolbar action instances
- doCreateToolbarActions();
-
- // Fill the toolbar
- doFillToolbar(toolbarManager);
-
- // Update actions
- updateToolbarItems(false);
- }
-
- /**
- * Creates a new selection changed listener instance.
- *
- * @return The new selection changed listener instance.
- */
- protected ToolbarSelectionChangedListener doCreateSelectionChangedListener() {
- return new ToolbarSelectionChangedListener();
- }
-
- /**
- * Adds the given action to the toolbar actions list.
- *
- * @param action The action instance. Must be not <code>null</code>.
- */
- protected final void add(AbstractTerminalAction action) {
- Assert.isNotNull(action);
- toolbarActions.add(action);
- }
-
- /**
- * Create the toolbar actions.
- */
- protected void doCreateToolbarActions() {
- // Create and add the paste action
- add(new TerminalActionPaste() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the copy action
- add(new TerminalActionCopy() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the scroll lock action
- add (new TabScrollLockAction() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
-
- // Create and add the clear all action
- add(new TerminalActionClearAll() {
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
- */
- @Override
- protected ITerminalViewControl getTarget() {
- return getActiveTerminalViewControl();
- }
- });
- }
-
- /**
- * Fill in the context menu content within the given manager.
- *
- * @param manager The menu manager. Must not be <code>null</code>.
- */
- protected void doFillToolbar(IToolBarManager manager) {
- Assert.isNotNull(manager);
-
- // Note: For the toolbar, the actions are added from left to right!
- // So we start with the additions marker here which is the most
- // left contribution item.
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(new Separator("anchor")); //$NON-NLS-1$
-
- // Loop all actions and add them to the menu manager
- for (AbstractTerminalAction action : toolbarActions) {
- // Add a separator before the clear all action or if the action is a separator
- if (action instanceof TabScrollLockAction
- || (action instanceof AbstractAction && ((AbstractAction)action).isSeparator())) {
- manager.insertAfter("anchor", new Separator()); //$NON-NLS-1$
- }
- // Add the action itself
- manager.insertAfter("anchor", action); //$NON-NLS-1$
- }
- }
-
- /**
- * Update the toolbar items.
- *
- * @param enabled <code>True</code> if the items shall be enabled, <code>false</code> otherwise.
- */
- protected void updateToolbarItems(boolean enabled) {
- // Determine the currently active terminal control
- ITerminalViewControl control = getActiveTerminalViewControl();
- // Loop all actions and update the status
- for (AbstractTerminalAction action : toolbarActions) {
- // If the terminal control is not available, the updateAction
- // method of certain actions enable the action (bugzilla #260372).
- // Workaround by forcing the action to get disabled with setEnabled.
- if (control == null) {
- action.setEnabled(false);
- }
- else {
- action.updateAction(enabled);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (IToolBarManager.class.isAssignableFrom(adapter)) {
- return toolbarManager;
- }
- // Try the parent view
- Object adapted = getParentView().getAdapter(adapter);
- if (adapted != null) {
- return adapted;
- }
-
- return super.getAdapter(adapter);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabPropertyChangeListener.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabPropertyChangeListener.java
deleted file mode 100644
index b84b8ee83..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabPropertyChangeListener.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
-import org.eclipse.tm.internal.terminal.view.TerminalView;
-
-/**
- * Terminals tab default property change listener implementation.
- */
-@SuppressWarnings("restriction")
-public class TabPropertyChangeListener implements IPropertyChangeListener {
- /**
- * Default terminal font property key.
- *
- * @see TerminalView#FONT_DEFINITION
- */
- public static final String FONT_DEFINITION = "terminal.views.view.font.definition"; //$NON-NLS-1$
-
- // Reference to the parent tab item
- private final CTabItem tabItem;
-
- /**
- * Constructor.
- *
- * @param tabItem The parent tab item. Must not be <code>null</code>.
- */
- public TabPropertyChangeListener(CTabItem tabItem) {
- super();
- Assert.isNotNull(tabItem);
- this.tabItem = tabItem;
- }
-
- /**
- * Returns the associated parent tab item.
- *
- * @return The parent tab item.
- */
- protected final CTabItem getTabItem() {
- return tabItem;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- // In case we are called once after the tab item got disposed
- // --> Do nothing
- if (getTabItem() == null || getTabItem().isDisposed()) return;
-
- // Listen to changes of the Font settings
- if (event.getProperty().equals(FONT_DEFINITION)) {
- onFontDefinitionProperyChanged();
- }
- }
-
- /**
- * Called if a property change event for the terminal font
- * definition is received.
- */
- protected void onFontDefinitionProperyChanged() {
- // Get the current font from JFace
- Font font = JFaceResources.getFont(FONT_DEFINITION);
- // Get the terminal control from the tab item
- if (getTabItem().getData() instanceof ITerminalViewControl) {
- ITerminalViewControl terminal = (ITerminalViewControl)getTabItem().getData();
- terminal.setFont(font);
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabTerminalListener.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabTerminalListener.java
deleted file mode 100644
index 0ffa15d5e..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/tabs/TabTerminalListener.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.tabs;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tm.internal.terminal.control.ITerminalListener;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.tm.te.ui.terminals.nls.Messages;
-
-/**
- * Terminals tab default terminal listener implementation.
- */
-@SuppressWarnings("restriction")
-public class TabTerminalListener implements ITerminalListener {
- private final CTabItem tabItem;
-
- /**
- * Constructor.
- *
- * @param tabItem The parent tab item. Must not be <code>null</code>.
- */
- public TabTerminalListener(CTabItem tabItem) {
- super();
- Assert.isNotNull(tabItem);
- this.tabItem = tabItem;
- }
-
- /**
- * Returns the associated parent tab item.
- *
- * @return The parent tab item.
- */
- protected final CTabItem getTabItem() {
- return tabItem;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.ITerminalListener#setState(org.eclipse.tm.internal.terminal.provisional.api.TerminalState)
- */
- @Override
- public void setState(final TerminalState state) {
- // The tab item must have been not yet disposed
- final CTabItem item = getTabItem();
- if (item == null || item.isDisposed()) return;
-
- // Update the tab item title
- item.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- String newTitle = getTerminalConsoleTabTitle(state);
- if (newTitle != null) item.setText(newTitle);
- }
- });
- }
-
- // The pattern will not change over the session life-time
- private static final Pattern TERMINAL_TITLE_TERMINATED_PATTERN = Pattern.compile(Messages.TabTerminalListener_consoleTerminated.replaceAll("\\{[0-9]+\\}", ".*")); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Returns the title to set to the terminal console tab for the given state.
- * <p>
- * <b>Note:</b> This method is called from {@link #setState(TerminalState)} and
- * is expected to by called within the UI thread.
- *
- * @param state The terminal state. Must be not <code>null</code>.
- * @return The terminal console tab title to set or <code>null</code> to leave the title unchanged.
- */
- protected String getTerminalConsoleTabTitle(TerminalState state) {
- Assert.isNotNull(state);
- Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
-
- // The tab item must have been not yet disposed
- CTabItem item = getTabItem();
- if (item == null || item.isDisposed()) return null;
-
- // Get the current tab title
- String oldTitle = item.getText();
-
- // Construct the new title
- String newTitle = null;
-
- if (TerminalState.CLOSED.equals(state)) {
- // Avoid multiple decorations of the closed state
- if (!TERMINAL_TITLE_TERMINATED_PATTERN.matcher(oldTitle).matches()) {
- newTitle = NLS.bind(Messages.TabTerminalListener_consoleTerminated, oldTitle);
- } else {
- newTitle = oldTitle;
- }
- }
-
- return newTitle != null && !newTitle.equals(oldTitle) ? newTitle : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.internal.terminal.control.ITerminalListener#setTerminalTitle(java.lang.String)
- */
- @Override
- public void setTerminalTitle(String title) {
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/AbstractConnectorType.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/AbstractConnectorType.java
deleted file mode 100644
index fef945f7d..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/AbstractConnectorType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.types;
-
-import org.eclipse.tm.te.runtime.extensions.ExecutableExtension;
-import org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType;
-
-/**
- * Abstract terminal connector type implementation.
- */
-public abstract class AbstractConnectorType extends ExecutableExtension implements IConnectorType {
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java
deleted file mode 100644
index 9b4cebe35..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/ConnectorManager.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.types;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager;
-import org.eclipse.tm.te.runtime.extensions.ExecutableExtensionProxy;
-import org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType;
-
-/**
- * Terminal connector type extension point manager implementation.
- */
-public class ConnectorManager extends AbstractExtensionPointManager<IConnectorType> {
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static ConnectorManager instance = new ConnectorManager();
- }
-
- /**
- * Returns the singleton instance for the terminal connector type extension point manager.
- */
- public static ConnectorManager getInstance() {
- return LazyInstanceHolder.instance;
- }
-
- /**
- * Constructor.
- */
- ConnectorManager() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
- */
- @Override
- protected String getExtensionPointId() {
- return "org.eclipse.tm.te.ui.terminals.connectorTypes"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName()
- */
- @Override
- protected String getConfigurationElementName() {
- return "connectorType"; //$NON-NLS-1$
- }
-
- /**
- * Returns the list of all contributed terminal connector types.
- *
- * @param unique If <code>true</code>, the method returns new instances for each
- * contributed terminal connector type.
- *
- * @return The list of contributed terminal connector types, or an empty array.
- */
- public IConnectorType[] getConnectorTypes(boolean unique) {
- List<IConnectorType> contributions = new ArrayList<IConnectorType>();
- Collection<ExecutableExtensionProxy<IConnectorType>> connectorTypes = getExtensions().values();
- for (ExecutableExtensionProxy<IConnectorType> connectorType : connectorTypes) {
- IConnectorType instance = unique ? connectorType.newInstance() : connectorType.getInstance();
- if (instance != null && !contributions.contains(instance)) {
- contributions.add(instance);
- }
- }
-
- return contributions.toArray(new IConnectorType[contributions.size()]);
- }
-
- /**
- * Returns the terminal connector type identified by its unique id. If no terminal
- * connector type with the specified id is registered, <code>null</code> is returned.
- *
- * @param id The unique id of the terminal connector type or <code>null</code>
- * @param unique If <code>true</code>, the method returns new instances of the terminal connector type contribution.
- *
- * @return The terminal connector type instance or <code>null</code>.
- */
- public IConnectorType getConnectorType(String id, boolean unique) {
- IConnectorType contribution = null;
- if (getExtensions().containsKey(id)) {
- ExecutableExtensionProxy<IConnectorType> proxy = getExtensions().get(id);
- // Get the extension instance
- contribution = unique ? proxy.newInstance() : proxy.getInstance();
- }
-
- return contribution;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/StreamsConnectorType.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/StreamsConnectorType.java
deleted file mode 100644
index 5fbf1af74..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/StreamsConnectorType.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.types;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tm.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tm.te.ui.terminals.internal.SettingsStore;
-import org.eclipse.tm.te.ui.terminals.streams.StreamsSettings;
-
-/**
- * Streams terminal connector type implementation.
- */
-@SuppressWarnings("restriction")
-public class StreamsConnectorType extends AbstractConnectorType {
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
- if (connectorId == null) connectorId = "org.eclipse.tm.te.ui.terminals.StreamsConnector"; //$NON-NLS-1$
-
- // Extract the streams properties
- OutputStream stdin = (OutputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDIN);
- InputStream stdout = (InputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT);
- InputStream stderr = (InputStream)properties.getProperty(ITerminalsConnectorConstants.PROP_STREAMS_STDERR);
- boolean localEcho = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
- String lineSeparator = properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the streams settings
- StreamsSettings streamsSettings = new StreamsSettings();
- streamsSettings.setStdinStream(stdin);
- streamsSettings.setStdoutStream(stdout);
- streamsSettings.setStderrStream(stderr);
- streamsSettings.setLocalEcho(localEcho);
- streamsSettings.setLineSeparator(lineSeparator);
- // And save the settings to the store
- streamsSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/TelnetConnectorType.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/TelnetConnectorType.java
deleted file mode 100644
index e1eee24e8..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/types/TelnetConnectorType.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.types;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
-import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
-import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
-import org.eclipse.tm.internal.terminal.telnet.TelnetSettings;
-import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tm.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tm.te.ui.terminals.internal.SettingsStore;
-
-/**
- * Telnet terminal connector type implementation.
- */
-@SuppressWarnings("restriction")
-public class TelnetConnectorType extends AbstractConnectorType {
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer)
- */
- @Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
- Assert.isNotNull(properties);
-
- // Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
-
- // Extract the telnet properties
- String host = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
- String port = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_PORT);
- String timeout = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TIMEOUT);
-
- int portOffset = 0;
- if (properties.getProperty(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) != null) {
- portOffset = properties.getIntProperty(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET);
- if (portOffset < 0) portOffset = 0;
- }
-
- return host != null && port != null ? createTelnetConnector(connectorId, new String[] { host, port, timeout }, portOffset) : null;
- }
-
- /**
- * Creates a terminal connector object based on the given telnet server attributes.
- * <p>
- * The telnet server attributes must contain at least 2 elements:
- * <ul>
- * <li>attributes[0] --> telnet server host name</li>
- * <li>attributes[1] --> telnet port</li>
- * <li>attributes[2] --> timeout (optional)</li>
- * </ul>
- *
- * @param connectorId The terminal connector id or <code>null</code>.
- * @param attributes The telnet server attributes. Must not be <code>null</code> and must have at least two elements.
- * @param portOffset Offset to add to the port.
- *
- * @return The terminal connector object instance or <code>null</code>.
- */
- protected ITerminalConnector createTelnetConnector(String connectorId, String[] attributes, int portOffset) {
- Assert.isNotNull(attributes);
- Assert.isTrue(attributes.length >= 2);
-
- if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"; //$NON-NLS-1$
-
- final String serverName = attributes[0];
- final String serverPort = Integer.toString(Integer.decode(attributes[1]).intValue() + portOffset);
- final String timeout = attributes.length >= 3 ? attributes[2] : null;
-
- // Construct the terminal settings store
- ISettingsStore store = new SettingsStore();
-
- // Construct the telnet settings
- TelnetSettings telnetSettings = new TelnetSettings();
- telnetSettings.setHost(serverName);
- telnetSettings.setNetworkPort(serverPort);
- if (timeout != null) {
- telnetSettings.setTimeout(timeout);
- }
- // And save the settings to the store
- telnetSettings.save(store);
-
- // Construct the terminal connector instance
- ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId);
- if (connector != null) {
- // Apply default settings
- connector.makeSettingsPage();
- // And load the real settings
- connector.load(store);
- }
-
- return connector;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/view/TerminalsView.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/view/TerminalsView.java
deleted file mode 100644
index 29445d972..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/view/TerminalsView.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.te.ui.terminals.view;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderManager;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderMenuHandler;
-import org.eclipse.tm.te.ui.terminals.tabs.TabFolderToolbarHandler;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * Terminals view.
- */
-public class TerminalsView extends ViewPart implements ITerminalsView {
-
- // Reference to the main page book control
- private PageBook pageBookControl;
- // Reference to the tab folder maintaining the consoles
- private CTabFolder tabFolderControl;
- // Reference to the tab folder manager
- private TabFolderManager tabFolderManager;
- // Reference to the tab folder menu handler
- private TabFolderMenuHandler tabFolderMenuHandler;
- // Reference to the tab folder toolbar handler
- private TabFolderToolbarHandler tabFolderToolbarHandler;
- // Reference to the empty page control (to be show if no console is open)
- private Control emptyPageControl;
-
- /**
- * Constructor.
- */
- public TerminalsView() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- */
- @Override
- public void dispose() {
- // Dispose the tab folder manager
- if (tabFolderManager != null) { tabFolderManager.dispose(); tabFolderManager = null; }
- // Dispose the tab folder menu handler
- if (tabFolderMenuHandler != null) { tabFolderMenuHandler.dispose(); tabFolderMenuHandler = null; }
- // Dispose the tab folder toolbar handler
- if (tabFolderToolbarHandler != null) { tabFolderToolbarHandler.dispose(); tabFolderToolbarHandler = null; }
-
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createPartControl(Composite parent) {
- // Create the page book control
- pageBookControl = doCreatePageBookControl(parent);
- Assert.isNotNull(pageBookControl);
- // Configure the page book control
- doConfigurePageBookControl(pageBookControl);
-
- // Create the empty page control
- emptyPageControl = doCreateEmptyPageControl(pageBookControl);
- Assert.isNotNull(emptyPageControl);
- // Configure the empty page control
- doConfigureEmptyPageControl(emptyPageControl);
-
- // Create the tab folder control (empty)
- tabFolderControl = doCreateTabFolderControl(pageBookControl);
- Assert.isNotNull(tabFolderControl);
- // Configure the tab folder control
- doConfigureTabFolderControl(tabFolderControl);
-
- // Create the tab folder manager
- tabFolderManager = doCreateTabFolderManager(this);
- Assert.isNotNull(tabFolderManager);
- // Set the tab folder manager as the selection provider
- getSite().setSelectionProvider(tabFolderManager);
-
- // Setup the tab folder menu handler
- tabFolderMenuHandler = doCreateTabFolderMenuHandler(this);
- Assert.isNotNull(tabFolderMenuHandler);
- doConfigureTabFolderMenuHandler(tabFolderMenuHandler);
-
- // Setup the tab folder toolbar handler
- tabFolderToolbarHandler = doCreateTabFolderToolbarHandler(this);
- Assert.isNotNull(tabFolderToolbarHandler);
- doConfigureTabFolderToolbarHandler(tabFolderToolbarHandler);
-
- // Show the empty page control by default
- switchToEmptyPageControl();
- }
-
- /**
- * Creates the {@link PageBook} instance.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @return The page book instance. Must never be <code>null</code>.
- */
- protected PageBook doCreatePageBookControl(Composite parent) {
- return new PageBook(parent, SWT.NONE);
- }
-
- /**
- * Configure the given page book control.
- *
- * @param pagebook The page book control. Must not be <code>null</code>.
- */
- protected void doConfigurePageBookControl(PageBook pagebook) {
- Assert.isNotNull(pagebook);
-
- if (getContextHelpId() != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pagebook, getContextHelpId());
- }
-
- /**
- * Returns the context help id associated with the terminal console view instance.
- * <p>
- * <b>Note:</b> The default implementation returns the view id as context help id.
- *
- * @return The context help id or <code>null</code> if none is associated.
- */
- @Override
- public String getContextHelpId() {
- return getViewSite().getId();
- }
-
- /**
- * Creates the empty page control instance.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @return The empty page control instance. Must never be <code>null</code>.
- */
- protected Control doCreateEmptyPageControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
- /**
- * Configures the empty page control.
- *
- * @param control The empty page control. Must not be <code>null</code>.
- */
- protected void doConfigureEmptyPageControl(Control control) {
- Assert.isNotNull(control);
- }
-
- /**
- * Creates the tab folder control instance.
- *
- * @param parent The parent composite. Must not be <code>null</code>.
- * @return The tab folder control instance. Must never be <code>null</code>.
- */
- protected CTabFolder doCreateTabFolderControl(Composite parent) {
- return new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT | SWT.BORDER);
- }
-
- /**
- * Configures the tab folder control.
- *
- * @param tabFolder The tab folder control. Must not be <code>null</code>.
- */
- protected void doConfigureTabFolderControl(CTabFolder tabFolder) {
- Assert.isNotNull(tabFolder);
-
- // Set the layout data
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Set the tab gradient coloring from the global preferences
- if (useGradientTabBackgroundColor()) {
- tabFolder.setSelectionBackground(new Color[] {
- JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$
- JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END") //$NON-NLS-1$
- },
- new int[] {100}, true);
- }
- // Apply the tab folder selection foreground color
- tabFolder.setSelectionForeground(JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
-
- // Set the tab style from the global preferences
- tabFolder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
- }
-
- /**
- * If <code>True</code> is returned, the inner tabs are colored with
- * gradient coloring set in the Eclipse workbench color settings.
- *
- * @return <code>True</code> to use gradient tab colors, <code>false</code> otherwise.
- */
- protected boolean useGradientTabBackgroundColor() {
- return false;
- }
-
- /**
- * Creates the tab folder manager.
- *
- * @param parentView The parent view instance. Must be not <code>null</code>.
- * @return The tab folder manager. Must never be <code>null</code>.
- */
- protected TabFolderManager doCreateTabFolderManager(ITerminalsView parentView) {
- Assert.isNotNull(parentView);
- return new TabFolderManager(parentView);
- }
-
- /**
- * Creates the tab folder menu handler.
- *
- * @param parentView The parent view instance. Must be not <code>null</code>.
- * @return The tab folder menu handler. Must never be <code>null</code>.
- */
- protected TabFolderMenuHandler doCreateTabFolderMenuHandler(ITerminalsView parentView) {
- Assert.isNotNull(parentView);
- return new TabFolderMenuHandler(parentView);
- }
-
- /**
- * Configure the tab folder menu handler
- *
- * @param menuHandler The tab folder menu handler. Must not be <code>null</code>.
- */
- protected void doConfigureTabFolderMenuHandler(TabFolderMenuHandler menuHandler) {
- Assert.isNotNull(menuHandler);
- menuHandler.initialize();
- }
-
- /**
- * Creates the tab folder toolbar handler.
- *
- * @param parentView The parent view instance. Must be not <code>null</code>.
- * @return The tab folder toolbar handler. Must never be <code>null</code>.
- */
- protected TabFolderToolbarHandler doCreateTabFolderToolbarHandler(ITerminalsView parentView) {
- Assert.isNotNull(parentView);
- return new TabFolderToolbarHandler(parentView);
- }
-
- /**
- * Configure the tab folder toolbar handler
- *
- * @param toolbarHandler The tab folder toolbar handler. Must not be <code>null</code>.
- */
- protected void doConfigureTabFolderToolbarHandler(TabFolderToolbarHandler toolbarHandler) {
- Assert.isNotNull(toolbarHandler);
- toolbarHandler.initialize();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
- @Override
- public void setFocus() {
- pageBookControl.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView#switchToEmptyPageControl()
- */
- @Override
- public void switchToEmptyPageControl() {
- if (!pageBookControl.isDisposed() && !emptyPageControl.isDisposed()) pageBookControl.showPage(emptyPageControl);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView#switchToTabFolderControl()
- */
- @Override
- public void switchToTabFolderControl() {
- if (!pageBookControl.isDisposed() && !tabFolderControl.isDisposed()) pageBookControl.showPage(tabFolderControl);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- if (CTabFolder.class.isAssignableFrom(adapter)) {
- return tabFolderControl;
- } else if (TabFolderManager.class.isAssignableFrom(adapter)) {
- return tabFolderManager;
- } else if (TabFolderMenuHandler.class.isAssignableFrom(adapter)) {
- return tabFolderMenuHandler;
- } else if (TabFolderToolbarHandler.class.isAssignableFrom(adapter)) {
- return tabFolderToolbarHandler;
- }
-
- return super.getAdapter(adapter);
- }
-}

Back to the top