本文整理匯總了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;
}