当前位置: 首页>>代码示例>>Java>>正文


Java IConfigurationElement.createExecutableExtension方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.IConfigurationElement.createExecutableExtension方法的典型用法代码示例。如果您正苦于以下问题:Java IConfigurationElement.createExecutableExtension方法的具体用法?Java IConfigurationElement.createExecutableExtension怎么用?Java IConfigurationElement.createExecutableExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.IConfigurationElement的用法示例。


在下文中一共展示了IConfigurationElement.createExecutableExtension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:DelegatingQuickfixProvider.java

示例2: 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());
       }
   }
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:24,代码来源:EvaluateContributionsHandler.java

示例3: createConnection

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
 * Create a new connection from the connection created defined in the element
 * 
 * @param connectionInformation
 *            the connection information
 * @param ele
 *            the configuration element
 * @param autoReconnectDelay
 *            the automatic reconnect delay or <code>null</code> if not automatic reconnect should be used
 * @return a new {@link ConnectionService} or <code>null</code>
 */
private static ConnectionService createConnection ( final ConnectionInformation connectionInformation, final IConfigurationElement ele, final Integer autoReconnectDelay, final boolean lazyActivation )
{
    try
    {
        final Object o = ele.createExecutableExtension ( "class" );
        if ( ! ( o instanceof ConnectionCreator ) )
        {
            return null;
        }

        return ( (ConnectionCreator)o ).createConnection ( connectionInformation, autoReconnectDelay, lazyActivation );
    }
    catch ( final CoreException e )
    {
        Activator.getDefault ().getLog ().log ( e.getStatus () );
        return null;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:30,代码来源:ConnectionCreatorHelper.java

示例4: 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;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:Helper.java

示例5: create

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private StyleGenerator create ( final IConfigurationElement ele )
{
    if ( ele == null )
    {
        return null;
    }

    try
    {
        final Object o = ele.createExecutableExtension ( Messages.PreferenceSelectorStyleGenerator_2 );
        if ( o instanceof StyleGenerator )
        {
            return (StyleGenerator)o;
        }
        logger.warn ( "Class referenced in 'generatorClass' did not implement {}", StyleGenerator.class ); //$NON-NLS-1$
        return null;
    }
    catch ( final CoreException e )
    {
        StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        return null;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:PreferenceSelectorStyleGenerator.java

示例6: buildCache

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private void buildCache ()
{
    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXPT_DANGLING_RESOLVER ) )
    {
        if ( !ele.getName ().equals ( ELE_RESOLVER ) )
        {
            continue;
        }
        try
        {
            final DanglingReferenceResolver resolver = (DanglingReferenceResolver)ele.createExecutableExtension ( ATTR_CLASS );
            logger.debug ( "Adding resolver: {}", resolver ); //$NON-NLS-1$
            this.cache.add ( resolver );
        }
        catch ( final Exception e )
        {
            Activator.getDefault ().getLog ().log ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, "Failed to create resolver instance", e ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:ForwardingDanglingReferenceResolver.java

示例7: initialize

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
 * Read 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 IExtension[] extensions = registry.getExtensionPoint(SUBGENERATORS_EXTENSIONS_POINT_ID)
				.getExtensions();
		for (IExtension extension : extensions) {
			final IConfigurationElement[] configElems = extension.getConfigurationElements();
			for (IConfigurationElement elem : configElems) {
				try {
					String fileExtensions = elem.getAttribute(ATT_FILE_EXTENSIONS);
					List<String> fileExtensionList = Splitter.on(',').trimResults().omitEmptyStrings()
							.splitToList(fileExtensions);
					ISubGenerator generator = (ISubGenerator) elem
							.createExecutableExtension(ATT_SUB_GENERATOR_CLASS);
					for (String fileExtension : fileExtensionList) {
						register(generator, fileExtension);
					}

				} catch (Exception ex) {
					LOGGER.error(
							"Error while reading extensions for extension point "
									+ SUBGENERATORS_EXTENSIONS_POINT_ID,
							ex);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:37,代码来源:SubGeneratorRegistry.java

示例8: editSelection

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
 * Edits a not run yet selection
 */
@SuppressWarnings({"squid:S3776", "squid:S135"})
protected void editSelection() {

	for (StatusBean bean : getSelection()) {
		if (bean.getStatus()!=org.eclipse.scanning.api.event.status.Status.SUBMITTED) {
			MessageDialog.openConfirm(getSite().getShell(), "Cannot Edit '"+bean.getName()+"'", "The run '"+bean.getName()+"' cannot be edited because it is not waiting to run.");
			continue;
		}

		try {
			final IConfigurationElement[] c = Platform.getExtensionRegistry().getConfigurationElementsFor(MODIFY_HANDLER_EXTENSION_POINT_ID);
			if (c!=null) {
				for (IConfigurationElement i : c) {
					final IModifyHandler handler = (IModifyHandler)i.createExecutableExtension("class");
					handler.init(service, createConsumerConfiguration());
					if (handler.isHandled(bean)) {
						boolean ok = handler.modify(bean);
						if (ok) continue;
					}
				}
			}
		} catch (Exception ne) {
			final String err = "Cannot modify "+bean.getRunDirectory()+" normally.\n\nPlease contact your support representative.";
			logger.error(err, ne);
			ErrorDialog.openError(getSite().getShell(), "Internal Error", err, new Status(IStatus.ERROR, Activator.PLUGIN_ID, ne.getMessage()));
			continue;
		}
		MessageDialog.openConfirm(getSite().getShell(), "Cannot Edit '"+bean.getName()+"'", "There are no editers registered for '"+bean.getName()+"'\n\nPlease contact your support representative.");
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:34,代码来源:StatusQueueView.java

示例9: rerunSelection

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
@SuppressWarnings("squid:S3776")
protected void rerunSelection() {

	for (StatusBean bean : getSelection()) {
		try {
			final IConfigurationElement[] c = Platform.getExtensionRegistry().getConfigurationElementsFor(RERUN_HANDLER_EXTENSION_POINT_ID);
			if (c!=null) {
				for (IConfigurationElement i : c) {
					final IRerunHandler handler = (IRerunHandler)i.createExecutableExtension("class");
					handler.init(service, createConsumerConfiguration());
					if (handler.isHandled(bean)) {
						final StatusBean copy = bean.getClass().newInstance();
						copy.merge(bean);
						copy.setUniqueId(UUID.randomUUID().toString());
						copy.setStatus(org.eclipse.scanning.api.event.status.Status.SUBMITTED);
						copy.setSubmissionTime(System.currentTimeMillis());
						boolean ok = handler.run(copy);
						if (ok) continue;
					}
				}
			}
		} catch (Exception ne) {
			final String err = "Cannot rerun "+bean.getRunDirectory()+" normally.\n\nPlease contact your support representative.";
			logger.error(err, ne);
			ErrorDialog.openError(getSite().getShell(), "Internal Error", err, new Status(IStatus.ERROR, Activator.PLUGIN_ID, ne.getMessage()));
			continue;
		}
		// If we have not already handled this rerun, it is possible to call a generic one.
		rerun(bean);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:32,代码来源:StatusQueueView.java

示例10: createFactory

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public static ViewElementFactory createFactory ( final EObject modelObject ) throws CoreException
{
    if ( modelObject == null )
    {
        return null;
    }

    final String requestedClass = modelObject.eClass ().getInstanceClassName ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_VIEW_ELEMENT_FACTORY ) )
    {
        if ( !"factory".equals ( ele.getName () ) )
        {
            continue;
        }

        for ( final IConfigurationElement child : ele.getChildren ( "supports" ) )
        {
            final String modelClass = child.getAttribute ( "modelClass" );
            if ( modelClass == null || modelClass.isEmpty () )
            {
                continue;
            }

            if ( modelClass.equals ( requestedClass ) )
            {
                return (ViewElementFactory)ele.createExecutableExtension ( "class" );
            }
        }

    }
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:34,代码来源:Activator.java

示例11: createDetailView

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private static DetailView createDetailView ( final String id, final IConfigurationElement ele, final Map<String, String> properties ) throws CoreException
{
    final Object o = ele.createExecutableExtension ( "class" ); //$NON-NLS-1$
    if ( o instanceof DetailView )
    {
        final DetailView view = (DetailView)o;
        return view;
    }
    else
    {
        logger.warn ( "View created object of type: " + o ); //$NON-NLS-1$
        return null;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:15,代码来源:DetailViewManager.java

示例12: createProcessor

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private NodeElementProcessor createProcessor ( final EObject element, final World world, final ApplicationNode applicationNode ) throws CoreException
{
    final EAnnotation an = element.eClass ().getEAnnotation ( "http://eclipse.org/SCADA/Configuration/World" );

    if ( an != null && Boolean.parseBoolean ( an.getDetails ().get ( "ignore" ) ) )
    {
        return new NodeElementProcessor () {

            @Override
            public void process ( final String phase, final IFolder baseDir, final IProgressMonitor monitor, final Map<String, String> properties ) throws Exception
            {
                // no-op
            }
        };
    }

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( Activator.EXTP_GENERATOR ) )
    {
        if ( !ele.getName ().equals ( ELE_NODE_ELEMENT_PROCESSOR ) )
        {
            continue;
        }
        if ( isMatch ( Activator.getDefault ().getBundle ().getBundleContext (), ele, element ) )
        {
            final NodeElementProcessorFactory factory = (NodeElementProcessorFactory)ele.createExecutableExtension ( "factoryClass" );
            return factory.createProcessor ( element, world, applicationNode );
        }
    }

    throw new IllegalStateException ( String.format ( "No processor found for element: %s", element ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:32,代码来源:WorldRunner.java

示例13: createFactories

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
protected static Map<String, DriverFactory> createFactories ()
{
    final Map<String, DriverFactory> result = new HashMap<String, DriverFactory> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_DRIVER ) )
    {
        if ( !ELE_DRIVER_FACTORY.equals ( ele.getName () ) )
        {
            continue;
        }
        final String typeId = ele.getAttribute ( "typeId" );

        logger.debug ( "Found driver factory for type: {}", typeId );

        try
        {
            final DriverFactory factory = (DriverFactory)ele.createExecutableExtension ( "factoryClass" );
            if ( typeId != null && factory != null )
            {
                result.put ( typeId, factory );
            }
        }
        catch ( final CoreException e )
        {
            getDefault ().getLog ().log ( e.getStatus () );
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:31,代码来源:Activator.java

示例14: loadCodeLensProvidersFromExtension

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
 * Add the SourceMap language supports.
 */
private synchronized void loadCodeLensProvidersFromExtension(IConfigurationElement[] cf) {
	for (IConfigurationElement ce : cf) {
		try {
			ICodeLensControllerFactory factory = (ICodeLensControllerFactory) ce.createExecutableExtension("class");
			factories.add(factory);
		} catch (Throwable e) {
			CodeLensEditorPlugin.log(e);
		}
	}
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:14,代码来源:CodeLensControllerRegistry.java

示例15: runElement

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
protected boolean runElement ( final EObject element, final DiagnosticChain diagnostics, final Map<Object, Object> context )
{
    if ( element == null )
    {
        return true;
    }

    if ( isCached ( element, context ) )
    {
        return true;
    }

    final String packageUri = element.eClass ().getEPackage ().getNsURI ();
    if ( packageUri == null )
    {
        return false;
    }

    boolean result = true;

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.utils.ecore.validation.handler" ) )
    {
        if ( !ele.getName ().equals ( "validationContext" ) )
        {
            continue;
        }

        final String uri = ele.getAttribute ( "packageUri" );
        if ( !packageUri.equals ( uri ) )
        {
            continue;
        }

        final String contextId = ele.getAttribute ( "contextId" );

        for ( final IConfigurationElement child : ele.getChildren ( "validator" ) )
        {
            if ( !child.getName ().equals ( "validator" ) )
            {
                continue;
            }

            if ( !isTargetMatch ( element.getClass (), child ) )
            {
                continue;
            }

            try
            {
                final Object o = child.createExecutableExtension ( "class" );
                if ( o instanceof Validator )
                {
                    final Validator v = (Validator)o;
                    final ValidationContextImpl validationContext = new ValidationContextImpl ( contextId, element );
                    v.validate ( validationContext );
                    if ( !validationContext.apply ( diagnostics ) )
                    {
                        result = false;
                    }
                }
            }
            catch ( final CoreException e )
            {
                ValidationPlugin.getDefault ().getLog ().log ( e.getStatus () );
                throw new IllegalStateException ( e );
            }
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:72,代码来源:ValidationRunner.java


注:本文中的org.eclipse.core.runtime.IConfigurationElement.createExecutableExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。