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

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/terminals/ui/views/TerminalViewTab.java (-166 / +54 lines)
Lines 15-20 Link Here
15
 * David McKnight   (IBM)        - [165680] "Show in Remote Shell View" does not work
15
 * David McKnight   (IBM)        - [165680] "Show in Remote Shell View" does not work
16
 * Yu-Fen Kuo      (MontaVista)  - Adapted from CommandsViewWorkbook
16
 * Yu-Fen Kuo      (MontaVista)  - Adapted from CommandsViewWorkbook
17
 * Anna Dushistova (MontaVista)  - Adapted from CommandsViewWorkbook
17
 * Anna Dushistova (MontaVista)  - Adapted from CommandsViewWorkbook
18
 * Anna Dushistova (MontaVista)  - [227537] rse.terminals.ui should not depend on tm.terminal.view
18
 ********************************************************************************/
19
 ********************************************************************************/
19
package org.eclipse.rse.internal.terminals.ui.views;
20
package org.eclipse.rse.internal.terminals.ui.views;
20
21
Lines 29-35 Link Here
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.custom.CTabFolder;
31
import org.eclipse.swt.custom.CTabFolder;
31
import org.eclipse.swt.custom.CTabItem;
32
import org.eclipse.swt.custom.CTabItem;
32
import org.eclipse.swt.dnd.TextTransfer;
33
import org.eclipse.swt.events.DisposeEvent;
33
import org.eclipse.swt.events.DisposeEvent;
34
import org.eclipse.swt.events.DisposeListener;
34
import org.eclipse.swt.events.DisposeListener;
35
import org.eclipse.swt.events.MenuEvent;
35
import org.eclipse.swt.events.MenuEvent;
Lines 39-83 Link Here
39
import org.eclipse.swt.widgets.Composite;
39
import org.eclipse.swt.widgets.Composite;
40
import org.eclipse.swt.widgets.Control;
40
import org.eclipse.swt.widgets.Control;
41
import org.eclipse.swt.widgets.Menu;
41
import org.eclipse.swt.widgets.Menu;
42
import org.eclipse.tm.internal.terminal.actions.TerminalAction;
43
import org.eclipse.tm.internal.terminal.actions.TerminalActionClearAll;
44
import org.eclipse.tm.internal.terminal.actions.TerminalActionCopy;
45
import org.eclipse.tm.internal.terminal.actions.TerminalActionCut;
46
import org.eclipse.tm.internal.terminal.actions.TerminalActionPaste;
47
import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectAll;
48
import org.eclipse.tm.internal.terminal.control.ITerminalListener;
42
import org.eclipse.tm.internal.terminal.control.ITerminalListener;
49
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
43
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
50
import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
44
import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
51
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
45
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
52
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
46
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
53
import org.eclipse.tm.internal.terminal.view.ITerminalView;
47
import org.eclipse.tm.terminal.control.actions.AbstractTerminalControlAction;
48
import org.eclipse.tm.terminal.control.actions.TerminalActionClearAll;
49
import org.eclipse.tm.terminal.control.actions.TerminalActionCopy;
50
import org.eclipse.tm.terminal.control.actions.TerminalActionCut;
51
import org.eclipse.tm.terminal.control.actions.TerminalActionPaste;
52
import org.eclipse.tm.terminal.control.actions.TerminalActionSelectAll;
54
53
55
/**
54
/**
56
 * This is the desktop view wrapper of the System View viewer.
55
 * This is the desktop view wrapper of the System View viewer.
57
 */
56
 */
58
public class TerminalViewTab extends Composite implements ITerminalListener,
57
public class TerminalViewTab extends Composite implements ITerminalListener{
59
        ITerminalView {
60
58
61
    public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$
59
    public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$
62
    private CTabFolder tabFolder;
60
    private CTabFolder tabFolder;
63
    private Menu menu;
61
    private Menu menu;
64
    private TerminalViewer viewer;
62
    private TerminalViewer viewer;
65
    private boolean fMenuAboutToShow;
63
    private boolean fMenuAboutToShow;
66
    private TerminalAction fActionEditCopy;
64
    private AbstractTerminalControlAction fActionEditCopy;
67
65
68
    private TerminalAction fActionEditCut;
66
    private AbstractTerminalControlAction fActionEditCut;
69
67
70
    private TerminalAction fActionEditPaste;
68
    private AbstractTerminalControlAction fActionEditPaste;
71
69
72
    private TerminalAction fActionEditClearAll;
70
    private AbstractTerminalControlAction fActionEditClearAll;
73
71
74
    private TerminalAction fActionEditSelectAll;
72
    private AbstractTerminalControlAction fActionEditSelectAll;
75
73
76
    protected class TerminalContextMenuHandler implements MenuListener,
74
    protected class TerminalContextMenuHandler implements MenuListener,
77
            IMenuListener {
75
            IMenuListener {
78
        public void menuHidden(MenuEvent event) {
76
        public void menuHidden(MenuEvent event) {
79
            fMenuAboutToShow = false;
77
            fMenuAboutToShow = false;
80
            updateEditCopy();
78
            fActionEditCopy.updateAction(fMenuAboutToShow);
81
        }
79
        }
82
80
83
        public void menuShown(MenuEvent e) {
81
        public void menuShown(MenuEvent e) {
Lines 86-96 Link Here
86
84
87
        public void menuAboutToShow(IMenuManager menuMgr) {
85
        public void menuAboutToShow(IMenuManager menuMgr) {
88
            fMenuAboutToShow = true;
86
            fMenuAboutToShow = true;
89
            updateEditCopy();
87
			fActionEditCopy.updateAction(fMenuAboutToShow);
90
            updateEditCut();
88
			fActionEditCut.updateAction(fMenuAboutToShow);
91
            updateEditSelectAll();
89
			fActionEditSelectAll.updateAction(fMenuAboutToShow);
92
            updateEditPaste();
90
			fActionEditPaste.updateAction(fMenuAboutToShow);
93
            updateEditClearAll();
91
			fActionEditClearAll.updateAction(fMenuAboutToShow);
94
        }
92
        }
95
    }
93
    }
96
94
Lines 234-244 Link Here
234
    }
232
    }
235
233
236
    protected void setupActions() {
234
    protected void setupActions() {
237
        fActionEditCopy = new TerminalActionCopy(this);
235
        fActionEditCopy = new TerminalActionCopy(){
238
        fActionEditCut = new TerminalActionCut(this);
236
        	protected ITerminalViewControl getTarget() {
239
        fActionEditPaste = new TerminalActionPaste(this);
237
        		return getCurrentTerminalViewControl();
240
        fActionEditClearAll = new TerminalActionClearAll(this);
238
        	}
241
        fActionEditSelectAll = new TerminalActionSelectAll(this);
239
        };
240
        fActionEditCut = new TerminalActionCut(){
241
        	protected ITerminalViewControl getTarget() {
242
        		return getCurrentTerminalViewControl();
243
        	}
244
        };
245
        fActionEditPaste = new TerminalActionPaste(){
246
        	protected ITerminalViewControl getTarget() {
247
        		return getCurrentTerminalViewControl();
248
        	}
249
        };
250
        fActionEditClearAll = new TerminalActionClearAll(){
251
        	protected ITerminalViewControl getTarget() {
252
        		return getCurrentTerminalViewControl();
253
        	}
254
        };
255
        fActionEditSelectAll = new TerminalActionSelectAll(){
256
        	protected ITerminalViewControl getTarget() {
257
        		return getCurrentTerminalViewControl();
258
        	}
259
        };
242
    }
260
    }
243
261
244
    protected void setupContextMenus() {
262
    protected void setupContextMenus() {
Lines 270-361 Link Here
270
        menuMgr.add(new Separator("Additions")); //$NON-NLS-1$
288
        menuMgr.add(new Separator("Additions")); //$NON-NLS-1$
271
    }
289
    }
272
290
273
    public void onEditCopy() {
274
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
275
        if (terminalViewControl == null)
276
            return;
277
        String selection = terminalViewControl.getSelection();
278
279
        if (!selection.equals("")) {//$NON-NLS-1$
280
            terminalViewControl.copy();
281
        } else {
282
            terminalViewControl.sendKey('\u0003');
283
        }
284
    }
285
286
    public void updateEditCopy() {
287
        boolean bEnabled = true;
288
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
289
        if (terminalViewControl == null)
290
            return;
291
        if (fMenuAboutToShow) {
292
            bEnabled = terminalViewControl.getSelection().length() > 0;
293
        }
294
295
        fActionEditCopy.setEnabled(bEnabled);
296
    }
297
298
    public void onEditCut() {
299
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
300
        if (terminalViewControl == null)
301
            return;
302
        terminalViewControl.sendKey('\u0018');
303
    }
304
305
    public void updateEditCut() {
306
        boolean bEnabled;
307
308
        bEnabled = !fMenuAboutToShow;
309
        fActionEditCut.setEnabled(bEnabled);
310
    }
311
312
    public void onEditPaste() {
313
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
314
        if (terminalViewControl == null)
315
            return;
316
        terminalViewControl.paste();
317
    }
318
319
    public void updateEditPaste() {
320
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
321
        if (terminalViewControl == null)
322
            return;
323
        String strText = (String) terminalViewControl.getClipboard()
324
                .getContents(TextTransfer.getInstance());
325
326
        boolean bEnabled = ((strText != null) && (!strText.equals("")));//$NON-NLS-1$
327
328
        fActionEditPaste.setEnabled(bEnabled);
329
    }
330
331
    public void onEditClearAll() {
332
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
333
        if (terminalViewControl == null)
334
            return;
335
        terminalViewControl.clearTerminal();
336
    }
337
338
    public void updateEditClearAll() {
339
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
340
        if (terminalViewControl == null)
341
            return;
342
        fActionEditClearAll.setEnabled(!terminalViewControl.isEmpty());
343
    }
344
345
    public void onEditSelectAll() {
346
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
347
        if (terminalViewControl == null)
348
            return;
349
        terminalViewControl.selectAll();
350
    }
351
352
    public void updateEditSelectAll() {
353
        ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
354
        if (terminalViewControl == null)
355
            return;
356
        fActionEditSelectAll.setEnabled(!terminalViewControl.isEmpty());
357
    }
358
359
    private void setTabTitle(IAdaptable root, CTabItem titem) {
291
    private void setTabTitle(IAdaptable root, CTabItem titem) {
360
        ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
292
        ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
361
                .getAdapter(ISystemViewElementAdapter.class);
293
                .getAdapter(ISystemViewElementAdapter.class);
Lines 365-424 Link Here
365
        }
297
        }
366
    }
298
    }
367
299
368
    public void setState(TerminalState state) {
369
        // terminalControl.setState(state);
370
    }
371
372
    public void setTerminalTitle(String title) {
373
        // TODO Auto-generated method stub
374
375
    }
376
377
    public boolean hasCommandInputField() {
378
        // TODO Auto-generated method stub
379
        return false;
380
    }
381
382
    public boolean isScrollLock() {
383
        // TODO Auto-generated method stub
384
        return false;
385
    }
386
387
    public void onTerminalConnect() {
388
        // TODO Auto-generated method stub
389
390
    }
391
392
    public void onTerminalDisconnect() {
393
        // TODO Auto-generated method stub
394
395
    }
396
397
    public void onTerminalFontChanged() {
398
        // TODO Auto-generated method stub
399
400
    }
401
402
    public void onTerminalNewTerminal() {
403
        // TODO Auto-generated method stub
404
405
    }
406
407
    public void onTerminalSettings() {
408
        // TODO Auto-generated method stub
409
410
    }
411
412
    public void setCommandInputField(boolean on) {
413
        // TODO Auto-generated method stub
414
415
    }
416
417
    public void setScrollLock(boolean b) {
418
        // TODO Auto-generated method stub
419
420
    }
421
422
    private void updateWithUniqueTitle(String title, CTabItem currentItem) {
300
    private void updateWithUniqueTitle(String title, CTabItem currentItem) {
423
        CTabItem[] items = tabFolder.getItems();
301
        CTabItem[] items = tabFolder.getItems();
424
        int increment = 1;
302
        int increment = 1;
Lines 448-451 Link Here
448
        }
326
        }
449
        return null;
327
        return null;
450
    }
328
    }
329
330
	public void setState(TerminalState state) {
331
		// TODO Auto-generated method stub
332
		
333
	}
334
335
	public void setTerminalTitle(String title) {
336
		// TODO Auto-generated method stub
337
		
338
	}
451
}
339
}
(-)src/org/eclipse/rse/internal/terminals/ui/views/RSETerminalConnectorImpl.java (-1 / +4 lines)
Lines 67-73 Link Here
67
    }
67
    }
68
68
69
    public void setTerminalSize(int newWidth, int newHeight) {
69
    public void setTerminalSize(int newWidth, int newHeight) {
70
        shell.setTerminalSize(newWidth, newHeight);
70
    	if(shell != null)
71
    	{	
72
            shell.setTerminalSize(newWidth, newHeight);
73
    	}    
71
    }
74
    }
72
75
73
    public InputStream getInputStream() {
76
    public InputStream getInputStream() {
(-)META-INF/MANIFEST.MF (-2 / +1 lines)
Lines 12-19 Link Here
12
 org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
12
 org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
13
 org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
13
 org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
14
 org.eclipse.rse.subsystems.terminals.core;bundle-version="[0.1.0,0.2.0)",
14
 org.eclipse.rse.subsystems.terminals.core;bundle-version="[0.1.0,0.2.0)",
15
 org.eclipse.tm.terminal;bundle-version="[2.0.0,2.1.0)",
15
 org.eclipse.tm.terminal;bundle-version="[2.0.0,2.1.0)"
16
 org.eclipse.tm.terminal.view;bundle-version="[2.0.0,2.1.0)"
17
Bundle-ActivationPolicy: lazy
16
Bundle-ActivationPolicy: lazy
18
Eclipse-LazyStart: true
17
Eclipse-LazyStart: true
19
Bundle-Vendor: %providerName
18
Bundle-Vendor: %providerName
(-)src/org/eclipse/tm/internal/terminal/actions/ActionMessages.properties (-5 / +1 lines)
Lines 13-18 Link Here
13
# Contributors:
13
# Contributors:
14
# Michael Scharf (Wind River) - split into core, view and connector plugins 
14
# Michael Scharf (Wind River) - split into core, view and connector plugins 
15
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
15
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
# Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
16
###############################################################################
17
###############################################################################
17
NEW_TERMINAL              = New Terminal
18
NEW_TERMINAL              = New Terminal
18
CONNECT                   = Connect
19
CONNECT                   = Connect
Lines 20-29 Link Here
20
SETTINGS_ELLIPSE          = Settings...
21
SETTINGS_ELLIPSE          = Settings...
21
SCROLL_LOCK_0			  = Scroll &Lock
22
SCROLL_LOCK_0			  = Scroll &Lock
22
SCROLL_LOCK_1			  = Scroll Lock
23
SCROLL_LOCK_1			  = Scroll Lock
23
COPY                      = Copy
24
CUT                       = Cut
25
PASTE                     = Paste
26
SELECTALL                 = Select All
27
CLEARALL                  = Clear Terminal
28
SETTINGS                  = Settings
24
SETTINGS                  = Settings
29
TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field
25
TOGGLE_COMMAND_INPUT_FIELD= Toggle Command Input Field
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionCopy.java (-40 lines)
Removed 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.ITerminalView;
20
import org.eclipse.ui.ISharedImages;
21
import org.eclipse.ui.PlatformUI;
22
23
public class TerminalActionCopy extends TerminalAction
24
{
25
    public TerminalActionCopy(ITerminalView target)
26
    {
27
        super(target,
28
              TerminalActionCopy.class.getName());
29
        ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
30
        setupAction(ActionMessages.COPY,
31
                    ActionMessages.COPY,
32
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
33
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
34
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED),
35
                    true);
36
    }
37
	public void run() {
38
		fTarget.onEditCopy();
39
	}
40
}
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionCut.java (-40 lines)
Removed 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.ITerminalView;
20
import org.eclipse.ui.ISharedImages;
21
import org.eclipse.ui.PlatformUI;
22
23
public class TerminalActionCut extends TerminalAction
24
{
25
    public TerminalActionCut(ITerminalView target)
26
    {
27
        super(target,
28
              TerminalActionCut.class.getName());
29
        ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
30
        setupAction(ActionMessages.CUT,
31
                    ActionMessages.CUT,
32
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
33
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
34
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED),
35
                    true);
36
    }
37
	public void run() {
38
		fTarget.onEditCut();
39
	}
40
}
(-)src/org/eclipse/tm/internal/terminal/actions/ActionMessages.java (-5 / +1 lines)
Lines 13-18 Link Here
13
 * Contributors:
13
 * Contributors:
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.tm.internal.terminal.actions;
18
package org.eclipse.tm.internal.terminal.actions;
18
19
Lines 30-40 Link Here
30
    public static String  SCROLL_LOCK_0;
31
    public static String  SCROLL_LOCK_0;
31
    public static String  SCROLL_LOCK_1;
32
    public static String  SCROLL_LOCK_1;
32
33
33
    public static String  COPY;
34
    public static String  CUT;
35
    public static String  PASTE;
36
    public static String  SELECTALL;
37
    public static String  CLEARALL;
38
    public static String  SETTINGS;
34
    public static String  SETTINGS;
39
35
40
}
36
}
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionClearAll.java (-42 lines)
Removed 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.ITerminalView;
20
import org.eclipse.tm.internal.terminal.view.ImageConsts;
21
22
public class TerminalActionClearAll extends TerminalAction
23
{
24
    public TerminalActionClearAll(ITerminalView target)
25
    {
26
        super(target,
27
              TerminalActionClearAll.class.getName());
28
29
        setupAction(ActionMessages.CLEARALL,
30
                    ActionMessages.CLEARALL,
31
                    ImageConsts.IMAGE_CLCL_CLEAR_ALL,
32
                    ImageConsts.IMAGE_ELCL_CLEAR_ALL,
33
                    ImageConsts.IMAGE_DLCL_CLEAR_ALL,
34
                    false);
35
    }
36
37
	public void run() {
38
		fTarget.onEditClearAll();
39
	}
40
}
41
42
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionSelectAll.java (-39 lines)
Removed 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.resource.ImageDescriptor;
20
import org.eclipse.tm.internal.terminal.view.ITerminalView;
21
22
public class TerminalActionSelectAll extends TerminalAction
23
{
24
    public TerminalActionSelectAll(ITerminalView target)
25
    {
26
        super(target,
27
              TerminalActionSelectAll.class.getName());
28
29
        setupAction(ActionMessages.SELECTALL,
30
                    ActionMessages.SELECTALL,
31
                    (ImageDescriptor)null,
32
                    null,
33
                    null,
34
                    false);
35
    }
36
	public void run() {
37
		fTarget.onEditSelectAll();
38
	}
39
}
(-)src/org/eclipse/tm/internal/terminal/actions/TerminalActionPaste.java (-40 lines)
Removed 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.ITerminalView;
20
import org.eclipse.ui.ISharedImages;
21
import org.eclipse.ui.PlatformUI;
22
23
public class TerminalActionPaste extends TerminalAction
24
{
25
    public TerminalActionPaste(ITerminalView target)
26
    {
27
        super(target,
28
              TerminalActionPaste.class.getName());
29
        ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
30
        setupAction(ActionMessages.PASTE,
31
                    ActionMessages.PASTE,
32
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
33
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED),
34
                    si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
35
                    false);
36
    }
37
	public void run() {
38
		fTarget.onEditPaste();
39
	}
40
}
(-)src/org/eclipse/tm/internal/terminal/view/TerminalView.java (-57 / +24 lines)
Lines 17-22 Link Here
17
 * Michael Scharf (Wind River) - [209656] ClassCastException in TerminalView under Eclipse-3.4M3
17
 * Michael Scharf (Wind River) - [209656] ClassCastException in TerminalView under Eclipse-3.4M3
18
 * Michael Scharf (Wind River) - [189774] Ctrl+V does not work in the command input field. 
18
 * Michael Scharf (Wind River) - [189774] Ctrl+V does not work in the command input field. 
19
 * Michael Scharf (Wind River) - [217999] Duplicate context menu entries in Terminal
19
 * Michael Scharf (Wind River) - [217999] Duplicate context menu entries in Terminal
20
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
20
 *******************************************************************************/
21
 *******************************************************************************/
21
package org.eclipse.tm.internal.terminal.view;
22
package org.eclipse.tm.internal.terminal.view;
22
23
Lines 33-39 Link Here
33
import org.eclipse.jface.util.IPropertyChangeListener;
34
import org.eclipse.jface.util.IPropertyChangeListener;
34
import org.eclipse.jface.util.PropertyChangeEvent;
35
import org.eclipse.jface.util.PropertyChangeEvent;
35
import org.eclipse.jface.window.Window;
36
import org.eclipse.jface.window.Window;
36
import org.eclipse.swt.dnd.TextTransfer;
37
import org.eclipse.swt.events.MenuEvent;
37
import org.eclipse.swt.events.MenuEvent;
38
import org.eclipse.swt.events.MenuListener;
38
import org.eclipse.swt.events.MenuListener;
39
import org.eclipse.swt.widgets.Composite;
39
import org.eclipse.swt.widgets.Composite;
Lines 41-54 Link Here
41
import org.eclipse.swt.widgets.Display;
41
import org.eclipse.swt.widgets.Display;
42
import org.eclipse.swt.widgets.Menu;
42
import org.eclipse.swt.widgets.Menu;
43
import org.eclipse.tm.internal.terminal.actions.TerminalAction;
43
import org.eclipse.tm.internal.terminal.actions.TerminalAction;
44
import org.eclipse.tm.internal.terminal.actions.TerminalActionClearAll;
45
import org.eclipse.tm.internal.terminal.actions.TerminalActionConnect;
44
import org.eclipse.tm.internal.terminal.actions.TerminalActionConnect;
46
import org.eclipse.tm.internal.terminal.actions.TerminalActionCopy;
47
import org.eclipse.tm.internal.terminal.actions.TerminalActionCut;
48
import org.eclipse.tm.internal.terminal.actions.TerminalActionDisconnect;
45
import org.eclipse.tm.internal.terminal.actions.TerminalActionDisconnect;
49
import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal;
46
import org.eclipse.tm.internal.terminal.actions.TerminalActionNewTerminal;
50
import org.eclipse.tm.internal.terminal.actions.TerminalActionPaste;
51
import org.eclipse.tm.internal.terminal.actions.TerminalActionSelectAll;
52
import org.eclipse.tm.internal.terminal.actions.TerminalActionSettings;
47
import org.eclipse.tm.internal.terminal.actions.TerminalActionSettings;
53
import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField;
48
import org.eclipse.tm.internal.terminal.actions.TerminalActionToggleCommandInputField;
54
import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
49
import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
Lines 60-65 Link Here
60
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
55
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
61
import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
56
import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
62
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
57
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
58
import org.eclipse.tm.terminal.control.actions.AbstractTerminalControlAction;
59
import org.eclipse.tm.terminal.control.actions.TerminalActionClearAll;
60
import org.eclipse.tm.terminal.control.actions.TerminalActionCopy;
61
import org.eclipse.tm.terminal.control.actions.TerminalActionCut;
62
import org.eclipse.tm.terminal.control.actions.TerminalActionPaste;
63
import org.eclipse.tm.terminal.control.actions.TerminalActionSelectAll;
63
import org.eclipse.ui.IMemento;
64
import org.eclipse.ui.IMemento;
64
import org.eclipse.ui.IViewReference;
65
import org.eclipse.ui.IViewReference;
65
import org.eclipse.ui.IViewSite;
66
import org.eclipse.ui.IViewSite;
Lines 92-106 Link Here
92
93
93
	protected TerminalAction fActionTerminalSettings;
94
	protected TerminalAction fActionTerminalSettings;
94
95
95
	protected TerminalAction fActionEditCopy;
96
	protected AbstractTerminalControlAction fActionEditCopy;
96
97
97
	protected TerminalAction fActionEditCut;
98
	protected AbstractTerminalControlAction fActionEditCut;
98
99
99
	protected TerminalAction fActionEditPaste;
100
	protected AbstractTerminalControlAction fActionEditPaste;
100
101
101
	protected TerminalAction fActionEditClearAll;
102
	protected AbstractTerminalControlAction fActionEditClearAll;
102
103
103
	protected TerminalAction fActionEditSelectAll;
104
	protected AbstractTerminalControlAction fActionEditSelectAll;
104
105
105
	protected TerminalAction fActionToggleCommandInputField;
106
	protected TerminalAction fActionToggleCommandInputField;
106
107
Lines 233-241 Link Here
233
		return fCtlTerminal.getState()==TerminalState.CONNECTING
234
		return fCtlTerminal.getState()==TerminalState.CONNECTING
234
		    || fCtlTerminal.getState()==TerminalState.OPENED;
235
		    || fCtlTerminal.getState()==TerminalState.OPENED;
235
	}
236
	}
236
	private boolean isConnected() {
237
237
		return fCtlTerminal.getState()==TerminalState.CONNECTED;
238
	}
239
	public void onTerminalDisconnect() {
238
	public void onTerminalDisconnect() {
240
		fCtlTerminal.disconnectTerminal();
239
		fCtlTerminal.disconnectTerminal();
241
	}
240
	}
Lines 366-420 Link Here
366
		}
365
		}
367
	}
366
	}
368
367
369
	public void updateEditCopy() {
370
		boolean bEnabled=true;
371
372
		if (fMenuAboutToShow) {
373
			bEnabled = fCtlTerminal.getSelection().length()>0;
374
		}
375
376
		fActionEditCopy.setEnabled(bEnabled);
377
	}
378
368
379
	public void onEditCut() {
369
	public void onEditCut() {
380
		fCtlTerminal.sendKey('\u0018');
370
		fCtlTerminal.sendKey('\u0018');
381
	}
371
	}
382
372
383
	public void updateEditCut() {
384
		boolean bEnabled;
385
386
		bEnabled = !fMenuAboutToShow;
387
		fActionEditCut.setEnabled(bEnabled);
388
	}
389
390
	public void onEditPaste() {
373
	public void onEditPaste() {
391
		fCtlTerminal.paste();
374
		fCtlTerminal.paste();
392
	}
375
	}
393
376
394
	public void updateEditPaste() {
395
		String strText = (String) fCtlTerminal.getClipboard().getContents(TextTransfer.getInstance());
396
397
		boolean bEnabled = ((strText != null) && (!strText.equals("")) && (isConnected()));//$NON-NLS-1$
398
399
		fActionEditPaste.setEnabled(bEnabled);
400
	}
401
402
	public void onEditClearAll() {
377
	public void onEditClearAll() {
403
		fCtlTerminal.clearTerminal();
378
		fCtlTerminal.clearTerminal();
404
	}
379
	}
405
380
406
	public void updateEditClearAll() {
407
		fActionEditClearAll.setEnabled(!fCtlTerminal.isEmpty());
408
	}
409
410
	public void onEditSelectAll() {
381
	public void onEditSelectAll() {
411
		fCtlTerminal.selectAll();
382
		fCtlTerminal.selectAll();
412
	}
383
	}
413
384
414
	public void updateEditSelectAll() {
415
		fActionEditSelectAll.setEnabled(!fCtlTerminal.isEmpty());
416
	}
417
418
	// ViewPart interface
385
	// ViewPart interface
419
386
420
	public void createPartControl(Composite wndParent) {
387
	public void createPartControl(Composite wndParent) {
Lines 511-521 Link Here
511
		fActionTerminalConnect = new TerminalActionConnect(this);
478
		fActionTerminalConnect = new TerminalActionConnect(this);
512
		fActionTerminalDisconnect = new TerminalActionDisconnect(this);
479
		fActionTerminalDisconnect = new TerminalActionDisconnect(this);
513
		fActionTerminalSettings = new TerminalActionSettings(this);
480
		fActionTerminalSettings = new TerminalActionSettings(this);
514
		fActionEditCopy = new TerminalActionCopy(this);
481
		fActionEditCopy = new TerminalActionCopy(fCtlTerminal);
515
		fActionEditCut = new TerminalActionCut(this);
482
		fActionEditCut = new TerminalActionCut(fCtlTerminal);
516
		fActionEditPaste = new TerminalActionPaste(this);
483
		fActionEditPaste = new TerminalActionPaste(fCtlTerminal);
517
		fActionEditClearAll = new TerminalActionClearAll(this);
484
		fActionEditClearAll = new TerminalActionClearAll(fCtlTerminal);
518
		fActionEditSelectAll = new TerminalActionSelectAll(this);
485
		fActionEditSelectAll = new TerminalActionSelectAll(fCtlTerminal);
519
		fActionToggleCommandInputField = new TerminalActionToggleCommandInputField(this);
486
		fActionToggleCommandInputField = new TerminalActionToggleCommandInputField(this);
520
	}
487
	}
521
	protected void setupLocalToolBars() {
488
	protected void setupLocalToolBars() {
Lines 569-575 Link Here
569
	protected class TerminalContextMenuHandler implements MenuListener, IMenuListener {
536
	protected class TerminalContextMenuHandler implements MenuListener, IMenuListener {
570
		public void menuHidden(MenuEvent event) {
537
		public void menuHidden(MenuEvent event) {
571
			fMenuAboutToShow = false;
538
			fMenuAboutToShow = false;
572
			updateEditCopy();
539
			fActionEditCopy.updateAction(fMenuAboutToShow);
573
		}
540
		}
574
541
575
		public void menuShown(MenuEvent e) {
542
		public void menuShown(MenuEvent e) {
Lines 577-587 Link Here
577
		}
544
		}
578
		public void menuAboutToShow(IMenuManager menuMgr) {
545
		public void menuAboutToShow(IMenuManager menuMgr) {
579
			fMenuAboutToShow = true;
546
			fMenuAboutToShow = true;
580
			updateEditCopy();
547
			fActionEditCopy.updateAction(fMenuAboutToShow);
581
			updateEditCut();
548
			fActionEditCut.updateAction(fMenuAboutToShow);
582
			updateEditSelectAll();
549
			fActionEditSelectAll.updateAction(fMenuAboutToShow);
583
			updateEditPaste();
550
			fActionEditPaste.updateAction(fMenuAboutToShow);
584
			updateEditClearAll();
551
			fActionEditClearAll.updateAction(fMenuAboutToShow);
585
		}
552
		}
586
	}
553
	}
587
554
(-)src/org/eclipse/tm/internal/terminal/view/ImageConsts.java (-3 / +1 lines)
Lines 13-18 Link Here
13
 * Contributors:
13
 * Contributors:
14
 * Michael Scharf (Wind River) - extracted from TerminalConsts
14
 * Michael Scharf (Wind River) - extracted from TerminalConsts
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.tm.internal.terminal.view;
18
package org.eclipse.tm.internal.terminal.view;
18
19
Lines 33-51 Link Here
33
    public static final String  IMAGE_CLCL_CONNECT             = "ImageClclConnect"; //$NON-NLS-1$
34
    public static final String  IMAGE_CLCL_CONNECT             = "ImageClclConnect"; //$NON-NLS-1$
34
    public static final String  IMAGE_CLCL_DISCONNECT          = "ImageClclDisconnect"; //$NON-NLS-1$
35
    public static final String  IMAGE_CLCL_DISCONNECT          = "ImageClclDisconnect"; //$NON-NLS-1$
35
    public static final String  IMAGE_CLCL_SETTINGS            = "ImageClclSettings"; //$NON-NLS-1$
36
    public static final String  IMAGE_CLCL_SETTINGS            = "ImageClclSettings"; //$NON-NLS-1$
36
    public static final String  IMAGE_CLCL_CLEAR_ALL            = "ImageClclClearAll"; //$NON-NLS-1$
37
    public static final String  IMAGE_CLCL_SCROLL_LOCK         = "ImageClclScrollLock"; //$NON-NLS-1$
37
    public static final String  IMAGE_CLCL_SCROLL_LOCK         = "ImageClclScrollLock"; //$NON-NLS-1$
38
38
39
    public static final String  IMAGE_DLCL_CONNECT             = "ImageDlclConnect"; //$NON-NLS-1$
39
    public static final String  IMAGE_DLCL_CONNECT             = "ImageDlclConnect"; //$NON-NLS-1$
40
    public static final String  IMAGE_DLCL_DISCONNECT          = "ImageDlclDisconnect"; //$NON-NLS-1$
40
    public static final String  IMAGE_DLCL_DISCONNECT          = "ImageDlclDisconnect"; //$NON-NLS-1$
41
    public static final String  IMAGE_DLCL_SETTINGS            = "ImageDlclSettings"; //$NON-NLS-1$
41
    public static final String  IMAGE_DLCL_SETTINGS            = "ImageDlclSettings"; //$NON-NLS-1$
42
    public static final String  IMAGE_DLCL_CLEAR_ALL            = "ImageDlclClearAll"; //$NON-NLS-1$
43
    public static final String  IMAGE_DLCL_SCROLL_LOCK         = "ImageDlclScrollLock"; //$NON-NLS-1$
42
    public static final String  IMAGE_DLCL_SCROLL_LOCK         = "ImageDlclScrollLock"; //$NON-NLS-1$
44
43
45
    public static final String  IMAGE_ELCL_CONNECT             = "ImageElclConnect"; //$NON-NLS-1$
44
    public static final String  IMAGE_ELCL_CONNECT             = "ImageElclConnect"; //$NON-NLS-1$
46
    public static final String  IMAGE_ELCL_DISCONNECT          = "ImageElclDisconnect"; //$NON-NLS-1$
45
    public static final String  IMAGE_ELCL_DISCONNECT          = "ImageElclDisconnect"; //$NON-NLS-1$
47
    public static final String  IMAGE_ELCL_SETTINGS            = "ImageElclSettings"; //$NON-NLS-1$
46
    public static final String  IMAGE_ELCL_SETTINGS            = "ImageElclSettings"; //$NON-NLS-1$
48
    public static final String  IMAGE_ELCL_CLEAR_ALL            = "ImageElclClearAll"; //$NON-NLS-1$
49
    public static final String  IMAGE_ELCL_SCROLL_LOCK         = "ImageElclScrollLock"; //$NON-NLS-1$
47
    public static final String  IMAGE_ELCL_SCROLL_LOCK         = "ImageElclScrollLock"; //$NON-NLS-1$
50
	public static final String  IMAGE_CLCL_COMMAND_INPUT_FIELD        = "ImageClclCommandInputField";//$NON-NLS-1$
48
	public static final String  IMAGE_CLCL_COMMAND_INPUT_FIELD        = "ImageClclCommandInputField";//$NON-NLS-1$
51
	public static final String  IMAGE_ELCL_COMMAND_INPUT_FIELD        = "ImageDlclCommandInputField";//$NON-NLS-1$
49
	public static final String  IMAGE_ELCL_COMMAND_INPUT_FIELD        = "ImageDlclCommandInputField";//$NON-NLS-1$
(-)src/org/eclipse/tm/internal/terminal/view/TerminalViewPlugin.java (-3 / +1 lines)
Lines 13-18 Link Here
13
 * Contributors:
13
 * Contributors:
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.tm.internal.terminal.view;
18
package org.eclipse.tm.internal.terminal.view;
18
19
Lines 49-55 Link Here
49
			map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
50
			map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
50
			map.put(ImageConsts.IMAGE_CLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
51
			map.put(ImageConsts.IMAGE_CLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
51
			map.put(ImageConsts.IMAGE_CLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
52
			map.put(ImageConsts.IMAGE_CLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
52
			map.put(ImageConsts.IMAGE_CLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$
53
53
54
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
54
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
55
55
Lines 62-68 Link Here
62
			map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
62
			map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
63
			map.put(ImageConsts.IMAGE_ELCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
63
			map.put(ImageConsts.IMAGE_ELCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
64
			map.put(ImageConsts.IMAGE_ELCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
64
			map.put(ImageConsts.IMAGE_ELCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
65
			map.put(ImageConsts.IMAGE_ELCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$
66
65
67
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
66
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
68
67
Lines 75-81 Link Here
75
			map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
74
			map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$
76
			map.put(ImageConsts.IMAGE_DLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
75
			map.put(ImageConsts.IMAGE_DLCL_COMMAND_INPUT_FIELD, "command_input_field.gif"); //$NON-NLS-1$
77
			map.put(ImageConsts.IMAGE_DLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
76
			map.put(ImageConsts.IMAGE_DLCL_SCROLL_LOCK, "lock_co.gif"); //$NON-NLS-1$
78
			map.put(ImageConsts.IMAGE_DLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$
79
77
80
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);
78
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);
81
79
(-)src/org/eclipse/tm/internal/terminal/control/impl/TerminalPlugin.java (+63 lines)
Lines 13-23 Link Here
13
 * Contributors:
13
 * Contributors:
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins 
14
 * Michael Scharf (Wind River) - split into core, view and connector plugins 
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.tm.internal.terminal.control.impl;
18
package org.eclipse.tm.internal.terminal.control.impl;
18
19
20
import java.net.MalformedURLException;
21
import java.net.URL;
22
import java.util.HashMap;
23
import java.util.Iterator;
24
19
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.core.runtime.Platform;
26
import org.eclipse.jface.resource.ImageDescriptor;
27
import org.eclipse.jface.resource.ImageRegistry;
20
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
28
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
29
import org.eclipse.tm.terminal.control.actions.ImageConsts;
21
import org.eclipse.ui.plugin.AbstractUIPlugin;
30
import org.eclipse.ui.plugin.AbstractUIPlugin;
22
31
23
public class TerminalPlugin extends AbstractUIPlugin {
32
public class TerminalPlugin extends AbstractUIPlugin {
Lines 25-30 Link Here
25
	public static final String  PLUGIN_ID  = "org.eclipse.tm.terminal"; //$NON-NLS-1$
34
	public static final String  PLUGIN_ID  = "org.eclipse.tm.terminal"; //$NON-NLS-1$
26
	public static final String  HELP_VIEW  = PLUGIN_ID + ".terminal_view"; //$NON-NLS-1$
35
	public static final String  HELP_VIEW  = PLUGIN_ID + ".terminal_view"; //$NON-NLS-1$
27
36
37
	protected void initializeImageRegistry(ImageRegistry imageRegistry) {
38
		HashMap map;
39
40
		map = new HashMap();
41
42
		try {
43
			// Local toolbars
44
			map.put(ImageConsts.IMAGE_CLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$
45
46
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map);
47
48
			map.clear();
49
50
			// Enabled local toolbars
51
			map.put(ImageConsts.IMAGE_ELCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$
52
53
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map);
54
55
			map.clear();
56
57
			// Disabled local toolbars
58
			map.put(ImageConsts.IMAGE_DLCL_CLEAR_ALL, "clear_co.gif"); //$NON-NLS-1$
59
60
			loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map);
61
62
			map.clear();
63
		} catch (MalformedURLException malformedURLException) {
64
			malformedURLException.printStackTrace();
65
		}
66
	}
67
	
28
	/**
68
	/**
29
	 * The constructor.
69
	 * The constructor.
30
	 */
70
	 */
Lines 55-58 Link Here
55
95
56
		return new Boolean(strEnabled).booleanValue();
96
		return new Boolean(strEnabled).booleanValue();
57
	}
97
	}
98
	
99
	protected void loadImageRegistry(ImageRegistry imageRegistry,
100
			String strDir, HashMap map) throws MalformedURLException {
101
		URL url;
102
		ImageDescriptor imageDescriptor;
103
		Iterator keys;
104
		String strKey;
105
		String strFile;
106
107
		keys = map.keySet().iterator();
108
109
		while (keys.hasNext()) {
110
			strKey = (String) keys.next();
111
			strFile = (String) map.get(strKey);
112
113
			if (strFile != null) {
114
				url = TerminalPlugin.getDefault().getBundle().getEntry(
115
						ImageConsts.IMAGE_DIR_ROOT + strDir + strFile);
116
				imageDescriptor = ImageDescriptor.createFromURL(url);
117
				imageRegistry.put(strKey, imageDescriptor);
118
			}
119
		}
120
	}
58
}
121
}
(-)build.properties (-2 / +7 lines)
Lines 13-18 Link Here
13
# Contributors:
13
# Contributors:
14
# Michael Scharf (Wind River) - split into core, view and connector plugins 
14
# Michael Scharf (Wind River) - split into core, view and connector plugins 
15
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
15
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
# Anna Dushistova (MontaVista) - added icons
16
###############################################################################
17
###############################################################################
17
bin.includes = .,\
18
bin.includes = .,\
18
               META-INF/,\
19
               META-INF/,\
Lines 20-27 Link Here
20
               plugin.properties,\
21
               plugin.properties,\
21
               .options,\
22
               .options,\
22
               README.txt,\
23
               README.txt,\
23
               about.html,about.ini,about.mappings,about.properties,\
24
               about.html,\
24
               eclipse32.png
25
               about.ini,\
26
               about.mappings,\
27
               about.properties,\
28
               eclipse32.png,\
29
               icons/
25
               
30
               
26
source.. = src/
31
source.. = src/
27
output.. = bin/
32
output.. = bin/
(-)META-INF/MANIFEST.MF (-2 / +12 lines)
Lines 18-24 Link Here
18
 org.eclipse.tm.internal.terminal.control.impl;x-friends:="org.eclipse.tm.terminal.test",
18
 org.eclipse.tm.internal.terminal.control.impl;x-friends:="org.eclipse.tm.terminal.test",
19
 org.eclipse.tm.internal.terminal.emulator;x-friends:="org.eclipse.tm.terminal.test",
19
 org.eclipse.tm.internal.terminal.emulator;x-friends:="org.eclipse.tm.terminal.test",
20
 org.eclipse.tm.internal.terminal.model;x-friends:="org.eclipse.tm.terminal.test",
20
 org.eclipse.tm.internal.terminal.model;x-friends:="org.eclipse.tm.terminal.test",
21
 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",
21
 org.eclipse.tm.internal.terminal.provisional.api;
22
 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",
22
  x-friends:="org.eclipse.tm.terminal.serial,
23
   org.eclipse.tm.terminal.ssh,
24
   org.eclipse.tm.terminal.telnet,
25
   org.eclipse.tm.terminal.view,
26
   org.eclipse.tm.terminal.test",
27
 org.eclipse.tm.internal.terminal.provisional.api.provider;
28
  x-friends:="org.eclipse.tm.terminal.serial,
29
   org.eclipse.tm.terminal.ssh,
30
   org.eclipse.tm.terminal.telnet,
31
   org.eclipse.tm.terminal.test",
23
 org.eclipse.tm.internal.terminal.textcanvas;x-friends:="org.eclipse.tm.terminal.test",
32
 org.eclipse.tm.internal.terminal.textcanvas;x-friends:="org.eclipse.tm.terminal.test",
33
 org.eclipse.tm.terminal.control.actions,
24
 org.eclipse.tm.terminal.model
34
 org.eclipse.tm.terminal.model
(-)src/org/eclipse/tm/terminal/control/actions/TerminalActionClearAll.java (+55 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
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
 ********************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
21
22
public class TerminalActionClearAll extends AbstractTerminalControlAction {
23
	public TerminalActionClearAll() {
24
		super(TerminalActionClearAll.class.getName());
25
26
		setupAction(ActionMessages.CLEARALL, ActionMessages.CLEARALL,
27
				ImageConsts.IMAGE_CLCL_CLEAR_ALL,
28
				ImageConsts.IMAGE_ELCL_CLEAR_ALL,
29
				ImageConsts.IMAGE_DLCL_CLEAR_ALL, false);
30
	}
31
32
	public TerminalActionClearAll(ITerminalViewControl target) {
33
		super(target, TerminalActionClearAll.class.getName());
34
35
		setupAction(ActionMessages.CLEARALL, ActionMessages.CLEARALL,
36
				ImageConsts.IMAGE_CLCL_CLEAR_ALL,
37
				ImageConsts.IMAGE_ELCL_CLEAR_ALL,
38
				ImageConsts.IMAGE_DLCL_CLEAR_ALL, false);
39
	}
40
41
	public void run() {
42
		ITerminalViewControl target = getTarget();
43
		if (target != null) {
44
			target.clearTerminal();
45
		}
46
	}
47
48
	public void updateAction(boolean aboutToShow) {
49
		ITerminalViewControl target = getTarget();
50
		if (target != null)
51
			setEnabled(!target.isEmpty());
52
		else
53
			setEnabled(false);
54
	}
55
}
(-)src/org/eclipse/tm/terminal/control/actions/TerminalActionCut.java (+55 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.terminal.control.actions;
18
19
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
20
import org.eclipse.ui.ISharedImages;
21
import org.eclipse.ui.PlatformUI;
22
23
public class TerminalActionCut extends AbstractTerminalControlAction {
24
	public TerminalActionCut() {
25
		super(TerminalActionCut.class.getName());
26
		ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
27
		setupAction(ActionMessages.CUT, ActionMessages.CUT, si
28
				.getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si
29
				.getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si
30
				.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true);
31
	}
32
33
	public TerminalActionCut(ITerminalViewControl target) {
34
		super(target, TerminalActionCut.class.getName());
35
		ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
36
		setupAction(ActionMessages.CUT, ActionMessages.CUT, si
37
				.getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si
38
				.getImageDescriptor(ISharedImages.IMG_TOOL_CUT), si
39
				.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true);
40
	}
41
42
	public void run() {
43
		ITerminalViewControl target = getTarget();
44
		if (target != null) {
45
			target.sendKey('\u0018');
46
		}
47
	}
48
49
	public void updateAction(boolean aboutToShow) {
50
		boolean bEnabled;
51
52
		bEnabled = !aboutToShow;
53
		setEnabled(bEnabled);
54
	}
55
}
(-)src/org/eclipse/tm/terminal/control/actions/TerminalActionSelectAll.java (+52 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
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
 *******************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
22
23
public class TerminalActionSelectAll extends AbstractTerminalControlAction {
24
	public TerminalActionSelectAll() {
25
		super(TerminalActionSelectAll.class.getName());
26
27
		setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL,
28
				(ImageDescriptor) null, null, null, false);
29
	}
30
31
	public TerminalActionSelectAll(ITerminalViewControl target) {
32
		super(target, TerminalActionSelectAll.class.getName());
33
34
		setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL,
35
				(ImageDescriptor) null, null, null, false);
36
	}
37
38
	public void run() {
39
		ITerminalViewControl target = getTarget();
40
		if (target != null) {
41
			target.selectAll();
42
		}
43
	}
44
45
	public void updateAction(boolean aboutToShow) {
46
		ITerminalViewControl target = getTarget();
47
		if (target != null)
48
			setEnabled(!target.isEmpty());
49
		else
50
			setEnabled(false);
51
	}
52
}
(-)src/org/eclipse/tm/terminal/control/actions/ActionMessages.java (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2003, 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
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
 *******************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
import org.eclipse.osgi.util.NLS;
21
22
public class ActionMessages extends NLS {
23
	static {
24
		NLS.initializeMessages(ActionMessages.class.getName(),
25
				ActionMessages.class);
26
	}
27
28
	public static String COPY;
29
	public static String CUT;
30
	public static String PASTE;
31
	public static String SELECTALL;
32
	public static String CLEARALL;
33
34
}
(-)src/org/eclipse/tm/terminal/control/actions/AbstractTerminalControlAction.java (+97 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
 * Anna Dushistova (MontaVista) - Adapted from TerminalAction
17
 *******************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
import org.eclipse.jface.action.Action;
21
import org.eclipse.jface.resource.ImageDescriptor;
22
import org.eclipse.jface.resource.ImageRegistry;
23
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
24
import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin;
25
26
public abstract class AbstractTerminalControlAction extends Action {
27
	private final ITerminalViewControl fTarget;
28
29
	public AbstractTerminalControlAction(String strId) {
30
		this(null, strId, 0);
31
	}
32
33
	public AbstractTerminalControlAction(ITerminalViewControl target,
34
			String strId) {
35
		this(target, strId, 0);
36
	}
37
38
	public AbstractTerminalControlAction(ITerminalViewControl target,
39
			String strId, int style) {
40
		super("", style); //$NON-NLS-1$
41
42
		fTarget = target;
43
44
		setId(strId);
45
	}
46
47
	abstract public void run();
48
49
	protected void setupAction(String strText, String strToolTip,
50
			String strImage, String strEnabledImage, String strDisabledImage,
51
			boolean bEnabled) {
52
		setupAction(strText, strToolTip, strImage, strEnabledImage,
53
				strDisabledImage, bEnabled, TerminalPlugin.getDefault()
54
						.getImageRegistry());
55
	}
56
57
	protected void setupAction(String strText, String strToolTip,
58
			String strHoverImage, String strEnabledImage,
59
			String strDisabledImage, boolean bEnabled,
60
			ImageRegistry imageRegistry) {
61
		setupAction(strText, strToolTip, imageRegistry
62
				.getDescriptor(strHoverImage), imageRegistry
63
				.getDescriptor(strEnabledImage), imageRegistry
64
				.getDescriptor(strDisabledImage), bEnabled);
65
	}
66
67
	protected void setupAction(String strText, String strToolTip,
68
			ImageDescriptor hoverImage, ImageDescriptor enabledImage,
69
			ImageDescriptor disabledImage, boolean bEnabled) {
70
		setText(strText);
71
		setToolTipText(strToolTip);
72
		setEnabled(bEnabled);
73
		if (enabledImage != null) {
74
			setImageDescriptor(enabledImage);
75
		}
76
		if (disabledImage != null) {
77
			setDisabledImageDescriptor(disabledImage);
78
		}
79
		if (hoverImage != null) {
80
			setHoverImageDescriptor(hoverImage);
81
		}
82
	}
83
84
	protected ITerminalViewControl getTarget() {
85
		return fTarget;
86
	}
87
88
	/**
89
	 * Subclasses can update their action
90
	 * 
91
	 * @param aboutToShow
92
	 *            true before the menu is shown -- false when the menu gets
93
	 *            hidden
94
	 */
95
	public void updateAction(boolean aboutToShow) {
96
	}
97
}
(-)src/org/eclipse/tm/terminal/control/actions/TerminalActionCopy.java (+64 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
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
 *******************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
21
import org.eclipse.ui.ISharedImages;
22
import org.eclipse.ui.PlatformUI;
23
24
public class TerminalActionCopy extends AbstractTerminalControlAction {
25
	public TerminalActionCopy() {
26
		super(TerminalActionCopy.class.getName());
27
		ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
28
		setupAction(ActionMessages.COPY, ActionMessages.COPY, si
29
				.getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si
30
				.getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si
31
				.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true);
32
	}
33
34
	public TerminalActionCopy(ITerminalViewControl target) {
35
		super(target, TerminalActionCopy.class.getName());
36
		ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
37
		setupAction(ActionMessages.COPY, ActionMessages.COPY, si
38
				.getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si
39
				.getImageDescriptor(ISharedImages.IMG_TOOL_COPY), si
40
				.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true);
41
	}
42
43
	public void run() {
44
		ITerminalViewControl target = getTarget();
45
		if (target != null) {
46
			String selection = target.getSelection();
47
48
			if (!selection.equals("")) {//$NON-NLS-1$
49
				target.copy();
50
			} else {
51
				target.sendKey('\u0003');
52
			}
53
		}
54
	}
55
56
	public void updateAction(boolean aboutToShow) {
57
		boolean bEnabled = true;
58
		ITerminalViewControl target = getTarget();
59
		if (aboutToShow && target != null) {
60
			bEnabled = target.getSelection().length() > 0;
61
		}
62
		setEnabled(bEnabled);
63
	}
64
}
(-)src/org/eclipse/tm/terminal/control/actions/ImageConsts.java (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2003, 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) - extracted from TerminalConsts
15
 * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
16
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
 *******************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
public interface ImageConsts {
21
	public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
22
	public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors
23
																// - size 16x16
24
																// //$NON-NLS-1$
25
	public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size
26
															// 16x16
27
															// //$NON-NLS-1$
28
	public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size
29
															// 16x16
30
															// //$NON-NLS-1$
31
32
	public static final String IMAGE_CLCL_CLEAR_ALL = "ImageClclClearAll"; //$NON-NLS-1$
33
34
	public static final String IMAGE_DLCL_CLEAR_ALL = "ImageDlclClearAll"; //$NON-NLS-1$
35
36
	public static final String IMAGE_ELCL_CLEAR_ALL = "ImageElclClearAll"; //$NON-NLS-1$
37
}
(-)src/org/eclipse/tm/terminal/control/actions/TerminalActionPaste.java (+62 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
 * Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
 *******************************************************************************/
18
package org.eclipse.tm.terminal.control.actions;
19
20
import org.eclipse.swt.dnd.TextTransfer;
21
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
22
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
23
import org.eclipse.ui.ISharedImages;
24
import org.eclipse.ui.PlatformUI;
25
26
public class TerminalActionPaste extends AbstractTerminalControlAction {
27
	public TerminalActionPaste() {
28
		super(TerminalActionPaste.class.getName());
29
		ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
30
		setupAction(ActionMessages.PASTE, ActionMessages.PASTE, si
31
				.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), si
32
				.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), si
33
				.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), false);
34
	}
35
36
	public TerminalActionPaste(ITerminalViewControl target) {
37
		super(target, TerminalActionPaste.class.getName());
38
		ISharedImages si = PlatformUI.getWorkbench().getSharedImages();
39
		setupAction(ActionMessages.PASTE, ActionMessages.PASTE, si
40
				.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), si
41
				.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), si
42
				.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE), false);
43
	}
44
45
	public void run() {
46
		ITerminalViewControl target = getTarget();
47
		if (target != null) {
48
			target.paste();
49
		}
50
	}
51
52
	public void updateAction(boolean aboutToShow) {
53
		boolean bEnabled = false;
54
		ITerminalViewControl target = getTarget();
55
		if (target != null) {
56
			String strText = (String) target.getClipboard().getContents(
57
					TextTransfer.getInstance());
58
			bEnabled = ((strText != null) && (!strText.equals("")) && (target.getState() == TerminalState.CONNECTED));//$NON-NLS-1$
59
		}
60
		setEnabled(bEnabled);
61
	}
62
}
(-)src/org/eclipse/tm/terminal/control/actions/ActionMessages.properties (+22 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2003, 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
# Anna Dushistova (MontaVista) - moved actions from terminal.view to terminal plugin
17
###############################################################################
18
COPY                      = Copy
19
CUT                       = Cut
20
PASTE                     = Paste
21
SELECTALL                 = Select All
22
CLEARALL                  = Clear Terminal

Return to bug 227537