Search in sources :

Example 6 with Property

use of org.eclipse.jst.server.generic.servertype.definition.Property in project webtools.servertools by eclipse.

the class ServerPropertiesEditorSection method createSection.

public void createSection(Composite parent) {
    super.createSection(parent);
    FormToolkit formToolkit = getFormToolkit(parent.getDisplay());
    Section section = formToolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
    section.setText(GenericServerUIMessages.ServerEditorSectionTitle);
    section.setDescription(GenericServerUIMessages.ServerEditorSectionDescription);
    section.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    Composite composite = formToolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 5;
    layout.marginWidth = 10;
    layout.verticalSpacing = 5;
    layout.horizontalSpacing = 15;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    List props = fServer.getServerDefinition().getProperty();
    for (Iterator iter = props.iterator(); iter.hasNext(); ) {
        Property property = (Property) iter.next();
        if (property.getContext().equals(Property.CONTEXT_SERVER))
            createPropertyControl(composite, property, formToolkit);
    }
    formToolkit.paintBordersFor(composite);
    section.setClient(composite);
    if (getExistingLaunch() != null) {
        getManagedForm().getMessageManager().addMessage(MESSAGE_ID_SERVER_RUNNING, GenericServerUIMessages.serverRunningCanNotSave, null, IMessageProvider.WARNING);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) Iterator(java.util.Iterator) List(java.util.List) ServerEditorSection(org.eclipse.wst.server.ui.editor.ServerEditorSection) Section(org.eclipse.ui.forms.widgets.Section) Property(org.eclipse.jst.server.generic.servertype.definition.Property)

Example 7 with Property

use of org.eclipse.jst.server.generic.servertype.definition.Property in project webtools.servertools by eclipse.

the class ServerRuntimeUtils method verifyProperty.

public static void verifyProperty(List property, String id, String value) {
    boolean found = false;
    int count = 0;
    Iterator iter = property.iterator();
    while (iter.hasNext()) {
        Property prop = (Property) iter.next();
        if (prop.getId().equals(id)) {
            assertEquals("Property value does not match", value, prop.getDefault());
            found = true;
            ++count;
        }
    }
    assertTrue("Property not found", found);
    assertEquals("More than one property found", 1, count);
}
Also used : Iterator(java.util.Iterator) Property(org.eclipse.jst.server.generic.servertype.definition.Property)

Example 8 with Property

use of org.eclipse.jst.server.generic.servertype.definition.Property in project webtools.servertools by eclipse.

the class GenericServerRuntime method setDefaults.

public void setDefaults(IProgressMonitor monitor) {
    List props = this.getServerTypeDefinition().getProperty();
    Map<String, String> instancePropsMap = new HashMap<String, String>();
    for (Iterator iter = props.iterator(); iter.hasNext(); ) {
        Property element = (Property) iter.next();
        if (Property.CONTEXT_RUNTIME.equalsIgnoreCase(element.getContext()))
            instancePropsMap.put(element.getId(), element.getDefault());
    }
    setServerInstanceProperties(instancePropsMap);
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) List(java.util.List) Property(org.eclipse.jst.server.generic.servertype.definition.Property)

Example 9 with Property

use of org.eclipse.jst.server.generic.servertype.definition.Property in project webtools.servertools by eclipse.

the class ServerRuntimeMergeUtil method combine.

/**
 * Combines a runtime definition and a server definition
 * into a single logical <code>ServerRuntime</code>.
 *
 * @param serverdef
 * @param runtimedef
 * @return serverdef
 */
public static ServerRuntime combine(ServerRuntime serverdef, ServerRuntime runtimedef) {
    /**
     * Add properties from runtimedef to serverdef if not already present,
     * this ensures that:
     *
     * (1) while we are affecting the cached copy of serverdef, it is always
     *     required to be combined with its runtimedef (if there is one), and
     *     we check that the property has not already been added
     *
     * (2) serverdef properties can override runtimedef properties
     */
    List properties = runtimedef.getProperty();
    if (properties != null) {
        Iterator iter = properties.iterator();
        while (iter.hasNext()) {
            Property prop = (Property) iter.next();
            addPropertyIfNotPresent(serverdef.getProperty(), prop);
        }
    }
    /**
     * Add classpaths from runtimedef to serverdef if not already present,
     * this ensures that:
     *
     * (1) while we are affecting the cached copy of serverdef, it is always
     *     required to be combined with its runtimedef (if there is one), and
     *     we check that the classpath has not already been added (by id)
     *
     * (2) serverdef classpath can override runtimedef classpath by id
     */
    List classpaths = runtimedef.getClasspath();
    if (classpaths != null) {
        Iterator iter = classpaths.iterator();
        while (iter.hasNext()) {
            Classpath classpath = (Classpath) iter.next();
            addClasspathIfNotPresent(serverdef.getClasspath(), classpath);
        }
    }
    return serverdef;
}
Also used : Classpath(org.eclipse.jst.server.generic.servertype.definition.Classpath) Iterator(java.util.Iterator) List(java.util.List) Property(org.eclipse.jst.server.generic.servertype.definition.Property)

Example 10 with Property

use of org.eclipse.jst.server.generic.servertype.definition.Property in project webtools.servertools by eclipse.

the class ServerTypeDefinitionDecorator method decorate.

/* (non-Javadoc)
	 * @see org.eclipse.jst.server.generic.ui.internal.GenericServerCompositeDecorator#decorate(org.eclipse.jst.server.generic.ui.internal.GenericServerComposite)
	 */
public void decorate(GenericServerComposite composite) {
    List properties = null;
    if (fDefinition == null) {
        properties = new ArrayList(0);
    } else {
        properties = fDefinition.getProperty();
    }
    for (int i = 0; i < properties.size(); i++) {
        Property property = (Property) properties.get(i);
        if (this.fContext.equals(property.getContext()))
            createPropertyControl(composite, property);
    }
    Dialog.applyDialogFont(composite);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Property(org.eclipse.jst.server.generic.servertype.definition.Property)

Aggregations

Property (org.eclipse.jst.server.generic.servertype.definition.Property)12 Iterator (java.util.Iterator)9 List (java.util.List)6 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Button (org.eclipse.swt.widgets.Button)2 Combo (org.eclipse.swt.widgets.Combo)2 Text (org.eclipse.swt.widgets.Text)2 StringTokenizer (java.util.StringTokenizer)1 Classpath (org.eclipse.jst.server.generic.servertype.definition.Classpath)1 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1 Section (org.eclipse.ui.forms.widgets.Section)1 ServerEditorSection (org.eclipse.wst.server.ui.editor.ServerEditorSection)1