1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

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

https://bugs.eclipse.org/bugs/show_bug.cgi?id=240023
This commit is contained in:
Michael Scharf 2008-07-08 23:13:35 +00:00
parent 9704ead40d
commit e16b33fb2e
4 changed files with 29 additions and 9 deletions

View file

@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [168197] Replace JFace MessagDialog by SWT MessageBox
* Martin Oberhuber (Wind River) - [168186] Add Terminal User Docs
* Michael Scharf (Wind River) - [196454] Initial connection settings dialog should not be blank
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -61,6 +62,7 @@ class TerminalSettingsDlg extends Dialog {
private PageBook fPageBook;
private IDialogSettings fDialogSettings;
private String fTerminalTitle;
private String fTitle=ViewMessages.TERMINALSETTINGS;
public TerminalSettingsDlg(Shell shell, ITerminalConnector[] connectors, ITerminalConnector connector) {
super(shell);
@ -73,6 +75,9 @@ class TerminalSettingsDlg extends Dialog {
fSelectedConnector=i;
}
}
public void setTitle(String title) {
fTitle=title;
}
/**
* @param connectors
* @return connectors excluding connectors with errors
@ -162,7 +167,7 @@ class TerminalSettingsDlg extends Dialog {
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(ViewMessages.TERMINALSETTINGS);
newShell.setText(fTitle);
}
protected Control createDialogArea(Composite parent) {
Composite ctlComposite = (Composite) super.createDialogArea(parent);

View file

@ -70,6 +70,7 @@ import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.ITerminalViewConnectionFactory;
import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.ITerminalViewConnectionListener;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
@ -243,7 +244,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
public void onTerminalNewTerminal() {
Logger.log("creating new Terminal instance."); //$NON-NLS-1$
setupControls();
if(newConnection()==null) {
if(newConnection(ViewMessages.NEW_TERMINAL_CONNECTION)==null) {
fMultiConnectionManager.removeActive();
}
}
@ -258,11 +259,17 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
// unique. This code runs only when the user clicks the New Terminal
// button, so there is no risk that this code will run twice in a single
// millisecond.
getSite().getPage().showView(
IViewPart newTerminalView = getSite().getPage().showView(
"org.eclipse.tm.terminal.view.TerminalView",//$NON-NLS-1$
"SecondaryTerminal" + System.currentTimeMillis(), //$NON-NLS-1$
IWorkbenchPage.VIEW_ACTIVATE);
if(newTerminalView instanceof ITerminalView) {
ITerminalConnector c = ((TerminalView)newTerminalView).newConnection(ViewMessages.NEW_TERMINAL_VIEW);
// if there is no connector selected, hide the new view
if(c==null) {
getSite().getPage().hideView(newTerminalView);
}
}
} catch (PartInitException ex) {
Logger.logException(ex);
}
@ -274,7 +281,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
if (fCtlTerminal.getState()!=TerminalState.CLOSED)
return;
if(fCtlTerminal.getTerminalConnector()==null)
setConnector(showSettingsDialog());
setConnector(showSettingsDialog(ViewMessages.TERMINALSETTINGS));
fCtlTerminal.connectTerminal();
}
@ -308,11 +315,11 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
}
public void onTerminalSettings() {
newConnection();
newConnection(null);
}
private ITerminalConnector newConnection() {
ITerminalConnector c=showSettingsDialog();
private ITerminalConnector newConnection(String title) {
ITerminalConnector c=showSettingsDialog(title);
if(c!=null) {
setConnector(c);
onTerminalConnect();
@ -320,7 +327,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
return c;
}
private ITerminalConnector showSettingsDialog() {
private ITerminalConnector showSettingsDialog(String title) {
// When the settings dialog is opened, load the Terminal settings from the
// persistent settings.
@ -329,6 +336,8 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
connectors=new ITerminalConnector[0];
TerminalSettingsDlg dlgTerminalSettings = new TerminalSettingsDlg(getViewSite().getShell(),connectors,fCtlTerminal.getTerminalConnector());
dlgTerminalSettings.setTerminalTitle(getActiveConnection().getPartName());
if(title!=null)
dlgTerminalSettings.setTitle(title);
Logger.log("opening Settings dialog."); //$NON-NLS-1$
if (dlgTerminalSettings.open() == Window.CANCEL) {

View file

@ -13,6 +13,7 @@
* Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -27,6 +28,8 @@ public class ViewMessages extends NLS {
public static String SETTINGS;
public static String TERMINALSETTINGS;
public static String NEW_TERMINAL_CONNECTION;
public static String NEW_TERMINAL_VIEW;
public static String CONNECTIONTYPE;
public static String VIEW_TITLE;
public static String VIEW_SETTINGS;

View file

@ -13,12 +13,15 @@
# Contributors:
# Michael Scharf (Wind River) - split into core, view and connector plugins
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
# Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
###############################################################################
NO_CONNECTION_SELECTED = No Connection Selected
PROP_TITLE = Terminal
SETTINGS = Settings
TERMINALSETTINGS = Terminal Settings
NEW_TERMINAL_CONNECTION = New Terminal Connection
NEW_TERMINAL_VIEW = New Terminal View
CONNECTIONTYPE = Connection Type
VIEW_TITLE = View Title:
VIEW_SETTINGS = View Settings: