use of org.eclipse.pde.core.plugin.IPluginExtension 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.IPluginExtension 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.IPluginExtension 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.IPluginExtension 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;
}
use of org.eclipse.pde.core.plugin.IPluginExtension in project dsl-devkit by dsldevkit.
the class CheckContextsExtensionTest method testIsExtensionUpdateRequiredFalse.
/**
* Test if isExtensionUpdateRequired returns false if a correct extension already exists.
*
* @throws CoreException
* the core exception
*/
@Test
public void testIsExtensionUpdateRequiredFalse() throws CoreException {
IPluginExtension extension = contextsUtil.addExtensionToPluginBase(pluginModel, catalog, ExtensionType.CONTEXTS, null);
Iterable<IPluginElement> elements = Iterables.filter(Lists.newArrayList(extension.getChildren()), IPluginElement.class);
assertFalse("No extension update is required ", contextsUtil.isExtensionUpdateRequired(catalog, extension, elements));
}
Aggregations