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


Java IContributor类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.IContributor的典型用法代码示例。如果您正苦于以下问题:Java IContributor类的具体用法?Java IContributor怎么用?Java IContributor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: contributesToExtensionPoint

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
/**
 * Returns <code>true</code> if this bundle implements the extension point
 * with the given <code>extensionPointId</code>.
 * 
 * @param bundle the bundle to test
 * @param extensionSimpleId the simple id of the extension point
 * @param extensionPointId extension id to search for
 * 
 * @return <code>true</code> if this bundle implements the extension point
 *         with the given <code>extensionPointId</code>
 */
public static boolean contributesToExtensionPoint(Bundle bundle,
    String extensionSimpleId, String extensionPointId) {
  IExtensionRegistry registry = RegistryFactory.getRegistry();
  IContributor contributor = ContributorFactoryOSGi.createContributor(bundle);
  for (IExtension extension : registry.getExtensions(contributor.getName())) {
    if (extension.getExtensionPointUniqueIdentifier().equals(extensionPointId)) {
      if (extensionSimpleId != null
          && !extensionSimpleId.equals(extension.getSimpleIdentifier())) {
        continue;
      }

      return true;
    }
  }

  return false;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:29,代码来源:BundleUtilities.java

示例2: retrieveEclipseVersionString

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
private String retrieveEclipseVersionString() {
	String product = System.getProperty("eclipse.product");
	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IExtensionPoint point = registry.getExtensionPoint("org.eclipse.core.runtime.products");
	if (point != null) {
		IExtension[] extensions = point.getExtensions();
		for (IExtension ext : extensions) {
			if (product.equals(ext.getUniqueIdentifier())) {
				IContributor contributor = ext.getContributor();
				if (contributor != null) {
					Bundle bundle = Platform.getBundle(contributor.getName());
					if (bundle != null) {
						Version version = bundle.getVersion();
						return version.getMajor() + "." + version.getMinor();
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:22,代码来源:CMakeLauncher.java

示例3: setupExtensions

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
@SuppressWarnings("restriction")
@BeforeClass
public static void setupExtensions() throws Exception {
	final IExtensionRegistry registry = Platform.getExtensionRegistry();
	Object key = ((ExtensionRegistry) registry).getTemporaryUserToken();
	Bundle bundle = Activator.getDefault().getBundle();
	IContributor contributor = ContributorFactoryOSGi.createContributor(bundle);
	InputStream inputStream = null;
	try {
		inputStream = FileLocator.openStream(bundle, new Path("datafiles/TestJSConstraintExtension.xml"), false);
		registry.addContribution(inputStream, contributor, false, null, null, key);
	} finally {
		if (inputStream != null) {
			inputStream.close();
		}
	}
	// wait until jobs kicked off by adding the contribution are complete
	DynamicExtensionUtils.waitForJobs();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:TestJSConstraint.java

示例4: convertAttributeResource

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
private static URL convertAttributeResource(String attr, IConfigurationElement el) 
{
	IContributor contributor = el.getDeclaringExtension().getContributor();
	Bundle bundle = Platform.getBundle(contributor.getName());
	URL u = bundle.getEntry(el.getAttribute(attr));
	try
	{
		return FileLocator.toFileURL(u);
	} catch (Exception e)
	{
		Logger.getGlobal().warning(String.format("Unable to find resource <%s> for example <%s>.", 
				el.getAttribute("name"),attr));
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	return null;
	
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:20,代码来源:Example.java

示例5: isTargetClass

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
private boolean isTargetClass ( final String className, final IContributor contributor, final Class<? extends EObject> clazz )
{
    if ( className == null )
    {
        return false;
    }

    final Bundle bundle = findBundle ( contributor );
    if ( bundle == null )
    {
        throw new IllegalStateException ( String.format ( "Unable to find bundle '%s'", contributor.getName () ) );
    }

    try
    {
        final Class<?> targetClazz = bundle.loadClass ( className );
        if ( targetClazz.isAssignableFrom ( clazz ) )
        {
            return true;
        }
    }
    catch ( final ClassNotFoundException e )
    {
        throw new IllegalStateException ( String.format ( "Unable to find target class '%s'", className ), e );
    }

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

示例6: findBundle

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
private Bundle findBundle ( final IContributor contributor )
{
    final String cid = contributor.getName ();

    for ( final Bundle bundle : this.context.getBundles () )
    {
        if ( bundle.getSymbolicName ().equals ( cid ) )
        {
            return bundle;
        }
    }
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:14,代码来源:ValidationRunner.java

示例7: load

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
/**
 * Load the plugins from the extension point, and fill the lists of entries.
 */
protected void load(String extensionId) {
  IExtensionRegistry registry = Platform.getExtensionRegistry();
  IExtensionPoint point = registry.getExtensionPoint(extensionId);
  if (null == point) {
    return;
  }
  for (IExtension extension: point.getExtensions()) {
    IContributor contrib = extension.getContributor();
    String bundleId = contrib.getName();
    // ... and for each elements
    for (IConfigurationElement element :
        extension.getConfigurationElements()) {

      // obtain an object on the entry
      ContributionEntry<T> entry = buildEntry(bundleId, element);
      String entryId = entry.getId();
      if (Strings.isNullOrEmpty(entryId)) {
        LOG.warn("Empty entry id in {} for {}", bundleId, extensionId);
      }
      entries.put(entryId, entry);

      // Try to instantiate the contribution and install it.
      try {
        T plugin = entry.prepareInstance();
        installContribution(entryId, plugin);
      } catch (CoreException err) {
        reportException(entryId, err);
        throw new RuntimeException(err);
      }
    }
  }
}
 
开发者ID:google,项目名称:depan,代码行数:36,代码来源:ContributionRegistry.java

示例8: informUser

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
/**
 * Log the status and inform the user about a misbehaving extension.
 *
 * @param descriptor the descriptor of the misbehaving extension
 * @param status a status object that will be logged
 */
void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) {
	JavaPlugin.log(status);
       String title= JavaTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
       CompletionProposalCategory category= descriptor.getCategory();
       IContributor culprit= descriptor.getContributor();
       Set<String> affectedPlugins= getAffectedContributors(category, culprit);

	final String avoidHint;
	final String culpritName= culprit == null ? null : culprit.getName();
	if (affectedPlugins.isEmpty())
		avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()});
	else
		avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)});

	String message= status.getMessage();
       // inlined from MessageDialog.openError
       MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(), title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) {
       	@Override
		protected Control createCustomArea(Composite parent) {
       		Link link= new Link(parent, SWT.NONE);
       		link.setText(avoidHint);
       		link.addSelectionListener(new SelectionAdapter() {
       			@Override
				public void widgetSelected(SelectionEvent e) {
       				PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$
       			}
       		});
       		GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
       		gridData.widthHint= this.getMinimumMessageWidth();
			link.setLayoutData(gridData);
       		return link;
       	}
       };
       dialog.open();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:42,代码来源:CompletionProposalComputerRegistry.java

示例9: getAffectedContributors

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
/**
 * Returns the names of contributors affected by disabling a category.
 *
 * @param category the category that would be disabled
 * @param culprit the culprit plug-in, which is not included in the returned list
 * @return the names of the contributors other than <code>culprit</code> that contribute to <code>category</code> (element type: {@link String})
 */
private Set<String> getAffectedContributors(CompletionProposalCategory category, IContributor culprit) {
    Set<String> affectedPlugins= new HashSet<String>();
       for (Iterator<CompletionProposalComputerDescriptor> it= getProposalComputerDescriptors().iterator(); it.hasNext();) {
        CompletionProposalComputerDescriptor desc= it.next();
        CompletionProposalCategory cat= desc.getCategory();
        if (cat.equals(category)) {
        	IContributor contributor= desc.getContributor();
        	if (contributor != null && !culprit.equals(contributor))
        		affectedPlugins.add(contributor.getName());
        }
       }
    return affectedPlugins;
   }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:CompletionProposalComputerRegistry.java

示例10: getContributor

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
/**
* Returns the contributor of the described extension.
*
* @return the contributor of the described extension
*/
  IContributor getContributor()  {
      try {
       return fElement.getContributor();
      } catch (InvalidRegistryObjectException e) {
      	return null;
      }
  }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:CompletionProposalComputerDescriptor.java

示例11: init

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
private static void init() {
	IConfigurationElement[] elements = Platform.getExtensionRegistry()
			.getConfigurationElementsFor(
					"org.scaledl.overview.Specification");

	for (IConfigurationElement el : elements) {
		try {
			IExtension declaringExtension = el.getDeclaringExtension();
			IContributor contributor = declaringExtension.getContributor();
			Bundle bundle = Platform.getBundle(contributor.getName());

			// Specification model URL -- this is correct way to get URI in product
			URL fileURL = bundle.getEntry(el.getAttribute("model"));
			URL resolvedFileURL = FileLocator.toFileURL(fileURL);
			URI resolvedURI = new URI (resolvedFileURL.getProtocol(), resolvedFileURL.getPath(), null);
			File file = new File(resolvedURI);

			// Load specification resource and add specification to registry
			XMIResourceImpl resource = new XMIResourceImpl();
			//File file = new File(FileLocator.resolve(fileURL).toURI());
			resource.load(new FileInputStream(file), new HashMap<Object,Object>());
			Specification specification = (Specification)resource.getContents().get(0);  
			instance.addSpecification(specification);

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:31,代码来源:SpecificationProviderService.java

示例12: addContribution

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
private static void addContribution(TreeMap<String, String> set, IConfigurationElement configElt) {
    String libPathAsString;
    String pluginId;
    IContributor contributor = null;
    try {
        contributor = configElt.getContributor();
        if (contributor == null) {
            throw new IllegalArgumentException("Null contributor");
        }
        pluginId = configElt.getAttribute(PLUGIN_ID);
        if (pluginId == null) {
            throw new IllegalArgumentException("Missing '" + PLUGIN_ID + "'");
        }
        libPathAsString = configElt.getAttribute(LIBRARY_PATH);
        if (libPathAsString == null) {
            throw new IllegalArgumentException("Missing '" + LIBRARY_PATH + "'");
        }
        libPathAsString = resolveRelativePath(contributor, libPathAsString);
        if (libPathAsString == null) {
            throw new IllegalArgumentException("Failed to resolve library path for: " + pluginId);
        }
        if(set.containsKey(pluginId)) {
            throw new IllegalArgumentException("Duplicated '" + pluginId + "' contribution.");
        }
        set.put(pluginId, libPathAsString);
    } catch (Throwable e) {
        String cName = contributor != null ? contributor.getName() : "unknown contributor";
        String message = "Failed to read contribution for '" + EXTENSION_POINT_ID
                + "' extension point from " + cName;
        FindbugsPlugin.getDefault().logException(e, message);
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:33,代码来源:DetectorsExtensionHelper.java

示例13: getContributor

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
public IContributor getContributor( ) throws InvalidRegistryObjectException
{
       if( bundle == null )
       {
           IExtension declaringExtn = getDeclaringExtension();
           if( declaringExtn != null )
               return declaringExtn.getContributor();
           return null;
       }
       
	return bundle.getContributor( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:13,代码来源:ConfigurationElement.java

示例14: addContribution

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
public boolean addContribution( InputStream is, IContributor contributor,
		boolean persist, String name, ResourceBundle translationBundle,
		Object token ) throws IllegalArgumentException

{
	throw new UnsupportedOperationException(
			"addContribution is not implemented yet" );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:9,代码来源:ExtensionRegistry.java

示例15: getExtensionPoints

import org.eclipse.core.runtime.IContributor; //导入依赖的package包/类
public IExtensionPoint[] getExtensionPoints( IContributor contributor )
{
	for ( Bundle bundle : bundles.values() )
	{
		if ( bundle.getContributor( ) == contributor )
		{
			return bundle.getExtensionPoints( );
		}
	}
	return new IExtensionPoint[]{};
}
 
开发者ID:eclipse,项目名称:birt,代码行数:12,代码来源:ExtensionRegistry.java


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