org.eclipse.core.runtime.IConfigurationElement Java Examples

The following examples show how to use org.eclipse.core.runtime.IConfigurationElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorldRunner.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private boolean isMatch ( final BundleContext ctx, final IConfigurationElement ele, final Object element )
{
    if ( isMatch ( Factories.loadClass ( ctx, ele, ATTR_FOR_CLASS ), element ) )
    {
        return true;
    }

    for ( final IConfigurationElement child : ele.getChildren ( ELE_FOR_CLASS ) )
    {
        if ( isMatch ( Factories.loadClass ( ctx, child, ATTR_CLASS ), element ) )
        {
            return true;
        }
    }
    return false;
}
 
Example #2
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public static List<ConfigurationFormInformation> findMatching ( final String factoryId )
{
    final List<ConfigurationFormInformation> result = new LinkedList<ConfigurationFormInformation> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_FORM ) )
    {
        if ( !"form".equals ( ele.getName () ) )
        {
            continue;
        }
        final ConfigurationFormInformation info = new ConfigurationFormInformation ( ele );
        if ( info.getFactoryIds () == null )
        {
            continue;
        }

        if ( info.getFactoryIds ().contains ( "*" ) || info.getFactoryIds ().contains ( factoryId ) )
        {
            result.add ( info );
        }
    }

    return result;
}
 
Example #3
Source File: ConnectionCreatorHelper.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: BirtWizardUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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( );
}
 
Example #5
Source File: CheckCfgUtil.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Retrieves all property contributions from the checkcfg property extension point.
 *
 * @return the collection of all available property contributions, never {@code null}
 */
public static Collection<ICheckCfgPropertySpecification> getAllPropertyContributions() {
  Set<ICheckCfgPropertySpecification> contributions = Sets.newHashSet();
  IExtensionRegistry registry = Platform.getExtensionRegistry();
  if (registry != null) { // registry is null in the standalone builder...
    IConfigurationElement[] elements = registry.getConfigurationElementsFor(PROPERTY_EXTENSION_POINT);
    for (IConfigurationElement element : elements) {
      try {
        contributions.add((ICheckCfgPropertySpecification) element.createExecutableExtension(PROPERTY_EXECUTABLE_EXTENSION_ATTRIBUTE));
      } catch (CoreException e) {
        LOGGER.log(Level.WARN, "Failed to instantiate property from " + element.getContributor(), e);
      }
    }
  }
  return contributions;
}
 
Example #6
Source File: SimpleMatcherFactory.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 加载记忆库匹配实现 ;
 */
private void runExtension() {
	IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
	try {
		for (IConfigurationElement e : config) {
			final Object o = e.createExecutableExtension("class");
			if (o instanceof ISimpleMatcher) {
				ISafeRunnable runnable = new ISafeRunnable() {

					public void handleException(Throwable exception) {
						logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), exception);
					}

					public void run() throws Exception {
						ISimpleMatcher simpleMatcher = (ISimpleMatcher) o;							
						matchers.add(simpleMatcher);
					}
				};
				SafeRunner.run(runnable);
			}
		}
	} catch (CoreException ex) {
		logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), ex);
	}
}
 
Example #7
Source File: SimpleMatcherFactory.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 加载记忆库匹配实现 ;
 */
private void runExtension() {
	IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
	try {
		for (IConfigurationElement e : config) {
			final Object o = e.createExecutableExtension("class");
			if (o instanceof ISimpleMatcher) {
				ISafeRunnable runnable = new ISafeRunnable() {

					public void handleException(Throwable exception) {
						logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), exception);
					}

					public void run() throws Exception {
						ISimpleMatcher simpleMatcher = (ISimpleMatcher) o;							
						matchers.add(simpleMatcher);
					}
				};
				SafeRunner.run(runnable);
			}
		}
	} catch (CoreException ex) {
		logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), ex);
	}
}
 
Example #8
Source File: TLCJob.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Retrieves all presenter of TLC job results
 * @return 
 */
protected static IResultPresenter[] getRegisteredResultPresenters()
{
    IConfigurationElement[] decls = Platform.getExtensionRegistry().getConfigurationElementsFor(
            IResultPresenter.EXTENSION_ID);

    Vector<IResultPresenter> validExtensions = new Vector<IResultPresenter>();
    for (int i = 0; i < decls.length; i++)
    {
        try
        {
            IResultPresenter extension = (IResultPresenter) decls[i].createExecutableExtension("class");
            validExtensions.add(extension);
        } catch (CoreException e)
        {
            TLCActivator.logError("Error instatiating the IResultPresenter extension", e);
        }
    }
    return validExtensions.toArray(new IResultPresenter[validExtensions.size()]);
}
 
Example #9
Source File: ObservableListContentProviderWithProposalListeners.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void initProposalListeners(final EObject context) {
    proposalListeners.clear();
    final IConfigurationElement[] configurationElements = BonitaStudioExtensionRegistryManager.getInstance()
            .getConfigurationElements(PROPOSAL_LISTENER_EXTENSION_ID);
    // Filters duplicates
    for (final IConfigurationElement configElement : configurationElements) {
        final String type = configElement.getAttribute("type");
        if (type.equals(ExpressionConstants.VARIABLE_TYPE)) {
            IDataProposalListener extension;
            try {
                extension = (IDataProposalListener) configElement.createExecutableExtension("providerClass");
                if (extension.isRelevant(context, null) && !proposalListeners.contains(extension)) {
                    extension.setMultipleData(isMultipleData());
                    proposalListeners.add(extension);
                }
            } catch (final CoreException e) {
                BonitaStudioLog.error(e);
            }

        }
    }
}
 
Example #10
Source File: AbstractModelBuilder.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void setServices(Item item) {
	// Give the Item the IMaterialsDatabase service.
	((Model) item).setMaterialsDatabase(materialsDatabase);

	// Let the base class set any other services.
	super.setServices(item);

	IConfigurationElement[] elements = Platform.getExtensionRegistry()
			.getConfigurationElementsFor(
					"org.eclipse.ice.item.IMaterialsDatabase");

	logger.info("Available configuration elements:");
	for (IConfigurationElement element : elements) {
		logger.info("Name" + element.getName());

	}

	return;
}
 
Example #11
Source File: DataSetProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param dataSetType
 * @param dataSourceType
 * @return
 */
public static IConfigurationElement findDataSetElement( String dataSetType,
		String dataSourceType )
{
	// NOTE: multiple data source types can support the same data set type
	IConfigurationElement dataSourceElem = findDataSourceElement( dataSourceType );
	if ( dataSourceElem != null )
	{
		// Find data set declared in the same extension
		IExtension ext = dataSourceElem.getDeclaringExtension( );
		IConfigurationElement[] elements = ext.getConfigurationElements( );
		for ( int n = 0; n < elements.length; n++ )
		{
			if ( elements[n].getAttribute( "id" ).equals( dataSetType ) ) //$NON-NLS-1$
			{
				return elements[n];
			}
		}
	}
	return null;
}
 
Example #12
Source File: AbstractValidElementBase.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Return all child elements of this element that conform to the hierarchy of the
 * XML schema that goes with this extension point. The order the returned elements
 * is not specified here.
 * 
 * @return the child elements of this element
 */
public AbstractValidElementBase[] getChildElements() {
  AbstractValidElementBase[] childElements = null;
  if (childElements == null) {
    IConfigurationElement[] ce = getConfigurationElement().getChildren();
    ArrayList<AbstractValidElementBase> elements = new ArrayList<AbstractValidElementBase>();
    for (IConfigurationElement element : ce) {
      AbstractValidElementBase e = createChildElement(element);
      if (e != null) {
        elements.add(e);
      }
    }
    childElements = elements.toArray(new AbstractValidElementBase[elements.size()]);
  }
  return childElements;
}
 
Example #13
Source File: LibraryFactory.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private static List<Filter> getFilters(IConfigurationElement[] children) {
  List<Filter> filters = new ArrayList<>();
  for (IConfigurationElement childElement : children) {
    switch (childElement.getName()) {
      case ELEMENT_NAME_EXCLUSION_FILTER:
        filters.add(Filter.exclusionFilter(childElement.getAttribute(ATTRIBUTE_NAME_PATTERN)));
        break;
      case ELEMENT_NAME_INCLUSION_FILTER:
        filters.add(Filter.inclusionFilter(childElement.getAttribute(ATTRIBUTE_NAME_PATTERN)));
        break;
      default:
        // other child element of libraryFile, e.g.: mavenCoordinates
        break;
    }
  }
  return filters;
}
 
Example #14
Source File: ServerManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private IServer restoreServerConfiguration(IMemento memento, String id) throws CoreException
{
	IServer serverConfiguration = null;
	String typeId = memento.getString(ATTR_TYPE);
	if (typeId != null)
	{
		IConfigurationElement element = configurationElements.get(typeId);
		if (element != null)
		{
			Object object = element.createExecutableExtension(ATT_CLASS);
			if (object instanceof IServer)
			{
				serverConfiguration = (IServer) object;
				serverConfiguration.loadState(memento);
			}
		}
	}
	return serverConfiguration;
}
 
Example #15
Source File: TextContainer.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private Optional<String> readUsingDataAccessExtension(Object object, String name){
	List<IConfigurationElement> placeholderExtensions =
		Extensions.getExtensions(ExtensionPointConstantsData.DATA_ACCESS, "TextPlaceHolder");
	for (IConfigurationElement iConfigurationElement : placeholderExtensions) {
		if (name.equals(iConfigurationElement.getAttribute("name"))
			&& object.getClass().getName().equals(iConfigurationElement.getAttribute("type"))) {
			try {
				ITextResolver resolver =
					(ITextResolver) iConfigurationElement.createExecutableExtension("resolver");
				return resolver.resolve(object);
			} catch (CoreException e) {
				log.warn(
					"Error getting resolver for name [" + name + "] object [" + object + "]");
			}
		}
	}
	return Optional.empty();
}
 
Example #16
Source File: ExtensionQuery.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Return the data provided by all available plugins for the given extension
 * point and attribute name.
 */
@SuppressWarnings("unchecked")
public List<Data<T>> getData() {
  return getDataImpl(new DataRetriever<T>() {
    @Override
    public T getData(IConfigurationElement configurationElement,
        String attrName) {
      try {
        return (T) configurationElement.createExecutableExtension(attrName);
      } catch (CoreException ce) {
        CorePluginLog.logError(ce);
      }
      return null;
    }
  });
}
 
Example #17
Source File: ConfigurationHelper.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private static EventHistoryViewConfiguration convertEventHistory ( final IConfigurationElement ele )
{
    try
    {
        final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$
        final String connectionString = ele.getAttribute ( "connectionString" ); //$NON-NLS-1$
        final ConnectionType connectionType = ConnectionType.valueOf ( ele.getAttribute ( "connectionType" ) ); //$NON-NLS-1$
        final String label = ele.getAttribute ( "label" ); //$NON-NLS-1$

        final List<ColumnLabelProviderInformation> columnInformation = new LinkedList<ColumnLabelProviderInformation> ();
        fillColumnInformation ( columnInformation, ele );

        return new EventHistoryViewConfiguration ( id, connectionString, connectionType, label, columnInformation );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to convert event history configuration: {}", ele ); //$NON-NLS-1$
        return null;
    }
}
 
Example #18
Source File: TabbedPropertyRegistry.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads property tab extensions. Returns all tab descriptors for the
 * current contributor id or an empty list if none is found.
 */
protected List readTabDescriptors() {
	List<TabDescriptor> result = new ArrayList<>();
	IConfigurationElement[] extensions = getConfigurationElements(EXTPT_TABS);
	for (IConfigurationElement extension : extensions) {
		IConfigurationElement[] tabs = extension.getChildren(ELEMENT_TAB);
		for (IConfigurationElement tab : tabs) {
			TabDescriptor descriptor = new TabDescriptor(tab);
			if (getIndex(propertyCategories.toArray(), descriptor
					.getCategory()) == -1) {
				/* tab descriptor has unknown category */
				handleTabError(tab, descriptor.getCategory() == null ? "" //$NON-NLS-1$
						: descriptor.getCategory());
			} else {
				result.add(descriptor);
			}
		}
	}
	return result;
}
 
Example #19
Source File: ImporterFactory.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void configure(final IConfigurationElement desc) {
    name = desc.getAttribute("inputName");
    filterExtension = desc.getAttribute("filterExtensions");
    description = desc.getAttribute("description");
    priorityDisplay = Integer.valueOf(desc.getAttribute("priorityDisplay"));
    final String menuIcon = desc.getAttribute("menuIcon");
    try {
        if (menuIcon != null) {
            final Bundle b = Platform.getBundle(desc.getContributor().getName());
            final URL iconURL = b.getResource(menuIcon);
            final File imageFile = new File(FileLocator.toFileURL(iconURL).getFile());
            try (final FileInputStream inputStream = new FileInputStream(imageFile);) {
                descriptionImage = new Image(Display.getDefault(), inputStream);
            }
        }
    } catch (final Exception e) {
        BonitaStudioLog.error(e);
    }
}
 
Example #20
Source File: GeneratorDescriptor.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
public GeneratorDescriptor(IConfigurationElement configElement) {
	this.configElement = configElement;
	
	this.id = getAttribute(configElement, ATT_ID, null);
	if(this.id == null) {
		throw new IllegalArgumentException("Missing " + ATT_ID + " attribute");
	}
	
	this.name = getAttribute(configElement, ATT_NAME, null);
	if(this.id == null) {
		throw new IllegalArgumentException("Missing " + ATT_ID + " attribute");
	}

	this.clazz = getAttribute(configElement, ATT_CLASS, null);
	if(this.id == null) {
		throw new IllegalArgumentException("Missing " + ATT_ID + " attribute");
	}
	
	this.description = getAttribute(configElement, ATT_DESCRIPTION, null);
	this.icon = getAttribute(configElement, ATT_ICON, null);
}
 
Example #21
Source File: SelfHelpDisplay.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private static void createHelpDisplay() {
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(HELP_DISPLAY_EXTENSION_ID );
	if (point != null) {
		IExtension[] extensions = point.getExtensions();
		if (extensions.length != 0) {
			// We need to pick up the non-default configuration
			IConfigurationElement[] elements = extensions[0]
					.getConfigurationElements();
			if (elements.length == 0) 
				return;
			IConfigurationElement displayElement  = elements[0];
			// Instantiate the help display
			try {
				helpDisplay = (AbstractHelpDisplay) (displayElement
						.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
			} catch (CoreException e) {
				HelpBasePlugin.logStatus(e.getStatus());
			}
		}
	}
}
 
Example #22
Source File: SVNFileModificationValidator.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private IFileModificationValidator loadUIValidator() {
      IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(ID, DEFAULT_FILE_MODIFICATION_VALIDATOR_EXTENSION);
if (extension != null) {
	IExtension[] extensions =  extension.getExtensions();
	if (extensions.length > 0) {
		IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
		if (configElements.length > 0) {
			try {
                      Object o = configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
                      if (o instanceof IFileModificationValidator) {
                          return (IFileModificationValidator)o;
                      }
                  } catch (CoreException e) {
                      SVNProviderPlugin.log(e.getStatus().getSeverity(), e.getMessage(), e);
                  }
		}
	}
}
return null;
  }
 
Example #23
Source File: TbMatcher.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 加载记忆库匹配实现 ;
 */
private void runExtension() {
	IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
			TERMMATCH_EXTENSION_ID);
	try {
		for (IConfigurationElement e : config) {
			final Object o = e.createExecutableExtension("class");
			if (o instanceof ITbMatch) {
				ISafeRunnable runnable = new ISafeRunnable() {

					public void handleException(Throwable exception) {
						logger.error(Messages.getString("match.TbMatcher.logger1"), exception);
					}

					public void run() throws Exception {
						termMatch = (ITbMatch) o;
					}
				};
				SafeRunner.run(runnable);
			}
		}
	} catch (CoreException ex) {
		logger.error(Messages.getString("match.TbMatcher.logger1"), ex);
	}
}
 
Example #24
Source File: Repository.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
private void initWeaver() {
    String weaverName = getProperties().getProperty(WEAVER);
    IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(MDDCore.PLUGIN_ID, "modelWeaver");
    IConfigurationElement[] elements = point.getConfigurationElements();
    for (IConfigurationElement current : elements)
        if (weaverName.equals(current.getAttribute("name"))) {
            try {
                weaver = (IModelWeaver) current.createExecutableExtension("class");
            } catch (CoreException e) {
                LogUtils.logError(MDDCore.PLUGIN_ID, "Could not instantiate weaver: " + weaverName, e);
            }
            return;
        }
}
 
Example #25
Source File: ExtensionRegistry.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private void init(List<T> allContributions) {
	IExtension[] extensions = Platform.getExtensionRegistry()
			.getExtensionPoint(pluginId, extensionPointName)
			.getExtensions();
	List<T> contributions = new ArrayList<>();
	for (int i = 0; i < extensions.length; i++) {
		IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
		for (int j = 0; j < configElements.length; j++) {
			parse(configElements[j], contributions);
		}
	}
	allContributions.addAll(contributions);
}
 
Example #26
Source File: DetectorsExtensionHelper.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void addContribution(TreeMap<String, String> set, IConfigurationElement configElt) {
    IContributor contributor = configElt.getContributor();
    try {
        if (contributor == null) {
            throw new IllegalArgumentException("Null contributor");
        }
        String pluginId = configElt.getAttribute(PLUGIN_ID);
        if (pluginId == null) {
            throw new IllegalArgumentException("Missing '" + PLUGIN_ID + "'");
        }
        String 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);
    }
}
 
Example #27
Source File: NativeProjectBuilder.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private void configureEnablement(IConfigurationElement[] enablementNodes) {
	if(enablementNodes == null || enablementNodes.length < 1 ) return;
	IConfigurationElement node = enablementNodes[0];
	try {
		 expression = ExpressionConverter.getDefault().perform(node);
		
	} catch (CoreException e) {
		HybridCore.log(IStatus.ERROR, "Error while reading the enablement", e);
	}
}
 
Example #28
Source File: MultiPageEditor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the external editor configurations.
 *
 * @return the external editor configurations
 */
//   (but don't load the actual editors, yet)
private void getExternalEditorConfigurations () {
  // Get extension point from Registry
  IExtensionPoint point = Platform.getExtensionRegistry()
              .getExtensionPoint(TAEConfiguratorPlugin.pluginId, EXTENSION_POINT_ID);
  
  externalEditorConfigurations = new ArrayList<>();
  
  // check: Any <extension> tags for our extension-point?
  if (point != null) {
    for (IExtension extension : point.getExtensions()) {
      Bundle b = Platform.getBundle(extension.getContributor().getName());
      if (b == null) {
        Utility.popMessage(
            "Problem with Editor Extension",
            "Editor '" + extension.getContributor().getName() + "' is present, but can't be loaded, probably because of unsatisfied dependencies\n",
            MessageDialog.ERROR);
        continue;
      }
      for (IConfigurationElement ces : extension.getConfigurationElements()) {
        externalEditorConfigurations.add(ces);
      }
    }
  } else {
    // Error - no such extension point
    Utility.popMessage(
        "Internal Error",
        "CDE's extension point is missing",
        MessageDialog.ERROR);
  }
}
 
Example #29
Source File: AnalyticsHandlersManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Loads the handlers.
 */
private void loadExtensions()
{
	final Set<IAnalyticsEventHandler> eventHandlers = new HashSet<IAnalyticsEventHandler>();
	EclipseUtil.processConfigurationElements(UsagePlugin.PLUGIN_ID, EXTENSION_POINT_ID,
			new IConfigurationElementProcessor()
			{

				public void processElement(IConfigurationElement element)
				{
					String name = element.getName();
					if (ELEMENT_HANDLER.equals(name))
					{
						try
						{
							eventHandlers.add((IAnalyticsEventHandler) element.createExecutableExtension(CLASS));
						}
						catch (CoreException e)
						{
							IdeLog.logError(UsagePlugin.getDefault(), "Error loading an analytics handler", e); //$NON-NLS-1$
						}
					}
				}

				public Set<String> getSupportElementNames()
				{
					return CollectionsUtil.newSet(ELEMENT_HANDLER);
				}
			});
	// Save the handlers in a read-only set.
	handlers = Collections.unmodifiableSet(eventHandlers);
}
 
Example #30
Source File: SimpleExtensionPointManager.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
private List<SimpleProxy<T>> createProxies(
    String extensionPointName,
    Class<T> klass,
    String elementName,
    String classNameAttr,
    String forcePluginActivationAttr) {
  List<SimpleProxy<T>> proxies = Lists.newArrayList();

  // Load the reference to the extension.
  IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
      MechanicPlugin.PLUGIN_ID, extensionPointName);

  if (point == null) {
    LOG.log(Level.SEVERE,
        "Cannot load extension point " + MechanicPlugin.PLUGIN_ID + "/" + extensionPointName);
    return proxies;
  }
  // This loads all the registered extensions to this point.
  IExtension[] extensions = point.getExtensions();
  for (IExtension extension : extensions) {
    IConfigurationElement[] configurationElements = extension.getConfigurationElements();
    for (IConfigurationElement element : configurationElements) {
      if (element.getName().equals(elementName)) {
        SimpleProxy<T> proxy =
            SimpleProxy.create(klass, element, classNameAttr, forcePluginActivationAttr);
        // If parseType has an error, it returns null.
        if (proxy != null) {
          proxies.add(proxy);
        }
      }
    }
  }

  return proxies;
}