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

bug 240023: [terminal] Get rid of the terminal's "Pin" button

https://bugs.eclipse.org/bugs/show_bug.cgi?id=240023
This commit is contained in:
Michael Scharf 2008-07-08 20:18:16 +00:00
parent 5a485ef094
commit 77a4acc0cf
11 changed files with 91 additions and 110 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

View file

@ -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
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.actions;
@ -24,7 +25,8 @@ public class ActionMessages extends NLS {
static {
NLS.initializeMessages(ActionMessages.class.getName(), ActionMessages.class);
}
public static String NEW_TERMINAL;
public static String NEW_TERMINAL_CONNECTION;
public static String NEW_TERMINAL_VIEW;
public static String CONNECT;
public static String TOGGLE_COMMAND_INPUT_FIELD;
public static String DISCONNECT;
@ -32,7 +34,6 @@ public class ActionMessages extends NLS {
public static String SCROLL_LOCK_0;
public static String SCROLL_LOCK_1;
public static String REMOVE;
public static String PIN;
public static String ConsoleDropDownAction_0;
public static String ConsoleDropDownAction_1;

View file

@ -15,8 +15,10 @@
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
# Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
# Michael Scharf (Wind River) - [172483] switch between connections
# Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
###############################################################################
NEW_TERMINAL = New Terminal
NEW_TERMINAL_CONNECTION = New Terminal Connection...
NEW_TERMINAL_VIEW = New Terminal View
CONNECT = Connect
DISCONNECT = Disconnect
SETTINGS_ELLIPSE = Settings...
@ -25,7 +27,6 @@ SCROLL_LOCK_1 = Scroll Lock
SETTINGS = Settings
TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field
REMOVE = Remove Terminal
PIN = Pin Terminal
ConsoleDropDownAction_0=Select Connection
ConsoleDropDownAction_1=Display Selected Connections

View file

@ -13,9 +13,16 @@
* Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.tm.internal.terminal.view.ITerminalView;
import org.eclipse.tm.internal.terminal.view.ImageConsts;
@ -24,23 +31,53 @@ import org.eclipse.tm.internal.terminal.view.ImageConsts;
*
* @author Fran Litterio <francis.litterio@windriver.com>
*/
public class TerminalActionNewTerminal extends TerminalAction
{
/**
* UNDER CONSTRUCTION
*/
public class TerminalActionNewTerminal extends TerminalAction implements IMenuCreator {
private Menu fMenu;
public TerminalActionNewTerminal(ITerminalView target)
{
super(target, TerminalActionNewTerminal.class.getName());
setupAction(ActionMessages.NEW_TERMINAL,
ActionMessages.NEW_TERMINAL,
setupAction(ActionMessages.NEW_TERMINAL_CONNECTION,
ActionMessages.NEW_TERMINAL_CONNECTION,
ImageConsts.IMAGE_NEW_TERMINAL,
ImageConsts.IMAGE_NEW_TERMINAL,
ImageConsts.IMAGE_NEW_TERMINAL,
true);
setMenuCreator(this);
}
public void run() {
fTarget.onTerminalNewTerminal();
}
public void dispose() {
if (fMenu != null) {
fMenu.dispose();
}
}
public Menu getMenu(Control parent) {
if(fMenu==null) {
fMenu= new Menu(parent);
addActionToMenu(fMenu,
new Action(ActionMessages.NEW_TERMINAL_CONNECTION) {
public void run() {
fTarget.onTerminalNewTerminal();
}
});
addActionToMenu(fMenu,
new Action(ActionMessages.NEW_TERMINAL_VIEW) {
public void run() {
fTarget.onTerminalNewView();
}
});
}
return fMenu;
}
protected void addActionToMenu(Menu parent, IAction action) {
ActionContributionItem item = new ActionContributionItem(action);
item.fill(parent, -1);
}
public Menu getMenu(Menu parent) {
return null;
}
}

View file

@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright (c) 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
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
*******************************************************************************/
package org.eclipse.tm.internal.terminal.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.tm.internal.terminal.view.ITerminalView;
import org.eclipse.tm.internal.terminal.view.ImageConsts;
public class TerminalActionPin extends TerminalAction
{
public TerminalActionPin(ITerminalView target)
{
super(target,
TerminalActionPin.class.getName(),IAction.AS_RADIO_BUTTON);
setupAction(ActionMessages.PIN,
ActionMessages.PIN,
ImageConsts.IMAGE_CLCL_PIN,
ImageConsts.IMAGE_ELCL_PIN,
ImageConsts.IMAGE_DLCL_PIN,
true);
setChecked(fTarget.isPinned());
}
public void run() {
fTarget.setPinned(!fTarget.isPinned());
setChecked(fTarget.isPinned());
}
}

View file

@ -9,24 +9,26 @@
* Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [227537] moved actions from terminal.view to terminal plugin
* Michael Scharf (Wind River) - [172483] switch between connections
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
public interface ITerminalView {
/**
* Display a new Terminal view. This method is called when the user clicks the New
* Terminal button in any Terminal view's toolbar.
* Create a new terminal connection within the view.
*/
public void onTerminalNewTerminal();
public void onTerminalConnect();
public void onTerminalDisconnect();
public void onTerminalSettings();
public void onTerminalFontChanged();
public boolean hasCommandInputField();
public void setCommandInputField(boolean on);
public boolean isScrollLock();
public void setScrollLock(boolean b);
public void setPinned(boolean pin);
public boolean isPinned();
void onTerminalNewTerminal();
/**
* Create a new Terminal view.
*/
void onTerminalNewView();
void onTerminalConnect();
void onTerminalDisconnect();
void onTerminalSettings();
void onTerminalFontChanged();
boolean hasCommandInputField();
void setCommandInputField(boolean on);
boolean isScrollLock();
void setScrollLock(boolean b);
}

View file

@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
* Michael Scharf (Wind River) - [172483] added some more icons
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -33,20 +34,17 @@ public interface ImageConsts
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_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_CLCL_PIN = "ImageClclPin"; //$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_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_PIN = "ImageDlclPin"; //$NON-NLS-1$
public static final String IMAGE_DLCL_REMOVE = "ImageDlclRemove"; //$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_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_ELCL_PIN = "ImageElclPin"; //$NON-NLS-1$
public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$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$

View file

@ -20,6 +20,7 @@
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
* Martin Oberhuber (Wind River) - [168186] Add Terminal User Docs
* Michael Scharf (Wind River) - [172483] switch between connections
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -49,7 +50,6 @@ import org.eclipse.tm.internal.terminal.actions.TerminalAction;
import org.eclipse.tm.internal.terminal.actions.TerminalActionConnect;
import org.eclipse.tm.internal.terminal.actions.TerminalActionDisconnect;
import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal;
import org.eclipse.tm.internal.terminal.actions.TerminalActionPin;
import org.eclipse.tm.internal.terminal.actions.TerminalActionRemove;
import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectionDropDown;
import org.eclipse.tm.internal.terminal.actions.TerminalActionSettings;
@ -82,8 +82,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
private static final String STORE_SETTING_SUMMARY = "SettingSummary"; //$NON-NLS-1$
private static final String STORE_PINNED = "Pinned"; //$NON-NLS-1$
private static final String STORE_TITLE = "Title"; //$NON-NLS-1$
public static final String FONT_DEFINITION = "terminal.views.view.font.definition"; //$NON-NLS-1$
@ -119,7 +117,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
protected TerminalPropertyChangeHandler fPropertyChangeHandler;
protected Action fActionTerminalDropDown;
protected Action fActionTerminalPin;
protected Action fActionTerminalRemove;
protected boolean fMenuAboutToShow;
@ -142,8 +139,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
private PageBook fPageBook;
private boolean fPinned=true;
/**
* This listener updates both, the view and the
* ITerminalViewConnection.
@ -247,7 +242,13 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
*/
public void onTerminalNewTerminal() {
Logger.log("creating new Terminal instance."); //$NON-NLS-1$
if(isPinned()) {
setupControls();
if(newConnection()==null) {
fMultiConnectionManager.removeActive();
}
}
public void onTerminalNewView() {
try {
// The second argument to showView() is a unique String identifying the
// secondary view instance. If it ever matches a previously used secondary
@ -265,12 +266,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
} catch (PartInitException ex) {
Logger.logException(ex);
}
} else {
setupControls();
if(newConnection()==null) {
fMultiConnectionManager.removeActive();
}
}
}
@ -495,13 +490,9 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
fStore=new SettingsStore(memento);
// have we stored the pinned status?
if(fStore.get(STORE_PINNED)!=null)
setPinned("true".equals(fStore.get(STORE_PINNED))); //$NON-NLS-1$
}
public void saveState(IMemento memento) {
super.saveState(memento);
fStore.put(STORE_PINNED, isPinned()?"true":"false"); //$NON-NLS-1$ //$NON-NLS-2$
fStore.put(STORE_TITLE,getPartName());
fMultiConnectionManager.saveState(new SettingStorePrefixDecorator(fStore,"connectionManager")); //$NON-NLS-1$
fStore.saveState(memento);
@ -512,8 +503,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
protected void setupActions() {
fActionTerminalDropDown = new TerminalActionSelectionDropDown(fMultiConnectionManager);
fActionTerminalPin=new TerminalActionPin(this);
fActionTerminalPin.setChecked(isPinned());
fActionTerminalRemove=new TerminalActionRemove(fMultiConnectionManager);
fActionTerminalNewTerminal = new TerminalActionNewTerminal(this);
// fActionTerminalScrollLock = new TerminalActionScrollLock(this);
@ -536,7 +525,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
toolBarMgr.add(fActionTerminalSettings);
toolBarMgr.add(fActionToggleCommandInputField);
toolBarMgr.add(new Separator("fixedGroup")); //$NON-NLS-1$
toolBarMgr.add(fActionTerminalPin);
toolBarMgr.add(fActionTerminalDropDown);
toolBarMgr.add(fActionTerminalNewTerminal);
toolBarMgr.add(fActionTerminalRemove);
@ -649,14 +637,6 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
updateStatus();
setPartName(getActiveConnection().getPartName());
}
public void setPinned(boolean pinned) {
fPinned=pinned;
}
public boolean isPinned() {
return fPinned;
}
/**
* TODO REMOVE This code (added 2008-06-11)
* Legacy code to real the old state. Once the state of the

View file

@ -16,6 +16,7 @@
* Anna Dushistova (MontaVista) - [227537] moved actions from terminal.view to terminal plugin
* Martin Oberhuber (Wind River) - [168186] Add Terminal User Docs
* Michael Scharf (Wind River) - [172483] switch between connections
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -54,7 +55,6 @@ public class TerminalViewPlugin extends AbstractUIPlugin {
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_PIN, "pin.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
@ -67,7 +67,6 @@ public class TerminalViewPlugin extends AbstractUIPlugin {
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_PIN, "pin.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_ELCL_REMOVE, "rem_co.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
@ -81,7 +80,6 @@ public class TerminalViewPlugin extends AbstractUIPlugin {
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_PIN, "pin.gif"); //$NON-NLS-1$
map.put(ImageConsts.IMAGE_DLCL_REMOVE, "rem_co.gif"); //$NON-NLS-1$
loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);