use of org.eclipse.core.runtime.IConfigurationElement in project bndtools by bndtools.
the class PluginClassSelectionPage method setSelectedElement.
public void setSelectedElement(IConfigurationElement selectedElement) {
IConfigurationElement old = this.selectedElement;
this.selectedElement = selectedElement;
if (Display.getCurrent() != null && table != null && !table.isDisposed()) {
if (!programmaticChange) {
try {
programmaticChange = true;
if (selectedElement == null)
viewer.setSelection(StructuredSelection.EMPTY);
else
viewer.setSelection(new StructuredSelection(selectedElement), true);
} finally {
programmaticChange = false;
}
}
// updateDescription();
validate();
getContainer().updateButtons();
}
propSupport.firePropertyChange("selectedElement", old, selectedElement);
}
use of org.eclipse.core.runtime.IConfigurationElement in project bndtools by bndtools.
the class PluginClassSorter method compare.
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
IConfigurationElement elem1 = (IConfigurationElement) e1;
IConfigurationElement elem2 = (IConfigurationElement) e2;
// Sort undeprecated plugins before deprecated ones.
int result = sortDeprecation(elem1, elem2);
if (result != 0)
return result;
// Sort by rank
result = sortByRank(elem1, elem2);
if (result != 0)
return result;
// Finally sort on name
return sortName(elem1, elem2);
}
use of org.eclipse.core.runtime.IConfigurationElement in project yamcs-studio by yamcs.
the class SimplePVLayer method createPVFactory.
private static AbstractPVFactory createPVFactory(String pvFactoryID) throws CoreException {
IExtensionRegistry extReg = Platform.getExtensionRegistry();
IConfigurationElement[] confElements = extReg.getConfigurationElementsFor(EXTPOINT_PVFACTORY);
for (IConfigurationElement element : confElements) {
String name = element.getAttribute("id");
if (name.equals(pvFactoryID)) {
Object object = element.createExecutableExtension("class");
if (object instanceof AbstractPVFactory) {
return (AbstractPVFactory) object;
}
}
}
return null;
}
use of org.eclipse.core.runtime.IConfigurationElement in project yamcs-studio by yamcs.
the class WidgetsService method loadAllWidgets.
/**
* Load all widgets information from extensions.
*/
private void loadAllWidgets() {
IExtensionRegistry extReg = Platform.getExtensionRegistry();
IConfigurationElement[] confElements = extReg.getConfigurationElementsFor(OPIBuilderPlugin.EXTPOINT_WIDGET);
List<IConfigurationElement> boyElements = new LinkedList<IConfigurationElement>();
List<IConfigurationElement> otherElements = new LinkedList<IConfigurationElement>();
// Sort elements. opibuilder.widgets should always appear first.
for (IConfigurationElement element : confElements) {
if (element.getContributor().getName().equals(BOY_WIDGETS_PLUGIN_NAME))
boyElements.add(element);
else
otherElements.add(element);
}
boyElements.addAll(otherElements);
for (IConfigurationElement element : boyElements) {
// $NON-NLS-1$
String typeId = element.getAttribute("typeId");
// $NON-NLS-1$
String name = element.getAttribute("name");
// $NON-NLS-1$
String icon = element.getAttribute("icon");
// //$NON-NLS-1$
String onlineHelpHtml = element.getAttribute("onlineHelpHtml");
String pluginId = element.getDeclaringExtension().getNamespaceIdentifier();
String description = element.getAttribute("description");
if (description == null || description.trim().length() == 0) {
description = "";
}
String category = element.getAttribute("category");
if (category == null || category.trim().length() == 0) {
category = DEFAULT_CATEGORY;
}
if (typeId != null) {
List<String> list = allCategoriesMap.get(category);
if (list == null) {
list = new ArrayList<String>();
allCategoriesMap.put(category, list);
}
// ensure no duplicates in the widgets palette
if (!list.contains(typeId))
list.add(typeId);
allWidgetDescriptorsMap.put(typeId, new WidgetDescriptor(element, typeId, name, description, icon, category, pluginId, onlineHelpHtml));
}
}
// sort the widget in the categories
// for(List<String> list : allCategoriesMap.values())
// Collections.sort(list);
}
use of org.eclipse.core.runtime.IConfigurationElement in project flux by eclipse.
the class ContributionContextTypeRegistry method createContextType.
/**
* Tries to create a context type given an id. Contributions to the
* <code>org.eclipse.ui.editors.templates</code> extension point are
* searched for the given identifier and the specified context type
* instantiated if it is found. Any contributed
* {@link org.eclipse.jface.text.templates.TemplateVariableResolver}s
* are also instantiated and added to the context type.
*
* @param id the id for the context type as specified in XML
* @return the instantiated and configured context type, or
* <code>null</code> if it is not found or cannot be instantiated
*/
public static TemplateContextType createContextType(String id) {
Assert.isNotNull(id);
IConfigurationElement[] extensions = getTemplateExtensions();
TemplateContextType type;
try {
type = createContextType(extensions, id);
if (type != null) {
TemplateVariableResolver[] resolvers = createResolvers(extensions, id);
for (int i = 0; i < resolvers.length; i++) type.addResolver(resolvers[i]);
}
} catch (CoreException e) {
//EditorsPlugin.log(e);
type = null;
}
return type;
}
Aggregations