### Eclipse Workspace Patch 1.0 #P org.eclipse.tm.terminal.view Index: src/org/eclipse/tm/internal/terminal/view/TerminalView.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java,v retrieving revision 1.25 diff -u -r1.25 TerminalView.java --- src/org/eclipse/tm/internal/terminal/view/TerminalView.java 4 Apr 2008 13:52:19 -0000 1.25 +++ src/org/eclipse/tm/internal/terminal/view/TerminalView.java 24 Apr 2008 08:10:39 -0000 @@ -17,6 +17,7 @@ * Michael Scharf (Wind River) - [209656] ClassCastException in TerminalView under Eclipse-3.4M3 * Michael Scharf (Wind River) - [189774] Ctrl+V does not work in the command input field. * Michael Scharf (Wind River) - [217999] Duplicate context menu entries in Terminal + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin *******************************************************************************/ package org.eclipse.tm.internal.terminal.view; @@ -33,7 +34,6 @@ import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.window.Window; -import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.events.MenuEvent; import org.eclipse.swt.events.MenuListener; import org.eclipse.swt.widgets.Composite; @@ -41,14 +41,9 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.tm.internal.terminal.actions.TerminalAction; -import org.eclipse.tm.internal.terminal.actions.TerminalActionClearAll; import org.eclipse.tm.internal.terminal.actions.TerminalActionConnect; -import org.eclipse.tm.internal.terminal.actions.TerminalActionCopy; -import org.eclipse.tm.internal.terminal.actions.TerminalActionCut; import org.eclipse.tm.internal.terminal.actions.TerminalActionDisconnect; import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal; -import org.eclipse.tm.internal.terminal.actions.TerminalActionPaste; -import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectAll; import org.eclipse.tm.internal.terminal.actions.TerminalActionSettings; import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField; import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory; @@ -60,6 +55,12 @@ import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.tm.terminal.control.actions.AbstractTerminalControlAction; +import org.eclipse.tm.terminal.control.actions.TerminalActionClearAll; +import org.eclipse.tm.terminal.control.actions.TerminalActionCopy; +import org.eclipse.tm.terminal.control.actions.TerminalActionCut; +import org.eclipse.tm.terminal.control.actions.TerminalActionPaste; +import org.eclipse.tm.terminal.control.actions.TerminalActionSelectAll; import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewReference; import org.eclipse.ui.IViewSite; @@ -92,15 +93,15 @@ protected TerminalAction fActionTerminalSettings; - protected TerminalAction fActionEditCopy; + protected AbstractTerminalControlAction fActionEditCopy; - protected TerminalAction fActionEditCut; + protected AbstractTerminalControlAction fActionEditCut; - protected TerminalAction fActionEditPaste; + protected AbstractTerminalControlAction fActionEditPaste; - protected TerminalAction fActionEditClearAll; + protected AbstractTerminalControlAction fActionEditClearAll; - protected TerminalAction fActionEditSelectAll; + protected AbstractTerminalControlAction fActionEditSelectAll; protected TerminalAction fActionToggleCommandInputField; @@ -233,9 +234,7 @@ return fCtlTerminal.getState()==TerminalState.CONNECTING || fCtlTerminal.getState()==TerminalState.OPENED; } - private boolean isConnected() { - return fCtlTerminal.getState()==TerminalState.CONNECTED; - } + public void onTerminalDisconnect() { fCtlTerminal.disconnectTerminal(); } @@ -366,55 +365,23 @@ } } - public void updateEditCopy() { - boolean bEnabled=true; - - if (fMenuAboutToShow) { - bEnabled = fCtlTerminal.getSelection().length()>0; - } - - fActionEditCopy.setEnabled(bEnabled); - } public void onEditCut() { fCtlTerminal.sendKey('\u0018'); } - public void updateEditCut() { - boolean bEnabled; - - bEnabled = !fMenuAboutToShow; - fActionEditCut.setEnabled(bEnabled); - } - public void onEditPaste() { fCtlTerminal.paste(); } - public void updateEditPaste() { - String strText = (String) fCtlTerminal.getClipboard().getContents(TextTransfer.getInstance()); - - boolean bEnabled = ((strText != null) && (!strText.equals("")) && (isConnected()));//$NON-NLS-1$ - - fActionEditPaste.setEnabled(bEnabled); - } - public void onEditClearAll() { fCtlTerminal.clearTerminal(); } - public void updateEditClearAll() { - fActionEditClearAll.setEnabled(!fCtlTerminal.isEmpty()); - } - public void onEditSelectAll() { fCtlTerminal.selectAll(); } - public void updateEditSelectAll() { - fActionEditSelectAll.setEnabled(!fCtlTerminal.isEmpty()); - } - // ViewPart interface public void createPartControl(Composite wndParent) { @@ -511,11 +478,11 @@ fActionTerminalConnect = new TerminalActionConnect(this); fActionTerminalDisconnect = new TerminalActionDisconnect(this); fActionTerminalSettings = new TerminalActionSettings(this); - fActionEditCopy = new TerminalActionCopy(this); - fActionEditCut = new TerminalActionCut(this); - fActionEditPaste = new TerminalActionPaste(this); - fActionEditClearAll = new TerminalActionClearAll(this); - fActionEditSelectAll = new TerminalActionSelectAll(this); + fActionEditCopy = new TerminalActionCopy(fCtlTerminal); + fActionEditCut = new TerminalActionCut(fCtlTerminal); + fActionEditPaste = new TerminalActionPaste(fCtlTerminal); + fActionEditClearAll = new TerminalActionClearAll(fCtlTerminal); + fActionEditSelectAll = new TerminalActionSelectAll(fCtlTerminal); fActionToggleCommandInputField = new TerminalActionToggleCommandInputField(this); } protected void setupLocalToolBars() { @@ -569,7 +536,7 @@ protected class TerminalContextMenuHandler implements MenuListener, IMenuListener { public void menuHidden(MenuEvent event) { fMenuAboutToShow = false; - updateEditCopy(); + fActionEditCopy.updateAction(fMenuAboutToShow); } public void menuShown(MenuEvent e) { @@ -577,11 +544,11 @@ } public void menuAboutToShow(IMenuManager menuMgr) { fMenuAboutToShow = true; - updateEditCopy(); - updateEditCut(); - updateEditSelectAll(); - updateEditPaste(); - updateEditClearAll(); + fActionEditCopy.updateAction(fMenuAboutToShow); + fActionEditCut.updateAction(fMenuAboutToShow); + fActionEditSelectAll.updateAction(fMenuAboutToShow); + fActionEditPaste.updateAction(fMenuAboutToShow); + fActionEditClearAll.updateAction(fMenuAboutToShow); } } Index: src/org/eclipse/tm/internal/terminal/view/ImageConsts.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ImageConsts.java,v retrieving revision 1.4 diff -u -r1.4 ImageConsts.java --- src/org/eclipse/tm/internal/terminal/view/ImageConsts.java 11 Oct 2007 20:00:55 -0000 1.4 +++ src/org/eclipse/tm/internal/terminal/view/ImageConsts.java 24 Apr 2008 08:10:39 -0000 @@ -13,6 +13,7 @@ * Contributors: * Michael Scharf (Wind River) - extracted from TerminalConsts * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin *******************************************************************************/ package org.eclipse.tm.internal.terminal.view; @@ -33,19 +34,16 @@ public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$ public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$ public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_CLEAR_ALL = "ImageClclClearAll"; //$NON-NLS-1$ public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$ public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$ public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$ public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_CLEAR_ALL = "ImageDlclClearAll"; //$NON-NLS-1$ public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$ public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$ public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$ public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_CLEAR_ALL = "ImageElclClearAll"; //$NON-NLS-1$ public static final String IMAGE_ELCL_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$ public static final String IMAGE_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$ public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$ Index: src/org/eclipse/tm/internal/terminal/view/TerminalViewPlugin.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewPlugin.java,v retrieving revision 1.6 diff -u -r1.6 TerminalViewPlugin.java --- src/org/eclipse/tm/internal/terminal/view/TerminalViewPlugin.java 11 Oct 2007 20:00:55 -0000 1.6 +++ src/org/eclipse/tm/internal/terminal/view/TerminalViewPlugin.java 24 Apr 2008 08:10:39 -0000 @@ -13,6 +13,7 @@ * Contributors: * Michael Scharf (Wind River) - split into core, view and connector plugins * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin *******************************************************************************/ package org.eclipse.tm.internal.terminal.view; @@ -49,7 +50,6 @@ map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ map.put(ImageConsts.IMAGE_CLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$ map.put(ImageConsts.IMAGE_CLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_CLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$ loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map); @@ -62,7 +62,6 @@ map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ map.put(ImageConsts.IMAGE_ELCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$ map.put(ImageConsts.IMAGE_ELCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_ELCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$ loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map); @@ -75,7 +74,6 @@ map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ map.put(ImageConsts.IMAGE_DLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$ map.put(ImageConsts.IMAGE_DLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_DLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$ loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map); Index: src/org/eclipse/tm/internal/terminal/actions/ActionMessages.properties =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/actions/ActionMessages.properties,v retrieving revision 1.4 diff -u -r1.4 ActionMessages.properties --- src/org/eclipse/tm/internal/terminal/actions/ActionMessages.properties 11 Oct 2007 20:00:55 -0000 1.4 +++ src/org/eclipse/tm/internal/terminal/actions/ActionMessages.properties 24 Apr 2008 08:10:39 -0000 @@ -13,6 +13,7 @@ # Contributors: # Michael Scharf (Wind River) - split into core, view and connector plugins # Martin Oberhuber (Wind River) - fixed copyright headers and beautified +# Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin ############################################################################### NEW_TERMINAL = New Terminal CONNECT = Connect @@ -20,10 +21,5 @@ SETTINGS_ELLIPSE = Settings... SCROLL_LOCK_0 = Scroll &Lock SCROLL_LOCK_1 = Scroll Lock -COPY = Copy -CUT = Cut -PASTE = Paste -SELECTALL = Select All -CLEARALL = Clear Terminal SETTINGS = Settings TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field Index: src/org/eclipse/tm/internal/terminal/actions/TerminalActionCopy.java =================================================================== RCS file: src/org/eclipse/tm/internal/terminal/actions/TerminalActionCopy.java diff -N src/org/eclipse/tm/internal/terminal/actions/TerminalActionCopy.java --- src/org/eclipse/tm/internal/terminal/actions/TerminalActionCopy.java 15 Feb 2007 10:20:24 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.internal.terminal.actions; - -import org.eclipse.tm.internal.terminal.view.ITerminalView; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -public class TerminalActionCopy extends TerminalAction -{ - public TerminalActionCopy(ITerminalView target) - { - super(target, - TerminalActionCopy.class.getName()); - ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); - setupAction(ActionMessages.COPY, - ActionMessages.COPY, - si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY), - si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY), - si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), - true); - } - public void run() { - fTarget.onEditCopy(); - } -} Index: src/org/eclipse/tm/internal/terminal/actions/TerminalActionCut.java =================================================================== RCS file: src/org/eclipse/tm/internal/terminal/actions/TerminalActionCut.java diff -N src/org/eclipse/tm/internal/terminal/actions/TerminalActionCut.java --- src/org/eclipse/tm/internal/terminal/actions/TerminalActionCut.java 15 Feb 2007 10:20:24 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.internal.terminal.actions; - -import org.eclipse.tm.internal.terminal.view.ITerminalView; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -public class TerminalActionCut extends TerminalAction -{ - public TerminalActionCut(ITerminalView target) - { - super(target, - TerminalActionCut.class.getName()); - ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); - setupAction(ActionMessages.CUT, - ActionMessages.CUT, - si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT), - si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT), - si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), - true); - } - public void run() { - fTarget.onEditCut(); - } -} Index: src/org/eclipse/tm/internal/terminal/actions/ActionMessages.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/actions/ActionMessages.java,v retrieving revision 1.4 diff -u -r1.4 ActionMessages.java --- src/org/eclipse/tm/internal/terminal/actions/ActionMessages.java 11 Oct 2007 20:00:55 -0000 1.4 +++ src/org/eclipse/tm/internal/terminal/actions/ActionMessages.java 24 Apr 2008 08:10:38 -0000 @@ -13,6 +13,7 @@ * Contributors: * Michael Scharf (Wind River) - split into core, view and connector plugins * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin *******************************************************************************/ package org.eclipse.tm.internal.terminal.actions; @@ -30,11 +31,6 @@ public static String SCROLL_LOCK_0; public static String SCROLL_LOCK_1; - public static String COPY; - public static String CUT; - public static String PASTE; - public static String SELECTALL; - public static String CLEARALL; public static String SETTINGS; } Index: src/org/eclipse/tm/internal/terminal/actions/TerminalActionClearAll.java =================================================================== RCS file: src/org/eclipse/tm/internal/terminal/actions/TerminalActionClearAll.java diff -N src/org/eclipse/tm/internal/terminal/actions/TerminalActionClearAll.java --- src/org/eclipse/tm/internal/terminal/actions/TerminalActionClearAll.java 11 Oct 2007 20:00:55 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.internal.terminal.actions; - -import org.eclipse.tm.internal.terminal.view.ITerminalView; -import org.eclipse.tm.internal.terminal.view.ImageConsts; - -public class TerminalActionClearAll extends TerminalAction -{ - public TerminalActionClearAll(ITerminalView target) - { - super(target, - TerminalActionClearAll.class.getName()); - - setupAction(ActionMessages.CLEARALL, - ActionMessages.CLEARALL, - ImageConsts.IMAGE_CLCL_CLEAR_ALL, - ImageConsts.IMAGE_ELCL_CLEAR_ALL, - ImageConsts.IMAGE_DLCL_CLEAR_ALL, - false); - } - - public void run() { - fTarget.onEditClearAll(); - } -} - - Index: src/org/eclipse/tm/internal/terminal/actions/TerminalActionSelectAll.java =================================================================== RCS file: src/org/eclipse/tm/internal/terminal/actions/TerminalActionSelectAll.java diff -N src/org/eclipse/tm/internal/terminal/actions/TerminalActionSelectAll.java --- src/org/eclipse/tm/internal/terminal/actions/TerminalActionSelectAll.java 15 Feb 2007 10:20:24 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.internal.terminal.actions; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.tm.internal.terminal.view.ITerminalView; - -public class TerminalActionSelectAll extends TerminalAction -{ - public TerminalActionSelectAll(ITerminalView target) - { - super(target, - TerminalActionSelectAll.class.getName()); - - setupAction(ActionMessages.SELECTALL, - ActionMessages.SELECTALL, - (ImageDescriptor)null, - null, - null, - false); - } - public void run() { - fTarget.onEditSelectAll(); - } -} Index: src/org/eclipse/tm/internal/terminal/actions/TerminalActionPaste.java =================================================================== RCS file: src/org/eclipse/tm/internal/terminal/actions/TerminalActionPaste.java diff -N src/org/eclipse/tm/internal/terminal/actions/TerminalActionPaste.java --- src/org/eclipse/tm/internal/terminal/actions/TerminalActionPaste.java 15 Feb 2007 10:20:24 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.internal.terminal.actions; - -import org.eclipse.tm.internal.terminal.view.ITerminalView; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -public class TerminalActionPaste extends TerminalAction -{ - public TerminalActionPaste(ITerminalView target) - { - super(target, - TerminalActionPaste.class.getName()); - ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); - setupAction(ActionMessages.PASTE, - ActionMessages.PASTE, - si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), - si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), - si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), - false); - } - public void run() { - fTarget.onEditPaste(); - } -} #P org.eclipse.tm.terminal Index: src/org/eclipse/tm/internal/terminal/control/impl/TerminalPlugin.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/impl/TerminalPlugin.java,v retrieving revision 1.4 diff -u -r1.4 TerminalPlugin.java --- src/org/eclipse/tm/internal/terminal/control/impl/TerminalPlugin.java 16 May 2007 00:25:45 -0000 1.4 +++ src/org/eclipse/tm/internal/terminal/control/impl/TerminalPlugin.java 24 Apr 2008 08:10:41 -0000 @@ -13,11 +13,20 @@ * Contributors: * Michael Scharf (Wind River) - split into core, view and connector plugins * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin *******************************************************************************/ package org.eclipse.tm.internal.terminal.control.impl; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; + import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.tm.internal.terminal.provisional.api.Logger; +import org.eclipse.tm.terminal.control.actions.ImageConsts; import org.eclipse.ui.plugin.AbstractUIPlugin; public class TerminalPlugin extends AbstractUIPlugin { @@ -25,6 +34,37 @@ public static final String PLUGIN_ID = "org.eclipse.tm.terminal"; //$NON-NLS-1$ public static final String HELP_VIEW = PLUGIN_ID + ".terminal_view"; //$NON-NLS-1$ + protected void initializeImageRegistry(ImageRegistry imageRegistry) { + HashMap map; + + map = new HashMap(); + + try { + // Local toolbars + map.put(ImageConsts.IMAGE_CLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$ + + loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map); + + map.clear(); + + // Enabled local toolbars + map.put(ImageConsts.IMAGE_ELCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$ + + loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map); + + map.clear(); + + // Disabled local toolbars + map.put(ImageConsts.IMAGE_DLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$ + + loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map); + + map.clear(); + } catch (MalformedURLException malformedURLException) { + malformedURLException.printStackTrace(); + } + } + /** * The constructor. */ @@ -55,4 +95,27 @@ return new Boolean(strEnabled).booleanValue(); } + + protected void loadImageRegistry(ImageRegistry imageRegistry, + String strDir, HashMap map) throws MalformedURLException { + URL url; + ImageDescriptor imageDescriptor; + Iterator keys; + String strKey; + String strFile; + + keys = map.keySet().iterator(); + + while (keys.hasNext()) { + strKey = (String) keys.next(); + strFile = (String) map.get(strKey); + + if (strFile != null) { + url = TerminalPlugin.getDefault().getBundle().getEntry( + ImageConsts.IMAGE_DIR_ROOT + strDir + strFile); + imageDescriptor = ImageDescriptor.createFromURL(url); + imageRegistry.put(strKey, imageDescriptor); + } + } + } } Index: build.properties =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/build.properties,v retrieving revision 1.8 diff -u -r1.8 build.properties --- build.properties 12 Feb 2008 23:51:17 -0000 1.8 +++ build.properties 24 Apr 2008 08:10:41 -0000 @@ -13,6 +13,7 @@ # Contributors: # Michael Scharf (Wind River) - split into core, view and connector plugins # Martin Oberhuber (Wind River) - fixed copyright headers and beautified +# Anna Dushistova (MontaVista) - added icons ############################################################################### bin.includes = .,\ META-INF/,\ @@ -20,8 +21,12 @@ plugin.properties,\ .options,\ README.txt,\ - about.html,about.ini,about.mappings,about.properties,\ - eclipse32.png + about.html,\ + about.ini,\ + about.mappings,\ + about.properties,\ + eclipse32.png,\ + icons/ source.. = src/ output.. = bin/ Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/META-INF/MANIFEST.MF,v retrieving revision 1.21 diff -u -r1.21 MANIFEST.MF --- META-INF/MANIFEST.MF 11 Apr 2008 17:37:14 -0000 1.21 +++ META-INF/MANIFEST.MF 24 Apr 2008 08:10:41 -0000 @@ -18,7 +18,17 @@ org.eclipse.tm.internal.terminal.control.impl;x-friends:="org.eclipse.tm.terminal.test", org.eclipse.tm.internal.terminal.emulator;x-friends:="org.eclipse.tm.terminal.test", org.eclipse.tm.internal.terminal.model;x-friends:="org.eclipse.tm.terminal.test", - org.eclipse.tm.internal.terminal.provisional.api;x-friends:="org.eclipse.tm.terminal.serial,org.eclipse.tm.terminal.ssh,org.eclipse.tm.terminal.telnet,org.eclipse.tm.terminal.view,org.eclipse.tm.terminal.test", - org.eclipse.tm.internal.terminal.provisional.api.provider;x-friends:="org.eclipse.tm.terminal.serial,org.eclipse.tm.terminal.ssh,org.eclipse.tm.terminal.telnet,org.eclipse.tm.terminal.test", + org.eclipse.tm.internal.terminal.provisional.api; + x-friends:="org.eclipse.tm.terminal.serial, + org.eclipse.tm.terminal.ssh, + org.eclipse.tm.terminal.telnet, + org.eclipse.tm.terminal.view, + org.eclipse.tm.terminal.test", + org.eclipse.tm.internal.terminal.provisional.api.provider; + x-friends:="org.eclipse.tm.terminal.serial, + org.eclipse.tm.terminal.ssh, + org.eclipse.tm.terminal.telnet, + org.eclipse.tm.terminal.test", org.eclipse.tm.internal.terminal.textcanvas;x-friends:="org.eclipse.tm.terminal.test", + org.eclipse.tm.terminal.control.actions, org.eclipse.tm.terminal.model Index: src/org/eclipse/tm/terminal/control/actions/TerminalActionClearAll.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/TerminalActionClearAll.java diff -N src/org/eclipse/tm/terminal/control/actions/TerminalActionClearAll.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/TerminalActionClearAll.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin + ********************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; + +public class TerminalActionClearAll extends AbstractTerminalControlAction { + public TerminalActionClearAll() { + super(TerminalActionClearAll.class.getName()); + + setupAction(ActionMessages.CLEARALL, ActionMessages.CLEARALL, + ImageConsts.IMAGE_CLCL_CLEAR_ALL, + ImageConsts.IMAGE_ELCL_CLEAR_ALL, + ImageConsts.IMAGE_DLCL_CLEAR_ALL, false); + } + + public TerminalActionClearAll(ITerminalViewControl target) { + super(target, TerminalActionClearAll.class.getName()); + + setupAction(ActionMessages.CLEARALL, ActionMessages.CLEARALL, + ImageConsts.IMAGE_CLCL_CLEAR_ALL, + ImageConsts.IMAGE_ELCL_CLEAR_ALL, + ImageConsts.IMAGE_DLCL_CLEAR_ALL, false); + } + + public void run() { + ITerminalViewControl target = getTarget(); + if (target != null) { + target.clearTerminal(); + } + } + + public void updateAction(boolean aboutToShow) { + ITerminalViewControl target = getTarget(); + if (target != null) + setEnabled(!target.isEmpty()); + else + setEnabled(false); + } +} Index: src/org/eclipse/tm/terminal/control/actions/TerminalActionCut.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/TerminalActionCut.java diff -N src/org/eclipse/tm/terminal/control/actions/TerminalActionCut.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/TerminalActionCut.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +public class TerminalActionCut extends AbstractTerminalControlAction { + public TerminalActionCut() { + super(TerminalActionCut.class.getName()); + ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); + setupAction(ActionMessages.CUT, ActionMessages.CUT, si + .getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si + .getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si + .getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true); + } + + public TerminalActionCut(ITerminalViewControl target) { + super(target, TerminalActionCut.class.getName()); + ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); + setupAction(ActionMessages.CUT, ActionMessages.CUT, si + .getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si + .getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si + .getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true); + } + + public void run() { + ITerminalViewControl target = getTarget(); + if (target != null) { + target.sendKey('\u0018'); + } + } + + public void updateAction(boolean aboutToShow) { + boolean bEnabled; + + bEnabled = !aboutToShow; + setEnabled(bEnabled); + } +} Index: src/org/eclipse/tm/terminal/control/actions/TerminalActionSelectAll.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/TerminalActionSelectAll.java diff -N src/org/eclipse/tm/terminal/control/actions/TerminalActionSelectAll.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/TerminalActionSelectAll.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; + +public class TerminalActionSelectAll extends AbstractTerminalControlAction { + public TerminalActionSelectAll() { + super(TerminalActionSelectAll.class.getName()); + + setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL, + (ImageDescriptor) null, null, null, false); + } + + public TerminalActionSelectAll(ITerminalViewControl target) { + super(target, TerminalActionSelectAll.class.getName()); + + setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL, + (ImageDescriptor) null, null, null, false); + } + + public void run() { + ITerminalViewControl target = getTarget(); + if (target != null) { + target.selectAll(); + } + } + + public void updateAction(boolean aboutToShow) { + ITerminalViewControl target = getTarget(); + if (target != null) + setEnabled(!target.isEmpty()); + else + setEnabled(false); + } +} Index: src/org/eclipse/tm/terminal/control/actions/ActionMessages.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/ActionMessages.java diff -N src/org/eclipse/tm/terminal/control/actions/ActionMessages.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/ActionMessages.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2003, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.osgi.util.NLS; + +public class ActionMessages extends NLS { + static { + NLS.initializeMessages(ActionMessages.class.getName(), + ActionMessages.class); + } + + public static String COPY; + public static String CUT; + public static String PASTE; + public static String SELECTALL; + public static String CLEARALL; + +} Index: src/org/eclipse/tm/terminal/control/actions/AbstractTerminalControlAction.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/AbstractTerminalControlAction.java diff -N src/org/eclipse/tm/terminal/control/actions/AbstractTerminalControlAction.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/AbstractTerminalControlAction.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - Adapted from TerminalAction + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin; + +public abstract class AbstractTerminalControlAction extends Action { + private final ITerminalViewControl fTarget; + + public AbstractTerminalControlAction(String strId) { + this(null, strId, 0); + } + + public AbstractTerminalControlAction(ITerminalViewControl target, + String strId) { + this(target, strId, 0); + } + + public AbstractTerminalControlAction(ITerminalViewControl target, + String strId, int style) { + super("", style); //$NON-NLS-1$ + + fTarget = target; + + setId(strId); + } + + abstract public void run(); + + protected void setupAction(String strText, String strToolTip, + String strImage, String strEnabledImage, String strDisabledImage, + boolean bEnabled) { + setupAction(strText, strToolTip, strImage, strEnabledImage, + strDisabledImage, bEnabled, TerminalPlugin.getDefault() + .getImageRegistry()); + } + + protected void setupAction(String strText, String strToolTip, + String strHoverImage, String strEnabledImage, + String strDisabledImage, boolean bEnabled, + ImageRegistry imageRegistry) { + setupAction(strText, strToolTip, imageRegistry + .getDescriptor(strHoverImage), imageRegistry + .getDescriptor(strEnabledImage), imageRegistry + .getDescriptor(strDisabledImage), bEnabled); + } + + protected void setupAction(String strText, String strToolTip, + ImageDescriptor hoverImage, ImageDescriptor enabledImage, + ImageDescriptor disabledImage, boolean bEnabled) { + setText(strText); + setToolTipText(strToolTip); + setEnabled(bEnabled); + if (enabledImage != null) { + setImageDescriptor(enabledImage); + } + if (disabledImage != null) { + setDisabledImageDescriptor(disabledImage); + } + if (hoverImage != null) { + setHoverImageDescriptor(hoverImage); + } + } + + protected ITerminalViewControl getTarget() { + return fTarget; + } + + /** + * Subclasses can update their action + * + * @param aboutToShow + * true before the menu is shown -- false when the menu gets + * hidden + */ + public void updateAction(boolean aboutToShow) { + } +} Index: src/org/eclipse/tm/terminal/control/actions/TerminalActionCopy.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/TerminalActionCopy.java diff -N src/org/eclipse/tm/terminal/control/actions/TerminalActionCopy.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/TerminalActionCopy.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +public class TerminalActionCopy extends AbstractTerminalControlAction { + public TerminalActionCopy() { + super(TerminalActionCopy.class.getName()); + ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); + setupAction(ActionMessages.COPY, ActionMessages.COPY, si + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true); + } + + public TerminalActionCopy(ITerminalViewControl target) { + super(target, TerminalActionCopy.class.getName()); + ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); + setupAction(ActionMessages.COPY, ActionMessages.COPY, si + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true); + } + + public void run() { + ITerminalViewControl target = getTarget(); + if (target != null) { + String selection = target.getSelection(); + + if (!selection.equals("")) {//$NON-NLS-1$ + target.copy(); + } else { + target.sendKey('\u0003'); + } + } + } + + public void updateAction(boolean aboutToShow) { + boolean bEnabled = true; + ITerminalViewControl target = getTarget(); + if (aboutToShow && target != null) { + bEnabled = target.getSelection().length() > 0; + } + setEnabled(bEnabled); + } +} Index: src/org/eclipse/tm/terminal/control/actions/ImageConsts.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/ImageConsts.java diff -N src/org/eclipse/tm/terminal/control/actions/ImageConsts.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/ImageConsts.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2003, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - extracted from TerminalConsts + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +public interface ImageConsts { + public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$ + public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors + // - size 16x16 + // //$NON-NLS-1$ + public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size + // 16x16 + // //$NON-NLS-1$ + public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size + // 16x16 + // //$NON-NLS-1$ + + public static final String IMAGE_CLCL_CLEAR_ALL = "ImageClclClearAll"; //$NON-NLS-1$ + + public static final String IMAGE_DLCL_CLEAR_ALL = "ImageDlclClearAll"; //$NON-NLS-1$ + + public static final String IMAGE_ELCL_CLEAR_ALL = "ImageElclClearAll"; //$NON-NLS-1$ +} Index: src/org/eclipse/tm/terminal/control/actions/TerminalActionPaste.java =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/TerminalActionPaste.java diff -N src/org/eclipse/tm/terminal/control/actions/TerminalActionPaste.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/TerminalActionPaste.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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 + * + * Initial Contributors: + * The following Wind River employees contributed to the Terminal component + * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, + * Helmut Haigermoser and Ted Williams. + * + * Contributors: + * Michael Scharf (Wind River) - split into core, view and connector plugins + * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin + *******************************************************************************/ +package org.eclipse.tm.terminal.control.actions; + +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +public class TerminalActionPaste extends AbstractTerminalControlAction { + public TerminalActionPaste() { + super(TerminalActionPaste.class.getName()); + ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); + setupAction(ActionMessages.PASTE, ActionMessages.PASTE, si + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), si + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), si + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), false); + } + + public TerminalActionPaste(ITerminalViewControl target) { + super(target, TerminalActionPaste.class.getName()); + ISharedImages si = PlatformUI.getWorkbench().getSharedImages(); + setupAction(ActionMessages.PASTE, ActionMessages.PASTE, si + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), si + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), si + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), false); + } + + public void run() { + ITerminalViewControl target = getTarget(); + if (target != null) { + target.paste(); + } + } + + public void updateAction(boolean aboutToShow) { + boolean bEnabled = false; + ITerminalViewControl target = getTarget(); + if (target != null) { + String strText = (String) target.getClipboard().getContents( + TextTransfer.getInstance()); + bEnabled = ((strText != null) && (!strText.equals("")) && (target.getState() == TerminalState.CONNECTED));//$NON-NLS-1$ + } + setEnabled(bEnabled); + } +} Index: src/org/eclipse/tm/terminal/control/actions/ActionMessages.properties =================================================================== RCS file: src/org/eclipse/tm/terminal/control/actions/ActionMessages.properties diff -N src/org/eclipse/tm/terminal/control/actions/ActionMessages.properties --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/tm/terminal/control/actions/ActionMessages.properties 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +############################################################################### +# Copyright (c) 2003, 2007 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 +# +# Initial Contributors: +# The following Wind River employees contributed to the Terminal component +# that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, +# Helmut Haigermoser and Ted Williams. +# +# Contributors: +# Michael Scharf (Wind River) - split into core, view and connector plugins +# Martin Oberhuber (Wind River) - fixed copyright headers and beautified +# Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin +############################################################################### +COPY = Copy +CUT = Cut +PASTE = Paste +SELECTALL = Select All +CLEARALL = Clear Terminal #P org.eclipse.rse.terminals.ui Index: src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java,v retrieving revision 1.3 diff -u -r1.3 TerminalViewTab.java --- src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java 24 Apr 2008 01:06:41 -0000 1.3 +++ src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java 24 Apr 2008 08:10:43 -0000 @@ -31,13 +31,11 @@ import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper; import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; -import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem; import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; import org.eclipse.rse.ui.view.ISystemViewElementAdapter; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.MenuEvent; @@ -48,45 +46,43 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; -import org.eclipse.tm.internal.terminal.actions.TerminalAction; -import org.eclipse.tm.internal.terminal.actions.TerminalActionClearAll; -import org.eclipse.tm.internal.terminal.actions.TerminalActionCopy; -import org.eclipse.tm.internal.terminal.actions.TerminalActionCut; -import org.eclipse.tm.internal.terminal.actions.TerminalActionPaste; -import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectAll; import org.eclipse.tm.internal.terminal.control.ITerminalListener; import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; -import org.eclipse.tm.internal.terminal.view.ITerminalView; +import org.eclipse.tm.terminal.control.actions.AbstractTerminalControlAction; +import org.eclipse.tm.terminal.control.actions.TerminalActionClearAll; +import org.eclipse.tm.terminal.control.actions.TerminalActionCopy; +import org.eclipse.tm.terminal.control.actions.TerminalActionCut; +import org.eclipse.tm.terminal.control.actions.TerminalActionPaste; +import org.eclipse.tm.terminal.control.actions.TerminalActionSelectAll; /** * This is the desktop view wrapper of the System View viewer. */ -public class TerminalViewTab extends Composite implements ITerminalListener, - ITerminalView { +public class TerminalViewTab extends Composite implements ITerminalListener{ public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$ private CTabFolder tabFolder; private Menu menu; private TerminalViewer viewer; private boolean fMenuAboutToShow; - private TerminalAction fActionEditCopy; + private AbstractTerminalControlAction fActionEditCopy; - private TerminalAction fActionEditCut; + private AbstractTerminalControlAction fActionEditCut; - private TerminalAction fActionEditPaste; + private AbstractTerminalControlAction fActionEditPaste; - private TerminalAction fActionEditClearAll; + private AbstractTerminalControlAction fActionEditClearAll; - private TerminalAction fActionEditSelectAll; + private AbstractTerminalControlAction fActionEditSelectAll; protected class TerminalContextMenuHandler implements MenuListener, IMenuListener { public void menuHidden(MenuEvent event) { fMenuAboutToShow = false; - updateEditCopy(); + fActionEditCopy.updateAction(fMenuAboutToShow); } public void menuShown(MenuEvent e) { @@ -95,11 +91,11 @@ public void menuAboutToShow(IMenuManager menuMgr) { fMenuAboutToShow = true; - updateEditCopy(); - updateEditCut(); - updateEditSelectAll(); - updateEditPaste(); - updateEditClearAll(); + fActionEditCopy.updateAction(fMenuAboutToShow); + fActionEditCut.updateAction(fMenuAboutToShow); + fActionEditSelectAll.updateAction(fMenuAboutToShow); + fActionEditPaste.updateAction(fMenuAboutToShow); + fActionEditClearAll.updateAction(fMenuAboutToShow); } } @@ -242,11 +238,31 @@ } protected void setupActions() { - fActionEditCopy = new TerminalActionCopy(this); - fActionEditCut = new TerminalActionCut(this); - fActionEditPaste = new TerminalActionPaste(this); - fActionEditClearAll = new TerminalActionClearAll(this); - fActionEditSelectAll = new TerminalActionSelectAll(this); + fActionEditCopy = new TerminalActionCopy(){ + protected ITerminalViewControl getTarget() { + return getCurrentTerminalViewControl(); + } + }; + fActionEditCut = new TerminalActionCut(){ + protected ITerminalViewControl getTarget() { + return getCurrentTerminalViewControl(); + } + }; + fActionEditPaste = new TerminalActionPaste(){ + protected ITerminalViewControl getTarget() { + return getCurrentTerminalViewControl(); + } + }; + fActionEditClearAll = new TerminalActionClearAll(){ + protected ITerminalViewControl getTarget() { + return getCurrentTerminalViewControl(); + } + }; + fActionEditSelectAll = new TerminalActionSelectAll(){ + protected ITerminalViewControl getTarget() { + return getCurrentTerminalViewControl(); + } + }; } protected void setupContextMenus() { @@ -278,92 +294,6 @@ menuMgr.add(new Separator("Additions")); //$NON-NLS-1$ } - public void onEditCopy() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - String selection = terminalViewControl.getSelection(); - - if (!selection.equals("")) {//$NON-NLS-1$ - terminalViewControl.copy(); - } else { - terminalViewControl.sendKey('\u0003'); - } - } - - public void updateEditCopy() { - boolean bEnabled = true; - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - if (fMenuAboutToShow) { - bEnabled = terminalViewControl.getSelection().length() > 0; - } - - fActionEditCopy.setEnabled(bEnabled); - } - - public void onEditCut() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - terminalViewControl.sendKey('\u0018'); - } - - public void updateEditCut() { - boolean bEnabled; - - bEnabled = !fMenuAboutToShow; - fActionEditCut.setEnabled(bEnabled); - } - - public void onEditPaste() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - terminalViewControl.paste(); - } - - public void updateEditPaste() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - String strText = (String) terminalViewControl.getClipboard() - .getContents(TextTransfer.getInstance()); - - boolean bEnabled = ((strText != null) && (!strText.equals("")));//$NON-NLS-1$ - - fActionEditPaste.setEnabled(bEnabled); - } - - public void onEditClearAll() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - terminalViewControl.clearTerminal(); - } - - public void updateEditClearAll() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - fActionEditClearAll.setEnabled(!terminalViewControl.isEmpty()); - } - - public void onEditSelectAll() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - terminalViewControl.selectAll(); - } - - public void updateEditSelectAll() { - ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); - if (terminalViewControl == null) - return; - fActionEditSelectAll.setEnabled(!terminalViewControl.isEmpty()); - } - private void setTabTitle(IAdaptable root, CTabItem titem) { ISystemViewElementAdapter va = (ISystemViewElementAdapter) root .getAdapter(ISystemViewElementAdapter.class); @@ -420,51 +350,6 @@ } - public boolean hasCommandInputField() { - // TODO Auto-generated method stub - return false; - } - - public boolean isScrollLock() { - // TODO Auto-generated method stub - return false; - } - - public void onTerminalConnect() { - // TODO Auto-generated method stub - - } - - public void onTerminalDisconnect() { - // TODO Auto-generated method stub - - } - - public void onTerminalFontChanged() { - // TODO Auto-generated method stub - - } - - public void onTerminalNewTerminal() { - // TODO Auto-generated method stub - - } - - public void onTerminalSettings() { - // TODO Auto-generated method stub - - } - - public void setCommandInputField(boolean on) { - // TODO Auto-generated method stub - - } - - public void setScrollLock(boolean b) { - // TODO Auto-generated method stub - - } - private void updateWithUniqueTitle(String title, CTabItem currentItem) { CTabItem[] items = tabFolder.getItems(); int increment = 1; Index: src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java,v retrieving revision 1.2 diff -u -r1.2 RSETerminalConnectorImpl.java --- src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java 24 Apr 2008 01:06:41 -0000 1.2 +++ src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java 24 Apr 2008 08:10:43 -0000 @@ -68,7 +68,10 @@ } public void setTerminalSize(int newWidth, int newHeight) { - shell.setTerminalSize(newWidth, newHeight); + if(shell != null) + { + shell.setTerminalSize(newWidth, newHeight); + } } public InputStream getInputStream() { Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.terminals.ui/META-INF/MANIFEST.MF,v retrieving revision 1.2 diff -u -r1.2 MANIFEST.MF --- META-INF/MANIFEST.MF 17 Apr 2008 11:00:38 -0000 1.2 +++ META-INF/MANIFEST.MF 24 Apr 2008 08:10:43 -0000 @@ -12,8 +12,7 @@ org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.subsystems.terminals.core;bundle-version="[0.1.0,0.2.0)", - org.eclipse.tm.terminal;bundle-version="[2.0.0,2.1.0)", - org.eclipse.tm.terminal.view;bundle-version="[2.0.0,2.1.0)" + org.eclipse.tm.terminal;bundle-version="[2.0.0,2.1.0)" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-Vendor: %providerName