Search in sources :

Example 21 with IPluginElement

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

Example 22 with IPluginElement

use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.

the class CheckContextsExtensionTest method testIsExtensionUpdateRequiredTrue.

/**
 * Test if isExtensionUpdateRequired is true, if the file path attribute is not as expected.
 *
 * @throws CoreException
 *           the core exception
 */
@Test
public void testIsExtensionUpdateRequiredTrue() throws CoreException {
    IPluginExtension extension = createErroneousExtension();
    Iterable<IPluginElement> elements = Iterables.filter(Lists.newArrayList(extension.getChildren()), IPluginElement.class);
    assertTrue("Extension update is required", contextsUtil.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 23 with IPluginElement

use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.

the class CheckTocExtensionTest method testIsExtensionUpdateRequiredTrue.

/**
 * Tests if isExtensionUpdateRequired returns true if only an erroneous extension exists for the check catalog.
 *
 * @throws CoreException
 *           the core exception
 */
@Test
public void testIsExtensionUpdateRequiredTrue() throws CoreException {
    IPluginExtension extension = createErroneousTocExtension();
    Iterable<IPluginElement> elements = Iterables.filter(Lists.newArrayList(extension.getChildren()), IPluginElement.class);
    assertTrue("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 24 with IPluginElement

use of org.eclipse.pde.core.plugin.IPluginElement in project dsl-devkit by dsldevkit.

the class CheckMarkerHelpExtensionHelper method createMarkerHelpElement.

/**
 * Creates the marker help element.
 *
 * @param extension
 *          the extension
 * @param check
 *          the check
 * @param contextId
 *          the context id
 * @return the i plugin element
 * @throws CoreException
 *           the core exception
 */
private IPluginElement createMarkerHelpElement(final IPluginExtension extension, final Check check, final String contextId) throws CoreException {
    IPluginElement element = extension.getModel().getFactory().createElement(extension);
    element.setName(MARKERHELP_ELEMENT);
    element.setAttribute(CONTEXT_ID_ATTRIBUTE_TAG, contextId);
    element.setAttribute(MARKERTYPE_ATTRIBUTE_TAG, getCheckType(check));
    return element;
}
Also used : IPluginElement(org.eclipse.pde.core.plugin.IPluginElement)

Aggregations

IPluginElement (org.eclipse.pde.core.plugin.IPluginElement)24 IPluginExtension (org.eclipse.pde.core.plugin.IPluginExtension)19 Test (org.junit.Test)11 CheckCatalog (com.avaloq.tools.ddk.check.check.CheckCatalog)4 IPluginObject (org.eclipse.pde.core.plugin.IPluginObject)4 Check (com.avaloq.tools.ddk.check.check.Check)3 IQualifiedNameProvider (org.eclipse.xtext.naming.IQualifiedNameProvider)2 XIssueExpression (com.avaloq.tools.ddk.check.check.XIssueExpression)1 NoSuchElementException (java.util.NoSuchElementException)1 IPluginAttribute (org.eclipse.pde.core.plugin.IPluginAttribute)1 Pair (org.eclipse.xtext.util.Pair)1