aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Weninger2011-11-21 06:52:13 (EST)
committerUwe Stieber2011-11-21 06:52:13 (EST)
commitd7a228f8e43eb1bbcf9748c7959353b46568af28 (patch)
tree483a86cc03609ccdbab743f22688a685723c86ad
parent1758a8715cbf833ab17508ba309c68fa5fa311ce (diff)
downloadorg.eclipse.tcf-d7a228f8e43eb1bbcf9748c7959353b46568af28.zip
org.eclipse.tcf-d7a228f8e43eb1bbcf9748c7959353b46568af28.tar.gz
org.eclipse.tcf-d7a228f8e43eb1bbcf9748c7959353b46568af28.tar.bz2
Target Explorer: Bug 361363 - [TERMINALS] Implement "Pin&Clone" for the "Terminals" view
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java59
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java205
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java20
14 files changed, 341 insertions, 32 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
index db16a8f..38fb534 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml
@@ -9,6 +9,7 @@
<!-- View contributions -->
<extension point="org.eclipse.ui.views">
<view
+ allowMultiple="true"
category="org.eclipse.tcf.te.ui.views.category"
class="org.eclipse.tcf.te.ui.terminals.view.TerminalsView"
icon="platform:/plugin/org.eclipse.ui.console/icons/full/eview16/console_view.gif"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java
new file mode 100644
index 0000000..af8e98a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.terminals.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
+import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts;
+import org.eclipse.tcf.te.ui.terminals.nls.Messages;
+import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction;
+
+/**
+ * Pins the currently visible terminal view.
+ */
+@SuppressWarnings("restriction")
+public class PinTerminalAction extends AbstractTerminalAction {
+
+ private ITerminalsView fView = null;
+
+ /**
+ * Constructor.
+ */
+ public PinTerminalAction(ITerminalsView view) {
+ super(null, PinTerminalAction.class.getName(), IAction.AS_CHECK_BOX);
+
+ fView=view;
+ setupAction(Messages.PinTerminalAction_menu,
+ Messages.PinTerminalAction_toolTip,
+ UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Hover),
+ UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Enabled),
+ UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Disabled),
+ true);
+ setChecked(fView.isPinned());
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ @Override
+ public void run() {
+ fView.setPinned(isChecked());
+ }
+
+ /* (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.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java
index ca8bbe6..dc953ce 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java
@@ -116,6 +116,14 @@ public class UIPlugin extends AbstractUIPlugin {
registry.put(ImageConsts.ACTION_ScrollLock_Enabled, ImageDescriptor.createFromURL(url));
url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$
registry.put(ImageConsts.ACTION_ScrollLock_Disabled, ImageDescriptor.createFromURL(url));
+
+ url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_CLCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ registry.put(ImageConsts.ACTION_PinTerminal_Hover, ImageDescriptor.createFromURL(url));
+ url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_ELCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ registry.put(ImageConsts.ACTION_PinTerminal_Enabled, ImageDescriptor.createFromURL(url));
+ url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ registry.put(ImageConsts.ACTION_PinTerminal_Disabled, ImageDescriptor.createFromURL(url));
+
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java
index 6e42a43..b927cb5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java
@@ -33,4 +33,20 @@ public interface ITerminalsView extends IViewPart {
* @return The context help id or <code>null</code> if none is associated.
*/
public String getContextHelpId();
+
+ /**
+ * Set the state of the view to be pinned
+ * which means a new terminal connection will be created
+ * in a new view
+ *
+ * @param pin
+ */
+ public void setPinned(boolean pin);
+
+ /**
+ * Return the pin state of the terminal view
+ *
+ * @return
+ */
+ public boolean isPinned();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java
index faf6af5..9285f42 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java
@@ -62,4 +62,20 @@ public interface ImageConsts {
* The key to access the scroll lock action image (hover).
*/
public static final String ACTION_ScrollLock_Hover = "ScrollLockAction_hover"; //$NON-NLS-1$
+
+ /**
+ * The key to access the pin terminal action image (enabled).
+ */
+ public static final String ACTION_PinTerminal_Enabled = "PinTerminalAction_enabled"; //$NON-NLS-1$
+
+ /**
+ * The key to access the pin terminal action image (disabled).
+ */
+ public static final String ACTION_PinTerminal_Disabled = "PinTerminalAction_disabled"; //$NON-NLS-1$
+
+ /**
+ * The key to access the pin terminal action image (hover).
+ */
+ public static final String ACTION_PinTerminal_Hover = "PinTerminalAction_hover"; //$NON-NLS-1$
+
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
index 54bcc11..54e8ebf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java
@@ -29,6 +29,7 @@ import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveListener;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PerspectiveAdapter;
@@ -39,6 +40,9 @@ import org.eclipse.ui.PlatformUI;
*/
@SuppressWarnings("restriction")
public class ConsoleManager {
+ private int secondaryIdCount;
+ private boolean secondaryIdCountInit;
+
// Reference to the perspective listener instance
private final IPerspectiveListener perspectiveListener;
@@ -131,7 +135,7 @@ public class ConsoleManager {
* @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) {
+ public ITerminalsView findConsoleView(String id, String secondaryId) {
Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
ITerminalsView view = null;
@@ -140,7 +144,7 @@ public class ConsoleManager {
IWorkbenchPage page = getActiveWorkbenchPage();
if (page != null) {
// Look for the view
- IViewPart part = page.findView(id != null ? id : IUIConstants.ID);
+ IViewPart part=getTerminalsViewWithSecondaryId(id != null ? id : IUIConstants.ID, secondaryId);
// Check the interface
if (part instanceof ITerminalsView) {
view = (ITerminalsView)part;
@@ -151,13 +155,117 @@ public class ConsoleManager {
}
/**
+ * search and return a terminal view with a specific
+ * secondary id
+ * @param id
+ * @param secondaryId
+ * @return
+ */
+ private IViewPart getTerminalsViewWithSecondaryId(String id, String secondaryId){
+ IWorkbenchPage page = getActiveWorkbenchPage();
+
+ IViewReference[] refs=page.getViewReferences();
+ for(int i=0; i<refs.length; i++){
+ IViewReference ref=refs[i];
+ if(ref.getId().equals(id)){
+ IViewPart part=ref.getView(true);
+ if(part instanceof ITerminalsView){
+ String secId=((IViewSite)part.getSite()).getSecondaryId();
+ if(secId.equals(secondaryId)){
+ return part;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * search and return a terminal view that is NOT pinned
+ * @param id
+ * @return
+ */
+ private IViewPart getFirstNotPinnedTerminalsView(String id){
+ IWorkbenchPage page = getActiveWorkbenchPage();
+
+ IViewReference[] refs=page.getViewReferences();
+ for(int i=0; i<refs.length; i++){
+ IViewReference ref=refs[i];
+ if(ref.getId().equals(id)){
+ IViewPart part=ref.getView(true);
+ if(part instanceof ITerminalsView){
+ if(!((ITerminalsView)part).isPinned()){
+ return part;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * search and return a terminal view if available
+ * @param id
+ * @param useActive - return only an active terminal view
+ * @return
+ */
+ private IViewPart getFirstTerminalsView(String id, boolean useActive){
+ IWorkbenchPage page = getActiveWorkbenchPage();
+
+ IViewReference[] refs=page.getViewReferences();
+ for(int i=0; i<refs.length; i++){
+ IViewReference ref=refs[i];
+ if(ref.getId().equals(id)){
+ IViewPart part=ref.getView(true);
+ if(useActive){
+ if(page.isPartVisible(part)){
+ return part;
+ }
+ } else {
+ return part;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * cycle through all terminal views and find the highest
+ * secondary view id to know where to continue when
+ * a new terminal view is created
+ * @param id
+ */
+ private void countTerminalViews(String id){
+ if(!secondaryIdCountInit){
+ secondaryIdCountInit=true;
+ secondaryIdCount=0;
+ IWorkbenchPage page = getActiveWorkbenchPage();
+
+ IViewReference[] refs=page.getViewReferences();
+ for(int i=0; i<refs.length; i++){
+ IViewReference ref=refs[i];
+ if(ref.getId().equals(id)){
+ String secId=ref.getSecondaryId();
+ try {
+ int secIdInt=Integer.parseInt(secId);
+ if(secIdInt>secondaryIdCount){
+ secondaryIdCount=secIdInt;
+ }
+ } catch(NumberFormatException e){
+ }
+ }
+ }
+ }
+ }
+
+ /**
* 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) {
+ public IViewPart showConsoleView(String id, String secondaryId) {
Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
// Get the active workbench page
@@ -165,15 +273,17 @@ public class ConsoleManager {
if (page != null) {
try {
// show the view
- IViewPart part = page.showView(id != null ? id : IUIConstants.ID);
+ IViewPart part = page.showView(id != null ? id : IUIConstants.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
// and force the view to the foreground
page.bringToTop(part);
+ return part;
} catch (PartInitException e) {
IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
e.getLocalizedMessage(), e);
UIPlugin.getDefault().getLog().log(status);
}
}
+ return null;
}
/**
@@ -182,21 +292,63 @@ public class ConsoleManager {
* @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) {
+ private IViewPart 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);
+ // Look for any terminal view
+ IViewPart anyTerminal=getFirstTerminalsView(id != null ? id : IUIConstants.ID, false);
+ // there is at least one terminal available
+ if(anyTerminal!=null){
+ // is there an active terminal view
+ IViewPart activePart=getFirstTerminalsView(id != null ? id : IUIConstants.ID, true);
+ // no terminal view active
+ if(activePart==null){
+ // use the first not pinned
+ IViewPart notPinnedPart=getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID);
+ if(notPinnedPart!=null){
+ if (activate) {
+ page.activate(notPinnedPart);
+ }
+ else {
+ page.bringToTop(notPinnedPart);
+ }
+ return notPinnedPart;
+ }
+ // else we need to create a new one
+ secondaryIdCount++;
+ IViewPart newPart=showConsoleView(id != null ? id : IUIConstants.ID, Integer.toString(secondaryIdCount));
+ return newPart;
}
- else {
- page.bringToTop(part);
+ // we found a active terminal page
+ // if it is pinned search for a non pinned (not active)
+ if(((ITerminalsView)activePart).isPinned()){
+ // we found one so use it
+ IViewPart notPinnedPart=getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID);
+ if(notPinnedPart!=null){
+ if (activate) {
+ page.activate(notPinnedPart);
+ }
+ else {
+ page.bringToTop(notPinnedPart);
+ }
+ return notPinnedPart;
+ }
+ // else we need to create a new one
+ secondaryIdCount++;
+ IViewPart newPart=showConsoleView(id != null ? id : IUIConstants.ID, Integer.toString(secondaryIdCount));
+ return newPart;
}
- } else if (activate) showConsoleView(id != null ? id : IUIConstants.ID);
+ // else return the active one
+ return activePart;
+ }
+ // create first new terminal
+ if (activate) {
+ IViewPart newPart=showConsoleView(id != null ? id : IUIConstants.ID, Integer.toString(secondaryIdCount));
+ return newPart;
+ }
}
+ return null;
}
/**
@@ -215,19 +367,23 @@ public class ConsoleManager {
Assert.isNotNull(connector);
Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
- // make the consoles view visible
- bringToTop(id, activate);
+ countTerminalViews(id != null ? id : IUIConstants.ID);
- // Get the console view
- ITerminalsView view = findConsoleView(id);
- if (view == null) return;
+ // make the consoles view visible
+ IViewPart part=bringToTop(id, activate);
+ if(part==null){
+ return;
+ }
+ ITerminalsView view = (ITerminalsView)part;
// 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);
+ String secId=((IViewSite)part.getSite()).getSecondaryId();
+
+ CTabItem item = findConsole(id, secId, title, connector, data);
// If no existing console exist -> Create the tab item
if (item == null) {
@@ -265,13 +421,13 @@ public class ConsoleManager {
*
* @return The corresponding console tab item or <code>null</code>.
*/
- public CTabItem findConsole(String id, String title, ITerminalConnector connector, Object data) {
+ public CTabItem findConsole(String id, String secondaryId, String title, ITerminalConnector connector, Object data) {
Assert.isNotNull(title);
Assert.isNotNull(connector);
Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
// Get the console view
- ITerminalsView view = findConsoleView(id);
+ ITerminalsView view = findConsoleView(id, secondaryId);
if (view == null) return null;
// Get the tab folder manager associated with the view
@@ -296,9 +452,12 @@ public class ConsoleManager {
Assert.isNotNull(connector);
Assert.isNotNull(Display.findDisplay(Thread.currentThread()));
+ String secondaryId=Integer.toString(secondaryIdCount);
// Lookup the console
- CTabItem console = findConsole(id, title, connector, data);
+ CTabItem console = findConsole(id, secondaryId, title, connector, data);
// If found, dispose the console
- if (console != null) console.dispose();
+ if (console != null) {
+ console.dispose();
+ }
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
index fe60fca..52c74ed 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java
@@ -33,6 +33,10 @@ public class Messages extends NLS {
public static String TabTerminalListener_consoleTerminated;
+ public static String PinTerminalAction_menu;
+
+ public static String PinTerminalAction_toolTip;
+
public static String ProcessSettingsPage_dialogTitle;
public static String ProcessSettingsPage_processImagePathSelectorControl_label;
public static String ProcessSettingsPage_processImagePathSelectorControl_button;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
index 4010007..a2a8972 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties
@@ -7,6 +7,8 @@ AbstractAction_error_commandExecutionFailed="Failed to execute command (id = {0}
TabTerminalListener_consoleTerminated=<terminated> {0}
+PinTerminalAction_menu=Pin
+PinTerminalAction_toolTip=Pin the Terminal View
ProcessSettingsPage_dialogTitle=Select Process Image
ProcessSettingsPage_processImagePathSelectorControl_label=Image Path:
ProcessSettingsPage_processImagePathSelectorControl_button=Browse
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java
index 11f846b..8060f08 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java
@@ -13,9 +13,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl;
-import org.eclipse.ui.services.IDisposable;
/**
* Streams connector implementation.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
index f8e8a26..2a0316d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java
@@ -20,11 +20,11 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
+import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.nls.Messages;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.ui.services.IDisposable;
/**
* Input stream monitor implementation.
@@ -143,7 +143,7 @@ public class InputStreamMonitor extends OutputStream implements IDisposable {
}
/* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
+ * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
*/
@Override
public void dispose() {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
index 1185a5b..5e26d65 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java
@@ -19,12 +19,12 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
+import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.internal.tracing.ITraceIds;
import org.eclipse.tcf.te.ui.terminals.nls.Messages;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.ui.services.IDisposable;
/**
* Output stream monitor implementation.
@@ -98,7 +98,7 @@ public class OutputStreamMonitor implements IDisposable {
}
/* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
+ * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
*/
@Override
public void dispose() {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
index 5c3e1dd..7f4d346 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java
@@ -10,10 +10,10 @@
package org.eclipse.tcf.te.ui.terminals.streams;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
-import org.eclipse.ui.services.IDisposable;
/**
* Streams connector implementation.
@@ -66,7 +66,7 @@ public class StreamsConnector extends AbstractStreamsConnector implements IDispo
}
/* (non-Javadoc)
- * @see org.eclipse.ui.services.IDisposable#dispose()
+ * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
*/
@Override
public void dispose() {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
index 50d6de9..468e5d5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.tcf.te.ui.terminals.actions.AbstractAction;
+import org.eclipse.tcf.te.ui.terminals.actions.PinTerminalAction;
import org.eclipse.tcf.te.ui.terminals.actions.TabScrollLockAction;
import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
@@ -235,6 +236,17 @@ public class TabFolderToolbarHandler extends PlatformObject {
return getActiveTerminalViewControl();
}
});
+
+ // Create and add the pin view action
+ add (new PinTerminalAction(getParentView()) {
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget()
+ */
+ @Override
+ protected ITerminalViewControl getTarget() {
+ return getActiveTerminalViewControl();
+ }
+ });
}
/**
@@ -251,6 +263,9 @@ public class TabFolderToolbarHandler extends PlatformObject {
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(new Separator("anchor")); //$NON-NLS-1$
+ // we want that at the end
+ PinTerminalAction pinAction=null;
+
// Loop all actions and add them to the menu manager
for (AbstractTerminalAction action : toolbarActions) {
// Add a separator before the clear all action or if the action is a separator
@@ -258,9 +273,18 @@ public class TabFolderToolbarHandler extends PlatformObject {
|| (action instanceof AbstractAction && ((AbstractAction)action).isSeparator())) {
manager.insertAfter("anchor", new Separator()); //$NON-NLS-1$
}
+ // skip pin action for now
+ if(action instanceof PinTerminalAction){
+ pinAction=(PinTerminalAction)action;
+ continue;
+ }
// Add the action itself
manager.insertAfter("anchor", action); //$NON-NLS-1$
}
+ // now add pin at the end
+ if(pinAction!=null){
+ manager.add(pinAction);
+ }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
index abd05e0..80f1dcd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
@@ -44,6 +44,8 @@ public class TerminalsView extends ViewPart implements ITerminalsView {
private TabFolderToolbarHandler tabFolderToolbarHandler;
// Reference to the empty page control (to be show if no console is open)
private Control emptyPageControl;
+ // Whether this terminal is pinned.
+ private boolean fPinned = false;
/**
* Constructor.
@@ -306,4 +308,22 @@ public class TerminalsView extends ViewPart implements ITerminalsView {
return super.getAdapter(adapter);
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView#setPinned(boolean)
+ */
+ @Override
+ public void setPinned(boolean pin) {
+ fPinned = pin;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.terminals.interfaces.ITerminalsView#isPinned()
+ */
+ @Override
+ public boolean isPinned() {
+ return fPinned;
+ }
}