View | Details | Raw Unified | Return to bug 172483 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tm/internal/terminal/view/TerminalView.java (-23 / +93 lines)
Lines 26-31 Link Here
26
import java.util.Set;
26
import java.util.Set;
27
27
28
import org.eclipse.core.runtime.Preferences;
28
import org.eclipse.core.runtime.Preferences;
29
import org.eclipse.jface.action.Action;
29
import org.eclipse.jface.action.IMenuListener;
30
import org.eclipse.jface.action.IMenuListener;
30
import org.eclipse.jface.action.IMenuManager;
31
import org.eclipse.jface.action.IMenuManager;
31
import org.eclipse.jface.action.IToolBarManager;
32
import org.eclipse.jface.action.IToolBarManager;
Lines 35-40 Link Here
35
import org.eclipse.jface.util.IPropertyChangeListener;
36
import org.eclipse.jface.util.IPropertyChangeListener;
36
import org.eclipse.jface.util.PropertyChangeEvent;
37
import org.eclipse.jface.util.PropertyChangeEvent;
37
import org.eclipse.jface.window.Window;
38
import org.eclipse.jface.window.Window;
39
import org.eclipse.swt.SWT;
38
import org.eclipse.swt.events.MenuEvent;
40
import org.eclipse.swt.events.MenuEvent;
39
import org.eclipse.swt.events.MenuListener;
41
import org.eclipse.swt.events.MenuListener;
40
import org.eclipse.swt.widgets.Composite;
42
import org.eclipse.swt.widgets.Composite;
Lines 45-50 Link Here
45
import org.eclipse.tm.internal.terminal.actions.TerminalActionConnect;
47
import org.eclipse.tm.internal.terminal.actions.TerminalActionConnect;
46
import org.eclipse.tm.internal.terminal.actions.TerminalActionDisconnect;
48
import org.eclipse.tm.internal.terminal.actions.TerminalActionDisconnect;
47
import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal;
49
import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal;
50
import org.eclipse.tm.internal.terminal.actions.TerminalActionPin;
51
import org.eclipse.tm.internal.terminal.actions.TerminalActionRemove;
52
import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectionDropDown;
48
import org.eclipse.tm.internal.terminal.actions.TerminalActionSettings;
53
import org.eclipse.tm.internal.terminal.actions.TerminalActionSettings;
49
import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField;
54
import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField;
50
import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
55
import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
Lines 61-66 Link Here
61
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
66
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
62
import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
67
import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
63
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
68
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
69
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.ITerminalViewConnectionFactory;
70
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.TerminalViewConnectionListener;
64
import org.eclipse.ui.IMemento;
71
import org.eclipse.ui.IMemento;
65
import org.eclipse.ui.IViewReference;
72
import org.eclipse.ui.IViewReference;
66
import org.eclipse.ui.IViewSite;
73
import org.eclipse.ui.IViewSite;
Lines 69-75 Link Here
69
import org.eclipse.ui.PlatformUI;
76
import org.eclipse.ui.PlatformUI;
70
import org.eclipse.ui.part.ViewPart;
77
import org.eclipse.ui.part.ViewPart;
71
78
72
public class TerminalView extends ViewPart implements ITerminalView, ITerminalListener {
79
public class TerminalView extends ViewPart implements ITerminalView, ITerminalListener, TerminalViewConnectionListener {
73
    private static final String STORE_CONNECTION_TYPE = "ConnectionType"; //$NON-NLS-1$
80
    private static final String STORE_CONNECTION_TYPE = "ConnectionType"; //$NON-NLS-1$
74
81
75
    private static final String STORE_SETTING_SUMMARY = "SettingSummary"; //$NON-NLS-1$
82
    private static final String STORE_SETTING_SUMMARY = "SettingSummary"; //$NON-NLS-1$
Lines 108-119 Link Here
108
115
109
	protected TerminalPropertyChangeHandler fPropertyChangeHandler;
116
	protected TerminalPropertyChangeHandler fPropertyChangeHandler;
110
117
118
	protected Action fActionTerminalDropDown;
119
	protected Action fActionTerminalPin;
120
	protected Action fActionTerminalRemove;
121
111
	protected boolean fMenuAboutToShow;
122
	protected boolean fMenuAboutToShow;
112
123
113
	private SettingsStore fStore;
124
	private SettingsStore fStore;
114
125
115
	private CommandInputFieldWithHistory fCommandInputField;
126
	private CommandInputFieldWithHistory fCommandInputField;
116
127
128
	private final TerminalViewConnectionManager fMultiConnectionManager=new TerminalViewConnectionManager();
117
	/**
129
	/**
118
	 * Listens to changes in the preferences
130
	 * Listens to changes in the preferences
119
	 */
131
	 */
Lines 126-134 Link Here
126
			}
138
			}
127
		}
139
		}
128
	};
140
	};
141
142
	private PageBook fPageBook;
143
144
	private boolean fPinned=true;
145
129
	public TerminalView() {
146
	public TerminalView() {
130
		Logger
147
		Logger
131
				.log("==============================================================="); //$NON-NLS-1$
148
				.log("==============================================================="); //$NON-NLS-1$
149
		fMultiConnectionManager.addListener(this);
132
	}
150
	}
133
151
134
	String findUniqueTitle(String title) {
152
	String findUniqueTitle(String title) {
Lines 189-214 Link Here
189
	 */
207
	 */
190
	public void onTerminalNewTerminal() {
208
	public void onTerminalNewTerminal() {
191
		Logger.log("creating new Terminal instance."); //$NON-NLS-1$
209
		Logger.log("creating new Terminal instance."); //$NON-NLS-1$
192
210
		if(fPinned) {
193
		try {
211
			try {
194
			// The second argument to showView() is a unique String identifying the
212
				// The second argument to showView() is a unique String identifying the
195
			// secondary view instance.  If it ever matches a previously used secondary
213
				// secondary view instance.  If it ever matches a previously used secondary
196
			// view identifier, then this call will not create a new Terminal view,
214
				// view identifier, then this call will not create a new Terminal view,
197
			// which is undesirable.  Therefore, we append the current time in
215
				// which is undesirable.  Therefore, we append the current time in
198
			// milliseconds to the secondary view identifier to ensure it is always
216
				// milliseconds to the secondary view identifier to ensure it is always
199
			// unique.  This code runs only when the user clicks the New Terminal
217
				// unique.  This code runs only when the user clicks the New Terminal
200
			// button, so there is no risk that this code will run twice in a single
218
				// button, so there is no risk that this code will run twice in a single
201
			// millisecond.
219
				// millisecond.
202
220
203
			getSite().getPage().showView(
221
				getSite().getPage().showView(
204
					"org.eclipse.tm.terminal.view.TerminalView",//$NON-NLS-1$
222
						"org.eclipse.tm.terminal.view.TerminalView",//$NON-NLS-1$
205
					"SecondaryTerminal" + System.currentTimeMillis(), //$NON-NLS-1$
223
						"SecondaryTerminal" + System.currentTimeMillis(), //$NON-NLS-1$
206
					IWorkbenchPage.VIEW_ACTIVATE);
224
						IWorkbenchPage.VIEW_ACTIVATE);
207
		} catch (PartInitException ex) {
225
			} catch (PartInitException ex) {
208
			Logger.logException(ex);
226
				Logger.logException(ex);
227
			}
228
		} else {
229
			setupControls();
230
			onTerminalSettings();
209
		}
231
		}
210
	}
232
	}
211
233
234
	
212
	public void onTerminalConnect() {
235
	public void onTerminalConnect() {
213
		//if (isConnected())
236
		//if (isConnected())
214
		if (fCtlTerminal.getState()!=TerminalState.CLOSED)
237
		if (fCtlTerminal.getState()!=TerminalState.CLOSED)
Lines 363-369 Link Here
363
		// sequence.
386
		// sequence.
364
387
365
		setPartName(findUniqueTitle(ViewMessages.PROP_TITLE));
388
		setPartName(findUniqueTitle(ViewMessages.PROP_TITLE));
366
		setupControls(wndParent);
389
		fPageBook=new PageBook(wndParent,SWT.NONE);
390
		ISettingsStore s=new SettingStorePrefixDecorator(fStore,"connectionManager"); //$NON-NLS-1$
391
		fMultiConnectionManager.loadState(s,new ITerminalViewConnectionFactory() {
392
			public ITerminalViewConnection create() {
393
				return makeViewConnection();
394
			}
395
		});
396
		// if there is no connection loaded, create at least one
397
		if(fMultiConnectionManager.size()==0) {
398
			setupControls();
399
			fPageBook.showPage(fCtlTerminal.getRootControl());
400
		}
367
		setupActions();
401
		setupActions();
368
		setupLocalToolBars();
402
		setupLocalToolBars();
369
		setupContextMenus();
403
		setupContextMenus();
Lines 393-402 Link Here
393
	/**
427
	/**
394
	 * This method creates the top-level control for the Terminal view.
428
	 * This method creates the top-level control for the Terminal view.
395
	 */
429
	 */
396
	protected void setupControls(Composite wndParent) {
430
	protected void setupControls() {
397
		ITerminalConnector[] connectors = makeConnectors();
431
		ITerminalViewConnection conn = makeViewConnection();
398
		fCtlTerminal = TerminalViewControlFactory.makeControl(this, wndParent, connectors);
432
		fMultiConnectionManager.addConnection(conn);
433
		fMultiConnectionManager.setConnection(conn);
434
	}
399
435
436
	private ITerminalViewConnection makeViewConnection() {
437
		ITerminalConnector[] connectors = makeConnectors();
438
		fCtlTerminal = TerminalViewControlFactory.makeControl(this, fPageBook, connectors);
439
		ITerminalViewConnection conn = new TerminalViewConnection(fCtlTerminal);
400
		String connectionType=fStore.get(STORE_CONNECTION_TYPE);
440
		String connectionType=fStore.get(STORE_CONNECTION_TYPE);
401
		for (int i = 0; i < connectors.length; i++) {
441
		for (int i = 0; i < connectors.length; i++) {
402
			connectors[i].load(getStore(connectors[i]));
442
			connectors[i].load(getStore(connectors[i]));
Lines 411-416 Link Here
411
		String title=fStore.get(STORE_TITLE);
451
		String title=fStore.get(STORE_TITLE);
412
		if(title!=null && title.length()>0)
452
		if(title!=null && title.length()>0)
413
			setPartName(title);
453
			setPartName(title);
454
		return conn;
414
	}
455
	}
415
456
416
	/**
457
	/**
Lines 443-448 Link Here
443
		fStore.put(STORE_HAS_COMMAND_INPUT_FIELD,hasCommandInputField()?"true":"false");   //$NON-NLS-1$//$NON-NLS-2$
484
		fStore.put(STORE_HAS_COMMAND_INPUT_FIELD,hasCommandInputField()?"true":"false");   //$NON-NLS-1$//$NON-NLS-2$
444
		fStore.put(STORE_SETTING_SUMMARY, getSettingsSummary());
485
		fStore.put(STORE_SETTING_SUMMARY, getSettingsSummary());
445
		fStore.put(STORE_TITLE,getPartName());
486
		fStore.put(STORE_TITLE,getPartName());
487
		fMultiConnectionManager.saveState(new SettingStorePrefixDecorator(fStore,"connectionManager")); //$NON-NLS-1$
446
		fStore.saveState(memento);
488
		fStore.saveState(memento);
447
	}
489
	}
448
	private ISettingsStore getStore(ITerminalConnector connector) {
490
	private ISettingsStore getStore(ITerminalConnector connector) {
Lines 450-455 Link Here
450
	}
492
	}
451
493
452
	protected void setupActions() {
494
	protected void setupActions() {
495
		fActionTerminalDropDown = new TerminalActionSelectionDropDown(fMultiConnectionManager);
496
		fActionTerminalPin=new TerminalActionPin(this);
497
		fActionTerminalPin.setChecked(isPinned());
498
		fActionTerminalRemove=new TerminalActionRemove(fMultiConnectionManager);
453
		fActionTerminalNewTerminal = new TerminalActionNewTerminal(this);
499
		fActionTerminalNewTerminal = new TerminalActionNewTerminal(this);
454
//		fActionTerminalScrollLock = new TerminalActionScrollLock(this);
500
//		fActionTerminalScrollLock = new TerminalActionScrollLock(this);
455
		fActionTerminalConnect = new TerminalActionConnect(this);
501
		fActionTerminalConnect = new TerminalActionConnect(this);
Lines 465-476 Link Here
465
	protected void setupLocalToolBars() {
511
	protected void setupLocalToolBars() {
466
		IToolBarManager toolBarMgr = getViewSite().getActionBars().getToolBarManager();
512
		IToolBarManager toolBarMgr = getViewSite().getActionBars().getToolBarManager();
467
513
468
		toolBarMgr.add(fActionTerminalNewTerminal);
514
		toolBarMgr.add(fActionTerminalRemove);
469
//		toolBarMgr.add(fActionTerminalScrollLock);
515
//		toolBarMgr.add(fActionTerminalScrollLock);
470
		toolBarMgr.add(fActionTerminalConnect);
516
		toolBarMgr.add(fActionTerminalConnect);
471
		toolBarMgr.add(fActionTerminalDisconnect);
517
		toolBarMgr.add(fActionTerminalDisconnect);
472
		toolBarMgr.add(fActionTerminalSettings);
518
		toolBarMgr.add(fActionTerminalSettings);
473
		toolBarMgr.add(fActionToggleCommandInputField);
519
		toolBarMgr.add(fActionToggleCommandInputField);
520
		toolBarMgr.add(new Separator("fixedGroup")); //$NON-NLS-1$
521
		toolBarMgr.add(fActionTerminalPin);
522
		toolBarMgr.add(fActionTerminalDropDown);
523
		toolBarMgr.add(fActionTerminalNewTerminal);
474
	}
524
	}
475
525
476
	protected void setupContextMenus() {
526
	protected void setupContextMenus() {
Lines 561-564 Link Here
561
	public void setScrollLock(boolean on) {
611
	public void setScrollLock(boolean on) {
562
		fCtlTerminal.setScrollLock(on);
612
		fCtlTerminal.setScrollLock(on);
563
	}
613
	}
614
615
	public void connectionsChanged() {
616
		if(fMultiConnectionManager.getCurrentConnection()!=null) {
617
			ITerminalViewControl ctrl = fMultiConnectionManager.getCurrentConnection().getCtlTerminal();
618
			if(fCtlTerminal!=ctrl) {
619
				fCtlTerminal=ctrl;
620
				fPageBook.showPage(fCtlTerminal.getRootControl());
621
				updateStatus();
622
				onTerminalStatus();
623
			}
624
		}
625
		
626
	}
627
628
	public void setPinned(boolean pinned) {
629
		fPinned=pinned;
630
	}
631
	private boolean isPinned() {
632
		return fPinned;
633
	}
564
}
634
}
(-)src/org/eclipse/tm/internal/terminal/view/ITerminalView.java (+1 lines)
Lines 26-29 Link Here
26
	public void setCommandInputField(boolean on);
26
	public void setCommandInputField(boolean on);
27
	public boolean isScrollLock();
27
	public boolean isScrollLock();
28
	public void setScrollLock(boolean b);
28
	public void setScrollLock(boolean b);
29
	public void setPinned(boolean pin);
29
}
30
}
(-)src/org/eclipse/tm/internal/terminal/view/ImageConsts.java (-4 / +9 lines)
Lines 20-50 Link Here
20
public interface ImageConsts
20
public interface ImageConsts
21
{
21
{
22
    public final static String  IMAGE_DIR_ROOT                 = "icons/"; //$NON-NLS-1$
22
    public final static String  IMAGE_DIR_ROOT                 = "icons/"; //$NON-NLS-1$
23
    public final static String  IMAGE_DIR_CTOOL                = "ctool16/";   // basic colors - size 16x16 //$NON-NLS-1$
24
    public final static String  IMAGE_DIR_LOCALTOOL            = "clcl16/";    // basic colors - size 16x16 //$NON-NLS-1$
23
    public final static String  IMAGE_DIR_LOCALTOOL            = "clcl16/";    // basic colors - size 16x16 //$NON-NLS-1$
25
    public final static String  IMAGE_DIR_DLCL                 = "dlcl16/";    // disabled - size 16x16 //$NON-NLS-1$
24
    public final static String  IMAGE_DIR_DLCL                 = "dlcl16/";    // disabled - size 16x16 //$NON-NLS-1$
26
    public final static String  IMAGE_DIR_ELCL                 = "elcl16/";    // enabled - size 16x16 //$NON-NLS-1$
25
    public final static String  IMAGE_DIR_ELCL                 = "elcl16/";    // enabled - size 16x16 //$NON-NLS-1$
27
    public final static String  IMAGE_DIR_OBJECT               = "obj16/";     // basic colors - size 16x16 //$NON-NLS-1$
28
    public final static String  IMAGE_DIR_WIZBAN               = "wizban/";    // basic colors - size 16x16 //$NON-NLS-1$
29
    public final static String  IMAGE_DIR_OVR                  = "ovr16/";     // basic colors - size 7x8 //$NON-NLS-1$
30
    public final static String  IMAGE_DIR_VIEW                 = "cview16/";   // views //$NON-NLS-1$
26
    public final static String  IMAGE_DIR_VIEW                 = "cview16/";   // views //$NON-NLS-1$
31
    public final static String  IMAGE_DIR_EVIEW                = "eview16/";   // views //$NON-NLS-1$
27
    public final static String  IMAGE_DIR_EVIEW                = "eview16/";   // views //$NON-NLS-1$
32
28
33
    public static final String  IMAGE_NEW_TERMINAL             = "TerminalViewNewTerminal"; //$NON-NLS-1$
29
    public static final String  IMAGE_NEW_TERMINAL             = "TerminalViewNewTerminal"; //$NON-NLS-1$
30
    public static final String  IMAGE_TERMINAL_VIEW            = "TerminalView"; //$NON-NLS-1$
34
    public static final String  IMAGE_CLCL_CONNECT             = "ImageClclConnect"; //$NON-NLS-1$
31
    public static final String  IMAGE_CLCL_CONNECT             = "ImageClclConnect"; //$NON-NLS-1$
35
    public static final String  IMAGE_CLCL_DISCONNECT          = "ImageClclDisconnect"; //$NON-NLS-1$
32
    public static final String  IMAGE_CLCL_DISCONNECT          = "ImageClclDisconnect"; //$NON-NLS-1$
36
    public static final String  IMAGE_CLCL_SETTINGS            = "ImageClclSettings"; //$NON-NLS-1$
33
    public static final String  IMAGE_CLCL_SETTINGS            = "ImageClclSettings"; //$NON-NLS-1$
37
    public static final String  IMAGE_CLCL_SCROLL_LOCK         = "ImageClclScrollLock"; //$NON-NLS-1$
34
    public static final String  IMAGE_CLCL_SCROLL_LOCK         = "ImageClclScrollLock"; //$NON-NLS-1$
35
    public static final String  IMAGE_CLCL_CLEAR         	   = "ImageClclClear"; //$NON-NLS-1$
36
    public static final String  IMAGE_CLCL_PIN         	       = "ImageClclPin"; //$NON-NLS-1$
38
37
39
    public static final String  IMAGE_DLCL_CONNECT             = "ImageDlclConnect"; //$NON-NLS-1$
38
    public static final String  IMAGE_DLCL_CONNECT             = "ImageDlclConnect"; //$NON-NLS-1$
40
    public static final String  IMAGE_DLCL_DISCONNECT          = "ImageDlclDisconnect"; //$NON-NLS-1$
39
    public static final String  IMAGE_DLCL_DISCONNECT          = "ImageDlclDisconnect"; //$NON-NLS-1$
41
    public static final String  IMAGE_DLCL_SETTINGS            = "ImageDlclSettings"; //$NON-NLS-1$
40
    public static final String  IMAGE_DLCL_SETTINGS            = "ImageDlclSettings"; //$NON-NLS-1$
42
    public static final String  IMAGE_DLCL_SCROLL_LOCK         = "ImageDlclScrollLock"; //$NON-NLS-1$
41
    public static final String  IMAGE_DLCL_SCROLL_LOCK         = "ImageDlclScrollLock"; //$NON-NLS-1$
42
    public static final String  IMAGE_DLCL_CLEAR         	   = "ImageDlclClear"; //$NON-NLS-1$
43
    public static final String  IMAGE_DLCL_PIN         	       = "ImageDlclPin"; //$NON-NLS-1$
44
    public static final String  IMAGE_DLCL_REMOVE         	   = "ImageDlclRemove"; //$NON-NLS-1$
43
45
44
    public static final String  IMAGE_ELCL_CONNECT             = "ImageElclConnect"; //$NON-NLS-1$
46
    public static final String  IMAGE_ELCL_CONNECT             = "ImageElclConnect"; //$NON-NLS-1$
45
    public static final String  IMAGE_ELCL_DISCONNECT          = "ImageElclDisconnect"; //$NON-NLS-1$
47
    public static final String  IMAGE_ELCL_DISCONNECT          = "ImageElclDisconnect"; //$NON-NLS-1$
46
    public static final String  IMAGE_ELCL_SETTINGS            = "ImageElclSettings"; //$NON-NLS-1$
48
    public static final String  IMAGE_ELCL_SETTINGS            = "ImageElclSettings"; //$NON-NLS-1$
47
    public static final String  IMAGE_ELCL_SCROLL_LOCK         = "ImageElclScrollLock"; //$NON-NLS-1$
49
    public static final String  IMAGE_ELCL_SCROLL_LOCK         = "ImageElclScrollLock"; //$NON-NLS-1$
50
    public static final String  IMAGE_ELCL_CLEAR         	   = "ImageElclClear"; //$NON-NLS-1$
51
    public static final String  IMAGE_ELCL_PIN         	       = "ImageElclPin"; //$NON-NLS-1$
52
    public static final String  IMAGE_ELCL_REMOVE         	   = "ImageElclRemove"; //$NON-NLS-1$
48
	public static final String  IMAGE_CLCL_COMMAND_INPUT_FIELD        = "ImageClclCommandInputField";//$NON-NLS-1$
53
	public static final String  IMAGE_CLCL_COMMAND_INPUT_FIELD        = "ImageClclCommandInputField";//$NON-NLS-1$
49
	public static final String  IMAGE_ELCL_COMMAND_INPUT_FIELD        = "ImageDlclCommandInputField";//$NON-NLS-1$
54
	public static final String  IMAGE_ELCL_COMMAND_INPUT_FIELD        = "ImageDlclCommandInputField";//$NON-NLS-1$
50
	public static final String  IMAGE_DLCL_COMMAND_INPUT_FIELD        = "ImageDlclCommandInputField";//$NON-NLS-1$
55
	public static final String  IMAGE_DLCL_COMMAND_INPUT_FIELD        = "ImageDlclCommandInputField";//$NON-NLS-1$
(-)src/org/eclipse/tm/internal/terminal/view/TerminalViewPlugin.java (-1 / +16 lines)
Lines 53-58 Link Here
53
			map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
53
			map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
54
			map.put(ImageConsts.IMAGE_CLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
54
			map.put(ImageConsts.IMAGE_CLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
55
			map.put(ImageConsts.IMAGE_CLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
55
			map.put(ImageConsts.IMAGE_CLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
56
			map.put(ImageConsts.IMAGE_CLCL_CLEAR, "clear_co.gif"); //$NON-NLS-1$
57
			map.put(ImageConsts.IMAGE_CLCL_PIN, "pin.gif"); //$NON-NLS-1$
56
58
57
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
59
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
58
60
Lines 65-71 Link Here
65
			map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
67
			map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
66
			map.put(ImageConsts.IMAGE_ELCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
68
			map.put(ImageConsts.IMAGE_ELCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
67
			map.put(ImageConsts.IMAGE_ELCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
69
			map.put(ImageConsts.IMAGE_ELCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
68
70
			map.put(ImageConsts.IMAGE_ELCL_CLEAR, "clear_co.gif"); //$NON-NLS-1$
71
			map.put(ImageConsts.IMAGE_ELCL_PIN, "pin.gif"); //$NON-NLS-1$
72
			map.put(ImageConsts.IMAGE_ELCL_REMOVE, "rem_co.gif"); //$NON-NLS-1$
73
			
69
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
74
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
70
75
71
			map.clear();
76
			map.clear();
Lines 77-86 Link Here
77
			map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
82
			map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
78
			map.put(ImageConsts.IMAGE_DLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
83
			map.put(ImageConsts.IMAGE_DLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
79
			map.put(ImageConsts.IMAGE_DLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
84
			map.put(ImageConsts.IMAGE_DLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
85
			map.put(ImageConsts.IMAGE_DLCL_CLEAR, "clear_co.gif"); //$NON-NLS-1$
86
			map.put(ImageConsts.IMAGE_DLCL_PIN, "pin.gif"); //$NON-NLS-1$
87
			map.put(ImageConsts.IMAGE_DLCL_REMOVE, "rem_co.gif"); //$NON-NLS-1$
80
88
81
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);
89
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);
82
90
83
			map.clear();
91
			map.clear();
92
93
			map.put(ImageConsts.IMAGE_TERMINAL_VIEW, "terminal_view.gif"); //$NON-NLS-1$
94
95
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_EVIEW, map);
96
97
			map.clear();
98
		
84
		} catch (MalformedURLException malformedURLException) {
99
		} catch (MalformedURLException malformedURLException) {
85
			malformedURLException.printStackTrace();
100
			malformedURLException.printStackTrace();
86
		}
101
		}
(-)src/org/eclipse/tm/internal/terminal/actions/ActionMessages.properties (+6 lines)
Lines 23-25 Link Here
23
SCROLL_LOCK_1			  = Scroll Lock
23
SCROLL_LOCK_1			  = Scroll Lock
24
SETTINGS                  = Settings
24
SETTINGS                  = Settings
25
TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field
25
TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field
26
REMOVE					  = Remove Terminal
27
PIN					      = Pin Terminal
28
29
ConsoleDropDownAction_0=Select Connection
30
ConsoleDropDownAction_1=Display Selected Connections
31
(-)src/org/eclipse/tm/internal/terminal/actions/ActionMessages.java (+6 lines)
Lines 20-25 Link Here
20
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.osgi.util.NLS;
21
21
22
public class ActionMessages extends NLS {
22
public class ActionMessages extends NLS {
23
23
	static {
24
	static {
24
		NLS.initializeMessages(ActionMessages.class.getName(), ActionMessages.class);
25
		NLS.initializeMessages(ActionMessages.class.getName(), ActionMessages.class);
25
	}
26
	}
Lines 30-35 Link Here
30
    public static String  SETTINGS_ELLIPSE;
31
    public static String  SETTINGS_ELLIPSE;
31
    public static String  SCROLL_LOCK_0;
32
    public static String  SCROLL_LOCK_0;
32
    public static String  SCROLL_LOCK_1;
33
    public static String  SCROLL_LOCK_1;
34
	public static String  REMOVE;
35
	public static String  PIN;
36
37
    public static String ConsoleDropDownAction_0;
38
    public static String ConsoleDropDownAction_1;
33
39
34
    public static String  SETTINGS;
40
    public static String  SETTINGS;
35
41
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionPin.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Wind River Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following Wind River employees contributed to the Terminal component
10
 * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb,
11
 * Helmut Haigermoser and Ted Williams.
12
 *
13
 * Contributors:
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins 
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 *******************************************************************************/
17
package org.eclipse.tm.internal.terminal.actions;
18
19
import org.eclipse.jface.action.IAction;
20
import org.eclipse.tm.internal.terminal.view.ITerminalView;
21
import org.eclipse.tm.internal.terminal.view.ImageConsts;
22
23
public class TerminalActionPin extends TerminalAction
24
{
25
    public TerminalActionPin(ITerminalView target)
26
    {
27
        super(target,
28
              TerminalActionPin.class.getName(),IAction.AS_RADIO_BUTTON);
29
30
        setupAction(ActionMessages.PIN,
31
                    ActionMessages.PIN,
32
                    ImageConsts.IMAGE_CLCL_PIN,
33
                    ImageConsts.IMAGE_ELCL_PIN,
34
                    ImageConsts.IMAGE_DLCL_PIN,
35
                    true);
36
    }
37
	public void run() {
38
		fTarget.setPinned(!isChecked());
39
		setChecked(!isChecked());
40
	}
41
}
(-)src/org/eclipse/tm/internal/terminal/actions/ShowConsoleAction.java (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.tm.internal.terminal.actions;
12
13
import org.eclipse.jface.action.Action;
14
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager;
15
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnection;
16
17
/**
18
 * Shows a specific console in the console view
19
 */
20
public class ShowConsoleAction extends Action {
21
	
22
	private final ITerminalViewConnection fConnection;
23
	private final ITerminalViewConnectionManager fView;
24
25
	/**
26
	 * Constructs an action to display the given console.
27
	 * 
28
	 * @param view the console view in which the given console is contained
29
	 * @param console the console
30
	 */
31
	public ShowConsoleAction(ITerminalViewConnectionManager view, ITerminalViewConnection console) {
32
		super(console.getName(), AS_RADIO_BUTTON);
33
		fConnection = console;
34
		fView = view;
35
		setImageDescriptor(console.getImageDescriptor());
36
	}
37
38
	/* (non-Javadoc)
39
	 * @see org.eclipse.jface.action.IAction#run()
40
	 */
41
	public void run() {
42
		fView.setConnection(fConnection);
43
	}
44
}
(-)src/org/eclipse/tm/internal/terminal/view/ITerminalViewConnectionManager.java (+65 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Wind River Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0 
5
 * which accompanies this distribution, and is available at 
6
 * http://www.eclipse.org/legal/epl-v10.html 
7
 * 
8
 * Contributors: 
9
 * Michael Scharf (Wind River) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.tm.internal.terminal.view;
12
13
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
14
15
16
/**
17
 * Supports multiple connections
18
 *
19
 */
20
public interface ITerminalViewConnectionManager {
21
	interface TerminalViewConnectionListener {
22
		void connectionsChanged();
23
	}
24
	interface ITerminalViewConnectionFactory {
25
		ITerminalViewConnection create();
26
	}
27
	/**
28
	 * @return a list of all connections this view can display
29
	 */
30
	ITerminalViewConnection[] getConnections();
31
	/**
32
	 * If more than two connections are available, remove the current connection
33
	 */
34
	void removeCurrent();
35
36
	/**
37
	 * @return the number of connections
38
	 */
39
	int size();
40
	/**
41
	 * @return th connection the view is showing at the moment
42
	 */
43
	ITerminalViewConnection getCurrentConnection();
44
45
	/**
46
	 * @param conn make this connection the current connection
47
	 */
48
	void setConnection(ITerminalViewConnection conn);
49
50
	/**
51
	 * If there are more than two connections toggle between this and the
52
	 * previously shown connection
53
	 */
54
	void swapConnection();
55
56
	void addListener(TerminalViewConnectionListener listener);
57
	void removeListener(TerminalViewConnectionListener listener);
58
	
59
	void saveState(ISettingsStore store);
60
	/**
61
	 * @param store
62
	 */
63
	void loadState(ISettingsStore store,ITerminalViewConnectionFactory factory);
64
	
65
}
(-)src/org/eclipse/tm/internal/terminal/view/ITerminalViewConnection.java (+27 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Wind River Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0 
5
 * which accompanies this distribution, and is available at 
6
 * http://www.eclipse.org/legal/epl-v10.html 
7
 * 
8
 * Contributors: 
9
 * Michael Scharf (Wind River) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.tm.internal.terminal.view;
12
13
import org.eclipse.jface.resource.ImageDescriptor;
14
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
15
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
16
17
public interface ITerminalViewConnection {
18
19
	String getName();
20
21
	ImageDescriptor getImageDescriptor();
22
	ITerminalViewControl getCtlTerminal();
23
24
	void saveState(ISettingsStore store);
25
26
	void loadState(ISettingsStore store);
27
}
(-)src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java (+115 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Wind River Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0 
5
 * which accompanies this distribution, and is available at 
6
 * http://www.eclipse.org/legal/epl-v10.html 
7
 * 
8
 * Contributors: 
9
 * Michael Scharf (Wind River) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.tm.internal.terminal.view;
12
13
import java.util.ArrayList;
14
import java.util.Iterator;
15
import java.util.List;
16
17
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
18
19
public class TerminalViewConnectionManager implements ITerminalViewConnectionManager {
20
	private final List fConnections=new ArrayList();
21
	private ITerminalViewConnection fCurrentConnection;
22
	private final List fListeners=new ArrayList();
23
	
24
	public ITerminalViewConnection[] getConnections() {
25
		return (ITerminalViewConnection[]) fConnections.toArray(new ITerminalViewConnection[fConnections.size()]);
26
	}
27
28
	public int size() {		// TODO Auto-generated method stub
29
		return fConnections.size();
30
	}
31
	
32
	public ITerminalViewConnection getCurrentConnection() {
33
		return fCurrentConnection;
34
	}
35
	public void setConnection(ITerminalViewConnection conn) {
36
		fCurrentConnection=conn;
37
		fireListeners();
38
	}
39
40
	public void swapConnection() {
41
		// TODO Auto-generated method stub
42
		
43
	}
44
45
	public void addConnection(ITerminalViewConnection conn) {
46
		fConnections.add(conn);
47
		fireListeners();
48
	}
49
	public void removeConnection(ITerminalViewConnection conn) {
50
		fConnections.remove(conn);
51
		fireListeners();
52
	}
53
54
	public void addListener(TerminalViewConnectionListener listener) {
55
		fListeners.add(listener);
56
	}
57
58
	public void removeListener(TerminalViewConnectionListener listener) {
59
		fListeners.remove(listener);
60
	}
61
	protected void fireListeners() {
62
		TerminalViewConnectionListener[] listeners=(TerminalViewConnectionListener[]) fListeners.toArray(new TerminalViewConnectionListener[fListeners.size()]);
63
		for (int i = 0; i < listeners.length; i++) {
64
			listeners[i].connectionsChanged();
65
		}
66
	}
67
68
	public void saveState(ISettingsStore store) {
69
		int n=0;
70
		store.put("size",""+fConnections.size()); //$NON-NLS-1$ //$NON-NLS-2$
71
		for (Iterator iterator = fConnections.iterator(); iterator.hasNext();) {
72
			String prefix="c"+n; //$NON-NLS-1$
73
			n++;
74
			ITerminalViewConnection connection = (ITerminalViewConnection) iterator.next();
75
			if(connection.equals(fCurrentConnection))
76
				store.put("current",prefix);  //$NON-NLS-1$
77
			connection.saveState(new SettingStorePrefixDecorator(store,prefix)); 
78
		}
79
	}
80
81
	public void loadState(ISettingsStore store,ITerminalViewConnectionFactory factory) {
82
		int size=0;
83
		try {
84
			size=Integer.parseInt(store.get("size")); //$NON-NLS-1$
85
		} catch(Exception e) {
86
			// ignore
87
		}
88
		if(size>0) {
89
			String current=store.get("current"); //$NON-NLS-1$
90
			int n=0;
91
			for (int i=0;i<size;i++) {
92
				String prefix="c"+n; //$NON-NLS-1$
93
				n++;
94
				ITerminalViewConnection connection = factory.create();
95
				fConnections.add(connection);
96
				if(prefix.equals(current))
97
					fCurrentConnection=connection;
98
				connection.loadState(new SettingStorePrefixDecorator(store,prefix));
99
			}
100
			fireListeners();
101
		}
102
	}
103
104
	public void removeCurrent() {
105
		if(fConnections.size()>1) {
106
			int i=fConnections.indexOf(fCurrentConnection);
107
			fConnections.remove(fCurrentConnection);
108
			if(i>=fConnections.size())
109
				i--;
110
			fCurrentConnection=(ITerminalViewConnection) fConnections.get(i);
111
			fireListeners();
112
			
113
		}
114
	}
115
}
(-)src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java (+68 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Wind River Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0 
5
 * which accompanies this distribution, and is available at 
6
 * http://www.eclipse.org/legal/epl-v10.html 
7
 * 
8
 * Contributors: 
9
 * Michael Scharf (Wind River) - initial API and implementation
10
 *******************************************************************************/
11
/**
12
 * 
13
 */
14
package org.eclipse.tm.internal.terminal.view;
15
16
import org.eclipse.jface.resource.ImageDescriptor;
17
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
18
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
19
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
20
21
class TerminalViewConnection implements ITerminalViewConnection {
22
	private static final String STORE_CONNECTION_TYPE = "ConnectionType"; //$NON-NLS-1$
23
	final private ITerminalViewControl fCtlTerminal;
24
	public TerminalViewConnection(ITerminalViewControl ctl) {
25
		super();
26
		fCtlTerminal = ctl;
27
	}
28
29
	/* (non-Javadoc)
30
	 * @see org.eclipse.tm.internal.terminal.actions.ITerminalViewConnection#getName()
31
	 */
32
	public String getName() {
33
		return fCtlTerminal.getSettingsSummary();
34
	}
35
36
	/* (non-Javadoc)
37
	 * @see org.eclipse.tm.internal.terminal.actions.ITerminalViewConnection#getImageDescriptor()
38
	 */
39
	public ImageDescriptor getImageDescriptor() {
40
		return TerminalViewPlugin.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW);
41
	}
42
43
	public ITerminalViewControl getCtlTerminal() {
44
		return fCtlTerminal;
45
	}
46
	private ISettingsStore getStore(ISettingsStore store,ITerminalConnector connector) {
47
		return new SettingStorePrefixDecorator(store,connector.getId()+"."); //$NON-NLS-1$
48
	}
49
	public void loadState(ISettingsStore store) {
50
		ITerminalConnector[] connectors=fCtlTerminal.getConnectors();
51
		String connectionType=store.get(STORE_CONNECTION_TYPE);
52
		for (int i = 0; i < connectors.length; i++) {
53
			connectors[i].load(getStore(store,connectors[i]));
54
			if(connectors[i].getId().equals(connectionType))
55
				fCtlTerminal.setConnector(connectors[i]);
56
		}
57
	}
58
59
	public void saveState(ISettingsStore store) {
60
		ITerminalConnector[] connectors=fCtlTerminal.getConnectors();
61
		for (int i = 0; i < connectors.length; i++) {
62
			connectors[i].save(getStore(store,connectors[i]));
63
		}
64
		if(fCtlTerminal.getTerminalConnector()!=null) {
65
			store.put(STORE_CONNECTION_TYPE,fCtlTerminal.getTerminalConnector().getId());
66
		}
67
	}
68
}
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionRemove.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Wind River Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Initial Contributors:
9
 * The following Wind River employees contributed to the Terminal component
10
 * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb,
11
 * Helmut Haigermoser and Ted Williams.
12
 *
13
 * Contributors:
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins 
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 *******************************************************************************/
17
package org.eclipse.tm.internal.terminal.actions;
18
19
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager;
20
import org.eclipse.tm.internal.terminal.view.ImageConsts;
21
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.TerminalViewConnectionListener;
22
23
public class TerminalActionRemove extends TerminalAction implements TerminalViewConnectionListener 
24
{
25
	private final ITerminalViewConnectionManager fConnectionManager;
26
    public TerminalActionRemove(ITerminalViewConnectionManager target)
27
    {
28
        super(null,
29
              TerminalActionRemove.class.getName());
30
        fConnectionManager=target;
31
        setupAction(ActionMessages.REMOVE,
32
                    ActionMessages.REMOVE,
33
                    null,
34
                    ImageConsts.IMAGE_ELCL_REMOVE,
35
                    ImageConsts.IMAGE_DLCL_REMOVE,
36
                    true);
37
    }
38
	public void run() {
39
		fConnectionManager.removeCurrent();
40
		fConnectionManager.addListener(this);
41
	}
42
	public void connectionsChanged() {
43
		setEnabled(fConnectionManager.size()>1);
44
	}
45
}
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionSelectionDropDown.java (+105 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.tm.internal.terminal.actions;
12
13
14
import org.eclipse.jface.action.Action;
15
import org.eclipse.jface.action.ActionContributionItem;
16
import org.eclipse.jface.action.IMenuCreator;
17
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Menu;
19
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnection;
20
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager;
21
import org.eclipse.tm.internal.terminal.view.ImageConsts;
22
import org.eclipse.tm.internal.terminal.view.TerminalViewPlugin;
23
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.TerminalViewConnectionListener;
24
25
/**
26
 * Drop down action in the console to select the console to display.
27
 */
28
public class TerminalActionSelectionDropDown extends Action implements IMenuCreator, TerminalViewConnectionListener {
29
	private ITerminalViewConnectionManager fConnections;
30
	private Menu fMenu;
31
	public TerminalActionSelectionDropDown(ITerminalViewConnectionManager view) {
32
		fConnections= view;
33
		setText(ActionMessages.ConsoleDropDownAction_0); 
34
		setToolTipText(ActionMessages.ConsoleDropDownAction_1); 
35
		setImageDescriptor(TerminalViewPlugin.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW));
36
//		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_DISPLAY_CONSOLE_ACTION);
37
		setMenuCreator(this);
38
		fConnections.addListener(this);
39
		connectionsChanged();
40
	}
41
42
	/* (non-Javadoc)
43
	 * @see org.eclipse.jface.action.IMenuCreator#dispose()
44
	 */
45
	public void dispose() {
46
		if (fMenu != null) {
47
			fMenu.dispose();
48
		}
49
		fConnections.removeListener(this);
50
		fConnections= null;
51
	}
52
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
55
	 */
56
	public Menu getMenu(Menu parent) {
57
		return null;
58
	}
59
60
	/* (non-Javadoc)
61
	 * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
62
	 */
63
	public Menu getMenu(Control parent) {
64
		if (fMenu != null) {
65
			fMenu.dispose();
66
		}
67
		
68
		fMenu= new Menu(parent);
69
		ITerminalViewConnection[] consoles= fConnections.getConnections();
70
		ITerminalViewConnection current = fConnections.getCurrentConnection();
71
		for (int i = 0; i < consoles.length; i++) {
72
			ITerminalViewConnection console = consoles[i];
73
			Action action = new ShowConsoleAction(fConnections, console);
74
			action.setChecked(console.equals(current));
75
			addActionToMenu(fMenu, action, i + 1);
76
		}
77
		return fMenu;
78
	}
79
	
80
	private void addActionToMenu(Menu parent, Action action, int accelerator) {
81
	    if (accelerator < 10) {
82
		    StringBuffer label= new StringBuffer();
83
			//add the numerical accelerator
84
			label.append('&');
85
			label.append(accelerator);
86
			label.append(' ');
87
			label.append(action.getText());
88
			action.setText(label.toString());
89
		}
90
		ActionContributionItem item= new ActionContributionItem(action);
91
		item.fill(parent, -1);
92
	}
93
94
	/* (non-Javadoc)
95
	 * @see org.eclipse.jface.action.IAction#run()
96
	 */
97
	public void run() {
98
		fConnections.swapConnection();
99
	}
100
101
	public void connectionsChanged() {
102
		ITerminalViewConnection[] consoles= fConnections.getConnections();
103
		setEnabled(consoles.length >= 1);
104
	}
105
}
(-)src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java (+3 lines)
Lines 549-554 Link Here
549
	public Control getControl() {
549
	public Control getControl() {
550
		return fCtlText;
550
		return fCtlText;
551
	}
551
	}
552
	public Control getRootControl() {
553
		return fWndParent;
554
	}
552
	protected void setupControls(Composite parent) {
555
	protected void setupControls(Composite parent) {
553
		// The Terminal view now aims to be an ANSI-conforming terminal emulator, so it
556
		// The Terminal view now aims to be an ANSI-conforming terminal emulator, so it
554
		// can't have a horizontal scroll bar (but a vertical one is ok).  Also, do
557
		// can't have a horizontal scroll bar (but a vertical one is ok).  Also, do
(-)src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java (+7 lines)
Lines 48-54 Link Here
48
	void setFont(Font font);
48
	void setFont(Font font);
49
	void setInvertedColors(boolean invert);
49
	void setInvertedColors(boolean invert);
50
	Font getFont();
50
	Font getFont();
51
	/**
52
	 * @return the text control
53
	 */
51
	Control getControl();
54
	Control getControl();
55
	/**
56
	 * @return the root of all controls
57
	 */
58
	Control getRootControl();
52
    boolean isDisposed();
59
    boolean isDisposed();
53
    void selectAll();
60
    void selectAll();
54
    void clearTerminal();
61
    void clearTerminal();

Return to bug 172483