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 bndtools by bndtools.
the class Activator method getReleaseParticipants.
public static List<IReleaseParticipant> getReleaseParticipants() {
//$NON-NLS-1$
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(PLUGIN_ID, "bndtoolsReleaseParticipant");
if (elements.length == 0) {
return Collections.emptyList();
}
List<IReleaseParticipant> participants = new ArrayList<IReleaseParticipant>();
for (IConfigurationElement element : elements) {
try {
//$NON-NLS-1$
IReleaseParticipant participant = (IReleaseParticipant) element.createExecutableExtension("class");
//$NON-NLS-1$
String strRanking = element.getAttribute("ranking");
int ranking = 0;
if (strRanking != null && strRanking.length() > 0) {
ranking = Integer.parseInt(strRanking);
}
participant.setRanking(ranking);
participants.add(participant);
} catch (CoreException e) {
logError(Messages.errorExecutingStartupParticipant, e);
}
}
return participants;
}
use of org.eclipse.core.runtime.IConfigurationElement in project che by eclipse.
the class ExtensionsRegistry method getDocumentSetupParticipants.
/**
* Returns the set of setup participants for the given file name or extension.
*
* @param nameOrExtension the name or extension to be used for lookup
* @return the sharable set of document setup participants
*/
protected List getDocumentSetupParticipants(String nameOrExtension) {
Set set = (Set) fSetupParticipantDescriptors.get(nameOrExtension);
if (set == null)
return null;
List participants = new ArrayList();
Iterator e = set.iterator();
while (e.hasNext()) {
IConfigurationElement entry = (IConfigurationElement) e.next();
Object participant = getExtension(entry, fSetupParticipants, IDocumentSetupParticipant.class);
if (participant != null)
participants.add(participant);
}
return participants;
}
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;
}
use of org.eclipse.core.runtime.IConfigurationElement in project translationstudio8 by heartsome.
the class SelfHelpDisplay method createHelpDisplay.
private static void createHelpDisplay() {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(HELP_DISPLAY_EXTENSION_ID);
if (point != null) {
IExtension[] extensions = point.getExtensions();
if (extensions.length != 0) {
// We need to pick up the non-default configuration
IConfigurationElement[] elements = extensions[0].getConfigurationElements();
if (elements.length == 0)
return;
IConfigurationElement displayElement = elements[0];
// Instantiate the help display
try {
helpDisplay = (AbstractHelpDisplay) (displayElement.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
} catch (CoreException e) {
HelpBasePlugin.logStatus(e.getStatus());
}
}
}
}
Aggregations