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

[cleanup] fixing javadoc errors, added null value check for subsystem configuration in testAttribute

This commit is contained in:
David Dykstal 2006-12-07 20:17:16 +00:00
parent a8d15bf226
commit 579a668568

View file

@ -47,10 +47,10 @@ import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.validators.ISystemValidator; import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorFilterName; import org.eclipse.rse.ui.validators.ValidatorFilterName;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionFilter;
import org.eclipse.ui.views.properties.IPropertyDescriptor; import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor; import org.eclipse.ui.views.properties.PropertyDescriptor;
/** /**
* Default Adapter for displaying filter objects in tree views. * Default Adapter for displaying filter objects in tree views.
* For some subsystems, these are children of SubSystem objects. * For some subsystems, these are children of SubSystem objects.
@ -184,17 +184,17 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
Object[] children = null; Object[] children = null;
SystemFilterSimple simpleFilter = (SystemFilterSimple)filter; SystemFilterSimple simpleFilter = (SystemFilterSimple)filter;
String[] filterStrings = simpleFilter.getFilterStrings(); String[] filterStrings = simpleFilter.getFilterStrings();
// 50167pc: The following was a problem, as the parent in a SimpleFilterSimpleImpl is not // 50167pc: The following was a problem, as the parent in a SystemFilterSimpleImpl is not
// to be trusted, since we tend to use the same instance for each connection in the list. // to be trusted, since we tend to use the same instance for each connection in the list.
ISubSystem ss = (ISubSystem)simpleFilter.getParent(); ISubSystem ss = (ISubSystem)simpleFilter.getParent();
String preSelectName = null; String preSelectName = null;
try try
{ {
Shell shell = getShell(); // Shell shell = getShell();
// hack to propogate type filters down from connection in select dialogs... // hack to propogate type filters down from connection in select dialogs...
ISystemViewInputProvider inputProvider = getInput(); ISystemViewInputProvider inputProvider = getInput();
if ( (inputProvider != null) && (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) && if ((inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) &&
(filterStrings != null) && (filterStrings.length>0) ) (filterStrings != null) && (filterStrings.length > 0) )
{ {
SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl)inputProvider; SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl)inputProvider;
if (ip.filtersNeedDecoration(element)) if (ip.filtersNeedDecoration(element))
@ -232,7 +232,10 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
match = child; match = child;
} }
//if (match != null) always reset even if it is null //if (match != null) always reset even if it is null
((SystemSelectRemoteObjectAPIProviderImpl)inputProvider).setPreSelectFilterChildObject(match); if (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl)
{
((SystemSelectRemoteObjectAPIProviderImpl) inputProvider).setPreSelectFilterChildObject(match);
}
} }
} }
catch (InterruptedException exc) catch (InterruptedException exc)
@ -359,8 +362,8 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
/** /**
* Return our unique property values * Return our unique property values
* The parent handles P_TEXT and P_TYPE only, and we augment that here. * The parent handles P_TEXT and P_TYPE only, and we augment that here.
* @param property the name of the property as named by its property descriptor * @param key the name of the property as named by its property descriptor
* @return the current value of the property * @return the current value of the property
*/ */
protected Object internalGetPropertyValue(Object key) protected Object internalGetPropertyValue(Object key)
{ {
@ -455,8 +458,8 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
return true; return true;
} }
/** /**
* Return a validator for verifying the new name is correct. * @param element either a filter for a rename action, or a filter pool for a "new" action.
* @param either a filter for a rename action, or a filter pool for a "new" action. * @return a validator for verifying the new name is correct.
*/ */
public ISystemValidator getNameValidator(Object element) public ISystemValidator getNameValidator(Object element)
{ {
@ -524,37 +527,38 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
} }
/** /**
* <i>Overide of parent method.</i><br> * Test an object to see if it has an attribute with a particular value.
* From <samp>IActionFilter</samp> so the popupMenus extension point can use &lt;filter&gt;, &lt;enablement&gt; * From <code>IActionFilter</code> so the popupMenus extension point can use
* or &lt;visibility&gt;. We add support is for the following: * &lt;filter&gt;, &lt;enablement&gt; or &lt;visibility&gt;.
* We add support for the following attributes:
* <ol> * <ol>
* <li>name="filterType". The value is tested against the non-translated filter type. Note all subsystems * <li>"filterType"
* support different types of filters. * The value is tested against the non-translated filter type.
* <li>name="showChangeFilterStringsPropertyPage". The value is tested against the call to the subsystem factory method showChangeFilterStringsPropertyPage(SystemFilter). * Not all subsystems support different types of filters.
* Compares against "true" (default) or "false". * <li>name="showChangeFilterStringsPropertyPage".
* The value is tested against the call to the
* subsystem configuration method showChangeFilterStringsPropertyPage(SystemFilter).
* values should be <code>true</code> or <code>false</code>.
* </ol> * </ol>
* @param target the object whose attribute we are testing
* @param name the attribute to test.
* @param value the value to test.
* @return true if the attribute of the given name can be said to have the given value
* @see IActionFilter#testAttribute(Object, String, String)
*/ */
public boolean testAttribute(Object target, String name, String value) public boolean testAttribute(Object target, String name, String value) {
{ boolean result = false;
if (name.equalsIgnoreCase("filterType")) //$NON-NLS-1$ if (name.equalsIgnoreCase("filterType")) { //$NON-NLS-1$
{
ISystemFilter filter = getFilter(target); ISystemFilter filter = getFilter(target);
String type = filter.getType(); String type = filter.getType();
if ((type == null) || (type.length() == 0)) result = (type != null) && (type.length() > 0) && value.equals(type);
return false; } else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage")) { //$NON-NLS-1$
else
return value.equals(type);
}
else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage")) //$NON-NLS-1$
{
ISystemFilter filter = getFilter(target); ISystemFilter filter = getFilter(target);
ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(filter); ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(filter);
if (value.equals("true")) //$NON-NLS-1$ result = (ssf != null) && ssf.showChangeFilterStringsPropertyPage(filter) && value.equals("true"); //$NON-NLS-1$
return ssf.showChangeFilterStringsPropertyPage(filter); } else {
else result = super.testAttribute(target, name, value);
return !ssf.showChangeFilterStringsPropertyPage(filter);
} }
else return result;
return super.testAttribute(target, name, value);
} }
} }