Shell
by the specified amounts.
+ * Do not increase the size of the Shell beyond the bounds of the Display.
+ */
+ protected void setShellSize(Point size) {
+ Rectangle bounds = getShell().getMonitor().getClientArea();
+ getShell().setSize(Math.min(size.x, bounds.width), Math.min(size.y, bounds.height));
+ }
+
protected void okPressed() {
if (!validateSettings())
return;
if(fSelectedConnector>=0) {
- fPages[fSelectedConnector].saveSettings();
+ getPage(fSelectedConnector).saveSettings();
}
super.okPressed();
}
@@ -80,8 +138,8 @@ class TerminalSettingsDlg extends Dialog {
}
private void initFields() {
// Load controls
- for (int i = 0; i < fPages.length; i++) {
- String name=fPages[i].getName();
+ for (int i = 0; i < fConnectors.length; i++) {
+ String name=fConnectors[i].getName();
fCtlConnTypeCombo.add(name);
if(fSelectedConnector==i) {
fCtlConnTypeCombo.select(i);
@@ -92,7 +150,7 @@ class TerminalSettingsDlg extends Dialog {
private boolean validateSettings() {
if(fSelectedConnector<0)
return true;
- return fPages[fSelectedConnector].validateSettings();
+ return getPage(fSelectedConnector).validateSettings();
}
private void setupPanel(Composite wndParent) {
setupConnTypePanel(wndParent);
@@ -123,11 +181,6 @@ class TerminalSettingsDlg extends Dialog {
group.setLayoutData(new GridData(GridData.FILL_BOTH));
fPageBook=new PageBook(group,SWT.NONE);
fPageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-
- for (int i = 0; i < fPages.length; i++) {
- fPages[i].createControl(fPageBook);
- }
}
private void setupListeners() {
fCtlConnTypeCombo.addSelectionListener(new SelectionAdapter() {
@@ -143,8 +196,9 @@ class TerminalSettingsDlg extends Dialog {
}
private void selectPage(int index) {
fSelectedConnector=index;
+ getPage(index);
Control[] pages=fPageBook.getChildren();
- fPageBook.showPage(pages[fSelectedConnector]);
+ fPageBook.showPage(pages[fPageIndex[fSelectedConnector]]);
}
protected IDialogSettings getDialogBoundsSettings() {
IDialogSettings ds=TerminalViewPlugin.getDefault().getDialogSettings();
diff --git a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java
index fc8a994c98a..1e2c34f9005 100644
--- a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java
+++ b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java
@@ -67,7 +67,9 @@ import org.eclipse.ui.part.ViewPart;
public class TerminalView extends ViewPart implements ITerminalView, ITerminalListener {
private static final String STORE_CONNECTION_TYPE = "ConnectionType"; //$NON-NLS-1$
- private static final String STORE_HAS_COMMAND_INPUT_FIELD = "HasCommandInputField"; //$NON-NLS-1$
+ private static final String STORE_SETTING_SUMMARY = "SettingSummary"; //$NON-NLS-1$
+
+ private static final String STORE_HAS_COMMAND_INPUT_FIELD = "HasCommandInputField"; //$NON-NLS-1$
private static final String STORE_COMMAND_INPUT_FIELD_HISTORY = "CommandInputFieldHistory"; //$NON-NLS-1$
@@ -244,20 +246,41 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
// display in the view's content description line. This is used by class
// TerminalText when it processes an ANSI OSC escape sequence that commands
// the terminal to display text in its title bar.
+ } else if(fCtlTerminal.getTerminalConnection()==null){
+ strTitle=ViewMessages.NO_CONNECTION_SELECTED;
} else {
// When parameter 'data' is null, we construct a descriptive string to
// display in the content description line.
String strConnected = getStateDisplayName(fCtlTerminal.getState());
- String status=fCtlTerminal.getStatusString(strConnected);
- if(status.length()>0)
- status=": "+status; //$NON-NLS-1$
- strTitle = ViewMessages.PROP_TITLE + status;
+ String summary = getSettingsSummary();
+ if(summary.length()>0)
+ summary=summary+" - "; //$NON-NLS-1$
+ String name=fCtlTerminal.getTerminalConnection().getName();
+ if(name.length()>0) {
+ name+=": "; //$NON-NLS-1$
+ }
+ strTitle = name + "("+ summary + strConnected + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
setContentDescription(strTitle);
getViewSite().getActionBars().getStatusLineManager().setMessage(
strTitle);
}
+ /**
+ * @return the setting summary. If there is no connection, or the connection
+ * has not been initialized, use the last stored state.
+ */
+ private String getSettingsSummary() {
+ // TODO: use another mechanism than "?" for the magic non initialized state
+ // see TerminalConnectorProxy.getSettingsSummary
+ String summary="?"; //$NON-NLS-1$
+ if(fCtlTerminal.getTerminalConnection()!=null)
+ summary=fCtlTerminal.getSettingsSummary();
+ if("?".equals(summary)) { //$NON-NLS-1$
+ summary=fStore.get(STORE_SETTING_SUMMARY, ""); //$NON-NLS-1$
+ }
+ return summary;
+ }
public void onTerminalStatus() {
setTerminalTitle(null);
}
@@ -417,10 +440,11 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
if(fCommandInputField!=null)
fStore.put(STORE_COMMAND_INPUT_FIELD_HISTORY, fCommandInputField.getHistory());
fStore.put(STORE_HAS_COMMAND_INPUT_FIELD,hasCommandInputField()?"true":"false"); //$NON-NLS-1$//$NON-NLS-2$
+ fStore.put(STORE_SETTING_SUMMARY, getSettingsSummary());
fStore.saveState(memento);
}
private ISettingsStore getStore(ITerminalConnector connector) {
- return new SettingStorePrefixDecorator(fStore,connector.getClass().getName()+"."); //$NON-NLS-1$
+ return new SettingStorePrefixDecorator(fStore,connector.getId()+"."); //$NON-NLS-1$
}
protected void setupActions() {
diff --git a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.java b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.java
index 7b284792187..a6ae47f360e 100644
--- a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.java
+++ b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.java
@@ -22,6 +22,7 @@ public class ViewMessages extends NLS {
static {
NLS.initializeMessages(ViewMessages.class.getName(), ViewMessages.class);
}
+ public static String NO_CONNECTION_SELECTED;
public static String PROP_TITLE;
public static String SETTINGS;
diff --git a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties
index 46f4f6da329..af72f181ce1 100644
--- a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties
+++ b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties
@@ -14,6 +14,7 @@
# Michael Scharf (Wind River) - split into core, view and connector plugins
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified
###############################################################################
+NO_CONNECTION_SELECTED = No Connection Selected
PROP_TITLE = Terminal
SETTINGS = Settings
diff --git a/org.eclipse.tm.terminal/plugin.properties b/org.eclipse.tm.terminal/plugin.properties
index f5c474e9c62..c6e04d21c73 100644
--- a/org.eclipse.tm.terminal/plugin.properties
+++ b/org.eclipse.tm.terminal/plugin.properties
@@ -17,6 +17,8 @@
pluginName = Target Management Terminal Widget
providerName = Eclipse.org
+telnetConnection = Telnet
+
terminal.context.name=Terminal widget context
terminal.context.description=Override ALT+x menu access keys
diff --git a/org.eclipse.tm.terminal/plugin.xml b/org.eclipse.tm.terminal/plugin.xml
index 2274c107522..8cba54c9549 100644
--- a/org.eclipse.tm.terminal/plugin.xml
+++ b/org.eclipse.tm.terminal/plugin.xml
@@ -15,7 +15,7 @@
getClass().getName()
+ * @return an ID of this connector. The id from the plugin.xml.
+ * Note: return null
because the framework takes
+ * care to get the value from the plugin.xml
*/
+ // TODO: eliminate the need of implementing this NOOP method for extensions
String getId();
+ /**
+ * @return null
the name (as specified in the plugin.xml)
+ *
Note: return null
because the framework takes
+ * care to get the value from the plugin.xml
+ */
+ // TODO: eliminate the need of implementing this NOOP method for extensions
+ String getName();
+
/**
* @return true if the contribution is functioning (e.g. all external libraries are
* installed). This was added for the serial support, because it requires the java comm
@@ -73,7 +84,7 @@ public interface ITerminalConnector {
* {@link #connect(ITerminalControl)}.
*
* @param store a string based data store. Short keys like "foo" can be used to
- * store the state of the connectio.
+ * store the state of the connection.
*/
void load(ISettingsStore store);
@@ -91,11 +102,9 @@ public interface ITerminalConnector {
ISettingsPage makeSettingsPage();
/**
- * @param connectedLabel a String with the connected state {@link TerminalState}.
- * Like "CONNECTED", "CLOSED". Can be used to build up the status string.
* @return A string that represents the state of the connection.
* TODO: Michael Scharf:
*/
- String getStatusString(String connectedLabel);
+ String getSettingsSummary();
}
diff --git a/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java b/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java
index 4e8d001a0c5..f699304c081 100644
--- a/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java
+++ b/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.tm.internal.terminal.provisional.api;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -33,6 +34,138 @@ import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin;
*