1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

[227537] moved actions from terminal.view to terminal plugin (apply Patch from Anna Dushistova)

This commit is contained in:
Martin Oberhuber 2008-04-25 20:14:53 +00:00
parent 65cd604525
commit 6cbd7e602d
25 changed files with 540 additions and 301 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins * Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.actions; package org.eclipse.tm.internal.terminal.actions;
@ -30,11 +31,6 @@ public class ActionMessages extends NLS {
public static String SCROLL_LOCK_0; public static String SCROLL_LOCK_0;
public static String SCROLL_LOCK_1; 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; public static String SETTINGS;
} }

View file

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. # Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
# Contributors: # Contributors:
# Michael Scharf (Wind River) - split into core, view and connector plugins # Michael Scharf (Wind River) - split into core, view and connector plugins
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified # Martin Oberhuber (Wind River) - fixed copyright headers and beautified
# Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
############################################################################### ###############################################################################
NEW_TERMINAL = New Terminal NEW_TERMINAL = New Terminal
CONNECT = Connect CONNECT = Connect
@ -20,10 +21,5 @@ DISCONNECT = Disconnect
SETTINGS_ELLIPSE = Settings... SETTINGS_ELLIPSE = Settings...
SCROLL_LOCK_0 = Scroll &Lock SCROLL_LOCK_0 = Scroll &Lock
SCROLL_LOCK_1 = Scroll Lock SCROLL_LOCK_1 = Scroll Lock
COPY = Copy
CUT = Cut
PASTE = Paste
SELECTALL = Select All
CLEARALL = Clear Terminal
SETTINGS = Settings SETTINGS = Settings
TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Michael Scharf (Wind River) - initial API and implementation * Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.view; package org.eclipse.tm.internal.terminal.view;
@ -21,11 +22,6 @@ public interface ITerminalView {
public void onTerminalDisconnect(); public void onTerminalDisconnect();
public void onTerminalSettings(); public void onTerminalSettings();
public void onTerminalFontChanged(); public void onTerminalFontChanged();
public void onEditCopy();
public void onEditCut();
public void onEditPaste();
public void onEditClearAll();
public void onEditSelectAll();
public boolean hasCommandInputField(); public boolean hasCommandInputField();
public void setCommandInputField(boolean on); public void setCommandInputField(boolean on);
public boolean isScrollLock(); public boolean isScrollLock();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - extracted from TerminalConsts * Michael Scharf (Wind River) - extracted from TerminalConsts
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.view; package org.eclipse.tm.internal.terminal.view;
@ -33,19 +34,16 @@ public interface ImageConsts
public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$ 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_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$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_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$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_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$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_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$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_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$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_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_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$ public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$

View file

@ -17,6 +17,7 @@
* Michael Scharf (Wind River) - [209656] ClassCastException in TerminalView under Eclipse-3.4M3 * 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) - [189774] Ctrl+V does not work in the command input field.
* Michael Scharf (Wind River) - [217999] Duplicate context menu entries in Terminal * Michael Scharf (Wind River) - [217999] Duplicate context menu entries in Terminal
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.view; package org.eclipse.tm.internal.terminal.view;
@ -33,7 +34,6 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.events.MenuEvent; import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener; import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -41,20 +41,20 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.tm.internal.terminal.actions.TerminalAction; 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.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.TerminalActionDisconnect;
import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal; 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.TerminalActionSettings;
import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField; import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField;
import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory; import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
import org.eclipse.tm.internal.terminal.control.ITerminalListener; import org.eclipse.tm.internal.terminal.control.ITerminalListener;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory; import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCut;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.Logger;
@ -92,15 +92,15 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
protected TerminalAction fActionTerminalSettings; protected TerminalAction fActionTerminalSettings;
protected TerminalAction fActionEditCopy; protected TerminalActionCopy fActionEditCopy;
protected TerminalAction fActionEditCut; protected TerminalActionCut fActionEditCut;
protected TerminalAction fActionEditPaste; protected TerminalActionPaste fActionEditPaste;
protected TerminalAction fActionEditClearAll; protected TerminalActionClearAll fActionEditClearAll;
protected TerminalAction fActionEditSelectAll; protected TerminalActionSelectAll fActionEditSelectAll;
protected TerminalAction fActionToggleCommandInputField; protected TerminalAction fActionToggleCommandInputField;
@ -233,9 +233,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
return fCtlTerminal.getState()==TerminalState.CONNECTING return fCtlTerminal.getState()==TerminalState.CONNECTING
|| fCtlTerminal.getState()==TerminalState.OPENED; || fCtlTerminal.getState()==TerminalState.OPENED;
} }
private boolean isConnected() {
return fCtlTerminal.getState()==TerminalState.CONNECTED;
}
public void onTerminalDisconnect() { public void onTerminalDisconnect() {
fCtlTerminal.disconnectTerminal(); fCtlTerminal.disconnectTerminal();
} }
@ -356,65 +354,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
fCtlTerminal.setFont(JFaceResources.getFont(FONT_DEFINITION)); fCtlTerminal.setFont(JFaceResources.getFont(FONT_DEFINITION));
} }
public void onEditCopy() {
String selection=fCtlTerminal.getSelection();
if (!selection.equals("")) {//$NON-NLS-1$
fCtlTerminal.copy();
} else {
fCtlTerminal.sendKey('\u0003');
}
}
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 // ViewPart interface
public void createPartControl(Composite wndParent) { public void createPartControl(Composite wndParent) {
@ -511,11 +450,11 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
fActionTerminalConnect = new TerminalActionConnect(this); fActionTerminalConnect = new TerminalActionConnect(this);
fActionTerminalDisconnect = new TerminalActionDisconnect(this); fActionTerminalDisconnect = new TerminalActionDisconnect(this);
fActionTerminalSettings = new TerminalActionSettings(this); fActionTerminalSettings = new TerminalActionSettings(this);
fActionEditCopy = new TerminalActionCopy(this); fActionEditCopy = new TerminalActionCopy(fCtlTerminal);
fActionEditCut = new TerminalActionCut(this); fActionEditCut = new TerminalActionCut(fCtlTerminal);
fActionEditPaste = new TerminalActionPaste(this); fActionEditPaste = new TerminalActionPaste(fCtlTerminal);
fActionEditClearAll = new TerminalActionClearAll(this); fActionEditClearAll = new TerminalActionClearAll(fCtlTerminal);
fActionEditSelectAll = new TerminalActionSelectAll(this); fActionEditSelectAll = new TerminalActionSelectAll(fCtlTerminal);
fActionToggleCommandInputField = new TerminalActionToggleCommandInputField(this); fActionToggleCommandInputField = new TerminalActionToggleCommandInputField(this);
} }
protected void setupLocalToolBars() { protected void setupLocalToolBars() {
@ -569,7 +508,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
protected class TerminalContextMenuHandler implements MenuListener, IMenuListener { protected class TerminalContextMenuHandler implements MenuListener, IMenuListener {
public void menuHidden(MenuEvent event) { public void menuHidden(MenuEvent event) {
fMenuAboutToShow = false; fMenuAboutToShow = false;
updateEditCopy(); fActionEditCopy.updateAction(fMenuAboutToShow);
} }
public void menuShown(MenuEvent e) { public void menuShown(MenuEvent e) {
@ -577,11 +516,11 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
} }
public void menuAboutToShow(IMenuManager menuMgr) { public void menuAboutToShow(IMenuManager menuMgr) {
fMenuAboutToShow = true; fMenuAboutToShow = true;
updateEditCopy(); fActionEditCopy.updateAction(fMenuAboutToShow);
updateEditCut(); fActionEditCut.updateAction(fMenuAboutToShow);
updateEditSelectAll(); fActionEditSelectAll.updateAction(fMenuAboutToShow);
updateEditPaste(); fActionEditPaste.updateAction(fMenuAboutToShow);
updateEditClearAll(); fActionEditClearAll.updateAction(fMenuAboutToShow);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins * Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.view; package org.eclipse.tm.internal.terminal.view;
@ -49,7 +50,6 @@ public class TerminalViewPlugin extends AbstractUIPlugin {
map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ 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_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_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); loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
@ -62,7 +62,6 @@ public class TerminalViewPlugin extends AbstractUIPlugin {
map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ 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_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_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); loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
@ -75,7 +74,6 @@ public class TerminalViewPlugin extends AbstractUIPlugin {
map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ 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_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_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); loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);

View file

@ -15,10 +15,20 @@ Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
Bundle-ClassPath: . Bundle-ClassPath: .
Export-Package: org.eclipse.tm.internal.terminal.connector;x-friends:="org.eclipse.tm.terminal.test", Export-Package: org.eclipse.tm.internal.terminal.connector;x-friends:="org.eclipse.tm.terminal.test",
org.eclipse.tm.internal.terminal.control;x-friends:="org.eclipse.tm.terminal.view", org.eclipse.tm.internal.terminal.control;x-friends:="org.eclipse.tm.terminal.view",
org.eclipse.tm.internal.terminal.control.actions;x-friends:="org.eclipse.tm.terminal.view",
org.eclipse.tm.internal.terminal.control.impl;x-friends:="org.eclipse.tm.terminal.test", 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.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.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;
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", 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.internal.terminal.textcanvas;x-friends:="org.eclipse.tm.terminal.test",
org.eclipse.tm.terminal.model org.eclipse.tm.terminal.model

View file

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. # Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
# Contributors: # Contributors:
# Michael Scharf (Wind River) - split into core, view and connector plugins # Michael Scharf (Wind River) - split into core, view and connector plugins
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified # Martin Oberhuber (Wind River) - fixed copyright headers and beautified
# Anna Dushistova (MontaVista) - added icons
############################################################################### ###############################################################################
bin.includes = .,\ bin.includes = .,\
META-INF/,\ META-INF/,\
@ -20,8 +21,12 @@ bin.includes = .,\
plugin.properties,\ plugin.properties,\
.options,\ .options,\
README.txt,\ README.txt,\
about.html,about.ini,about.mappings,about.properties,\ about.html,\
eclipse32.png about.ini,\
about.mappings,\
about.properties,\
eclipse32.png,\
icons/
source.. = src/ source.. = src/
output.. = bin/ output.. = bin/

View file

@ -0,0 +1,101 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 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.internal.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 AbstractTerminalAction extends Action {
private final ITerminalViewControl fTarget;
public AbstractTerminalAction(String strId) {
this(null, strId, 0);
}
public AbstractTerminalAction(ITerminalViewControl target,
String strId) {
this(target, strId, 0);
}
public AbstractTerminalAction(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);
}
}
/**
* Return the terminal instance on which the action should operate.
*
* @return the terminal instance on which the action should operate.
*/
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) {
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,27 +13,22 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins * Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.actions; package org.eclipse.tm.internal.terminal.control.actions;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.osgi.util.NLS;
import org.eclipse.tm.internal.terminal.view.ITerminalView;
public class TerminalActionSelectAll extends TerminalAction public class ActionMessages extends NLS {
{ static {
public TerminalActionSelectAll(ITerminalView target) NLS.initializeMessages(ActionMessages.class.getName(),
{ ActionMessages.class);
super(target,
TerminalActionSelectAll.class.getName());
setupAction(ActionMessages.SELECTALL,
ActionMessages.SELECTALL,
(ImageDescriptor)null,
null,
null,
false);
}
public void run() {
fTarget.onEditSelectAll();
} }
public static String COPY;
public static String CUT;
public static String PASTE;
public static String SELECTALL;
public static String CLEARALL;
} }

View file

@ -0,0 +1,22 @@
###############################################################################
# Copyright (c) 2003, 2008 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) - [227537] moved actions from terminal.view to terminal plugin
###############################################################################
COPY = Copy
CUT = Cut
PASTE = Paste
SELECTALL = Select All
CLEARALL = Clear Terminal

View file

@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2003, 2008 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) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/
package org.eclipse.tm.internal.terminal.control.actions;
public interface ImageConsts {
public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
public final static String IMAGE_DIR_LOCALTOOL = IMAGE_DIR_ROOT + "clcl16/"; // basic colors - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_DLCL = IMAGE_DIR_ROOT + "dlcl16/"; // disabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_ELCL = IMAGE_DIR_ROOT+ "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$
}

View file

@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 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) - [227537] moved actions from terminal.view to terminal plugin
********************************************************************************/
package org.eclipse.tm.internal.terminal.control.actions;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
public class TerminalActionClearAll extends AbstractTerminalAction {
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);
}
}

View file

@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 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) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/
package org.eclipse.tm.internal.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 AbstractTerminalAction {
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);
}
}

View file

@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 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.control.actions;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
public class TerminalActionCut extends AbstractTerminalAction {
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);
}
}

View file

@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 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) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/
package org.eclipse.tm.internal.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 AbstractTerminalAction {
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);
}
}

View file

@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 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) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/
package org.eclipse.tm.internal.terminal.control.actions;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
public class TerminalActionSelectAll extends AbstractTerminalAction {
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);
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,10 +13,17 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins * Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.control.impl; package org.eclipse.tm.internal.terminal.control.impl;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.tm.internal.terminal.control.actions.ImageConsts;
import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.Logger;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
@ -55,4 +62,23 @@ public class TerminalPlugin extends AbstractUIPlugin {
return new Boolean(strEnabled).booleanValue(); return new Boolean(strEnabled).booleanValue();
} }
protected void initializeImageRegistry(ImageRegistry imageRegistry) {
try {
// Local toolbars
putImageInRegistry(imageRegistry, ImageConsts.IMAGE_CLCL_CLEAR_ALL, ImageConsts.IMAGE_DIR_LOCALTOOL + "clear_co.gif"); //$NON-NLS-1$
// Enabled local toolbars
putImageInRegistry(imageRegistry, ImageConsts.IMAGE_ELCL_CLEAR_ALL, ImageConsts.IMAGE_DIR_ELCL + "clear_co.gif"); //$NON-NLS-1$
// Disabled local toolbars
putImageInRegistry(imageRegistry, ImageConsts.IMAGE_DLCL_CLEAR_ALL, ImageConsts.IMAGE_DIR_DLCL + "clear_co.gif"); //$NON-NLS-1$
} catch (MalformedURLException malformedURLException) {
malformedURLException.printStackTrace();
}
}
protected void putImageInRegistry(ImageRegistry imageRegistry, String strKey, String relativePath) throws MalformedURLException {
URL url = TerminalPlugin.getDefault().getBundle().getEntry(relativePath);
ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url);
imageRegistry.put(strKey, imageDescriptor);
}
} }