X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java index ea4a706..c0416e6 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java @@ -1,13 +1,13 @@ package net.sourceforge.phpdt.externaltools.internal.registry; /********************************************************************** -Copyright (c) 2002 IBM Corp. and others. All rights reserved. -This file is made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html -� -Contributors: -**********************************************************************/ + Copyright (c) 2002 IBM Corp. and others. All rights reserved. + This file is made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + � + Contributors: + **********************************************************************/ import net.sourceforge.phpdt.externaltools.group.IGroupDialogPage; import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages; @@ -27,57 +27,64 @@ import org.eclipse.swt.widgets.Label; * Abtract representation of the different variables. */ public abstract class ExternalToolVariable { - private static final IVariableComponent defaultComponent = new DefaultVariableComponent(false); - + private static final IVariableComponent defaultComponent = new DefaultVariableComponent( + false); + private String tag; + private String description; + private IConfigurationElement element; /** * Creates an variable definition * - * @param tag the variable tag - * @param description a short description of what the variable will expand to - * @param element the configuration element + * @param tag + * the variable tag + * @param description + * a short description of what the variable will expand to + * @param element + * the configuration element */ - /*package*/ ExternalToolVariable(String tag, String description, IConfigurationElement element) { + /* package */ExternalToolVariable(String tag, String description, + IConfigurationElement element) { super(); this.tag = tag; this.description = description; this.element = element; } - + /** - * Creates an instance of the class specified by - * the given element attribute name. Can return - * null if none or if problems creating - * the instance. + * Creates an instance of the class specified by the given element attribute + * name. Can return null if none or if problems creating the + * instance. */ protected final Object createObject(String attributeName) { try { return element.createExecutableExtension(attributeName); } catch (CoreException e) { - ExternalToolsPlugin.getDefault().getLog().log(e.getStatus()); + ExternalToolsPlugin.getDefault().getLog().log(e.getStatus()); return null; } } - + /** - * Returns the component class to allow - * visual editing of the variable's value. + * Returns the component class to allow visual editing of the variable's + * value. */ public final IVariableComponent getComponent() { - String className = element.getAttribute(ExternalToolVariableRegistry.TAG_COMPONENT_CLASS); + String className = element + .getAttribute(ExternalToolVariableRegistry.TAG_COMPONENT_CLASS); if (className == null || className.trim().length() == 0) return defaultComponent; - + Object component = createObject(ExternalToolVariableRegistry.TAG_COMPONENT_CLASS); if (component == null) return new DefaultVariableComponent(true); else - return (IVariableComponent)component; + return (IVariableComponent) component; } - + /** * Returns the variable's description */ @@ -92,63 +99,68 @@ public abstract class ExternalToolVariable { return tag; } - /** - * Default variable component implementation which does not - * allow variable value editing visually. - */ - private static final class DefaultVariableComponent implements IVariableComponent { + * Default variable component implementation which does not allow variable + * value editing visually. + */ + private static final class DefaultVariableComponent implements + IVariableComponent { private boolean showError = false; + private Label message = null; - + public DefaultVariableComponent(boolean showError) { super(); this.showError = showError; } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public Control getControl() { return message; } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ - public void createContents(Composite parent, String varTag, IGroupDialogPage page) { + public void createContents(Composite parent, String varTag, + IGroupDialogPage page) { if (showError) { message = new Label(parent, SWT.NONE); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); message.setLayoutData(data); message.setFont(parent.getFont()); - message.setText(ExternalToolsModelMessages.getString("ExternalToolVariable.componentErrorMessage")); //$NON-NLS-1$ - message.setForeground(JFaceColors.getErrorText(message.getDisplay())); + message + .setText(ExternalToolsModelMessages + .getString("ExternalToolVariable.componentErrorMessage")); //$NON-NLS-1$ + message.setForeground(JFaceColors.getErrorText(message + .getDisplay())); } } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public String getVariableValue() { return null; } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public boolean isValid() { return true; } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public void setVariableValue(String varValue) { } - /* (non-Javadoc) - * Method declared on IVariableComponent. + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public void validate() { }