本文整理匯總了Java中org.eclipse.core.runtime.IConfigurationElement類的典型用法代碼示例。如果您正苦於以下問題:Java IConfigurationElement類的具體用法?Java IConfigurationElement怎麽用?Java IConfigurationElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IConfigurationElement類屬於org.eclipse.core.runtime包,在下文中一共展示了IConfigurationElement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initialize
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Reads information from extensions defined in plugin.xml files.
*/
private void initialize() {
if (isInitialized)
throw new IllegalStateException("may invoke method initialize() only once");
isInitialized = true;
final IExtensionRegistry registry = RegistryFactory.getRegistry();
if (registry != null) {
final IConfigurationElement[] configElems = registry
.getConfigurationElementsFor(TESTERS_EXTENSION_POINT_ID);
for (IConfigurationElement elem : configElems) {
try {
final EclipseTesterDescriptor descriptor = new EclipseTesterDescriptor(elem);
injector.injectMembers(descriptor);
register(descriptor);
} catch (Exception ex) {
log.error("Error while reading extensions for extension point " + TESTERS_EXTENSION_POINT_ID, ex);
}
}
}
}
示例2: initialize
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Reads information from extensions defined in plugin.xml files.
*/
private void initialize() {
if (isInitialized)
throw new IllegalStateException("may invoke method initialize() only once");
isInitialized = true;
final IExtensionRegistry registry = RegistryFactory.getRegistry();
if (registry != null) {
final IConfigurationElement[] configElems = registry
.getConfigurationElementsFor(RUNNERS_EXTENSION_POINT_ID);
for (IConfigurationElement elem : configElems) {
try {
final EclipseRunnerDescriptor descriptor = new EclipseRunnerDescriptor(elem);
injector.injectMembers(descriptor);
register(descriptor);
} catch (Exception ex) {
log.error("Error while reading extensions for extension point " + RUNNERS_EXTENSION_POINT_ID, ex);
}
}
}
}
示例3: initContributions
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
private Supplier<Map<String, WorkingSetManager>> initContributions() {
return memoize(() -> {
if (!isRunning()) {
return emptyMap();
}
final Builder<String, WorkingSetManager> builder = ImmutableMap.builder();
final IConfigurationElement[] elements = getExtensionRegistry()
.getConfigurationElementsFor(EXTENSION_POINT_ID);
for (final IConfigurationElement element : elements) {
try {
final WorkingSetManager manager = (WorkingSetManager) element
.createExecutableExtension(CLASS_ATTRIBUTE);
injector.injectMembers(manager);
builder.put(manager.getId(), manager);
} catch (final CoreException e) {
LOGGER.error("Error while trying to instantiate working set manager.", e);
}
}
return builder.build();
});
}
示例4: collectRegisteredProviders
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
private static Builder<DefaultQuickfixProvider> collectRegisteredProviders() {
final Builder<DefaultQuickfixProvider> builder = ImmutableList.<DefaultQuickfixProvider> builder();
if (Platform.isRunning()) {
final IConfigurationElement[] elements = getQuickfixSupplierElements();
for (final IConfigurationElement element : elements) {
try {
final Object extension = element.createExecutableExtension(CLAZZ_PROPERTY_NAME);
if (extension instanceof QuickfixProviderSupplier) {
builder.add(((QuickfixProviderSupplier) extension).get());
}
} catch (final CoreException e) {
LOGGER.error("Error while instantiating quickfix provider supplier instance.", e);
}
}
}
return builder;
}
示例5: execute
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Execute.
* @param registry the registry
*/
@Execute
public void execute() {
System.out.println("Start evaluating available extensions");
IConfigurationElement[] config = this.getExtensionRegistry().getConfigurationElementsFor(PLUGIN_ID);
try {
for (IConfigurationElement e : config) {
System.out.println("Evaluating extension " + e.getName());
final Object object = e.createExecutableExtension("class");
if (object instanceof PlugIn) {
executeExtension(object);
}
}
} catch (CoreException ex) {
System.err.println(ex.getMessage());
}
}
示例6: retrieveLocators
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Retrieve all the locators registered with the extension point, and additionally store them in a cache.
*
* @return All locators registered with the extension point.
*/
public List<ILocator> retrieveLocators() {
if (locators == null) {
IExtensionRegistry reg = Platform.getExtensionRegistry();
IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.gemoc.dsl.debug.locator");
IExtension[] extensions = ep.getExtensions();
ArrayList<ILocator> contributors = new ArrayList<ILocator>();
for (int i = 0; i < extensions.length; i++) {
IExtension ext = extensions[i];
IConfigurationElement[] ce = ext.getConfigurationElements();
for (int j = 0; j < ce.length; j++) {
ILocator locator;
try {
locator = (ILocator)ce[j].createExecutableExtension("class");
contributors.add(locator);
} catch (CoreException e) {
e.printStackTrace();
}
}
}
locators = contributors;
}
return locators;
}
示例7: getMelangeBundle
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Return a bundle with a .melange declaring 'language'
*/
public static Bundle getMelangeBundle(String languageName){
IConfigurationElement[] melangeLanguages = Platform
.getExtensionRegistry().getConfigurationElementsFor(
"fr.inria.diverse.melange.language");
String melangeBundleName = "";
for (IConfigurationElement lang : melangeLanguages) {
if(lang.getAttribute("id").equals(languageName)){
melangeBundleName = lang.getContributor().getName();
return Platform.getBundle(melangeBundleName);
}
}
return null;
}
示例8: getModelTypes
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Return all ModelTypes matching 'language'
*/
public static List<String> getModelTypes(String language){
List<String> modelTypeNames = new ArrayList<String>();
IConfigurationElement[] melangeLanguages = Platform
.getExtensionRegistry().getConfigurationElementsFor(
"fr.inria.diverse.melange.language");
for (IConfigurationElement lang : melangeLanguages) {
if (lang.getAttribute("id").equals(language)) {
IConfigurationElement[] adapters = lang
.getChildren("adapter");
for (IConfigurationElement adapter : adapters) {
modelTypeNames.add(adapter
.getAttribute("modeltypeId"));
}
}
}
return modelTypeNames;
}
示例9: internal_getSpecifications
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
protected Collection<T> internal_getSpecifications()
{
IConfigurationElement[] confElements = getExtensions(getExtensionPointName());
ArrayList<T> specs = new ArrayList<T>();
for (int i = 0; i < confElements.length; i++)
{
try
{
T s = createInstance();
s.setSpecification(confElements[i]);
specs.add(s);
}
catch (InstantiationException | IllegalAccessException e)
{
// silent catch
e.printStackTrace();
//throw new ExtensionPointException(e.getMessage(), e);
}
}
return specs;
}
示例10: isTargetMatch
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
private boolean isTargetMatch ( final Class<? extends EObject> clazz, final IConfigurationElement ele )
{
if ( isTargetClass ( ele.getAttribute ( "filterClass" ), ele.getContributor (), clazz ) )
{
return true;
}
for ( final IConfigurationElement child : ele.getChildren ( "filterClass" ) )
{
if ( isTargetClass ( child.getAttribute ( "class" ), ele.getContributor (), clazz ) )
{
return true;
}
}
return false;
}
示例11: createConnection
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
public static ConnectionService createConnection ( final ConnectionInformation info, final Integer autoReconnectDelay, final boolean lazyActivation )
{
if ( info == null )
{
return null;
}
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( Activator.EXTP_CONNECTON_CREATOR ) )
{
final String interfaceName = ele.getAttribute ( "interface" );
final String driverName = ele.getAttribute ( "driver" );
if ( interfaceName == null || driverName == null )
{
continue;
}
if ( interfaceName.equals ( info.getInterface () ) && driverName.equals ( info.getDriver () ) )
{
final ConnectionService service = createConnection ( info, ele, autoReconnectDelay, lazyActivation );
if ( service != null )
{
return service;
}
}
}
return null;
}
示例12: initialize
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
/**
* Initializes the extensions map.
*
* @throws CoreException
* if the registry cannot be initialized
*/
public void initialize() {
try {
if (Platform.isRunning()) {
registry.clear();
final IExtension[] extensions = Platform.getExtensionRegistry()
.getExtensionPoint(OCCIE_EXTENSION_POINT).getExtensions();
for (int i = 0; i < extensions.length; i++) {
final IConfigurationElement[] configElements = extensions[i]
.getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
String scheme = configElements[j].getAttribute("scheme"); //$NON-NLS-1$
String uri = "platform:/plugin/" + extensions[i].getContributor().getName() + "/" + configElements[j].getAttribute("file"); //$NON-NLS-1$
registerExtension(scheme, uri);
}
}
}
} catch(NoClassDefFoundError ncdfe) {
LOGGER.info(" Running out of an Eclipse Platform...");
}
}
示例13: findFactory
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
public static KeyProviderFactory findFactory ( final String id )
{
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_KEY_PROVIDER_FACTORY ) )
{
if ( !ELE_FACTORY.equals ( ele.getName () ) )
{
continue;
}
try
{
return (KeyProviderFactory)ele.createExecutableExtension ( ATTR_CLASS );
}
catch ( final CoreException e )
{
StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
}
}
return null;
}
示例14: createFactories
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
public static Collection<KeyProviderFactory> createFactories ()
{
final Collection<KeyProviderFactory> result = new LinkedList<KeyProviderFactory> ();
for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_KEY_PROVIDER_FACTORY ) )
{
if ( !ELE_FACTORY.equals ( ele.getName () ) )
{
continue;
}
try
{
result.add ( (KeyProviderFactory)ele.createExecutableExtension ( ATTR_CLASS ) );
}
catch ( final CoreException e )
{
StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
}
}
return result;
}
示例15: getExtensionDescriptors
import org.eclipse.core.runtime.IConfigurationElement; //導入依賴的package包/類
public static List<ExtensionDescriptor> getExtensionDescriptors ()
{
final List<ExtensionDescriptor> result = new LinkedList<ExtensionDescriptor> ();
for ( final IConfigurationElement element : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_VIEWER ) )
{
if ( !"viewerExtension".equals ( element.getName () ) )
{
continue;
}
result.add ( new ExtensionDescriptor ( element ) );
}
return result;
}