use of org.eclipse.core.runtime.IExtensionRegistry in project eclipse.platform.text by eclipse.
the class HyperlinkDetectorDescriptor method getContributedHyperlinkDetectors.
/**
* Returns descriptors for all hyperlink detector extensions.
*
* @return an array with the contributed hyperlink detectors
*/
public static HyperlinkDetectorDescriptor[] getContributedHyperlinkDetectors() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry.getConfigurationElementsFor(HYPERLINK_DETECTORS_EXTENSION_POINT);
HyperlinkDetectorDescriptor[] hyperlinkDetectorDescs = createDescriptors(elements);
return hyperlinkDetectorDescs;
}
use of org.eclipse.core.runtime.IExtensionRegistry in project eclipse.platform.text by eclipse.
the class HyperlinkDetectorTargetDescriptor method getContributedHyperlinkDetectorTargets.
/**
* Returns descriptors for all hyperlink detector extensions.
*
* @return an array with the contributed hyperlink detectors
*/
public static HyperlinkDetectorTargetDescriptor[] getContributedHyperlinkDetectorTargets() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry.getConfigurationElementsFor(HYPERLINK_DETECTOR_TARGETS_EXTENSION_POINT);
HyperlinkDetectorTargetDescriptor[] hyperlinkDetectorDescs = createDescriptors(elements);
return hyperlinkDetectorDescs;
}
use of org.eclipse.core.runtime.IExtensionRegistry in project eclipse.platform.text by eclipse.
the class RulerColumnRegistry method reload.
/**
* Reloads the extensions to the extension point.
* <p>
* This method can be called more than once in order to reload from
* a changed extension registry.
* </p>
*/
public void reload() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
List<IConfigurationElement> elements = new ArrayList<>(Arrays.asList(registry.getConfigurationElementsFor(TextEditorPlugin.PLUGIN_ID, EXTENSION_POINT)));
List<RulerColumnDescriptor> descriptors = new ArrayList<>();
Map<String, RulerColumnDescriptor> descriptorMap = new HashMap<>();
for (Iterator<IConfigurationElement> iter = elements.iterator(); iter.hasNext(); ) {
IConfigurationElement element = iter.next();
try {
RulerColumnDescriptor desc = new RulerColumnDescriptor(element, this);
String id = desc.getId();
if (descriptorMap.containsKey(id)) {
noteDuplicateId(desc);
continue;
}
descriptors.add(desc);
descriptorMap.put(id, desc);
} catch (InvalidRegistryObjectException x) {
/*
* Element is not valid any longer as the contributing plug-in was unloaded or for
* some other reason. Do not include the extension in the list and inform the user
* about it.
*/
noteInvalidExtension(element, x);
} catch (CoreException x) {
warnUser(x.getStatus());
}
}
sort(descriptors);
synchronized (this) {
fDescriptors = Collections.unmodifiableList(descriptors);
fDescriptorMap = Collections.unmodifiableMap(descriptorMap);
}
}
use of org.eclipse.core.runtime.IExtensionRegistry in project eclipse.platform.text by eclipse.
the class QuickDiffExtensionsRegistry method reloadExtensions.
/**
* Reads all extensions.
* <p>
* This method can be called more than once in
* order to reload from a changed extension registry.
* </p>
*/
public synchronized void reloadExtensions() {
fDefaultDescriptor = null;
IExtensionRegistry registry = Platform.getExtensionRegistry();
List<ReferenceProviderDescriptor> list = new ArrayList<>();
IConfigurationElement[] elements = registry.getConfigurationElementsFor(TextEditorPlugin.PLUGIN_ID, TextEditorPlugin.REFERENCE_PROVIDER_EXTENSION_POINT);
for (int i = 0; i < elements.length; i++) {
ReferenceProviderDescriptor desc = new ReferenceProviderDescriptor(elements[i]);
if (// $NON-NLS-1$
desc.getId().equals("org.eclipse.ui.internal.editors.quickdiff.LastSaveReferenceProvider"))
fDefaultDescriptor = desc;
list.add(desc);
}
// make sure the default is the first one in the list
if (fDefaultDescriptor != null) {
list.remove(fDefaultDescriptor);
list.add(0, fDefaultDescriptor);
}
fDescriptors = Collections.unmodifiableList(list);
}
use of org.eclipse.core.runtime.IExtensionRegistry in project linuxtools by eclipse.
the class STBinutilsFactoryManager method getBinutilsFactoryImpl.
/**
* Try to find an extension point matching the given cpu; Then test availability of the tools. If no match, return
* default binutils factory
* @param cpu The cpu identifier.
* @return The factory.
*/
private static ISTBinutilsFactory getBinutilsFactoryImpl(String cpu) {
try {
IExtensionRegistry reg = Platform.getExtensionRegistry();
// $NON-NLS-1$
IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.linuxtools.binutils.crossCompilerBinutils");
IExtension[] exts = ep.getExtensions();
for (IExtension extension : exts) {
IConfigurationElement[] elems = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : elems) {
// $NON-NLS-1$
String s = configurationElement.getAttribute("CPU");
if (cpu.equals(s)) {
ISTBinutilsFactory factory = (ISTBinutilsFactory) configurationElement.createExecutableExtension(// $NON-NLS-1$
"binutilsFactory");
if (factory.testAvailability())
return factory;
}
}
}
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
if (defaultFactory == null) {
defaultFactory = new DefaultBinutilsFactory();
}
return defaultFactory;
}
Aggregations