use of org.eclipse.pde.core.plugin.IPluginExtension 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.IPluginExtension 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.IPluginExtension 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.IPluginExtension 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);
}
use of org.eclipse.pde.core.plugin.IPluginExtension 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);
}
Aggregations