1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 05:25:21 +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

@ -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);

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* 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
@ -108,9 +108,10 @@ public class SystemTypeFieldEditor extends FieldEditor
/** /**
* 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)
{ {
@ -375,7 +376,7 @@ public class SystemTypeFieldEditor extends FieldEditor
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
@ -395,17 +396,16 @@ 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;
@ -432,14 +432,15 @@ 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$
} }