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);
}
}
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);
}
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);
}
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;
}
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);
}
Aggregations