diff --git a/plugins/org.eclipse.tm.terminal.view.ui/icons/clcl16/new_terminal_view.gif b/plugins/org.eclipse.tm.terminal.view.ui/icons/clcl16/new_terminal_view.gif new file mode 100644 index 00000000000..00896268424 Binary files /dev/null and b/plugins/org.eclipse.tm.terminal.view.ui/icons/clcl16/new_terminal_view.gif differ diff --git a/plugins/org.eclipse.tm.terminal.view.ui/icons/dlcl16/new_terminal_view.gif b/plugins/org.eclipse.tm.terminal.view.ui/icons/dlcl16/new_terminal_view.gif new file mode 100644 index 00000000000..25adc24b2a6 Binary files /dev/null and b/plugins/org.eclipse.tm.terminal.view.ui/icons/dlcl16/new_terminal_view.gif differ diff --git a/plugins/org.eclipse.tm.terminal.view.ui/icons/elcl16/new_terminal_view.gif b/plugins/org.eclipse.tm.terminal.view.ui/icons/elcl16/new_terminal_view.gif new file mode 100644 index 00000000000..b81882b503d Binary files /dev/null and b/plugins/org.eclipse.tm.terminal.view.ui/icons/elcl16/new_terminal_view.gif differ diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/NewTerminalViewAction.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/NewTerminalViewAction.java new file mode 100644 index 00000000000..9f4ba462e2b --- /dev/null +++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/NewTerminalViewAction.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.terminal.view.ui.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.tm.terminal.view.ui.activator.UIPlugin; +import org.eclipse.tm.terminal.view.ui.interfaces.ITerminalsView; +import org.eclipse.tm.terminal.view.ui.interfaces.ImageConsts; +import org.eclipse.tm.terminal.view.ui.nls.Messages; + +/** + * Opens a new terminal view with a new secondary view ID. + */ +public class NewTerminalViewAction extends AbstractTerminalAction { + + private ITerminalsView view = null; + + /** + * Constructor. + */ + public NewTerminalViewAction(ITerminalsView view) { + super(null, NewTerminalViewAction.class.getName(), IAction.AS_PUSH_BUTTON); + + this.view = view; + setupAction(Messages.NewTerminalViewAction_menu, Messages.NewTerminalViewAction_tooltip, + UIPlugin.getImageDescriptor(ImageConsts.ACTION_NewTerminalView_Hover), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_NewTerminalView_Enabled), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_NewTerminalView_Disabled), true); + setEnabled(true); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#run() + */ + @Override + public void run() { + } + +} diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/activator/UIPlugin.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/activator/UIPlugin.java index ccf5df983e0..dd2368fc6d4 100644 --- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/activator/UIPlugin.java +++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/activator/UIPlugin.java @@ -239,6 +239,13 @@ public class UIPlugin extends AbstractUIPlugin { registry.put(ImageConsts.ACTION_ToggleCommandField_Enabled, ImageDescriptor.createFromURL(url)); url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_DLCL + "command_input_field.gif"); //$NON-NLS-1$ registry.put(ImageConsts.ACTION_ToggleCommandField_Disabled, ImageDescriptor.createFromURL(url)); + + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_CLCL + "new_terminal_view.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.ACTION_NewTerminalView_Hover, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "new_terminal_view.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.ACTION_NewTerminalView_Enabled, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_DLCL + "new_terminal_view.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.ACTION_NewTerminalView_Disabled, ImageDescriptor.createFromURL(url)); } /** diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/interfaces/ImageConsts.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/interfaces/ImageConsts.java index 931874d38ba..9d5265d587e 100644 --- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/interfaces/ImageConsts.java +++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/interfaces/ImageConsts.java @@ -79,6 +79,21 @@ public interface ImageConsts { */ public static final String ACTION_PinTerminal_Hover = "PinTerminalAction_hover"; //$NON-NLS-1$ + /** + * The key to access the new terminal view action image (enabled). + */ + public static final String ACTION_NewTerminalView_Enabled = "NewTerminalViewAction_enabled"; //$NON-NLS-1$ + + /** + * The key to access the new terminal view action image (disabled). + */ + public static final String ACTION_NewTerminalView_Disabled = "NewTerminalViewAction_disabled"; //$NON-NLS-1$ + + /** + * The key to access the new terminal view action image (hover). + */ + public static final String ACTION_NewTerminalView_Hover = "NewTerminalViewAction_hover"; //$NON-NLS-1$ + /** * The key to access the toggle command field action image (enabled). */ diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.java index 4b94845bc88..5e0c6c2585a 100644 --- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.java +++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.java @@ -73,6 +73,9 @@ public class Messages extends NLS { public static String PinTerminalAction_menu; public static String PinTerminalAction_toolTip; + public static String NewTerminalViewAction_menu; + public static String NewTerminalViewAction_tooltip; + public static String ToggleCommandFieldAction_menu; public static String ToggleCommandFieldAction_toolTip; diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.properties b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.properties index f7a77a435dc..1060c0dc0b7 100644 --- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.properties +++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/nls/Messages.properties @@ -31,6 +31,9 @@ TabTerminalListener_consoleConnecting={0} : {1}... PinTerminalAction_menu=Pin PinTerminalAction_toolTip=Pin the Terminal View +NewTerminalViewAction_menu=New Terminal View +NewTerminalViewAction_tooltip=Opens a new Terminal View + ToggleCommandFieldAction_menu=Toggle Command Input Field ToggleCommandFieldAction_toolTip=Toggle Command Input Field diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java index 44bdcfe6d18..c4a5872116d 100644 --- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java +++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java @@ -29,6 +29,7 @@ import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy; import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; import org.eclipse.tm.terminal.view.ui.actions.AbstractAction; +import org.eclipse.tm.terminal.view.ui.actions.NewTerminalViewAction; import org.eclipse.tm.terminal.view.ui.actions.PinTerminalAction; import org.eclipse.tm.terminal.view.ui.actions.TabScrollLockAction; import org.eclipse.tm.terminal.view.ui.actions.ToggleCommandFieldAction; @@ -284,6 +285,17 @@ public class TabFolderToolbarHandler extends PlatformObject { return getActiveTerminalViewControl(); } }); + + // Create and add the new terminal view action +// add (new NewTerminalViewAction(getParentView()) { +// /* (non-Javadoc) +// * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget() +// */ +// @Override +// protected ITerminalViewControl getTarget() { +// return getActiveTerminalViewControl(); +// } +// }); } /** @@ -301,7 +313,8 @@ public class TabFolderToolbarHandler extends PlatformObject { manager.add(new Separator("anchor")); //$NON-NLS-1$ // we want that at the end - PinTerminalAction pinAction=null; + PinTerminalAction pinAction = null; + NewTerminalViewAction newTerminalAction = null; // Loop all actions and add them to the menu manager for (AbstractTerminalAction action : toolbarActions) { @@ -311,17 +324,25 @@ public class TabFolderToolbarHandler extends PlatformObject { manager.insertAfter("anchor", new Separator()); //$NON-NLS-1$ } // skip pin action for now - if(action instanceof PinTerminalAction){ + if (action instanceof PinTerminalAction){ pinAction=(PinTerminalAction)action; continue; } + // skip new terminal view action for now + if (action instanceof NewTerminalViewAction){ + newTerminalAction = (NewTerminalViewAction)action; + continue; + } // Add the action itself manager.insertAfter("anchor", action); //$NON-NLS-1$ } // now add pin at the end - if(pinAction!=null){ + if (pinAction != null){ manager.add(pinAction); } + if (newTerminalAction != null){ + manager.add(newTerminalAction); + } } /** @@ -337,7 +358,7 @@ public class TabFolderToolbarHandler extends PlatformObject { // 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 instanceof PinTerminalAction)) { + if (control == null && !(action instanceof PinTerminalAction) && !(action instanceof NewTerminalViewAction)) { action.setEnabled(false); } else {