use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.
the class CheckTocExtensionTest method createErroneousTocExtension.
/**
* Creates an erroneous toc extension.
*
* @return the plugin extension
* @throws CoreException
* the core exception
*/
private IPluginExtension createErroneousTocExtension() throws CoreException {
IPluginExtension newExtension = pluginModel.getFactory().createExtension();
newExtension.setPoint(CheckTocExtensionHelper.TOC_EXTENSION_POINT_ID);
newExtension.setName(tocUtil.getExtensionPointName(catalog));
IPluginElement element = pluginModel.getFactory().createElement(newExtension);
element.setName("toc");
element.setAttribute("file", "dummy/file/location");
newExtension.add(element);
return newExtension;
}
use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.
the class CheckTocExtensionTest method testIsExtensionUpdateRequiredFalse.
/**
* Tests if isExtensionUpdateRequires returns false if a correct extension already exists.
*
* @throws CoreException
* the core exception
*/
@Test
public void testIsExtensionUpdateRequiredFalse() throws CoreException {
IPluginExtension extension = tocUtil.addExtensionToPluginBase(pluginModel, catalog, ExtensionType.CONTEXTS, null);
Iterable<IPluginElement> elements = Iterables.filter(Lists.newArrayList(extension.getChildren()), IPluginElement.class);
assertFalse("No toc extension update is required", tocUtil.isExtensionUpdateRequired(catalog, extension, elements));
}
use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.
the class CheckTocExtensionTest method testCreateExtension.
/**
* Tests if the toc extension is correctly created.
*
* @throws CoreException
* the core exception
*/
@Test
public void testCreateExtension() throws CoreException {
IPluginExtension extension = tocUtil.addExtensionToPluginBase(pluginModel, catalog, ExtensionType.CONTEXTS, null);
assertEquals("Toc extension has been created", CheckTocExtensionHelper.TOC_EXTENSION_POINT_ID, extension.getPoint());
assertEquals("Toc extension name is correct", tocUtil.getExtensionPointName(catalog), extension.getName());
assertEquals("Extension has exactly one element", 1, extension.getChildCount());
assertEquals("toc.xml file location is correctly set", CheckTocExtensionHelper.TOC_FILE_NAME, ((IPluginElement) extension.getChildren()[0]).getAttribute("file").getValue());
}
use of org.eclipse.pde.core.plugin.IPluginElement in project webtools.servertools by eclipse.
the class GenericServerTemplate method addServerDefinition.
private void addServerDefinition(IPluginBase plugin, IPluginModelFactory factory) throws CoreException {
// $NON-NLS-1$
IPluginExtension definitionExtension = createExtension("org.eclipse.jst.server.generic.core.serverdefinition", true);
IPluginElement serverDef = factory.createElement(definitionExtension);
// $NON-NLS-1$
serverDef.setName("serverdefinition");
// $NON-NLS-1$
serverDef.setAttribute("id", getRuntimeId());
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
serverDef.setAttribute("definitionfile", "/servers/" + getStringOption(KEY_SERVER_NAME) + ".serverdef");
definitionExtension.add(serverDef);
if (!definitionExtension.isInTheModel())
plugin.add(definitionExtension);
}
use of org.eclipse.pde.core.plugin.IPluginElement in project webtools.servertools by eclipse.
the class GenericServerTemplate method addWizardFragment.
private void addWizardFragment(IPluginBase plugin, IPluginModelFactory factory) throws CoreException {
// $NON-NLS-1$
IPluginExtension wizardExtension = createExtension("org.eclipse.wst.server.ui.wizardFragments", true);
IPluginElement runtimeWiz = factory.createElement(wizardExtension);
// $NON-NLS-1$
runtimeWiz.setName("fragment");
// $NON-NLS-1$ //$NON-NLS-2$
runtimeWiz.setAttribute("id", getNamespace() + ".runtimeWizard");
// $NON-NLS-1$ //$NON-NLS-2$
runtimeWiz.setAttribute("class", "org.eclipse.jst.server.generic.ui.internal.GenericServerRuntimeWizardFragment");
// $NON-NLS-1$
runtimeWiz.setAttribute("typeIds", getRuntimeId());
wizardExtension.add(runtimeWiz);
if (!wizardExtension.isInTheModel())
plugin.add(wizardExtension);
IPluginElement serverWiz = factory.createElement(wizardExtension);
// $NON-NLS-1$
serverWiz.setName("fragment");
// $NON-NLS-1$ //$NON-NLS-2$
serverWiz.setAttribute("id", getNamespace() + ".serverWizard");
// $NON-NLS-1$ //$NON-NLS-2$
serverWiz.setAttribute("class", "org.eclipse.jst.server.generic.ui.internal.GenericServerWizardFragment");
// $NON-NLS-1$
serverWiz.setAttribute("typeIds", getServerId());
wizardExtension.add(serverWiz);
}
Aggregations