use of org.eclipse.pde.core.plugin.IPluginElement in project webtools.servertools by eclipse.
the class GenericServerTemplate method addServerType.
private void addServerType(IPluginBase plugin, IPluginModelFactory factory) throws CoreException {
// $NON-NLS-1$
IPluginExtension serverExtension = createExtension("org.eclipse.wst.server.core.serverTypes", true);
IPluginElement serverType = factory.createElement(serverExtension);
// $NON-NLS-1$
serverType.setName("serverType");
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("runtime", "true");
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("class", "org.eclipse.jst.server.generic.core.internal.GenericServer");
// $NON-NLS-1$
serverType.setAttribute("id", getServerId());
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("initialState", "stopped");
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("supportsRemoteHosts", "false");
// $NON-NLS-1$
serverType.setAttribute("runtimeTypeId", getRuntimeId());
// $NON-NLS-1$
serverType.setAttribute("description", getStringOption(KEY_SERVER_DESCRIPTION));
// $NON-NLS-1$
serverType.setAttribute("launchConfigId", getSelectedConfigType());
// $NON-NLS-1$
serverType.setAttribute("behaviourClass", getSelectedBehaviourClass());
// $NON-NLS-1$
serverType.setAttribute("name", getStringOption(KEY_SERVER_NAME));
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("startTimeout", "75000");
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("stopTimeout", "30000");
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("hasConfiguration", "false");
// $NON-NLS-1$ //$NON-NLS-2$
serverType.setAttribute("launchModes", "run,debug");
// $NON-NLS-1$
serverType.setAttribute("startBeforePublish", Boolean.toString(getBooleanOption(KEY_SERVER_START_BEFORE_PUBLISH)));
serverExtension.add(serverType);
if (!serverExtension.isInTheModel())
plugin.add(serverExtension);
}
use of org.eclipse.pde.core.plugin.IPluginElement in project webtools.servertools by eclipse.
the class GenericServerTemplate method addRuntimeType.
private void addRuntimeType(IPluginBase plugin, IPluginModelFactory factory) throws CoreException {
// $NON-NLS-1$
IPluginExtension extension = createExtension("org.eclipse.wst.server.core.runtimeTypes", true);
IPluginElement runtimeType = factory.createElement(extension);
// $NON-NLS-1$
runtimeType.setName("runtimeType");
// $NON-NLS-1$
runtimeType.setAttribute("id", getRuntimeId());
// $NON-NLS-1$
runtimeType.setAttribute("name", getStringOption(KEY_SERVER_NAME));
// $NON-NLS-1$
runtimeType.setAttribute("description", getStringOption(KEY_SERVER_DESCRIPTION));
// $NON-NLS-1$
runtimeType.setAttribute("vendor", getStringOption(KEY_SERVER_VENDOR));
// $NON-NLS-1$
runtimeType.setAttribute("version", getStringOption(KEY_SERVER_VERSION));
// $NON-NLS-1$ //$NON-NLS-2$
runtimeType.setAttribute("class", "org.eclipse.jst.server.generic.core.internal.GenericServerRuntime");
IPluginElement moduleType = factory.createElement(runtimeType);
// $NON-NLS-1$
moduleType.setName("moduleType");
// $NON-NLS-1$ //$NON-NLS-2$
moduleType.setAttribute("types", "jst.web");
// $NON-NLS-1$ //$NON-NLS-2$
moduleType.setAttribute("versions", "1.2, 1.3");
runtimeType.add(moduleType);
extension.add(runtimeType);
if (!extension.isInTheModel())
plugin.add(extension);
}
use of org.eclipse.pde.core.plugin.IPluginElement in project webtools.servertools by eclipse.
the class GenericServerTemplate method addServerImage.
private void addServerImage(IPluginBase plugin, IPluginModelFactory factory) throws CoreException {
// $NON-NLS-1$
IPluginExtension imageExtension = createExtension("org.eclipse.wst.server.ui.serverImages", true);
IPluginElement serverImage = factory.createElement(imageExtension);
// $NON-NLS-1$
serverImage.setName("image");
// $NON-NLS-1$ //$NON-NLS-2$
serverImage.setAttribute("id", getNamespace() + ".serverImage");
// $NON-NLS-1$ //$NON-NLS-2$
serverImage.setAttribute("icon", "icons/server.gif");
// $NON-NLS-1$
serverImage.setAttribute("typeIds", getServerId());
imageExtension.add(serverImage);
IPluginElement runtimeImage = factory.createElement(imageExtension);
// $NON-NLS-1$
runtimeImage.setName("image");
// $NON-NLS-1$ //$NON-NLS-2$
runtimeImage.setAttribute("id", getNamespace() + ".runtimeImage");
// $NON-NLS-1$ //$NON-NLS-2$
runtimeImage.setAttribute("icon", "icons/server.gif");
// $NON-NLS-1$
runtimeImage.setAttribute("typeIds", getRuntimeId());
imageExtension.add(runtimeImage);
if (!imageExtension.isInTheModel())
plugin.add(imageExtension);
}
use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.
the class CheckMarkerHelpExtensionTest method testRemoveElement.
/**
* Tests if a marker help element is removed if the corresponding check is deleted.
*
* @throws Exception
* the exception
*/
@Test
public void testRemoveElement() throws Exception {
final CheckCatalog catalogWithTwoChecks = parser.parse(CATALOG_WITH_TWO_CHECKS);
IPluginExtension extension = createMarkerHelpExtension(catalogWithTwoChecks);
assertEquals("Original catalog has two marker help extensions", 2, extension.getChildCount());
CheckCatalog catalogWithOneCheck = parser.parse(CATALOG_WITH_SECOND_CHECK_ONDEMAND);
markerUtil.updateExtension(catalogWithOneCheck, extension);
assertEquals("Updated catalog has one marker help extension only", 1, extension.getChildCount());
assertEquals("The element for the removed check has been deleted.", SECONDCHECK_CONTEXTID, ((IPluginElement) extension.getChildren()[0]).getAttribute(CheckMarkerHelpExtensionHelper.CONTEXT_ID_ATTRIBUTE_TAG).getValue());
}
use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.
the class CheckContextsExtensionTest method createErroneousExtension.
/**
* Creates the extension with wrong file path.
*
* @return the i plugin extension
* @throws CoreException
* the core exception
*/
private IPluginExtension createErroneousExtension() throws CoreException {
IPluginExtension extension = pluginModel.getFactory().createExtension();
extension.setPoint(CheckContextsExtensionHelper.CONTEXTS_EXTENSION_POINT_ID);
extension.setName(contextsUtil.getExtensionPointName(catalog));
IPluginElement element = extension.getModel().getFactory().createElement(extension);
element.setName(CheckContextsExtensionHelper.CONTEXT_ELEMENT);
element.setAttribute(CheckContextsExtensionHelper.FILE_ATTRIBUTE_TAG, "dummy_name");
extension.add(element);
return extension;
}
Aggregations