diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionClearAll.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionClearAll.java index 400c08bb8e8..65a4a3b38d2 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionClearAll.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionClearAll.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2004, 2009 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 @@ -14,6 +14,7 @@ * 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 + * Uwe Stieber (Wind River) - [260372] [terminal] Certain terminal actions are enabled if no target terminal control is available ********************************************************************************/ package org.eclipse.tm.internal.terminal.control.actions; @@ -47,9 +48,6 @@ public class TerminalActionClearAll extends AbstractTerminalAction { public void updateAction(boolean aboutToShow) { ITerminalViewControl target = getTarget(); - if (target != null) - setEnabled(!target.isEmpty()); - else - setEnabled(false); + setEnabled(target != null && !target.isEmpty()); } } diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCopy.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCopy.java index 3bc2bdcaf11..dabf91dfcb9 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCopy.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCopy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2004, 2009 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 @@ -14,6 +14,7 @@ * 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 + * Uwe Stieber (Wind River) - [260372] [terminal] Certain terminal actions are enabled if no target terminal control is available *******************************************************************************/ package org.eclipse.tm.internal.terminal.control.actions; @@ -54,9 +55,9 @@ public class TerminalActionCopy extends AbstractTerminalAction { } public void updateAction(boolean aboutToShow) { - boolean bEnabled = true; ITerminalViewControl target = getTarget(); - if (aboutToShow && target != null) { + boolean bEnabled = target != null; + if (aboutToShow && bEnabled) { bEnabled = target.getSelection().length() > 0; } setEnabled(bEnabled); diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCut.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCut.java index 50232f168c6..b33d6553f52 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCut.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionCut.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2004, 2009 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 @@ -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 + * Uwe Stieber (Wind River) - [260372] [terminal] Certain terminal actions are enabled if no target terminal control is available *******************************************************************************/ package org.eclipse.tm.internal.terminal.control.actions; @@ -47,9 +48,7 @@ public class TerminalActionCut extends AbstractTerminalAction { } public void updateAction(boolean aboutToShow) { - boolean bEnabled; - - bEnabled = !aboutToShow; - setEnabled(bEnabled); + // Cut is always disabled + setEnabled(false); } } diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionPaste.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionPaste.java index 36d30b0db1c..9f13b82ddf4 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionPaste.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionPaste.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2004, 2009 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 @@ -14,6 +14,7 @@ * 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 + * Uwe Stieber (Wind River) - [260372] [terminal] Certain terminal actions are enabled if no target terminal control is available *******************************************************************************/ package org.eclipse.tm.internal.terminal.control.actions; @@ -50,9 +51,9 @@ public class TerminalActionPaste extends AbstractTerminalAction { } public void updateAction(boolean aboutToShow) { - boolean bEnabled = false; ITerminalViewControl target = getTarget(); - if (target != null) { + boolean bEnabled = target != null; + if (bEnabled) { String strText = (String) target.getClipboard().getContents( TextTransfer.getInstance()); bEnabled = ((strText != null) && (!strText.equals("")) && (target.getState() == TerminalState.CONNECTED));//$NON-NLS-1$ diff --git a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionSelectAll.java b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionSelectAll.java index 08c4aa29e00..08526a80bc0 100644 --- a/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionSelectAll.java +++ b/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/actions/TerminalActionSelectAll.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2004, 2009 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 @@ -14,6 +14,7 @@ * 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 + * Uwe Stieber (Wind River) - [260372] [terminal] Certain terminal actions are enabled if no target terminal control is available *******************************************************************************/ package org.eclipse.tm.internal.terminal.control.actions; @@ -44,9 +45,6 @@ public class TerminalActionSelectAll extends AbstractTerminalAction { public void updateAction(boolean aboutToShow) { ITerminalViewControl target = getTarget(); - if (target != null) - setEnabled(!target.isEmpty()); - else - setEnabled(false); + setEnabled(target != null && !target.isEmpty()); } }