Search in sources :

Example 11 with IPluginExtension

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));
}
Also used : IPluginExtension(org.eclipse.pde.core.plugin.IPluginExtension) IPluginElement(org.eclipse.pde.core.plugin.IPluginElement) Test(org.junit.Test)

Example 12 with IPluginExtension

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());
}
Also used : IPluginExtension(org.eclipse.pde.core.plugin.IPluginExtension) IPluginElement(org.eclipse.pde.core.plugin.IPluginElement) Test(org.junit.Test)

Example 13 with IPluginExtension

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);
}
Also used : IPluginExtension(org.eclipse.pde.core.plugin.IPluginExtension) IPluginElement(org.eclipse.pde.core.plugin.IPluginElement)

Example 14 with IPluginExtension

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);
}
Also used : IPluginExtension(org.eclipse.pde.core.plugin.IPluginExtension) IPluginElement(org.eclipse.pde.core.plugin.IPluginElement)

Example 15 with IPluginExtension

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);
}
Also used : IPluginExtension(org.eclipse.pde.core.plugin.IPluginExtension) IPluginElement(org.eclipse.pde.core.plugin.IPluginElement)

Aggregations

IPluginExtension (org.eclipse.pde.core.plugin.IPluginExtension)27 IPluginElement (org.eclipse.pde.core.plugin.IPluginElement)19 Test (org.junit.Test)12 CheckCatalog (com.avaloq.tools.ddk.check.check.CheckCatalog)4 IPluginObject (org.eclipse.pde.core.plugin.IPluginObject)3 QualifiedName (org.eclipse.xtext.naming.QualifiedName)3 XIssueExpression (com.avaloq.tools.ddk.check.check.XIssueExpression)1