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 |
} |