1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

[179937] Remove shell settings property page (encoding field no longer needed)

This commit is contained in:
Kushal Munir 2007-05-25 02:53:55 +00:00
parent edd9347052
commit 44b28989a7
8 changed files with 1 additions and 380 deletions

View file

@ -22,8 +22,6 @@ providerName = Eclipse.org
View.RemoteCommands = Remote Shell
PropertyPage.ShellSettings = Shell Settings
PropertyPage.ServerLauncherSettings = Server Launcher Settings
PropertyPage.Service = Service
PropertyPage.EnvVariables = Environment Variables

View file

@ -112,15 +112,6 @@ Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter fro
<enabledWhen>
<instanceof value="org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem"/>
</enabledWhen>
</page>
<page
name="%PropertyPage.ShellSettings"
class="org.eclipse.rse.internal.shells.ui.propertypages.SystemShellPropertyPage"
id="org.eclipse.rse.shells.ui.propertypages.SystemShellPropertyPage">
<enabledWhen>
<instanceof value="org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem"/>
</enabledWhen>
</page>
<page

View file

@ -22,15 +22,6 @@ public class ShellResources extends NLS
{
private static String BUNDLE_NAME = "org.eclipse.rse.internal.shells.ui.ShellResources"; //$NON-NLS-1$
public static String RESID_SHELL_PROPERTYPAGE_TITLE;
public static String RESID_SHELL_PROPERTYPAGE_DESCRIPTION;
public static String RESID_SHELL_PROPERTYPAGE_ENCODING;
public static String RESID_SHELL_PROPERTYPAGE_DEFAULT_ENCODING;
public static String RESID_SHELL_PROPERTYPAGE_HOST_ENCODING;
public static String RESID_SHELL_PROPERTYPAGE_OTHER_ENCODING;
public static String RESID_UNSUPPORTED_ENCODING;
public static String RESID_SHELLS_RUN_IN_NEW_SHELL_LABEL;
public static String RESID_SHELLS_RUN_IN_NEW_SHELL_TOOLTIP;
public static String RESID_SHELLS_RUN_COMMAND_LABEL;

View file

@ -20,14 +20,6 @@
###################################################################################
############################ Universal Commands ############################
###################################################################################
RESID_SHELL_PROPERTYPAGE_TITLE=Shell Settings
RESID_SHELL_PROPERTYPAGE_DESCRIPTION=Configure settings for shells
RESID_SHELL_PROPERTYPAGE_ENCODING=Shell Encoding
RESID_SHELL_PROPERTYPAGE_DEFAULT_ENCODING=Default
RESID_SHELL_PROPERTYPAGE_HOST_ENCODING=Host encoding
RESID_SHELL_PROPERTYPAGE_OTHER_ENCODING=Select or enter an encoding
RESID_UNSUPPORTED_ENCODING=This is not a supported encoding
RESID_SHELLS_RUN_IN_NEW_SHELL_LABEL = Run in new shell
RESID_SHELLS_RUN_IN_NEW_SHELL_TOOLTIP = Indicate whether the command is to be launched in a new shell or the system default shell
RESID_SHELLS_RUN_COMMAND_LABEL = Run Command

View file

@ -1,142 +0,0 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. 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 http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.shells.ui.propertypages;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.rse.internal.shells.ui.ShellResources;
import org.eclipse.rse.internal.shells.ui.view.EncodingForm;
import org.eclipse.rse.subsystems.shells.core.subsystems.RemoteCmdSubSystem;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
public class SystemShellPropertyPage extends SystemBasePropertyPage
{
private EncodingForm _form;
public SystemShellPropertyPage()
{
super();
setDescription(ShellResources.RESID_SHELL_PROPERTYPAGE_DESCRIPTION);
}
public void setShellEncodingDefaults(List encodings)
{
StringBuffer history = new StringBuffer();
for (int i = 0; i < encodings.size(); i++)
{
String encoding = (String)encodings.get(i);
history.append(encoding);
if (i < encodings.size())
{
history.append(',');
}
}
RSEUIPlugin.getDefault().getPreferenceStore().setValue("shell.encodingDefaults", history.toString()); //$NON-NLS-1$
}
public List getShellEncodingDefaults()
{
List result = new ArrayList();
String attribute = RSEUIPlugin.getDefault().getPreferenceStore().getString("shell.encodingDefaults"); //$NON-NLS-1$
if (attribute != null && attribute.length() > 0)
{
String[] list = attribute.split(","); //$NON-NLS-1$
for (int i = 0; i < list.length; i++)
{
result.add(list[i]);
}
}
else
{
result.add("UTF-8"); //$NON-NLS-1$
result.add("UTF-16"); //$NON-NLS-1$
result.add("US-ASCII"); //$NON-NLS-1$
result.add("ISO-8859-1"); //$NON-NLS-1$
result.add("Cp1252"); //$NON-NLS-1$
result.add("Cp1256"); //$NON-NLS-1$
}
return result;
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#createContentArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createContentArea(Composite parent)
{
Font font = parent.getFont();
Group group = new Group(parent, SWT.NONE);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(data);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
group.setLayout(layout);
group.setText(ShellResources.RESID_SHELL_PROPERTYPAGE_ENCODING);
group.setFont(font);
_form = new EncodingForm(getShell(), getMessageLine());
_form.createContents(group);
RemoteCmdSubSystem cmdSS = getCmdSubSystem();
_form.initialize(getShellEncodingDefaults(), cmdSS.getShellEncoding());
return _form.getDefaultControl();
}
public RemoteCmdSubSystem getCmdSubSystem()
{
return (RemoteCmdSubSystem)getElement();
}
/* (non-Javadoc)
* @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#verifyPageContents()
*/
protected boolean verifyPageContents()
{
return true;
}
/**
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
public boolean performOk()
{
String encoding = _form.getEncoding();
getCmdSubSystem().setShellEncoding(encoding);
List defaults = getShellEncodingDefaults();
if (!defaults.contains(encoding))
{
defaults.add(encoding);
setShellEncodingDefaults(defaults);
}
return true;
}
}

View file

@ -1,174 +0,0 @@
/********************************************************************************
* Copyright (c) 2005, 2006 IBM Corporation. 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 http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.shells.ui.view;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.List;
import org.eclipse.rse.internal.shells.ui.ShellResources;
import org.eclipse.rse.ui.SystemBaseForm;
import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
public class EncodingForm extends SystemBaseForm
{
// State for encoding group
private String _encoding;
private String _defaultEncoding;
private Button _defaultEncodingButton;
private Button _otherEncodingButton;
private Combo _encodingCombo;
public EncodingForm(Shell shell, ISystemMessageLine line)
{
super(shell, line);
_defaultEncoding = ShellResources.RESID_SHELL_PROPERTYPAGE_DEFAULT_ENCODING;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.ui.SystemBaseForm#createContents(org.eclipse.swt.widgets.Composite)
*/
public Control createContents(Composite group)
{
SelectionAdapter buttonListener = new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e) {
updateEncodingState(_defaultEncodingButton.getSelection());
updateValidState();
}
};
_defaultEncodingButton = new Button(group, SWT.RADIO);
_defaultEncodingButton.setText(ShellResources.RESID_SHELL_PROPERTYPAGE_HOST_ENCODING);
GridData data = new GridData();
Font font = group.getFont();
data.horizontalSpan = 2;
_defaultEncodingButton.setLayoutData(data);
_defaultEncodingButton.addSelectionListener(buttonListener);
_defaultEncodingButton.setFont(font);
_otherEncodingButton = new Button(group, SWT.RADIO);
_otherEncodingButton.setText(ShellResources.RESID_SHELL_PROPERTYPAGE_OTHER_ENCODING);
_otherEncodingButton.addSelectionListener(buttonListener);
_otherEncodingButton.setFont(font);
_encodingCombo = new Combo(group, SWT.NONE);
data = new GridData();
_encodingCombo.setFont(font);
_encodingCombo.setLayoutData(data);
_encodingCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateValidState();
}
});
return _encodingCombo;
}
public void initialize(List defaults, String encoding)
{
_encoding = encoding;
boolean isDefault = _encoding == null || _encoding.length() == 0 || encoding.equals(_defaultEncoding);
if (!isDefault && !defaults.contains(_encoding))
{
defaults.add(_encoding);
}
Collections.sort(defaults);
for (int i = 0; i < defaults.size(); ++i) {
_encodingCombo.add((String) defaults.get(i));
}
_encodingCombo.setText(isDefault ? _defaultEncoding : _encoding);
updateEncodingState(isDefault);
}
public Control getDefaultControl()
{
return _encodingCombo;
}
public boolean usingDefault()
{
return _defaultEncodingButton.getSelection();
}
public String getEncoding()
{
if (usingDefault())
{
return ""; //$NON-NLS-1$
}
return _encodingCombo.getText();
}
protected void updateValidState()
{
if (!isEncodingValid())
{
getMessageLine().setErrorMessage(ShellResources.RESID_UNSUPPORTED_ENCODING);
}
else
{
getMessageLine().clearErrorMessage();
}
}
private boolean isEncodingValid()
{
return _defaultEncodingButton.getSelection()
|| isValidEncoding(_encodingCombo.getText());
}
private boolean isValidEncoding(String enc)
{
try {
new String(new byte[0], enc);
return true;
} catch (UnsupportedEncodingException e) {
return false;
}
}
private void updateEncodingState(boolean useDefault)
{
_defaultEncodingButton.setSelection(useDefault);
_otherEncodingButton.setSelection(!useDefault);
_encodingCombo.setEnabled(!useDefault);
updateValidState();
}
}

View file

@ -19,7 +19,6 @@ package org.eclipse.rse.subsystems.shells.core.subsystems;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.IRemoteSystemEnvVar;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.swt.widgets.Shell;
@ -139,16 +138,7 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
* Provide list of executed commands on subsystem.This is only applicable if the subsystem factory reports
* true for supportsCommands().
*/
public String[] getExecutedCommands();
/**
* Returns the shell encoding to assume when reading IO from a remote shell.
*
* @deprecated use {@link IHost#getDefaultEncoding(boolean)} instead
*/
public String getShellEncoding();
public String[] getExecutedCommands();
/**
* Provide a list of possible commands for the specified context. This method is primarily used

View file

@ -83,31 +83,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
return (IRemoteCmdSubSystemConfiguration) super.getSubSystemConfiguration();
}
public String getShellEncoding()
{
IPropertySet set = getPropertySet("Remote"); //$NON-NLS-1$
if (set != null)
{
return set.getPropertyValue("shell.encoding"); //$NON-NLS-1$
}
return null;
}
/**
* @deprecated use {@link IHost#setDefaultEncoding(String, boolean)} instead
*/
public void setShellEncoding(String encoding)
{
IPropertySet set = getPropertySet("Remote"); //$NON-NLS-1$
if (set == null)
{
set = createPropertySet("Remote", getDescription()); //$NON-NLS-1$
}
set.addProperty("shell.encoding", encoding); //$NON-NLS-1$
setDirty(true);
commit();
}
/**
* Long running list processing calls this method to check for a user-cancel
* event. If user did cancel, an exception is thrown.