mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Bug 488959 - TerminalConsole toolbar extensibility.
Allow other plugins to contribute Actions to TerminalConsole toolbar. Upversion the console plug-ins to 1.1 for the new APIs. Change-Id: Ife6f54e0d294f766dff2a88841b6807b259fad1d Signed-off-by: Jonathan Williams <jonwilliams@qnx.com>
This commit is contained in:
parent
a59238ffeb
commit
7a3f956c90
16 changed files with 302 additions and 27 deletions
|
@ -20,9 +20,15 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -2,13 +2,14 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.remote.console;singleton:=true
|
Bundle-SymbolicName: org.eclipse.remote.console;singleton:=true
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.1.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.remote.internal.console.Activator
|
Bundle-Activator: org.eclipse.remote.internal.console.Activator
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Vendor: %pluginProvider
|
Bundle-Vendor: %pluginProvider
|
||||||
Export-Package: org.eclipse.remote.console
|
Export-Package: org.eclipse.remote.console,
|
||||||
|
org.eclipse.remote.console.actions
|
||||||
Import-Package: org.eclipse.core.commands,
|
Import-Package: org.eclipse.core.commands,
|
||||||
org.eclipse.core.runtime,
|
org.eclipse.core.runtime,
|
||||||
org.eclipse.core.runtime.jobs,
|
org.eclipse.core.runtime.jobs,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?eclipse version="3.4"?>
|
<?eclipse version="3.4"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<extension-point id="org.eclipse.remote.console.toolbar" name="org.eclipse.remote.console.toolbar" schema="schema/consoleToolbar.exsd"/>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.console.consoleFactories">
|
point="org.eclipse.ui.console.consoleFactories">
|
||||||
<consoleFactory
|
<consoleFactory
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>org.eclipse.remote.console</artifactId>
|
<artifactId>org.eclipse.remote.console</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
116
bundles/org.eclipse.remote.console/schema/consoleToolbar.exsd
Normal file
116
bundles/org.eclipse.remote.console/schema/consoleToolbar.exsd
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.remote.console" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.schema plugin="org.eclipse.remote.console" id="org.eclipse.remote.console.toolbar" name="Terminal Console Toolbar Contributions"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter description of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.element />
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element ref="action" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="action">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Identifier for this action
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="connectionType" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
The connection type this Action applies to
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="actionFactory" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
A class implementing IConsoleActionFactory to be called to create the Action
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.remote.console.actions.IConsoleActionFactory"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter the first release in which this extension point appears.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter extension point usage example here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter API information here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
|
||||||
|
</schema>
|
|
@ -17,13 +17,15 @@ import org.eclipse.remote.internal.console.TerminalConsoleFactory;
|
||||||
import org.eclipse.ui.console.IConsole;
|
import org.eclipse.ui.console.IConsole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of public API utility methods to open
|
* A collection of public API utility methods to open consoles to
|
||||||
* consoles to IRemoteConnection objects
|
* IRemoteConnection objects
|
||||||
|
*
|
||||||
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public class TerminalConsoleUtility {
|
public class TerminalConsoleUtility {
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to allow selection of an IRemoteConnection,
|
* Opens a dialog to allow selection of an IRemoteConnection, encoding, etc.
|
||||||
* encoding, etc. and then open a console to it.
|
* and then open a console to it.
|
||||||
*/
|
*/
|
||||||
public void openConsole() {
|
public void openConsole() {
|
||||||
new TerminalConsoleFactory().openConsole();
|
new TerminalConsoleFactory().openConsole();
|
||||||
|
|
|
@ -8,13 +8,16 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.remote.internal.console.actions;
|
package org.eclipse.remote.console.actions;
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.resource.ImageRegistry;
|
import org.eclipse.jface.resource.ImageRegistry;
|
||||||
import org.eclipse.remote.internal.console.Activator;
|
import org.eclipse.remote.internal.console.Activator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
public abstract class ConsoleAction extends Action {
|
public abstract class ConsoleAction extends Action {
|
||||||
public ConsoleAction(String id) {
|
public ConsoleAction(String id) {
|
||||||
this(id, 0);
|
this(id, 0);
|
||||||
|
@ -25,27 +28,20 @@ public abstract class ConsoleAction extends Action {
|
||||||
setId(id);
|
setId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupAction(String text, String tooltip,
|
protected void setupAction(String text, String tooltip, String image, String enabledImage, String disabledImage,
|
||||||
String image, String enabledImage, String disabledImage,
|
|
||||||
boolean enabled) {
|
boolean enabled) {
|
||||||
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
|
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
|
||||||
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
|
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupAction(String text, String tooltip,
|
protected void setupAction(String text, String tooltip, String hoverImage, String enabledImage,
|
||||||
String hoverImage, String enabledImage, String disabledImage,
|
String disabledImage, boolean enabled, ImageRegistry imageRegistry) {
|
||||||
boolean enabled, ImageRegistry imageRegistry) {
|
setupAction(text, tooltip, imageRegistry.getDescriptor(hoverImage), imageRegistry.getDescriptor(enabledImage),
|
||||||
setupAction(text,
|
imageRegistry.getDescriptor(disabledImage), enabled);
|
||||||
tooltip,
|
|
||||||
imageRegistry.getDescriptor(hoverImage),
|
|
||||||
imageRegistry.getDescriptor(enabledImage),
|
|
||||||
imageRegistry.getDescriptor(disabledImage),
|
|
||||||
enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupAction(String text, String tooltip,
|
protected void setupAction(String text, String tooltip, ImageDescriptor hoverImage, ImageDescriptor enabledImage,
|
||||||
ImageDescriptor hoverImage, ImageDescriptor enabledImage, ImageDescriptor disabledImage,
|
ImageDescriptor disabledImage, boolean enabled) {
|
||||||
boolean enabled) {
|
|
||||||
setText(text);
|
setText(text);
|
||||||
setToolTipText(tooltip);
|
setToolTipText(tooltip);
|
||||||
setEnabled(enabled);
|
setEnabled(enabled);
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2016 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.remote.console.actions;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
|
public interface IConsoleActionFactory {
|
||||||
|
public ConsoleAction createAction(String actionId, String connectionType, IAdaptable adapter);
|
||||||
|
}
|
|
@ -20,7 +20,6 @@ import org.eclipse.ui.console.IConsoleView;
|
||||||
import org.eclipse.ui.part.IPageBookViewPage;
|
import org.eclipse.ui.part.IPageBookViewPage;
|
||||||
import org.eclipse.ui.progress.UIJob;
|
import org.eclipse.ui.progress.UIJob;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class TerminalConsole extends AbstractConsole {
|
public class TerminalConsole extends AbstractConsole {
|
||||||
private final String encoding;
|
private final String encoding;
|
||||||
private final TerminalConsoleConnector terminalConnector;
|
private final TerminalConsoleConnector terminalConnector;
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2016 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.remote.internal.console;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.remote.console.actions.IConsoleActionFactory;
|
||||||
|
|
||||||
|
public class TerminalConsoleExtensionManager {
|
||||||
|
private static TerminalConsoleExtensionManager instance;
|
||||||
|
private Map<String, List<String>> actions;
|
||||||
|
private Map<String, IConsoleActionFactory> factories;
|
||||||
|
private Map<String, IConfigurationElement> elements;
|
||||||
|
|
||||||
|
private TerminalConsoleExtensionManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TerminalConsoleExtensionManager getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new TerminalConsoleExtensionManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getActionsForType(String id) {
|
||||||
|
initialize();
|
||||||
|
List<String> list = actions.get(id);
|
||||||
|
return list == null ? new ArrayList<String>() : list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConsoleActionFactory getFactory(String id) {
|
||||||
|
return factories.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
if (actions == null) {
|
||||||
|
actions = new LinkedHashMap<>();
|
||||||
|
elements = new LinkedHashMap<>();
|
||||||
|
factories = new HashMap<>();
|
||||||
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
|
IExtensionPoint point = registry
|
||||||
|
.getExtensionPoint(Activator.getDefault().getBundle().getSymbolicName() + ".toolbar");
|
||||||
|
for (IExtension extension : point.getExtensions()) {
|
||||||
|
for (IConfigurationElement element : extension.getConfigurationElements()) {
|
||||||
|
String id = element.getAttribute("id"); //$NON-NLS-1$
|
||||||
|
if (id != null) {
|
||||||
|
elements.put(id, element);
|
||||||
|
IConsoleActionFactory factory = null;
|
||||||
|
try {
|
||||||
|
factory = (IConsoleActionFactory) element.createExecutableExtension("actionFactory");
|
||||||
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e);
|
||||||
|
}
|
||||||
|
if (factory != null) {
|
||||||
|
String connectionType = element.getAttribute("connectionType");
|
||||||
|
if (connectionType != null) {
|
||||||
|
List<String> actionList = actions.get(connectionType);
|
||||||
|
if (actionList == null) {
|
||||||
|
actionList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
actionList.add(id);
|
||||||
|
actions.put(connectionType, actionList);
|
||||||
|
factories.put(id, factory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,9 @@
|
||||||
package org.eclipse.remote.internal.console;
|
package org.eclipse.remote.internal.console;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
@ -20,6 +22,9 @@ import org.eclipse.jface.action.GroupMarker;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
import org.eclipse.remote.console.actions.ConsoleAction;
|
||||||
|
import org.eclipse.remote.console.actions.IConsoleActionFactory;
|
||||||
|
import org.eclipse.remote.core.IRemoteConnection;
|
||||||
import org.eclipse.remote.internal.console.actions.ConsoleActionConnect;
|
import org.eclipse.remote.internal.console.actions.ConsoleActionConnect;
|
||||||
import org.eclipse.remote.internal.console.actions.ConsoleActionDisconnect;
|
import org.eclipse.remote.internal.console.actions.ConsoleActionDisconnect;
|
||||||
import org.eclipse.remote.internal.console.actions.ConsoleActionScrollLock;
|
import org.eclipse.remote.internal.console.actions.ConsoleActionScrollLock;
|
||||||
|
@ -40,9 +45,9 @@ import org.eclipse.ui.part.IPageSite;
|
||||||
import org.eclipse.ui.part.Page;
|
import org.eclipse.ui.part.Page;
|
||||||
import org.eclipse.ui.progress.UIJob;
|
import org.eclipse.ui.progress.UIJob;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
public class TerminalConsolePage extends Page implements IAdaptable {
|
||||||
public class TerminalConsolePage extends Page {
|
|
||||||
public static final String TOOLBAR_GROUP_ID = "org.eclipse.remote.internal.terminal.console.Toolbar"; //$NON-NLS-1$
|
public static final String TOOLBAR_GROUP_ID = "org.eclipse.remote.internal.terminal.console.Toolbar"; //$NON-NLS-1$
|
||||||
|
public static final String CONTRIBUTIONS_GROUP_ID = "org.eclipse.remote.internal.terminal.console.Toolbar.contributions"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final ConsoleActionConnect connectAction;
|
private final ConsoleActionConnect connectAction;
|
||||||
private final ConsoleActionDisconnect disconnectAction;
|
private final ConsoleActionDisconnect disconnectAction;
|
||||||
|
@ -89,10 +94,29 @@ public class TerminalConsolePage extends Page {
|
||||||
super.init(pageSite);
|
super.init(pageSite);
|
||||||
IToolBarManager toolBarManager = pageSite.getActionBars().getToolBarManager();
|
IToolBarManager toolBarManager = pageSite.getActionBars().getToolBarManager();
|
||||||
toolBarManager.insertBefore(IConsoleConstants.OUTPUT_GROUP, new GroupMarker(TOOLBAR_GROUP_ID));
|
toolBarManager.insertBefore(IConsoleConstants.OUTPUT_GROUP, new GroupMarker(TOOLBAR_GROUP_ID));
|
||||||
|
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, connectAction);
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, connectAction);
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction);
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction);
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this));
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this));
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole));
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole));
|
||||||
|
|
||||||
|
toolBarManager.insertAfter(TOOLBAR_GROUP_ID, new GroupMarker(CONTRIBUTIONS_GROUP_ID));
|
||||||
|
|
||||||
|
addToolbarContributions(toolBarManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToolbarContributions(IToolBarManager toolBarManager) {
|
||||||
|
String connectionType = terminalConsole.getConnection().getConnectionType().getId();
|
||||||
|
List<String> actions = TerminalConsoleExtensionManager.getInstance().getActionsForType(connectionType);
|
||||||
|
for (String id : actions) {
|
||||||
|
IConsoleActionFactory factory = TerminalConsoleExtensionManager.getInstance().getFactory(id);
|
||||||
|
if (factory != null) {
|
||||||
|
ConsoleAction action = factory.createAction(id, connectionType, this);
|
||||||
|
if (action != null) {
|
||||||
|
toolBarManager.appendToGroup(CONTRIBUTIONS_GROUP_ID, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -175,4 +199,22 @@ public class TerminalConsolePage extends Page {
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
|
if (adapter.equals(IRemoteConnection.class)) {
|
||||||
|
return (T) terminalConsole.getConnection();
|
||||||
|
}
|
||||||
|
if (adapter.equals(TerminalConsole.class)) {
|
||||||
|
return (T) terminalConsole;
|
||||||
|
}
|
||||||
|
if (adapter.equals(TerminalConsolePage.class)) {
|
||||||
|
return (T) this;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.remote.internal.console.actions;
|
package org.eclipse.remote.internal.console.actions;
|
||||||
|
|
||||||
|
import org.eclipse.remote.console.actions.ConsoleAction;
|
||||||
import org.eclipse.remote.internal.console.ImageConsts;
|
import org.eclipse.remote.internal.console.ImageConsts;
|
||||||
import org.eclipse.remote.internal.console.TerminalConsole;
|
import org.eclipse.remote.internal.console.TerminalConsole;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.remote.internal.console.actions;
|
package org.eclipse.remote.internal.console.actions;
|
||||||
|
|
||||||
|
import org.eclipse.remote.console.actions.ConsoleAction;
|
||||||
import org.eclipse.remote.internal.console.ImageConsts;
|
import org.eclipse.remote.internal.console.ImageConsts;
|
||||||
import org.eclipse.remote.internal.console.TerminalConsole;
|
import org.eclipse.remote.internal.console.TerminalConsole;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.remote.internal.console.actions;
|
package org.eclipse.remote.internal.console.actions;
|
||||||
|
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.remote.console.actions.ConsoleAction;
|
||||||
import org.eclipse.remote.internal.console.ImageConsts;
|
import org.eclipse.remote.internal.console.ImageConsts;
|
||||||
import org.eclipse.remote.internal.console.TerminalConsolePage;
|
import org.eclipse.remote.internal.console.TerminalConsolePage;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<feature
|
<feature
|
||||||
id="org.eclipse.remote.console"
|
id="org.eclipse.remote.console"
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="2.0.2.qualifier"
|
version="2.1.0.qualifier"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
license-feature="org.eclipse.license"
|
license-feature="org.eclipse.license"
|
||||||
license-feature-version="0.0.0">
|
license-feature-version="0.0.0">
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<groupId>org.eclipse.remote.features</groupId>
|
<groupId>org.eclipse.remote.features</groupId>
|
||||||
<artifactId>org.eclipse.remote.console</artifactId>
|
<artifactId>org.eclipse.remote.console</artifactId>
|
||||||
<version>2.0.2-SNAPSHOT</version>
|
<version>2.1.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-feature</packaging>
|
<packaging>eclipse-feature</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
Loading…
Add table
Reference in a new issue