mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 13:05:22 +02:00
[244437] Moved ITerminalListener implementation to separate inner class.
This commit is contained in:
parent
de1312524d
commit
5de65b0325
1 changed files with 285 additions and 266 deletions
|
@ -18,6 +18,7 @@
|
||||||
* Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits
|
* Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits
|
||||||
* Martin Oberhuber (Wind River) - [227571] RSE Terminal should honor Encoding set on the IHost
|
* Martin Oberhuber (Wind River) - [227571] RSE Terminal should honor Encoding set on the IHost
|
||||||
* Michael Scharf (Wind River) - [236203] [rseterminal] Potentially UI blocking code in TerminalViewTab.createTabItem
|
* Michael Scharf (Wind River) - [236203] [rseterminal] Potentially UI blocking code in TerminalViewTab.createTabItem
|
||||||
|
* Anna Dushistova (MontaVista) - [244437] [rseterminal] Possible race condition when multiple Terminals are launched after each other
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
package org.eclipse.rse.internal.terminals.ui.views;
|
package org.eclipse.rse.internal.terminals.ui.views;
|
||||||
|
|
||||||
|
@ -64,324 +65,342 @@ import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||||
/**
|
/**
|
||||||
* This is the desktop view wrapper of the System View viewer.
|
* This is the desktop view wrapper of the System View viewer.
|
||||||
*/
|
*/
|
||||||
public class TerminalViewTab extends Composite implements ITerminalListener{
|
public class TerminalViewTab extends Composite {
|
||||||
|
|
||||||
public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$
|
public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$
|
||||||
private final CTabFolder tabFolder;
|
|
||||||
private Menu menu;
|
private final CTabFolder tabFolder;
|
||||||
private boolean fMenuAboutToShow;
|
|
||||||
private TerminalActionCopy fActionEditCopy;
|
private Menu menu;
|
||||||
|
|
||||||
|
private boolean fMenuAboutToShow;
|
||||||
|
|
||||||
|
private TerminalActionCopy fActionEditCopy;
|
||||||
|
|
||||||
private TerminalActionCut fActionEditCut;
|
private TerminalActionCut fActionEditCut;
|
||||||
|
|
||||||
private TerminalActionPaste fActionEditPaste;
|
private TerminalActionPaste fActionEditPaste;
|
||||||
|
|
||||||
private TerminalActionClearAll fActionEditClearAll;
|
private TerminalActionClearAll fActionEditClearAll;
|
||||||
|
|
||||||
|
private TerminalActionSelectAll fActionEditSelectAll;
|
||||||
|
|
||||||
private TerminalActionSelectAll fActionEditSelectAll;
|
|
||||||
private String fInitialWorkingDirCmd;
|
|
||||||
private ITerminalViewControl fTerminalControl;
|
private ITerminalViewControl fTerminalControl;
|
||||||
|
|
||||||
protected class TerminalContextMenuHandler implements MenuListener,
|
protected class TerminalContextMenuHandler implements MenuListener,
|
||||||
IMenuListener {
|
IMenuListener {
|
||||||
public void menuHidden(MenuEvent event) {
|
public void menuHidden(MenuEvent event) {
|
||||||
fMenuAboutToShow = false;
|
fMenuAboutToShow = false;
|
||||||
fActionEditCopy.updateAction(fMenuAboutToShow);
|
fActionEditCopy.updateAction(fMenuAboutToShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void menuShown(MenuEvent e) {
|
public void menuShown(MenuEvent e) {
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
public void menuAboutToShow(IMenuManager menuMgr) {
|
}
|
||||||
fMenuAboutToShow = true;
|
|
||||||
|
public void menuAboutToShow(IMenuManager menuMgr) {
|
||||||
|
fMenuAboutToShow = true;
|
||||||
fActionEditCopy.updateAction(fMenuAboutToShow);
|
fActionEditCopy.updateAction(fMenuAboutToShow);
|
||||||
fActionEditCut.updateAction(fMenuAboutToShow);
|
fActionEditCut.updateAction(fMenuAboutToShow);
|
||||||
fActionEditSelectAll.updateAction(fMenuAboutToShow);
|
fActionEditSelectAll.updateAction(fMenuAboutToShow);
|
||||||
fActionEditPaste.updateAction(fMenuAboutToShow);
|
fActionEditPaste.updateAction(fMenuAboutToShow);
|
||||||
fActionEditClearAll.updateAction(fMenuAboutToShow);
|
fActionEditClearAll.updateAction(fMenuAboutToShow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerminalViewTab(final Composite parent, TerminalViewer viewer) {
|
public TerminalViewTab(final Composite parent, TerminalViewer viewer) {
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
tabFolder = new CTabFolder(this, SWT.NONE);
|
tabFolder = new CTabFolder(this, SWT.NONE);
|
||||||
tabFolder.setLayout(new FillLayout());
|
tabFolder.setLayout(new FillLayout());
|
||||||
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
setLayout(new FillLayout());
|
setLayout(new FillLayout());
|
||||||
tabFolder.setBackground(parent.getBackground());
|
tabFolder.setBackground(parent.getBackground());
|
||||||
tabFolder.setSimple(false);
|
tabFolder.setSimple(false);
|
||||||
tabFolder.setUnselectedImageVisible(false);
|
tabFolder.setUnselectedImageVisible(false);
|
||||||
tabFolder.setUnselectedCloseVisible(false);
|
tabFolder.setUnselectedCloseVisible(false);
|
||||||
|
|
||||||
tabFolder.setMinimizeVisible(false);
|
tabFolder.setMinimizeVisible(false);
|
||||||
tabFolder.setMaximizeVisible(false);
|
tabFolder.setMaximizeVisible(false);
|
||||||
setupActions();
|
setupActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (!tabFolder.isDisposed()) {
|
if (!tabFolder.isDisposed()) {
|
||||||
tabFolder.dispose();
|
tabFolder.dispose();
|
||||||
}
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CTabFolder getFolder() {
|
public CTabFolder getFolder() {
|
||||||
return tabFolder;
|
return tabFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Object root) {
|
public void remove(Object root) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CTabItem getSelectedTab() {
|
public CTabItem getSelectedTab() {
|
||||||
if (tabFolder.getItemCount() > 0) {
|
if (tabFolder.getItemCount() > 0) {
|
||||||
int index = tabFolder.getSelectionIndex();
|
int index = tabFolder.getSelectionIndex();
|
||||||
CTabItem item = tabFolder.getItem(index);
|
CTabItem item = tabFolder.getItem(index);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showCurrentPage() {
|
public void showCurrentPage() {
|
||||||
tabFolder.setFocus();
|
tabFolder.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showPageFor(Object root) {
|
public void showPageFor(Object root) {
|
||||||
for (int i = 0; i < tabFolder.getItemCount(); i++) {
|
for (int i = 0; i < tabFolder.getItemCount(); i++) {
|
||||||
CTabItem item = tabFolder.getItem(i);
|
CTabItem item = tabFolder.getItem(i);
|
||||||
if (item.getData() == root) {
|
if (item.getData() == root) {
|
||||||
tabFolder.setSelection(item);
|
tabFolder.setSelection(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showPageFor(String tabName) {
|
public void showPageFor(String tabName) {
|
||||||
for (int i = 0; i < tabFolder.getItemCount(); i++) {
|
for (int i = 0; i < tabFolder.getItemCount(); i++) {
|
||||||
CTabItem item = tabFolder.getItem(i);
|
CTabItem item = tabFolder.getItem(i);
|
||||||
if (item.getText().equals(tabName)) {
|
if (item.getText().equals(tabName)) {
|
||||||
tabFolder.setSelection(item);
|
tabFolder.setSelection(item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disposePageFor(String tabName) {
|
public void disposePageFor(String tabName) {
|
||||||
for (int i = 0; i < tabFolder.getItemCount(); i++) {
|
for (int i = 0; i < tabFolder.getItemCount(); i++) {
|
||||||
CTabItem item = tabFolder.getItem(i);
|
CTabItem item = tabFolder.getItem(i);
|
||||||
if (item.getText().equals(tabName)) {
|
if (item.getText().equals(tabName)) {
|
||||||
item.dispose();
|
item.dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CTabItem createTabItem(IAdaptable root, String initialWorkingDirCmd) {
|
|
||||||
fInitialWorkingDirCmd = initialWorkingDirCmd;
|
|
||||||
CTabItem item = new CTabItem(tabFolder, SWT.CLOSE);
|
|
||||||
setTabTitle(root, item);
|
|
||||||
|
|
||||||
item.setData(root);
|
public CTabItem createTabItem(IAdaptable root,
|
||||||
Composite c = new Composite(tabFolder, SWT.NONE);
|
final String initialWorkingDirCmd) {
|
||||||
c.setLayout(new FillLayout());
|
CTabItem item = new CTabItem(tabFolder, SWT.CLOSE);
|
||||||
|
setTabTitle(root, item);
|
||||||
|
|
||||||
tabFolder.getParent().layout(true);
|
item.setData(root);
|
||||||
if (root instanceof IHost) {
|
Composite c = new Composite(tabFolder, SWT.NONE);
|
||||||
IHost host = (IHost) root;
|
c.setLayout(new FillLayout());
|
||||||
|
|
||||||
ITerminalConnector connector = new RSETerminalConnector(host);
|
tabFolder.getParent().layout(true);
|
||||||
fTerminalControl = TerminalViewControlFactory
|
if (root instanceof IHost) {
|
||||||
.makeControl(this, c,
|
IHost host = (IHost) root;
|
||||||
new ITerminalConnector[] { connector });
|
|
||||||
|
ITerminalConnector connector = new RSETerminalConnector(host);
|
||||||
|
fTerminalControl = TerminalViewControlFactory.makeControl(
|
||||||
|
new ITerminalListener() {
|
||||||
|
|
||||||
|
public void setState(final TerminalState state) {
|
||||||
|
if (state == TerminalState.CLOSED
|
||||||
|
|| state == TerminalState.CONNECTED) {
|
||||||
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
CTabItem item = tabFolder
|
||||||
|
.getSelection();
|
||||||
|
if (item != null && !item.isDisposed()) {
|
||||||
|
Object data = item.getData();
|
||||||
|
if (data instanceof IHost) {
|
||||||
|
IHost host = (IHost) data;
|
||||||
|
final ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper
|
||||||
|
.getTerminalSubSystem(host);
|
||||||
|
|
||||||
|
if (state == TerminalState.CONNECTED)
|
||||||
|
TerminalServiceHelper
|
||||||
|
.updateTerminalShellForTerminalElement(item);
|
||||||
|
|
||||||
|
setTabImage(host, item);
|
||||||
|
ISystemRegistry registry = RSECorePlugin
|
||||||
|
.getTheSystemRegistry();
|
||||||
|
registry
|
||||||
|
.fireEvent(new SystemResourceChangeEvent(
|
||||||
|
terminalServiceSubSystem,
|
||||||
|
ISystemResourceChangeEvents.EVENT_REFRESH,
|
||||||
|
terminalServiceSubSystem));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state == TerminalState.CONNECTED) {
|
||||||
|
if (initialWorkingDirCmd != null) {
|
||||||
|
fTerminalControl
|
||||||
|
.pasteString(initialWorkingDirCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalTitle(String title) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}, c, new ITerminalConnector[] { connector });
|
||||||
// Specify Encoding for Terminal
|
// Specify Encoding for Terminal
|
||||||
try {
|
try {
|
||||||
fTerminalControl.setEncoding(host.getDefaultEncoding(true));
|
fTerminalControl.setEncoding(host.getDefaultEncoding(true));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
/* ignore and allow fallback to default encoding */
|
/* ignore and allow fallback to default encoding */
|
||||||
}
|
}
|
||||||
fTerminalControl.setConnector(connector);
|
fTerminalControl.setConnector(connector);
|
||||||
fTerminalControl.connectTerminal();
|
fTerminalControl.connectTerminal();
|
||||||
item.setData(DATA_KEY_CONTROL, fTerminalControl);
|
item.setData(DATA_KEY_CONTROL, fTerminalControl);
|
||||||
}
|
}
|
||||||
item.setControl(c);
|
item.setControl(c);
|
||||||
tabFolder.setSelection(item);
|
tabFolder.setSelection(item);
|
||||||
item.addDisposeListener(new DisposeListener() {
|
item.addDisposeListener(new DisposeListener() {
|
||||||
|
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
public void widgetDisposed(DisposeEvent e) {
|
||||||
Object source = e.getSource();
|
Object source = e.getSource();
|
||||||
if (source instanceof CTabItem) {
|
if (source instanceof CTabItem) {
|
||||||
CTabItem currentItem = (CTabItem) source;
|
CTabItem currentItem = (CTabItem) source;
|
||||||
Object data = currentItem.getData(DATA_KEY_CONTROL);
|
Object data = currentItem.getData(DATA_KEY_CONTROL);
|
||||||
if (data instanceof ITerminalViewControl) {
|
if (data instanceof ITerminalViewControl) {
|
||||||
((ITerminalViewControl) data).disposeTerminal();
|
((ITerminalViewControl) data).disposeTerminal();
|
||||||
}
|
}
|
||||||
data = currentItem.getData();
|
data = currentItem.getData();
|
||||||
if (data instanceof IHost) {
|
if (data instanceof IHost) {
|
||||||
TerminalServiceHelper.removeTerminalElementFromHost(
|
TerminalServiceHelper.removeTerminalElementFromHost(
|
||||||
currentItem, (IHost) data);
|
currentItem, (IHost) data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setupContextMenus();
|
setupContextMenus();
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupActions() {
|
protected void setupActions() {
|
||||||
fActionEditCopy = new TerminalActionCopy(){
|
fActionEditCopy = new TerminalActionCopy() {
|
||||||
protected ITerminalViewControl getTarget() {
|
protected ITerminalViewControl getTarget() {
|
||||||
return getCurrentTerminalViewControl();
|
return getCurrentTerminalViewControl();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fActionEditCut = new TerminalActionCut(){
|
fActionEditCut = new TerminalActionCut() {
|
||||||
protected ITerminalViewControl getTarget() {
|
protected ITerminalViewControl getTarget() {
|
||||||
return getCurrentTerminalViewControl();
|
return getCurrentTerminalViewControl();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fActionEditPaste = new TerminalActionPaste(){
|
fActionEditPaste = new TerminalActionPaste() {
|
||||||
protected ITerminalViewControl getTarget() {
|
protected ITerminalViewControl getTarget() {
|
||||||
return getCurrentTerminalViewControl();
|
return getCurrentTerminalViewControl();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fActionEditClearAll = new TerminalActionClearAll(){
|
fActionEditClearAll = new TerminalActionClearAll() {
|
||||||
protected ITerminalViewControl getTarget() {
|
protected ITerminalViewControl getTarget() {
|
||||||
return getCurrentTerminalViewControl();
|
return getCurrentTerminalViewControl();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fActionEditSelectAll = new TerminalActionSelectAll(){
|
fActionEditSelectAll = new TerminalActionSelectAll() {
|
||||||
protected ITerminalViewControl getTarget() {
|
protected ITerminalViewControl getTarget() {
|
||||||
return getCurrentTerminalViewControl();
|
return getCurrentTerminalViewControl();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupContextMenus() {
|
protected void setupContextMenus() {
|
||||||
ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
|
ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
|
||||||
if (terminalViewControl == null)
|
if (terminalViewControl == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (menu == null) {
|
if (menu == null) {
|
||||||
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
|
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
|
||||||
menu = menuMgr.createContextMenu(tabFolder);
|
menu = menuMgr.createContextMenu(tabFolder);
|
||||||
loadContextMenus(menuMgr);
|
loadContextMenus(menuMgr);
|
||||||
TerminalContextMenuHandler contextMenuHandler = new TerminalContextMenuHandler();
|
TerminalContextMenuHandler contextMenuHandler = new TerminalContextMenuHandler();
|
||||||
menuMgr.addMenuListener(contextMenuHandler);
|
menuMgr.addMenuListener(contextMenuHandler);
|
||||||
menu.addMenuListener(contextMenuHandler);
|
menu.addMenuListener(contextMenuHandler);
|
||||||
}
|
}
|
||||||
Control ctlText = terminalViewControl.getControl();
|
Control ctlText = terminalViewControl.getControl();
|
||||||
ctlText.setMenu(menu);
|
ctlText.setMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadContextMenus(IMenuManager menuMgr) {
|
protected void loadContextMenus(IMenuManager menuMgr) {
|
||||||
menuMgr.add(fActionEditCopy);
|
menuMgr.add(fActionEditCopy);
|
||||||
menuMgr.add(fActionEditPaste);
|
menuMgr.add(fActionEditPaste);
|
||||||
menuMgr.add(new Separator());
|
menuMgr.add(new Separator());
|
||||||
menuMgr.add(fActionEditClearAll);
|
menuMgr.add(fActionEditClearAll);
|
||||||
menuMgr.add(fActionEditSelectAll);
|
menuMgr.add(fActionEditSelectAll);
|
||||||
menuMgr.add(new Separator());
|
menuMgr.add(new Separator());
|
||||||
|
|
||||||
// Other plug-ins can contribute there actions here
|
// Other plug-ins can contribute there actions here
|
||||||
menuMgr.add(new Separator("Additions")); //$NON-NLS-1$
|
menuMgr.add(new Separator("Additions")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTabTitle(IAdaptable root, CTabItem titem) {
|
private void setTabTitle(IAdaptable root, CTabItem titem) {
|
||||||
ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
|
ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
|
||||||
.getAdapter(ISystemViewElementAdapter.class);
|
.getAdapter(ISystemViewElementAdapter.class);
|
||||||
if (va != null) {
|
if (va != null) {
|
||||||
updateWithUniqueTitle(va.getName(root), titem);
|
updateWithUniqueTitle(va.getName(root), titem);
|
||||||
setTabImage(root, titem);
|
setTabImage(root, titem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void setTabImage(IAdaptable root, CTabItem titem) {
|
|
||||||
ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
|
|
||||||
.getAdapter(ISystemViewElementAdapter.class);
|
|
||||||
if (va != null) {
|
|
||||||
if (root instanceof IHost){
|
|
||||||
ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper.getTerminalSubSystem((IHost)root);
|
|
||||||
TerminalElement element = terminalServiceSubSystem.getChild(titem.getText());
|
|
||||||
if (element != null){
|
|
||||||
va = (ISystemViewElementAdapter) element.getAdapter(ISystemViewElementAdapter.class);
|
|
||||||
titem.setImage(va.getImageDescriptor(element).createImage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
titem.setImage(va.getImageDescriptor(root).createImage());
|
private void setTabImage(IAdaptable root, CTabItem titem) {
|
||||||
}
|
ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
|
||||||
}
|
.getAdapter(ISystemViewElementAdapter.class);
|
||||||
public void setState(final TerminalState state) {
|
if (va != null) {
|
||||||
if (state == TerminalState.CLOSED || state == TerminalState.CONNECTED){
|
if (root instanceof IHost) {
|
||||||
Display.getDefault().asyncExec(new Runnable(){
|
ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper
|
||||||
public void run() {
|
.getTerminalSubSystem((IHost) root);
|
||||||
CTabItem item = tabFolder.getSelection();
|
TerminalElement element = terminalServiceSubSystem
|
||||||
if (item != null && !item.isDisposed()){
|
.getChild(titem.getText());
|
||||||
Object data = item.getData();
|
if (element != null) {
|
||||||
if (data instanceof IHost){
|
va = (ISystemViewElementAdapter) element
|
||||||
IHost host = (IHost)data;
|
.getAdapter(ISystemViewElementAdapter.class);
|
||||||
final ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper.getTerminalSubSystem(host);
|
titem
|
||||||
|
.setImage(va.getImageDescriptor(element)
|
||||||
|
.createImage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (state == TerminalState.CONNECTED)
|
titem.setImage(va.getImageDescriptor(root).createImage());
|
||||||
TerminalServiceHelper.updateTerminalShellForTerminalElement(item);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setTabImage(host, item);
|
private void updateWithUniqueTitle(String title, CTabItem currentItem) {
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
CTabItem[] items = tabFolder.getItems();
|
||||||
registry.fireEvent(new SystemResourceChangeEvent(terminalServiceSubSystem,
|
int increment = 1;
|
||||||
ISystemResourceChangeEvents.EVENT_REFRESH, terminalServiceSubSystem));
|
String temp = title;
|
||||||
}
|
for (int i = 0; i < items.length; i++) {
|
||||||
}
|
if (items[i] != currentItem) {
|
||||||
if(state == TerminalState.CONNECTED) {
|
String name = items[i].getText();
|
||||||
if(fInitialWorkingDirCmd != null) {
|
if (name != null) {
|
||||||
fTerminalControl.pasteString(fInitialWorkingDirCmd);
|
if (name.equals(temp)) {
|
||||||
fInitialWorkingDirCmd = null;
|
temp = title + " " + increment++; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
currentItem.setText(temp);
|
||||||
|
}
|
||||||
|
|
||||||
public void setTerminalTitle(String title) {
|
private ITerminalViewControl getCurrentTerminalViewControl() {
|
||||||
// TODO Auto-generated method stub
|
if (tabFolder != null && !tabFolder.isDisposed()) {
|
||||||
|
CTabItem item = tabFolder.getSelection();
|
||||||
}
|
if (item != null && !item.isDisposed()) {
|
||||||
|
Object data = item.getData(DATA_KEY_CONTROL);
|
||||||
private void updateWithUniqueTitle(String title, CTabItem currentItem) {
|
if (data instanceof ITerminalViewControl)
|
||||||
CTabItem[] items = tabFolder.getItems();
|
return ((ITerminalViewControl) data);
|
||||||
int increment = 1;
|
}
|
||||||
String temp = title;
|
}
|
||||||
for (int i = 0; i < items.length; i++) {
|
return null;
|
||||||
if (items[i] != currentItem) {
|
}
|
||||||
String name = items[i].getText();
|
|
||||||
if (name != null) {
|
|
||||||
if (name.equals(temp)) {
|
|
||||||
temp = title + " " + increment++; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentItem.setText(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ITerminalViewControl getCurrentTerminalViewControl() {
|
|
||||||
if (tabFolder != null && !tabFolder.isDisposed()) {
|
|
||||||
CTabItem item = tabFolder.getSelection();
|
|
||||||
if (item != null && !item.isDisposed()) {
|
|
||||||
Object data = item.getData(DATA_KEY_CONTROL);
|
|
||||||
if (data instanceof ITerminalViewControl)
|
|
||||||
return ((ITerminalViewControl) data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue