1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 12:05:21 +02:00

[fix] Bug 260372 - [terminal] Certain terminal actions are enabled if no target terminal control is available

This commit is contained in:
Uwe Stieber 2009-01-26 14:16:15 +00:00
parent 728c02223c
commit 995c8f06e7
5 changed files with 18 additions and 21 deletions

View file

@ -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 * 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
@ -14,6 +14,7 @@
* 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 * 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; package org.eclipse.tm.internal.terminal.control.actions;
@ -47,9 +48,6 @@ public class TerminalActionClearAll extends AbstractTerminalAction {
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) setEnabled(target != null && !target.isEmpty());
setEnabled(!target.isEmpty());
else
setEnabled(false);
} }
} }

View file

@ -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 * 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
@ -14,6 +14,7 @@
* 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 * 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; package org.eclipse.tm.internal.terminal.control.actions;
@ -54,9 +55,9 @@ public class TerminalActionCopy extends AbstractTerminalAction {
} }
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
boolean bEnabled = true;
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (aboutToShow && target != null) { boolean bEnabled = target != null;
if (aboutToShow && bEnabled) {
bEnabled = target.getSelection().length() > 0; bEnabled = target.getSelection().length() > 0;
} }
setEnabled(bEnabled); setEnabled(bEnabled);

View file

@ -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 * 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
* 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; package org.eclipse.tm.internal.terminal.control.actions;
@ -47,9 +48,7 @@ public class TerminalActionCut extends AbstractTerminalAction {
} }
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
boolean bEnabled; // Cut is always disabled
setEnabled(false);
bEnabled = !aboutToShow;
setEnabled(bEnabled);
} }
} }

View file

@ -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 * 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
@ -14,6 +14,7 @@
* 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 * 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; package org.eclipse.tm.internal.terminal.control.actions;
@ -50,9 +51,9 @@ public class TerminalActionPaste extends AbstractTerminalAction {
} }
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
boolean bEnabled = false;
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) { boolean bEnabled = target != null;
if (bEnabled) {
String strText = (String) target.getClipboard().getContents( String strText = (String) target.getClipboard().getContents(
TextTransfer.getInstance()); TextTransfer.getInstance());
bEnabled = ((strText != null) && (!strText.equals("")) && (target.getState() == TerminalState.CONNECTED));//$NON-NLS-1$ bEnabled = ((strText != null) && (!strText.equals("")) && (target.getState() == TerminalState.CONNECTED));//$NON-NLS-1$

View file

@ -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 * 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
@ -14,6 +14,7 @@
* 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 * 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; package org.eclipse.tm.internal.terminal.control.actions;
@ -44,9 +45,6 @@ public class TerminalActionSelectAll extends AbstractTerminalAction {
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) setEnabled(target != null && !target.isEmpty());
setEnabled(!target.isEmpty());
else
setEnabled(false);
} }
} }