本文整理汇总了Java中org.eclipse.core.runtime.IExtensionPoint.getConfigurationElements方法的典型用法代码示例。如果您正苦于以下问题:Java IExtensionPoint.getConfigurationElements方法的具体用法?Java IExtensionPoint.getConfigurationElements怎么用?Java IExtensionPoint.getConfigurationElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IExtensionPoint
的用法示例。
在下文中一共展示了IExtensionPoint.getConfigurationElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfigurationElementsForCheckinPolicy
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Gets the configuration elements for the plugins that extend our checkin
* policy extension point.
*
* @return an array of configuration elements from plugins that support our
* extension point.
*/
private IConfigurationElement[] getConfigurationElementsForCheckinPolicy() {
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint extensionPoint = registry.getExtensionPoint(CHECKIN_POLICY_EXTENSION_POINT_NAME);
/*
* These extension points should always be available even if there are
* no contributions available (policy implementations), but it's good to
* check anyway.
*/
if (extensionPoint == null) {
final String messageFormat = "Couldn't load extension point {0}"; //$NON-NLS-1$
final String message = MessageFormat.format(messageFormat, CHECKIN_POLICY_EXTENSION_POINT_NAME);
log.error(message);
throw new PolicyLoaderException(message, null);
}
return extensionPoint.getConfigurationElements();
}
示例2: getListener
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Returns a {@link SingleListenerFacade} of the resource changing listeners
* by loading extension points and creating new listeners on demand.
* Subsequent calls will used cached listener data.
*
* @return A {@link SingleListenerFacade} of
* {@link ResourceChangingCommandListener}s.
*/
public static SingleListenerFacade getListener() {
synchronized (lock) {
if (listener == null) {
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);
final IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
final ListenerList list = new StandardListenerList();
for (int i = 0; i < elements.length; i++) {
try {
list.addListener(elements[i].createExecutableExtension("class")); //$NON-NLS-1$
} catch (final CoreException e) {
log.warn("Could not create " + EXTENSION_POINT_ID + " class", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
listener = new SingleListenerFacade(ResourceChangingCommandListener.class, list);
}
return listener;
}
}
示例3: addExtensionDebugLauncherMenus
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
private void addExtensionDebugLauncherMenus(IMenuManager menu, String url) {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IDebugLaunch.EXTENSION_ID);
IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
if (elements == null || elements.length == 0) {
return;
}
for (IConfigurationElement element : elements) {
try {
IDebugLaunch debugLaunch = (IDebugLaunch) element.createExecutableExtension("class");
String label = element.getAttribute("label");
addExtensionDebugLauncherMenu(menu, label, debugLaunch, url);
} catch (CoreException e) {
CorePluginLog.logError("Could not add launcher menu.", e);
}
}
}
示例4: launchExtension
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
private void launchExtension(String browserName, String url) throws CoreException {
if (browserName == null || browserName.isEmpty()) {
return;
}
// remove the id, which sets the default browser id
browserName = browserName.replace(BROWSER_NAME_EXTENSION, "");
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IDebugLaunch.EXTENSION_ID);
IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
if (elements == null || elements.length == 0) {
return;
}
for (IConfigurationElement element : elements) {
IDebugLaunch debugLaunch = (IDebugLaunch) element.createExecutableExtension("class");
String label = element.getAttribute("label");
if (debugLaunch != null && label != null && label.equals(browserName)) {
debugLaunch.launch(project, url, "debug");
}
}
}
示例5: getRefactoringService
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
private static IRefactoringService getRefactoringService() {
IExtensionPoint extp = Platform.getExtensionRegistry().getExtensionPoint( "org.eclipse.babel.core.refactoringService");
if (extp != null){
IConfigurationElement[] elements = extp.getConfigurationElements();
if (elements.length != 0) {
try {
return (IRefactoringService) elements[0]
.createExecutableExtension("class");
} catch (CoreException e) {
e.printStackTrace();
}
}
}
return new StandardRefactoring();
}
示例6: init
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Initialize the chain of plan edit approvers.
*/
private void init()
{
chain = new ArrayList<IPlanEditApprover>();
// construct the chain of approvers
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(APPROVER_EXTENSIONS);
IConfigurationElement[] extensions = extensionPoint.getConfigurationElements();
for (IConfigurationElement extension : extensions)
{
try {
IPlanEditApprover approver = (IPlanEditApprover) extension.createExecutableExtension("class");
chain.add(approver);
} catch (ThreadDeath td) {
throw td;
} catch (Throwable t) {
trace.error("Error during construction of PlanEditApprover chains: " + t, t);
}
}
}
示例7: getZoomOptionsFromExtensionPoint
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
private List<ZoomOption> getZoomOptionsFromExtensionPoint() {
List<ZoomOption> options = new ArrayList<ZoomOption>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint("gov.nasa.arc.spife.core.plan.editor.timeline.TimelineZoomOptions");
if (extensionPoint == null)
return options;
for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
ZoomOption zoomOption = parseZoomOption(element);
if (zoomOption == null) {
continue;
}
options.add(zoomOption);
String defaultString = element.getAttribute("default");
if (defaultString != null && defaultString.equals("true")) {
zoomLevel = options.size() - 1;
}
}
return options;
}
示例8: getRuntimePlanMergeColumnProviders
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
private static List<AbstractPlanMergeColumnProvider> getRuntimePlanMergeColumnProviders(EPlan plan) {
List<AbstractPlanMergeColumnProvider> providers = new ArrayList();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint("gov.nasa.ensemble.common.ClassRegistry");
for (IConfigurationElement lookupElement : extensionPoint.getConfigurationElements()) {
String className = lookupElement.getAttribute("class");
if (IRuntimeMergeColumnProvider.class.getName().equals(className)) {
for (IConfigurationElement implementationElement : lookupElement.getChildren("implementation")) {
Class implClass = ExtensionUtils.getClass(implementationElement, implementationElement.getAttribute("class"));
if (AbstractPlanMergeColumnProvider.class.isAssignableFrom(implClass)) {
try {
Constructor constructor = implClass.getConstructor(new Class[] { EPlan.class });
AbstractPlanMergeColumnProvider provider = (AbstractPlanMergeColumnProvider) constructor.newInstance(new Object[] { plan } );
providers.add(provider);
} catch (Exception e) {
LogUtil.error(e);
}
}
}
}
}
return providers;
}
示例9: removePopupMenus
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
public static void removePopupMenus(String[] popupIds) {
final java.util.List<IExtension> extensionsToRemove = new java.util.ArrayList<IExtension>();
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint point = registry.getExtensionPoint("org.eclipse.ui.popupMenus");
final List<String> popups = Arrays.asList(popupIds);
for (final IConfigurationElement elem : point.getConfigurationElements()) {
final String id = elem.getAttribute("id");
if (popups.contains(id))
extensionsToRemove.add(elem.getDeclaringExtension());
}
for (IExtension ext : extensionsToRemove) {
try {
registry.removeExtension(ext, ReflectionUtils.get(registry, "masterToken"));
} catch (Throwable t) {
// ignore
}
}
}
示例10: createFeatureProviders
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
protected Collection<FeatureProvider> createFeatureProviders() throws ResourceException {
IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(PLUGIN_ID, "features");
Collection<FeatureProvider> providers = new HashSet<FeatureProvider>();
providers.add(resourceProvider);
Set<Class<?>> knownFeatures = new HashSet<Class<?>>();
IConfigurationElement[] configurationElements = point.getConfigurationElements();
for (int i = 0; i < configurationElements.length; i++) {
try {
FeatureProvider currentFeatureProvider = (FeatureProvider) configurationElements[i]
.createExecutableExtension("provider");
if (!currentFeatureProvider.isEnabled())
continue;
Set<Class<?>> provided = new HashSet<Class<?>>(Arrays.asList(currentFeatureProvider
.getProvidedFeatureTypes()));
provided.retainAll(knownFeatures);
if (!provided.isEmpty())
throw new ResourceException("Provider " + currentFeatureProvider.getClass().getSimpleName()
+ " provides redundant features: " + provided);
knownFeatures.addAll(Arrays.asList(currentFeatureProvider.getProvidedFeatureTypes()));
providers.add(currentFeatureProvider);
} catch (CoreException e) {
throw new ResourceException(e);
}
}
return providers;
}
示例11: findConfigurationElementsByExtension
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Find Configuration Elements from Extension Registry by Extension ID
*
* @param extensionId
* @return
*/
public static IConfigurationElement[] findConfigurationElementsByExtension(
String extensionId )
{
if ( extensionId == null )
return null;
// find Extension Point entry
IExtensionRegistry registry = Platform.getExtensionRegistry( );
IExtensionPoint extensionPoint = registry.getExtensionPoint( extensionId );
if ( extensionPoint == null )
{
return null;
}
return extensionPoint.getConfigurationElements( );
}
示例12: findConfigurationElementsByExtension
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Find Configuration Elements from Extension Registry by Extension ID
*
* @param extensionId
* @return
*/
public static IConfigurationElement[] findConfigurationElementsByExtension(
String extensionId )
{
if ( extensionId == null )
return null;
// find Extension Point entry
IExtensionRegistry registry = Platform.getExtensionRegistry( );
IExtensionPoint extensionPoint = registry
.getExtensionPoint( extensionId );
if ( extensionPoint == null )
{
return null;
}
return extensionPoint.getConfigurationElements( );
}
示例13: getConfigurationElements
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Returns all configuration elements of appcontext extension point
*
* @return
*/
private static IConfigurationElement[] getConfigurationElements( )
{
// load extension point entry
IExtensionRegistry registry = Platform.getExtensionRegistry( );
IExtensionPoint extensionPoint = registry
.getExtensionPoint( APPCONTEXT_EXTENSION_ID );
if ( extensionPoint != null )
{
// get all configuration elements
return extensionPoint.getConfigurationElements( );
}
return null;
}
示例14: getStatusReporters
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
private final TFSResourceChangeStatusReporter[] getStatusReporters() {
synchronized (statusReporterLock) {
/*
* If we do not have any TFSResourceChangeStatusNotifiers, query
* extension points. This allows UI-aware plugins to provide
* enhanced reporting and prompting functionality.
*/
if (statusReporters == null) {
final List<TFSResourceChangeStatusReporter> reporterList =
new ArrayList<TFSResourceChangeStatusReporter>();
/* Add the logging provider (required) */
reporterList.add(new TFSResourceChangeLoggingStatusReporter());
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint extensionPoint = registry.getExtensionPoint(STATUS_REPORTERS_EXTENSION_POINT_ID);
final IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
try {
final TFSResourceChangeStatusReporter reporter =
(TFSResourceChangeStatusReporter) elements[i].createExecutableExtension("class"); //$NON-NLS-1$
if (reporter != null) {
reporterList.add(reporter);
}
} catch (final CoreException e) {
log.warn(MessageFormat.format(
"Could not create {0} class", //$NON-NLS-1$
STATUS_REPORTERS_EXTENSION_POINT_ID), e);
}
}
statusReporters = reporterList.toArray(new TFSResourceChangeStatusReporter[reporterList.size()]);
}
return statusReporters;
}
}
示例15: getPreferredWorkItemEditorID
import org.eclipse.core.runtime.IExtensionPoint; //导入方法依赖的package包/类
/**
* Retrieve the preferred editor ID from the preferences store and verify
* the editor is still contributed. The internal work item editor ID is
* returned as a fallback if there are any errors.
*
*
* @return The editor ID of the preferred editor or the internal work item
* editor if the preferred editor is no longer contributed.
*/
private static String getPreferredWorkItemEditorID() {
// Find the preferred work item editor.
/* @formatter:off
*
* We decided to always use the External Web Browser Editor for work items.
* S123 09/05/2017
*
* final IPreferenceStore preferences = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();
* final String prefValue = preferences.getString(UIPreferenceConstants.WORK_ITEM_EDITOR_ID);
*
* @formatter:on
*/
final String prefValue = EXTERNAL_WEB_ACCESS_EDITOR_ID;
// Check that the preferred work item editor still exists.
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint extensionPoint = registry.getExtensionPoint(WORK_ITEM_EDITORS_EXTENSION_POINT_ID);
final IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
// Check all contributed editors for the preference value.
for (final IConfigurationElement element : elements) {
final String id = element.getAttribute("id"); //$NON-NLS-1$
if (id.equals(prefValue)) {
// Use the preferred contributed editor.
return id;
}
}
// Default to embedded Web Access editor
return EXTERNAL_WEB_ACCESS_EDITOR_ID;
}