use of org.eclipse.pde.core.plugin.IPluginExtension 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));
}
use of org.eclipse.pde.core.plugin.IPluginExtension 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));
}
use of org.eclipse.pde.core.plugin.IPluginExtension in project dsl-devkit by dsldevkit.
the class AbstractCheckExtensionHelper method addExtensionToPluginBase.
@Override
public IPluginExtension addExtensionToPluginBase(final IPluginModelBase base, final CheckCatalog catalog, final ExtensionType type, final String extensionId) throws CoreException {
if (isExtensionEnabled(base, catalog, type, extensionId)) {
IPluginExtension newExtension = createExtension(catalog, extensionId, base);
base.getPluginBase().add(newExtension);
return newExtension;
}
return null;
}
use of org.eclipse.pde.core.plugin.IPluginExtension in project dsl-devkit by dsldevkit.
the class CheckExtensionHelperManager method updateExtensions.
/**
* Update check catalog extensions if necessary.
*
* @param catalog
* the catalog
* @param pluginModel
* the plugin model
* @param monitor
* the monitor
* @throws CoreException
* the core exception
*/
public void updateExtensions(final CheckCatalog catalog, final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
QualifiedName catalogName = nameProvider.apply(catalog);
Collection<IPluginExtension> catalogExtensions = findExtensions(pluginModel, catalogName, ExtensionType.ALL);
// Update extensions as appropriate
for (IPluginExtension extension : catalogExtensions) {
if (!hasGrammar(catalog)) {
// no extensions for Catalogs without valid grammar
pluginModel.getPluginBase().remove(extension);
// nothing more to do if no grammar is available
continue;
} else {
for (ICheckExtensionHelper helper : getExtensionHelpers()) {
// TODO getExtensionHelper using extension.getPoint() would make this more efficient
helper.updateExtension(catalog, extension);
}
}
}
}
use of org.eclipse.pde.core.plugin.IPluginExtension in project dsl-devkit by dsldevkit.
the class CheckExtensionHelperManager method addExtensions.
/**
* Add check catalog extensions if not already existing.
*
* @param catalog
* the catalog
* @param pluginModel
* the plugin model
* @param monitor
* the monitor
* @throws CoreException
* the core exception
*/
public void addExtensions(final CheckCatalog catalog, final IPluginModelBase pluginModel, final IProgressMonitor monitor) throws CoreException {
QualifiedName catalogName = nameProvider.apply(catalog);
Collection<IPluginExtension> catalogExtensions = findExtensions(pluginModel, catalogName, ExtensionType.ALL);
Iterable<ExtensionType> registeredExtensionTypes = findExtensionTypes(catalogExtensions);
if (hasGrammar(catalog)) {
for (ExtensionType type : ExtensionType.values()) {
ICheckExtensionHelper helper = getExtensionHelper(type);
if (helper == null) {
continue;
}
if (!Iterables.contains(registeredExtensionTypes, type)) {
helper.addExtensionToPluginBase(pluginModel, catalog, type, getExtensionId(nameProvider.apply(catalog), type));
}
}
}
}
Aggregations