use of org.eclipse.core.runtime.IExtensionPoint in project webtools.servertools by eclipse.
the class ExtensionPointUtil method getExtensionPoint.
private static IExtensionPoint getExtensionPoint(String id) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(id);
return extensionPoint;
}
use of org.eclipse.core.runtime.IExtensionPoint in project webtools.servertools by eclipse.
the class ExtensionPointUtil method getExtensions.
private static IExtension[] getExtensions(String extensionId) {
IExtensionPoint extensionPoint = getExtensionPoint(extensionId);
IExtension[] extensions = extensionPoint.getExtensions();
return extensions;
}
use of org.eclipse.core.runtime.IExtensionPoint in project eclipse.platform.runtime by eclipse.
the class EclipseTestHarnessApplication method findTestFor.
/**
* Finds, creates and returns a prototypical test object for the test with
* the given name/id. Returns <code>null</code> if no such test is found
* or the class defined by the test extension could not be found.
* In either failure case a message is output on the System console.
*/
protected Object findTestFor(String testName) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PI_TESTHARNESS, PT_TESTS);
IConfigurationElement[] elements = point.getConfigurationElements();
for (IConfigurationElement element : elements) {
if (element.getName().equals("test")) {
String id = element.getAttribute("id");
if (id != null && id.equals(testName)) {
try {
return element.createExecutableExtension("run");
} catch (CoreException e) {
System.err.println("Could not instantiate test: " + testName);
e.printStackTrace();
return null;
}
}
}
}
System.out.println("Could not find test: " + testName);
return null;
}
use of org.eclipse.core.runtime.IExtensionPoint in project eclipse.platform.runtime by eclipse.
the class ContributorsTest method testByContributor.
/**
* bundleA, bundleB, and fragment on bundleA all use the same namespace. Verify that getting
* elements by contributor returns all elements from the contributor and only from that
* contributor.
*
* @throws IOException
* @throws BundleException
*/
public void testByContributor() throws IOException, BundleException {
Bundle bundleA = null;
Bundle bundleB = null;
Bundle fragment = null;
try {
bundleA = BundleTestingHelper.installBundle("0.1", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/A");
bundleB = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/B");
fragment = BundleTestingHelper.installBundle("0.2", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/elementsByContributor/Afragment");
BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] { bundleA, bundleB, fragment });
IExtensionRegistry registry = RegistryFactory.getRegistry();
// verify bundleA (bundle B is the same - will work if this works)
IContributor contributorA = ContributorFactoryOSGi.createContributor(bundleA);
IExtensionPoint[] extPointsA = registry.getExtensionPoints(contributorA);
assertNotNull(extPointsA);
assertTrue(extPointsA.length == 1);
assertTrue(extPointsA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.PointA"));
IExtension[] extsA = registry.getExtensions(contributorA);
assertNotNull(extsA);
assertTrue(extsA.length == 1);
assertTrue(extsA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.ExtensionA"));
// verify fragment
IContributor contributorAF = ContributorFactoryOSGi.createContributor(fragment);
IExtensionPoint[] extPointsFragmentA = registry.getExtensionPoints(contributorAF);
assertNotNull(extPointsFragmentA);
assertTrue(extPointsFragmentA.length == 1);
assertTrue(extPointsFragmentA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.PointFA"));
IExtension[] extsFragmentA = registry.getExtensions(contributorAF);
assertNotNull(extsFragmentA);
assertTrue(extsFragmentA.length == 1);
assertTrue(extsFragmentA[0].getUniqueIdentifier().equals("org.eclipse.test.registryByContrib.ExtensionFA"));
} finally {
if (bundleA != null)
bundleA.uninstall();
if (bundleB != null)
bundleB.uninstall();
if (fragment != null)
fragment.uninstall();
}
}
use of org.eclipse.core.runtime.IExtensionPoint in project mdw-designer by CenturyLinkCloud.
the class WorkflowProjectManager method getAllExtensions.
private List<ExtensionModule> getAllExtensions() {
if (allExtensions == null) {
allExtensions = new ArrayList<ExtensionModule>();
// read the plug-in extensions
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint("com.centurylink.mdw.designer.ui.extensionModules");
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
for (IConfigurationElement element : extension.getConfigurationElements()) {
try {
ExtensionModule module = (ExtensionModule) element.createExecutableExtension("class");
module.setId(element.getAttribute("id"));
module.setName(element.getAttribute("name"));
module.setDescription(element.getAttribute("description"));
// null
module.setVersion(element.getAttribute("version"));
// means
// MDW
// version
String requiredMdwVersion = element.getAttribute("requiredMdwVersion");
if (requiredMdwVersion != null)
// null
module.setRequiredMdwVersion(requiredMdwVersion);
// means
// any
// >=
// 5.1
allExtensions.add(module);
} catch (Exception ex) {
PluginMessages.log("Unable to load MDW Extension for element: " + element);
PluginMessages.log(ex);
}
}
}
}
Collections.sort(allExtensions);
return allExtensions;
}
Aggregations