1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 22:25:25 +02:00

Bug 244405 - [terminal] Add a UI Control for setting the Terminal's encoding

This commit is contained in:
Martin Oberhuber 2012-01-31 15:02:15 +00:00
parent cc0c4d9c18
commit 0555dadb25
20 changed files with 187 additions and 51 deletions

View file

@ -1,5 +1,5 @@
####################################################################################################
# Copyright (c) 2008, 2011 Mirko Raner and others.
# Copyright (c) 2008, 2012 Mirko Raner and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -22,7 +22,7 @@ featureName=Local Terminal SDK (Incubation)
providerName=Eclipse TM Project
# "tmUpdateSiteName" property - label for the update site
tmUpdateSiteName=Target Management 3.3 Updates
tmUpdateSiteName=Target Management 3.4 Updates
# "description" property - description of the feature
description=A terminal emulation for local shells and external tools.\n\
@ -31,7 +31,7 @@ and the Terminal View required to drive the plugin.
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
Copyright (c) 2008, 2011 Mirko Raner and others.\n\
Copyright (c) 2008, 2012 Mirko Raner and others.\n\
All rights reserved. This program and the accompanying materials\n\
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2008, 2011 Mirko Raner and others
Copyright (c) 2008, 2012 Mirko Raner and others
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@ -13,7 +13,7 @@
<feature
id="org.eclipse.tm.terminal.local.sdk"
label="%featureName"
version="0.2.1.qualifier"
version="0.3.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg">
@ -30,8 +30,8 @@
</license>
<url>
<update label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.3"/>
<discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.3"/>
<update label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.4"/>
<discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.4"/>
</url>
<includes

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm.features</groupId>
<artifactId>org.eclipse.tm.terminal.local.sdk</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
# Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -25,11 +25,11 @@ plug-ins for Serial, SSH and Telnet connections. Includes Source Code.
providerName=Eclipse TM Project
# "tmUpdateSiteName" property - label for the update site
tmUpdateSiteName=Target Management 3.3 Updates
tmUpdateSiteName=Target Management 3.4 Updates
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
Copyright (c) 2003, 2011 Wind River Systems, Inc. and others.\n\
Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.\n\
All rights reserved. This program and the accompanying materials\n\
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@ -13,7 +13,7 @@
<feature
id="org.eclipse.tm.terminal.sdk"
label="%featureName"
version="3.2.1.qualifier"
version="3.3.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg">
@ -30,8 +30,8 @@
</license>
<url>
<update label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.3"/>
<discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.3"/>
<update label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.4"/>
<discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.4"/>
</url>
<includes

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm.features</groupId>
<artifactId>org.eclipse.tm.terminal.sdk</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
# Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -21,14 +21,14 @@ featureName=Target Management Terminal View
providerName=Eclipse TM Project
# "tmUpdateSiteName" property - label for the update site
tmUpdateSiteName=Target Management 3.3 Updates
tmUpdateSiteName=Target Management 3.4 Updates
# "description" property - description of the feature
description=An Eclipse Workbench standalone view for the Terminal widget.
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
Copyright (c) 2003, 2011 Wind River Systems, Inc. and others.\n\
Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.\n\
All rights reserved. This program and the accompanying materials\n\
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@ -13,7 +13,7 @@
<feature
id="org.eclipse.tm.terminal.view"
label="%featureName"
version="2.2.0.qualifier"
version="2.3.0.qualifier"
provider-name="%providerName">
<description>
@ -29,8 +29,8 @@
</license>
<url>
<update label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.3"/>
<discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.3"/>
<update label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.4"/>
<discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/tm/updates/3.4"/>
</url>
<requires>

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm.features</groupId>
<artifactId>org.eclipse.tm.terminal.view</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
# Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -21,14 +21,14 @@ featureName=Target Management Terminal View Source
providerName=Eclipse TM Project
# "tmUpdateSiteName" property - label for the update site
tmUpdateSiteName=Target Management 3.3 Updates
tmUpdateSiteName=Target Management 3.4 Updates
# "description" property - description of the feature
description=An Eclipse Workbench standalone view for the Terminal widget.
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
Copyright (c) 2003, 2011 Wind River Systems, Inc. and others.\n\
Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.\n\
All rights reserved. This program and the accompanying materials\n\
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\

View file

@ -1,5 +1,5 @@
################################################################################
# Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
# Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -21,5 +21,5 @@ blurb=Target Management Terminal View Source\n\
Version: {featureVersion}\n\
Build id: {0}\n\
\n\
(c) Copyright Wind River Systems, Inc. and others 2003, 2011. All rights reserved.\n\
(c) Copyright Wind River Systems, Inc. and others 2003, 2012. All rights reserved.\n\
Visit http://www.eclipse.org/tm

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.view;singleton:=true
Bundle-Version: 2.2.0.qualifier
Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.eclipse.tm.internal.terminal.view.TerminalViewPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,

View file

@ -1,5 +1,5 @@
################################################################################
# Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
# Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -21,5 +21,5 @@ blurb=Target Management Terminal View\n\
Version: {featureVersion}\n\
Build id: {0}\n\
\n\
(c) Copyright Wind River Systems, Inc. and others 2003, 2011. All rights reserved.\n\
(c) Copyright Wind River Systems, Inc. and others 2003, 2012. All rights reserved.\n\
Visit http://www.eclipse.org/tm

View file

@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.tm</groupId>
<artifactId>org.eclipse.tm.terminal.view</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial API and implementation
* Ahmet Alptekin (Tubitak) - [244405] Add a UI Control for setting the Terminal's encoding
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -75,4 +76,13 @@ public interface ITerminalViewConnection {
* @param summary
*/
void setSummary(String summary);
/**
* @param encoding the encoding of this connection
*/
void setEncoding(String encoding);
/**
* @return the encoding of this connection
*/
String getEncoding();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -19,14 +19,17 @@
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
* Martin Oberhuber (Wind River) - [206917] Add validation for Terminal Settings
* Uwe Stieber (Wind River) - [282996] [terminal][api] Add "hidden" attribute to terminal connector extension point
* Ahmet Alptekin (Tubitak) - [244405] Add a UI Control for setting the Terminal's encoding
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@ -51,6 +54,7 @@ import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.ui.PlatformUI;
class TerminalSettingsDlg extends Dialog {
private Combo fEncodingCombo;
private Combo fCtlConnTypeCombo;
private Text fTerminalTitleText;
private final ITerminalConnector[] fConnectors;
@ -65,6 +69,7 @@ class TerminalSettingsDlg extends Dialog {
private IDialogSettings fDialogSettings;
private String fTerminalTitle;
private String fTitle=ViewMessages.TERMINALSETTINGS;
private String fEncoding;
public TerminalSettingsDlg(Shell shell, ITerminalConnector[] connectors, ITerminalConnector connector) {
super(shell);
@ -151,17 +156,18 @@ class TerminalSettingsDlg extends Dialog {
protected void okPressed() {
if (!validateSettings()) {
String strTitle = ViewMessages.TERMINALSETTINGS;
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(strTitle);
mb.setMessage(ViewMessages.INVALID_SETTINGS);
mb.open();
showErrorMessage(ViewMessages.INVALID_SETTINGS);
return;
}
if (!updateValidState()) {
showErrorMessage(ViewMessages.ENCODING_NOT_AVAILABLE);
return;
}
if(fSelectedConnector>=0) {
getPage(fSelectedConnector).saveSettings();
}
fTerminalTitle=fTerminalTitleText.getText();
fEncoding = fEncodingCombo.getText();
super.okPressed();
}
protected void cancelPressed() {
@ -202,6 +208,8 @@ class TerminalSettingsDlg extends Dialog {
fCtlConnTypeCombo.select(selectedConnector);
selectPage(selectedConnector);
}
doLoad();
setCombo(fEncodingCombo, fEncoding);
}
/**
* @return the connector to show when the dialog opens
@ -227,6 +235,7 @@ class TerminalSettingsDlg extends Dialog {
}
private void setupPanel(Composite wndParent) {
setupSettingsTypePanel(wndParent);
//setupEncodingPanel(wndParent);
if(fConnectors.length>0) {
setupConnTypePanel(wndParent);
setupSettingsGroup(wndParent);
@ -250,6 +259,13 @@ class TerminalSettingsDlg extends Dialog {
fTerminalTitleText = new Text(wndGroup, SWT.BORDER);
fTerminalTitleText.setText(fTerminalTitle);
fTerminalTitleText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label encodingLabel=new Label(wndGroup,SWT.NONE);
encodingLabel.setText(ViewMessages.ENCODING);
encodingLabel.setLayoutData(new GridData(GridData.BEGINNING));
fEncodingCombo = new Combo(wndGroup, SWT.DROP_DOWN);
fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
private void setupConnTypePanel(Composite wndParent) {
Group wndGroup;
@ -278,6 +294,7 @@ class TerminalSettingsDlg extends Dialog {
fPageBook=new PageBook(group,SWT.NONE);
fPageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
private void setupListeners() {
if(fCtlConnTypeCombo==null)
return;
@ -331,4 +348,73 @@ class TerminalSettingsDlg extends Dialog {
public String getTerminalTitle() {
return fTerminalTitle;
}
private void doLoad() {
if (fEncodingCombo != null) {
List encodings = new ArrayList();
encodings.add("ISO-8859-1"); //$NON-NLS-1$
encodings.add("UTF-8"); //$NON-NLS-1$
//TODO when moving to J2SE-1.5, restore the simpler way getting the default encoding
//String hostEncoding =Charset.defaultCharset().displayName();
String hostEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding();
if (!encodings.contains(hostEncoding))
encodings.add(hostEncoding);
populateEncodingsCombo(encodings);
}
}
private void populateEncodingsCombo(List encodings) {
String[] encodingStrings = new String[encodings.size()];
encodings.toArray(encodingStrings);
fEncodingCombo.setItems(encodingStrings);
}
private boolean isEncodingValid() {
return isValidEncoding(fEncodingCombo.getText());
}
private boolean isValidEncoding(String enc) {
try {
return Charset.isSupported(enc);
} catch (IllegalCharsetNameException e) {
return false;
}
}
private boolean updateValidState() {
boolean isValid = true;
boolean isValidNow = isEncodingValid();
if (isValidNow != isValid) {
isValid = isValidNow;
}
return isValid;
}
private void showErrorMessage(String message) {
String strTitle = ViewMessages.TERMINALSETTINGS;
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(strTitle);
mb.setMessage(message);
mb.open();
return;
}
private void setCombo(Combo combo,String value) {
if(value==null)
return;
int nIndex = combo.indexOf(value);
if (nIndex == -1) {
if((combo.getStyle() & SWT.READ_ONLY)==0) {
combo.add(value);
nIndex = combo.indexOf(value);
} else {
return;
}
}
combo.select(nIndex);
}
public String getEncoding() {
return fEncoding;
}
public void setEncoding(String fEncoding) {
this.fEncoding = fEncoding;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2010 Wind River Systems, Inc. and others.
* Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -25,6 +25,7 @@
* Michael Scharf (Wind River) - [241096] Secondary terminals in same view do not observe the "invert colors" Preference
* Michael Scharf (Wind River) - [262996] get rid of TerminalState.OPENED
* Martin Oberhuber (Wind River) - [205486] Enable ScrollLock
* Ahmet Alptekin (Tubitak) - [244405] Add a UI Control for setting the Terminal's encoding
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -291,6 +292,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
return;
if(fCtlTerminal.getTerminalConnector()==null)
setConnector(showSettingsDialog(ViewMessages.TERMINALSETTINGS));
setEncoding(getActiveConnection().getEncoding());
fCtlTerminal.connectTerminal();
}
@ -351,6 +353,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
c=fCtlTerminal.getTerminalConnector();
TerminalSettingsDlg dlgTerminalSettings = new TerminalSettingsDlg(getViewSite().getShell(),connectors,c);
dlgTerminalSettings.setTerminalTitle(getActiveConnection().getPartName());
dlgTerminalSettings.setEncoding(getActiveConnection().getEncoding());
if(title!=null)
dlgTerminalSettings.setTitle(title);
Logger.log("opening Settings dialog."); //$NON-NLS-1$
@ -369,9 +372,15 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi
saveSettings(getPreferenceSettingsStore(), dlgTerminalSettings.getConnector());
setViewTitle(dlgTerminalSettings.getTerminalTitle());
setEncoding(dlgTerminalSettings.getEncoding());
return dlgTerminalSettings.getConnector();
}
private void setEncoding(String encoding) {
getActiveConnection().setEncoding(encoding);
updateSummary();
}
private void setConnector(ITerminalConnector connector) {
fCtlTerminal.setConnector(connector);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -10,10 +10,14 @@
* Michael Scharf (Wind River) - [240097] Allow paste with the middle mouse button
* Michael Scharf (Wind River) - [262996] get rid of TerminalState.OPENED
* Anton Leherbauer (Wind River) - [335021] Middle mouse button copy/paste does not work with the terminal
* Ahmet Alptekin (Tubitak) - [244405] Add a UI Control for setting the Terminal's encoding
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
import java.io.UnsupportedEncodingException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.TextTransfer;
@ -23,6 +27,7 @@ import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
/**
@ -36,14 +41,15 @@ class TerminalViewConnection implements ITerminalViewConnection {
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_COMMAND_INPUT_FIELD_HISTORY = "CommandInputFieldHistory"; //$NON-NLS-1$
private static final String STORE_ENCODING="Encoding"; //$NON-NLS-1$
final private ITerminalViewControl fCtlTerminal;
private String fTitle;
private String fSummary;
private String fHistory;
private CommandInputFieldWithHistory fCommandInputField;
private String fPartName;
private String fEncoding;
public TerminalViewConnection(ITerminalViewControl ctl) {
fCtlTerminal = ctl;
fCtlTerminal.getControl().addMouseListener(new MouseAdapter(){
@ -90,7 +96,7 @@ class TerminalViewConnection implements ITerminalViewConnection {
fPartName=store.get(STORE_PART_NAME);
fSummary=store.get(STORE_SUMMARY);
fHistory=store.get(STORE_COMMAND_INPUT_FIELD_HISTORY);
fEncoding=store.get(STORE_ENCODING);
// load the state of the connection types
ITerminalConnector[] connectors=fCtlTerminal.getConnectors();
String connectionType=store.get(STORE_CONNECTION_TYPE);
@ -109,6 +115,7 @@ class TerminalViewConnection implements ITerminalViewConnection {
store.put(STORE_PART_NAME, fPartName);
store.put(STORE_SUMMARY,fSummary);
store.put(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory);
store.put(STORE_ENCODING, fEncoding);
if(fCommandInputField!=null)
store.put(STORE_COMMAND_INPUT_FIELD_HISTORY, fCommandInputField.getHistory());
else
@ -173,6 +180,7 @@ class TerminalViewConnection implements ITerminalViewConnection {
// display in the content description line.
String strConnected = getStateDisplayName(fCtlTerminal.getState());
String summary = getSettingsSummary();
String encoding=getEncoding();
//TODO Title should use an NLS String and com.ibm.icu.MessageFormat
//In order to make the logic of assembling, and the separators, better adapt to foreign languages
if(summary.length()>0)
@ -181,7 +189,11 @@ class TerminalViewConnection implements ITerminalViewConnection {
if(name.length()>0) {
name+=": "; //$NON-NLS-1$
}
strTitle = name + "("+ summary + strConnected + ")"; //$NON-NLS-1$ //$NON-NLS-2$
if (encoding.length()>0) {
encoding = NLS.bind(ViewMessages.ENCODING_WITH_PARENTHESES, encoding);
//encoding=ViewMessages.ENCODING+" "+"("+encoding+")"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}
strTitle = name + "("+ summary + strConnected + ")"+" - "+encoding; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return strTitle;
}
@ -209,5 +221,17 @@ class TerminalViewConnection implements ITerminalViewConnection {
fPartName=name;
}
public String getEncoding() {
return fEncoding==null?fCtlTerminal.getEncoding():fEncoding;
}
public void setEncoding(String fEncoding) {
try {
fCtlTerminal.setEncoding(fEncoding);
this.fEncoding = fEncoding;
} catch (UnsupportedEncodingException uex) {
Logger.logException(uex);
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -16,6 +16,7 @@
* Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
* Martin Oberhuber (Wind River) - [206917] Add validation for Terminal Settings
* Martin Oberhuber (Wind River) - [262996] get rid of TerminalState.OPENED
* Ahmet Alptekin (Tubitak) - [244405] Add a UI Control for setting the Terminal's encoding
*******************************************************************************/
package org.eclipse.tm.internal.terminal.view;
@ -36,6 +37,8 @@ public class ViewMessages extends NLS {
public static String VIEW_TITLE;
public static String VIEW_SETTINGS;
public static String INVALID_SETTINGS;
public static String ENCODING;
public static String ENCODING_WITH_PARENTHESES;
public static String INVERT_COLORS;
public static String BUFFERLINES;
@ -48,5 +51,5 @@ public class ViewMessages extends NLS {
public static String CANNOT_INITIALIZE;
public static String CONNECTOR_NOT_AVAILABLE;
public static String ENCODING_NOT_AVAILABLE;
}

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2003, 2010 Wind River Systems, Inc. and others.
# Copyright (c) 2003, 2012 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -16,6 +16,7 @@
# Michael Scharf (Wind River) - [240023] Get rid of the terminal's "Pin" button
# Martin Oberhuber (Wind River) - [206917] Add validation for Terminal Settings
# Martin Oberhuber (Wind River) - [262996] get rid of TerminalState.OPENED
# Ahmet Alptekin (Tubitak) - [244405] Add a UI Control for setting the Terminal's encoding
###############################################################################
NO_CONNECTION_SELECTED = No Connection Selected
PROP_TITLE = Terminal
@ -28,6 +29,8 @@ CONNECTIONTYPE = Connection Type
VIEW_TITLE = View Title:
VIEW_SETTINGS = View Settings:
INVALID_SETTINGS = The specified settings are invalid, please review or cancel.
ENCODING = Encoding:
ENCODING_WITH_PARENTHESES = Encoding: ({0})
INVERT_COLORS = Invert terminal colors
BUFFERLINES = Terminal buffer lines:
@ -40,3 +43,4 @@ STATE_CLOSED = CLOSED
CANNOT_INITIALIZE = Cannot initialize {0}:\n{1}
CONNECTOR_NOT_AVAILABLE = Connector {0} is not available!
ENCODING_NOT_AVAILABLE = Encoding is not available!