org.eclipse.ui.IPartListener#org.eclipse.core.runtime.IConfigurationElement源码实例Demo

下面列出了org.eclipse.ui.IPartListener#org.eclipse.core.runtime.IConfigurationElement 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tmxeditor8   文件: TbMatcher.java
/**
 * 加载记忆库匹配实现 ;
 */
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);
	}
}
 
源代码2 项目: bonita-studio   文件: TabbedPropertyRegistry.java
/**
 * 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;
}
 
源代码3 项目: elexis-3-core   文件: TextContainer.java
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();
}
 
源代码4 项目: google-cloud-eclipse   文件: LibraryFactory.java
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;
}
 
源代码5 项目: ice   文件: AbstractModelBuilder.java
@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;
}
 
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);
            }

        }
    }
}
 
源代码7 项目: tlaplus   文件: TLCJob.java
/**
 * 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()]);
}
 
源代码8 项目: dsl-devkit   文件: CheckCfgUtil.java
/**
 * 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;
}
 
源代码9 项目: neoscada   文件: ConnectionCreatorHelper.java
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;
}
 
源代码10 项目: birt   文件: DataSetProvider.java
/**
 * @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;
}
 
源代码11 项目: neoscada   文件: ConfigurationHelper.java
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;
    }
}
 
源代码12 项目: translationstudio8   文件: SimpleMatcherFactory.java
/**
 * 加载记忆库匹配实现 ;
 */
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);
	}
}
 
源代码13 项目: tmxeditor8   文件: SimpleMatcherFactory.java
/**
 * 加载记忆库匹配实现 ;
 */
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);
	}
}
 
源代码14 项目: bonita-studio   文件: ImporterFactory.java
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);
    }
}
 
源代码15 项目: tmxeditor8   文件: SelfHelpDisplay.java
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());
			}
		}
	}
}
 
源代码16 项目: gwt-eclipse-plugin   文件: ExtensionQuery.java
/**
 * 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;
    }
  });
}
 
源代码17 项目: neoscada   文件: Activator.java
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;
}
 
源代码18 项目: birt   文件: BirtWizardUtil.java
/**
 * 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( );
}
 
源代码19 项目: dsl-devkit   文件: AbstractValidElementBase.java
/**
 * 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;
}
 
源代码20 项目: neoscada   文件: WorldRunner.java
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;
}
 
源代码21 项目: APICloud-Studio   文件: ServerManager.java
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;
}
 
源代码22 项目: Knowage-Server   文件: GeneratorDescriptor.java
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);
}
 
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;
  }
 
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;
}
 
源代码25 项目: google-cloud-eclipse   文件: LibraryFactoryTest.java
@Test
public void testCreate_nonLibrary() {
  try {
    LibraryFactory.create(Mockito.mock(IConfigurationElement.class));
    Assert.fail();
  } catch (LibraryFactoryException ex) {
    Assert.assertNotNull(ex.getMessage());
  }
}
 
源代码26 项目: wildwebdeveloper   文件: XMLExtensionRegistry.java
public List<String> getXMLLSClassPathExtensions() {
	Map<IConfigurationElement, LemminxClasspathExtensionProvider> extensionProviders = getRegisteredClassPathProviders();

	List<String> classpathExtensions = new ArrayList<>();
	extensionProviders.entrySet().stream()
			.map(Entry<IConfigurationElement, LemminxClasspathExtensionProvider>::getValue)
			.map(LemminxClasspathExtensionProvider::get)
			.forEach(list -> list.forEach(jar -> classpathExtensions.add(jar.getAbsolutePath())));

	return classpathExtensions;
}
 
源代码27 项目: statecharts   文件: FileExtensions.java
public static Iterable<FileExtensionDescriptor> getFileExtensions() {
	IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID);
	if (generatorDescriptors == null) {
		generatorDescriptors = transform(newArrayList(configurationElements), new CreateFileExtensions());
	}
	return generatorDescriptors;
}
 
源代码28 项目: birt   文件: ExtensionPointManager.java
private ExtendedElementUIPoint createReportItemUIPoint( IExtension extension )
{
	IConfigurationElement[] elements = extension.getConfigurationElements( );
	if ( elements != null && elements.length > 0 )
	{
		return loadElements( elements );
	}
	return null;
}
 
源代码29 项目: bonita-studio   文件: Repository.java
@SuppressWarnings("unchecked")
protected IRepositoryStore<? extends IRepositoryFileStore> createRepositoryStore(
        final IConfigurationElement configuration, final IProgressMonitor monitor) throws CoreException {
    final IRepositoryStore<? extends IRepositoryFileStore> store;
    try {
        store = extensionContextInjectionFactory.make(configuration, CLASS, IRepositoryStore.class);
        monitor.subTask(Messages.bind(Messages.creatingStore, store.getDisplayName()));
        store.createRepositoryStore(this);
        monitor.worked(1);
        return store;
    } catch (final ClassNotFoundException e) {
        throw new CoreException(new Status(IStatus.ERROR, CommonRepositoryPlugin.PLUGIN_ID,
                "Failed to instantiate Repository store", e));
    }
}
 
源代码30 项目: n4js   文件: EclipseRunnerDescriptor.java
/**
 * Create a new runner descriptor from the given configuration element. Will perform extensive validity checks and
 * throw {@link IllegalArgumentException}s in case of errors.
 */
public EclipseRunnerDescriptor(IConfigurationElement configElem) {
	this.configElem = configElem;
	if (this.configElem == null) {
		throw new IllegalArgumentException("configElem may not be null");
	}

	this.id = configElem.getAttribute(ATTR_ID);
	if (this.id == null || this.id.trim().isEmpty()) {
		throw new IllegalArgumentException(
				"extension attribute '" + ATTR_ID + "' may not be null or empty");
	}

	this.name = configElem.getAttribute(ATTR_NAME);
	if (this.name == null || this.name.trim().isEmpty()) {
		throw new IllegalArgumentException(
				"extension attribute '" + ATTR_NAME + "' may not be null or empty");
	}

	final String environmentRaw = configElem.getAttribute(ATTR_ENVIRONMENT);
	if (environmentRaw == null || environmentRaw.trim().isEmpty()) {
		throw new IllegalArgumentException(
				"extension attribute '" + ATTR_ENVIRONMENT + "' may not be null or empty");
	}
	this.environment = RuntimeEnvironment.fromProjectName(new N4JSProjectName(environmentRaw));
	if (this.environment == null) {
		throw new IllegalArgumentException("unknown runtime environment: "
				+ environmentRaw
				+ " (valid values are: "
				+ Stream.of(RuntimeEnvironment.values()).map(re -> re.getProjectName().getRawName())
						.collect(Collectors.joining(", "))
				+ ")");
	}
}