1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 21:15:23 +02:00

[cleanup] Get rid of deprecated RSESystemTypeAdapter use

This commit is contained in:
Martin Oberhuber 2008-04-22 11:43:23 +00:00
parent 5231677a6d
commit e8ea74bdf4
2 changed files with 96 additions and 90 deletions

View file

@ -14,7 +14,7 @@
* David Dykstal (IBM) - moved SystemPreferencesManager to a new package * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
* - created and used RSEPreferencesManager * - created and used RSEPreferencesManager
* Uwe Stieber (Wind River) - Reworked new connection wizard extension point. * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking * Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking
@ -60,12 +60,12 @@ public class RSESystemTypeAdapter extends RSEAdapter {
/** /**
* Returns the "live" image descriptor for this system type. * Returns the "live" image descriptor for this system type.
* *
* If no "live" icon is found, but a non-live icon was specified, * If no "live" icon is found, but a non-live icon was specified,
* the non-live icon is returned instead. If a non-live icon also * the non-live icon is returned instead. If a non-live icon also
* was not specified, the default live connection image descriptor * was not specified, the default live connection image descriptor
* is returned. * is returned.
* *
* @param object The object to get an image descriptor for. * @param object The object to get an image descriptor for.
* @return ImageDescriptor * @return ImageDescriptor
*/ */
@ -109,9 +109,9 @@ public class RSESystemTypeAdapter extends RSEAdapter {
} }
/** /**
* Create a URL from the argument absolute or relative path. The bundle parameter is * Create a URL from the argument absolute or relative path. The bundle parameter is
* used as the base for relative paths and may be null. * used as the base for relative paths and may be null.
* *
* @param value the absolute or relative path * @param value the absolute or relative path
* @param definingBundle bundle to be used for relative paths (may be null) * @param definingBundle bundle to be used for relative paths (may be null)
* @return the URL to the resource * @return the URL to the resource
@ -133,7 +133,7 @@ public class RSESystemTypeAdapter extends RSEAdapter {
/** /**
* Returns the name of the system type if the object passed in is of type <code>IRSESystemType</code>. Otherwise, returns the value of the parent implementation. * Returns the name of the system type if the object passed in is of type <code>IRSESystemType</code>. Otherwise, returns the value of the parent implementation.
* *
* @see org.eclipse.ui.model.WorkbenchAdapter#getLabel(java.lang.Object) * @see org.eclipse.ui.model.WorkbenchAdapter#getLabel(java.lang.Object)
*/ */
public String getLabel(Object object) { public String getLabel(Object object) {
@ -201,12 +201,13 @@ public class RSESystemTypeAdapter extends RSEAdapter {
* <p> * <p>
* Note that system types which are provided by extenders via the dynamic * Note that system types which are provided by extenders via the dynamic
* sytemTypeProviders extension point may have their own logic to determine * sytemTypeProviders extension point may have their own logic to determine
* whether they are enabled or not, so changing the enabled setting may * whether they are enabled or not, so changing the enabled setting may not
* not work for them. * work for them.
* *
* @param object The system type being adapted. * @param object The system type being adapted.
* @param isEnabled true if the system type is enabled. false if it is not. * @param isEnabled true if the system type is enabled. false if it is not.
* @deprecated Set the enabled state in {@link RSEPreferencesManager} directly * @deprecated Use
* {@link RSEPreferencesManager#setIsSystemTypeEnabled(IRSESystemType, boolean)}
*/ */
public void setIsEnabled(Object object, boolean isEnabled) { public void setIsEnabled(Object object, boolean isEnabled) {
IRSESystemType systemType = getSystemType(object); IRSESystemType systemType = getSystemType(object);
@ -231,9 +232,13 @@ public class RSESystemTypeAdapter extends RSEAdapter {
} }
/** /**
* Set the default user id for this system type. Stored in the RSE core preferences. * Set the default user id for this system type. Stored in the RSE core
* preferences.
*
* @param object the system type that we are adapting * @param object the system type that we are adapting
* @param defaultUserId the id to set for this system type * @param defaultUserId the id to set for this system type
* @deprecated Use
* {@link RSEPreferencesManager#setDefaultUserId(IRSESystemType, String)}
*/ */
public void setDefaultUserId(Object object, String defaultUserId) { public void setDefaultUserId(Object object, String defaultUserId) {
IRSESystemType systemType = getSystemType(object); IRSESystemType systemType = getSystemType(object);
@ -249,7 +254,7 @@ public class RSESystemTypeAdapter extends RSEAdapter {
} }
return result; return result;
} }
/** /**
* Called from <code>SystemViewPart#fillLocalToolBar(boolean)</code> to allow dynamic system * Called from <code>SystemViewPart#fillLocalToolBar(boolean)</code> to allow dynamic system
* type providers to customize the RSE standard toolbar structure regarding their needs. * type providers to customize the RSE standard toolbar structure regarding their needs.
@ -258,13 +263,13 @@ public class RSESystemTypeAdapter extends RSEAdapter {
* is associated with multiple system types, this method is called multiple times. * is associated with multiple system types, this method is called multiple times.
* Overriders must check if the required groups are added to the toolbar already * Overriders must check if the required groups are added to the toolbar already
* and must avoid to add them multiple times! * and must avoid to add them multiple times!
* *
* @param view The view to customize. Must be not <code>null</code>. * @param view The view to customize. Must be not <code>null</code>.
*/ */
public void addCustomToolbarGroups(IViewPart view) { public void addCustomToolbarGroups(IViewPart view) {
// The static standard RSE system types have no custom toolbar groups. // The static standard RSE system types have no custom toolbar groups.
} }
/** /**
* Called from {@link org.eclipse.rse.internal.ui.view.SystemView#createStandardGroups(IMenuManager)} to allow dynamic system * Called from {@link org.eclipse.rse.internal.ui.view.SystemView#createStandardGroups(IMenuManager)} to allow dynamic system
* type providers to customize the RSE standard menu structure regarding their needs. * type providers to customize the RSE standard menu structure regarding their needs.
@ -272,32 +277,32 @@ public class RSESystemTypeAdapter extends RSEAdapter {
* <b>Note:</b> This method is called for each system type. If a single system type adapter * <b>Note:</b> This method is called for each system type. If a single system type adapter
* is associated with multiple system types, this method is called multiple times. * is associated with multiple system types, this method is called multiple times.
* Overriders must check if the required groups are added to the menu already * Overriders must check if the required groups are added to the menu already
* and must avoid to add them multiple times! * and must avoid to add them multiple times!
* *
* @param menu The menu manager. Must be not <code>null</code>. * @param menu The menu manager. Must be not <code>null</code>.
*/ */
public void addCustomMenuGroups(IMenuManager menu) { public void addCustomMenuGroups(IMenuManager menu) {
// The static standard RSE system types have no custom menu groups. // The static standard RSE system types have no custom menu groups.
} }
/** /**
* Checks if the given wizard descriptor is accepted for the system types the * Checks if the given wizard descriptor is accepted for the system types the
* adapter is covering. * adapter is covering.
* *
* @param wizardConfigurationElementName The wizard configuration element name. Must be not <code>null</code>. * @param wizardConfigurationElementName The wizard configuration element name. Must be not <code>null</code>.
* @param descriptor The wizard descriptor. Must be not <code>null</code>. * @param descriptor The wizard descriptor. Must be not <code>null</code>.
* *
* @return <code>True</code> is accepted, <code>false</code> otherwise. * @return <code>True</code> is accepted, <code>false</code> otherwise.
*/ */
public boolean acceptWizardDescriptor(String wizardConfigurationElementName, IRSEWizardDescriptor descriptor) { public boolean acceptWizardDescriptor(String wizardConfigurationElementName, IRSEWizardDescriptor descriptor) {
assert wizardConfigurationElementName != null && descriptor != null; assert wizardConfigurationElementName != null && descriptor != null;
// We always accept the default RSE new connection wizard // We always accept the default RSE new connection wizard
if ("org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard".equals(descriptor.getId())) { //$NON-NLS-1$ if ("org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard".equals(descriptor.getId())) { //$NON-NLS-1$
return true; return true;
} }
return false; return false;
} }
} }

View file

@ -1,15 +1,15 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* David Dykstal (IBM) - moved SystemPreferencesManager to a new package * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
* - created and used RSEPreferencesManager * - created and used RSEPreferencesManager
@ -61,8 +61,8 @@ import org.eclipse.swt.widgets.TableItem;
* This is a field type editor for the Remote Systems preference page, * This is a field type editor for the Remote Systems preference page,
* used for setting system type preferences. * used for setting system type preferences.
*/ */
public class SystemTypeFieldEditor extends FieldEditor public class SystemTypeFieldEditor extends FieldEditor
implements ICellModifier, ITableLabelProvider, IStructuredContentProvider implements ICellModifier, ITableLabelProvider, IStructuredContentProvider
{ {
private Table table; private Table table;
private GridData tableData; private GridData tableData;
@ -73,9 +73,9 @@ public class SystemTypeFieldEditor extends FieldEditor
public static final char EACHVALUE_DELIMITER='+'; public static final char EACHVALUE_DELIMITER='+';
private Hashtable keyValues; private Hashtable keyValues;
private IRSESystemType[] systemTypes; private IRSESystemType[] systemTypes;
private boolean enabledStateChanged = false; private boolean enabledStateChanged = false;
private static final int COLUMN_NAME = 0; private static final int COLUMN_NAME = 0;
private static final int COLUMN_ENABLED = 1; private static final int COLUMN_ENABLED = 1;
private static final int COLUMN_USERID = 2; private static final int COLUMN_USERID = 2;
@ -83,36 +83,37 @@ public class SystemTypeFieldEditor extends FieldEditor
private static final String P_ENABLED = "enabled"; //$NON-NLS-1$ private static final String P_ENABLED = "enabled"; //$NON-NLS-1$
private static final String P_DESC = "desc"; //$NON-NLS-1$ private static final String P_DESC = "desc"; //$NON-NLS-1$
private static final String P_USERID = "userid"; //$NON-NLS-1$ private static final String P_USERID = "userid"; //$NON-NLS-1$
private static final String columnHeaders[] = private static final String columnHeaders[] =
{ {
SystemResources.RESID_PREF_SYSTYPE_COLHDG_NAME, SystemResources.RESID_PREF_SYSTYPE_COLHDG_NAME,
SystemResources.RESID_PREF_SYSTYPE_COLHDG_ENABLED, SystemResources.RESID_PREF_SYSTYPE_COLHDG_ENABLED,
SystemResources.RESID_PREF_SYSTYPE_COLHDG_USERID, SystemResources.RESID_PREF_SYSTYPE_COLHDG_USERID,
SystemResources.RESID_PREF_SYSTYPE_COLHDG_DESC SystemResources.RESID_PREF_SYSTYPE_COLHDG_DESC
}; };
private static ColumnLayoutData columnLayouts[] = private static ColumnLayoutData columnLayouts[] =
{ {
new ColumnWeightData(20,80,true), new ColumnWeightData(20,80,true),
new ColumnWeightData(20,15,true), new ColumnWeightData(20,15,true),
new ColumnWeightData(20,100,true), new ColumnWeightData(20,100,true),
new ColumnWeightData(55,280,true) new ColumnWeightData(55,280,true)
}; };
// give each column a property value to identify it // give each column a property value to identify it
private static final String[] tableColumnProperties = private static final String[] tableColumnProperties =
{ {
P_NAME, P_ENABLED, P_USERID, P_DESC P_NAME, P_ENABLED, P_USERID, P_DESC
}; };
private static final boolean[] enabledStates = {Boolean.TRUE.booleanValue(), Boolean.FALSE.booleanValue()}; private static final boolean[] enabledStates = {Boolean.TRUE.booleanValue(), Boolean.FALSE.booleanValue()};
private static final String[] enabledStateStrings = {Boolean.TRUE.toString(), Boolean.FALSE.toString()}; private static final String[] enabledStateStrings = {Boolean.TRUE.toString(), Boolean.FALSE.toString()};
/** /**
* Constructor * Constructor
* @param name *
* @param labelText * @param name the name of the preference this field editor works on
* @param parent * @param labelText the label text of the field editor
* @param parent the parent of the field editor's control
*/ */
public SystemTypeFieldEditor(String name, String labelText, Composite parent) public SystemTypeFieldEditor(String name, String labelText, Composite parent)
{ {
super(name, labelText, parent); super(name, labelText, parent);
} }
@ -120,7 +121,7 @@ public class SystemTypeFieldEditor extends FieldEditor
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int) * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
*/ */
protected void adjustForNumColumns(int numColumns) protected void adjustForNumColumns(int numColumns)
{ {
((GridData)table.getLayoutData()).horizontalSpan = numColumns; ((GridData)table.getLayoutData()).horizontalSpan = numColumns;
} }
@ -128,13 +129,13 @@ public class SystemTypeFieldEditor extends FieldEditor
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int) * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
*/ */
protected void doFillIntoGrid(Composite parent, int numColumns) protected void doFillIntoGrid(Composite parent, int numColumns)
{ {
table = createTable(parent); table = createTable(parent);
((GridData)table.getLayoutData()).horizontalSpan = numColumns; ((GridData)table.getLayoutData()).horizontalSpan = numColumns;
tableViewer = new TableViewer(table); tableViewer = new TableViewer(table);
createColumns(); createColumns();
tableViewer.setColumnProperties(tableColumnProperties); tableViewer.setColumnProperties(tableColumnProperties);
tableViewer.setCellModifier(this); tableViewer.setCellModifier(this);
CellEditor editors[] = new CellEditor[columnHeaders.length]; CellEditor editors[] = new CellEditor[columnHeaders.length];
userIdCellEditor = new TextCellEditor(table); userIdCellEditor = new TextCellEditor(table);
@ -145,20 +146,20 @@ public class SystemTypeFieldEditor extends FieldEditor
tableViewer.setLabelProvider(this); tableViewer.setLabelProvider(this);
tableViewer.setContentProvider(this); tableViewer.setContentProvider(this);
tableViewer.setInput(new Object()); tableViewer.setInput(new Object());
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doLoad() * @see org.eclipse.jface.preference.FieldEditor#doLoad()
*/ */
protected void doLoad() protected void doLoad()
{ {
if (systemTypes == null) if (systemTypes == null)
systemTypes = getSystemTypes(false); systemTypes = getSystemTypes(false);
String value = RSEPreferencesManager.getSystemTypeValues(); String value = RSEPreferencesManager.getSystemTypeValues();
keyValues = null; keyValues = null;
if ((value == null) || (value.length() == 0)) if ((value == null) || (value.length() == 0))
{ {
keyValues = new Hashtable(); keyValues = new Hashtable();
@ -168,11 +169,11 @@ public class SystemTypeFieldEditor extends FieldEditor
keyValues = parseString(value); keyValues = parseString(value);
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doLoadDefault() * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
*/ */
protected void doLoadDefault() protected void doLoadDefault()
{ {
// when Defaults button pressed, we re-read the system types from disk // when Defaults button pressed, we re-read the system types from disk
systemTypes = getSystemTypes(true); systemTypes = getSystemTypes(true);
@ -183,7 +184,7 @@ public class SystemTypeFieldEditor extends FieldEditor
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doStore() * @see org.eclipse.jface.preference.FieldEditor#doStore()
*/ */
protected void doStore() protected void doStore()
{ {
if (systemTypes != null) if (systemTypes != null)
{ {
@ -198,7 +199,7 @@ public class SystemTypeFieldEditor extends FieldEditor
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls() * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
*/ */
public int getNumberOfControls() public int getNumberOfControls()
{ {
return 1; return 1;
} }
@ -214,46 +215,46 @@ public class SystemTypeFieldEditor extends FieldEditor
/* /*
* @see FieldEditor.isValid(). * @see FieldEditor.isValid().
*/ */
public boolean isValid() public boolean isValid()
{ {
return true; return true;
} }
// ---------------- // ----------------
// local methods... // local methods...
// ---------------- // ----------------
private Table createTable(Composite parent) private Table createTable(Composite parent)
{ {
table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
table.setLinesVisible(true); table.setLinesVisible(true);
tableData = new GridData(); tableData = new GridData();
tableData.horizontalAlignment = GridData.FILL; tableData.horizontalAlignment = GridData.FILL;
tableData.grabExcessHorizontalSpace = true; tableData.grabExcessHorizontalSpace = true;
tableData.widthHint = 410; tableData.widthHint = 410;
tableData.heightHint= 30; tableData.heightHint= 30;
tableData.verticalAlignment = GridData.FILL; tableData.verticalAlignment = GridData.FILL;
tableData.grabExcessVerticalSpace = true; tableData.grabExcessVerticalSpace = true;
table.setLayoutData(tableData); table.setLayoutData(tableData);
SystemWidgetHelpers.setHelp(table, RSEUIPlugin.HELPPREFIX+"systype_preferences"); //$NON-NLS-1$ SystemWidgetHelpers.setHelp(table, RSEUIPlugin.HELPPREFIX+"systype_preferences"); //$NON-NLS-1$
return table; return table;
} }
private void createColumns() private void createColumns()
{ {
TableLayout layout = new TableLayout(); TableLayout layout = new TableLayout();
table.setLayout(layout); table.setLayout(layout);
table.setHeaderVisible(true); table.setHeaderVisible(true);
for (int i = 0; i < columnHeaders.length; i++) for (int i = 0; i < columnHeaders.length; i++)
{ {
layout.addColumnData(columnLayouts[i]); layout.addColumnData(columnLayouts[i]);
TableColumn tc = new TableColumn(table, SWT.NONE,i); TableColumn tc = new TableColumn(table, SWT.NONE,i);
tc.setResizable(columnLayouts[i].resizable); tc.setResizable(columnLayouts[i].resizable);
tc.setText(columnHeaders[i]); tc.setText(columnHeaders[i]);
} }
} }
/** /**
@ -279,7 +280,7 @@ public class SystemTypeFieldEditor extends FieldEditor
} }
return keyValues; return keyValues;
} }
private static String makeString(char charOne, char charTwo) private static String makeString(char charOne, char charTwo)
{ {
StringBuffer s = new StringBuffer(2); StringBuffer s = new StringBuffer(2);
@ -287,7 +288,7 @@ public class SystemTypeFieldEditor extends FieldEditor
s.append(charTwo); s.append(charTwo);
return s.toString(); return s.toString();
} }
/** /**
* Convert hashtable of key-value pairs into a single string * Convert hashtable of key-value pairs into a single string
*/ */
@ -312,7 +313,7 @@ public class SystemTypeFieldEditor extends FieldEditor
return sb.toString(); return sb.toString();
} }
/** /**
* Retrieve an array of currently known system types. * Retrieve an array of currently known system types.
* @param restoreDefaults restore the default values for the system types * @param restoreDefaults restore the default values for the system types
@ -351,7 +352,7 @@ public class SystemTypeFieldEditor extends FieldEditor
* @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
*/ */
public boolean canModify(Object element, String property) public boolean canModify(Object element, String property)
{ {
if (property.equals(P_ENABLED)) if (property.equals(P_ENABLED))
{ {
return true; return true;
@ -371,11 +372,11 @@ public class SystemTypeFieldEditor extends FieldEditor
IRSESystemType row = (IRSESystemType)element; IRSESystemType row = (IRSESystemType)element;
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(row.getAdapter(RSESystemTypeAdapter.class)); RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(row.getAdapter(RSESystemTypeAdapter.class));
Object value = ""; //$NON-NLS-1$ Object value = ""; //$NON-NLS-1$
if (property.equals(P_NAME)) if (property.equals(P_NAME))
value = row.getLabel(); value = row.getLabel();
else if (property.equals(P_ENABLED)) else if (property.equals(P_ENABLED))
value = (adapter.isEnabled(row) ? new Integer(0) : new Integer(1)); value = (row.isEnabled() ? new Integer(0) : new Integer(1));
else if (property.equals(P_USERID)) else if (property.equals(P_USERID))
value = (adapter.getDefaultUserId(row) == null) ? "" : adapter.getDefaultUserId(row); //$NON-NLS-1$ value = (adapter.getDefaultUserId(row) == null) ? "" : adapter.getDefaultUserId(row); //$NON-NLS-1$
else else
@ -383,7 +384,7 @@ public class SystemTypeFieldEditor extends FieldEditor
return value; return value;
} }
public boolean enabledStateChanged() public boolean enabledStateChanged()
{ {
return enabledStateChanged; return enabledStateChanged;
@ -394,22 +395,21 @@ public class SystemTypeFieldEditor extends FieldEditor
*/ */
public void modify(Object element, String property, Object value) public void modify(Object element, String property, Object value)
{ {
IRSESystemType row = (IRSESystemType)(((TableItem)element).getData()); IRSESystemType row = (IRSESystemType)(((TableItem)element).getData());
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(row.getAdapter(RSESystemTypeAdapter.class));
if (property.equals(P_ENABLED)) if (property.equals(P_ENABLED))
{ {
Integer val = (Integer)value; Integer val = (Integer)value;
adapter.setIsEnabled(row, enabledStates[val.intValue()]); RSEPreferencesManager.setIsSystemTypeEnabled(row, enabledStates[val.intValue()]);
enabledStateChanged = true; enabledStateChanged = true;
} }
else if (property.equals(P_USERID)) else if (property.equals(P_USERID))
{ {
adapter.setDefaultUserId(row, (String)value); RSEPreferencesManager.setDefaultUserId(row, (String) value);
} }
else else
return; return;
keyValues.put(row.getId(), ""); //$NON-NLS-1$ keyValues.put(row.getId(), ""); //$NON-NLS-1$
tableViewer.update(row, null); tableViewer.update(row, null);
} }
@ -432,15 +432,16 @@ public class SystemTypeFieldEditor extends FieldEditor
public String getColumnText(Object element, int columnIndex) public String getColumnText(Object element, int columnIndex)
{ {
IRSESystemType currType = (IRSESystemType)element; IRSESystemType currType = (IRSESystemType)element;
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(currType.getAdapter(RSESystemTypeAdapter.class));
if (columnIndex == COLUMN_NAME) if (columnIndex == COLUMN_NAME)
return currType.getLabel(); return currType.getLabel();
else if (columnIndex == COLUMN_ENABLED) else if (columnIndex == COLUMN_ENABLED)
return Boolean.toString(adapter.isEnabled(currType)); return Boolean.toString(currType.isEnabled());
else if (columnIndex == COLUMN_USERID) else if (columnIndex == COLUMN_USERID) {
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter) (currType.getAdapter(RSESystemTypeAdapter.class));
return (adapter.getDefaultUserId(currType)==null ? "" : adapter.getDefaultUserId(currType)); //$NON-NLS-1$ return (adapter.getDefaultUserId(currType)==null ? "" : adapter.getDefaultUserId(currType)); //$NON-NLS-1$
else }
else
return (currType.getDescription()==null ? "" : currType.getDescription()); //$NON-NLS-1$ return (currType.getDescription()==null ? "" : currType.getDescription()); //$NON-NLS-1$
} }
@ -455,7 +456,7 @@ public class SystemTypeFieldEditor extends FieldEditor
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
*/ */
public boolean isLabelProperty(Object element, String property) public boolean isLabelProperty(Object element, String property)
{ {
return true; return true;
} }
@ -469,7 +470,7 @@ public class SystemTypeFieldEditor extends FieldEditor
// ------------------------------------- // -------------------------------------
// IStructuredContentProvider methods... // IStructuredContentProvider methods...
// ------------------------------------- // -------------------------------------
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/ */
@ -486,7 +487,7 @@ public class SystemTypeFieldEditor extends FieldEditor
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
{ {
} }
// ---------------- // ----------------
// Other methods... // Other methods...
// ---------------- // ----------------
@ -539,15 +540,15 @@ public class SystemTypeFieldEditor extends FieldEditor
// // find this system type in the array... // // find this system type in the array...
// IRSESystemType matchingType = RSECorePlugin.getTheCoreRegistry().getSystemType(key); // IRSESystemType matchingType = RSECorePlugin.getTheCoreRegistry().getSystemType(key);
// RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(matchingType.getAdapter(RSESystemTypeAdapter.class)); // RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(matchingType.getAdapter(RSESystemTypeAdapter.class));
// //
// // update this system type's attributes as per preferences... // // update this system type's attributes as per preferences...
// { // {
// adapter.setIsEnabled(matchingType, attr1.equals("true")); //$NON-NLS-1$ // adapter.setIsEnabled(matchingType, attr1.equals("true")); //$NON-NLS-1$
// if (!attr2.equals("null")) //$NON-NLS-1$ // if (!attr2.equals("null")) //$NON-NLS-1$
// adapter.setDefaultUserId(matchingType, attr2); // adapter.setDefaultUserId(matchingType, attr2);
// } // }
// } // }
// } // }
// return keyValues; // return keyValues;
// } // }
} }