org.eclipse.core.runtime.InvalidRegistryObjectException Java Examples

The following examples show how to use org.eclipse.core.runtime.InvalidRegistryObjectException. 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: ProposalSorterHandle.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new descriptor.
 *
 * @param element the configuration element to read
 * @throws InvalidRegistryObjectException if the configuration element is not valid any longer
 * @throws CoreException if the configuration does not contain mandatory attributes
 */
ProposalSorterHandle(IConfigurationElement element) throws InvalidRegistryObjectException, CoreException {
	Assert.isLegal(element != null);

	fElement= element;
	fId= element.getAttribute(ID);
	checkNotNull(fId, ID);

	String name= element.getAttribute(NAME);
	if (name == null)
		fName= fId;
	else
		fName= name;

	fClass= element.getAttribute(CLASS);
	checkNotNull(fClass, CLASS);
}
 
Example #2
Source File: TmfAnalysisModuleOutputs.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static ITmfNewAnalysisModuleListener getListenerFromOutputElement(IConfigurationElement ce) {
    ITmfNewAnalysisModuleListener listener = null;
    try {
        IAnalysisOutput output = (IAnalysisOutput) ce.createExecutableExtension(CLASS_ATTR);
        if (output == null) {
            Activator.logWarning("An output could not be created"); //$NON-NLS-1$
            return listener;
        }
        for (IConfigurationElement childCe : ce.getChildren()) {
            if (childCe.getName().equals(ANALYSIS_ID_ELEM)) {
                listener = new TmfNewAnalysisOutputListener(output, childCe.getAttribute(ID_ATTR), null);
            } else if (childCe.getName().equals(MODULE_CLASS_ELEM)) {
                String contributorName = childCe.getContributor().getName();
                Class<?> moduleClass = Platform.getBundle(contributorName).loadClass(childCe.getAttribute(CLASS_ATTR));
                listener = new TmfNewAnalysisOutputListener(output, null, moduleClass.asSubclass(IAnalysisModule.class));
            }
        }
    } catch (InvalidRegistryObjectException | CoreException | ClassNotFoundException e) {
        Activator.logError("Error creating module output listener", e); //$NON-NLS-1$
    }
    return listener;
}
 
Example #3
Source File: TmfAnalysisModuleHelperConfigElement.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static ApplicableClass parseTraceTypeElement(IConfigurationElement element) {
    try {
        Class<?> applyclass = getBundle(element).loadClass(element.getAttribute(TmfAnalysisModuleSourceConfigElement.CLASS_ATTR));
        String classAppliesVal = element.getAttribute(TmfAnalysisModuleSourceConfigElement.APPLIES_ATTR);
        boolean classApplies = true;
        if (classAppliesVal != null) {
            classApplies = Boolean.parseBoolean(classAppliesVal);
        }
        if (classApplies) {
            return new ApplicableClass(applyclass, true);
        }
        return new ApplicableClass(applyclass, false);
    } catch (ClassNotFoundException | InvalidRegistryObjectException e) {
        Activator.logError("Error in applies to trace", e); //$NON-NLS-1$
    }
    return null;
}
 
Example #4
Source File: TmfExperimentElement.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Refreshes the trace type filed by reading the trace type persistent
 * property of the resource reference.
 *
 * If trace type is null after refresh, set it to the generic trace type
 * (for seamless upgrade)
 */
@Override
public void refreshTraceType() {
    super.refreshTraceType();
    if (getTraceType() == null) {
        IConfigurationElement ce = TmfTraceType.getTraceAttributes(TmfTraceType.DEFAULT_EXPERIMENT_TYPE);
        if (ce != null) {
            try {
                IFolder experimentFolder = getResource();
                experimentFolder.setPersistentProperty(TmfCommonConstants.TRACETYPE, ce.getAttribute(TmfTraceType.ID_ATTR));
                super.refreshTraceType();
            } catch (InvalidRegistryObjectException | CoreException e) {
            }
        }
    }
}
 
Example #5
Source File: XMLExtensionRegistry.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Returns the XML extension jar paths relative to the root of their
 * contributing plug-in.
 *
 * @return List of XML extension jar paths (relative to the root of their
 *         contributing plug-in).
 */
public List<String> getXMLExtensionJars() {
	if (this.outOfSync) {
		sync();
	}
	// Filter for .jar files and retrieve their paths relative to their contributing
	// plug-in
	return this.extensions.entrySet().stream().filter(extension -> extension.getValue().endsWith(".jar"))
			.map(extension -> {
				try {
					return new java.io.File(FileLocator.toFileURL(
							FileLocator.find(Platform.getBundle(extension.getKey().getContributor().getName()),
									new Path(extension.getValue())))
							.getPath()).getAbsolutePath();
				} catch (InvalidRegistryObjectException | IOException e) {
					Activator.getDefault().getLog()
							.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
					return null;
				}
			}).filter(Objects::nonNull).collect(Collectors.toList());
}
 
Example #6
Source File: ConfigurationHelper.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private static ParameterizedCommand convertCommand ( final IConfigurationElement commandElement ) throws NotDefinedException, InvalidRegistryObjectException
{
    final ICommandService commandService = (ICommandService)PlatformUI.getWorkbench ().getService ( ICommandService.class );
    final Command command = commandService.getCommand ( commandElement.getAttribute ( "id" ) ); //$NON-NLS-1$
    final List<Parameterization> parameters = new ArrayList<Parameterization> ();
    for ( final IConfigurationElement parameter : commandElement.getChildren ( "parameter" ) ) //$NON-NLS-1$
    {
        final IParameter name = command.getParameter ( parameter.getAttribute ( "name" ) ); //$NON-NLS-1$
        final String value = parameter.getAttribute ( "value" ); //$NON-NLS-1$
        parameters.add ( new Parameterization ( name, value ) );
    }
    return new ParameterizedCommand ( command, parameters.toArray ( new Parameterization[] {} ) );
}
 
Example #7
Source File: CompletionProposalComputerDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
* 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;
      }
  }
 
Example #8
Source File: ProposalSorterHandle.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Checks that the given attribute value is not <code>null</code>.
 *
 * @param value the value to check if not null
 * @param attribute the attribute
 * @throws InvalidRegistryObjectException if the registry element is no longer valid
 * @throws CoreException if <code>value</code> is <code>null</code>
 */
private void checkNotNull(Object value, String attribute) throws InvalidRegistryObjectException, CoreException {
	if (value == null) {
		Object[] args= { getId(), fElement.getContributor().getName(), attribute };
		String message= Messages.format(JavaTextMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
		IStatus status= new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, null);
		throw new CoreException(status);
	}
}
 
Example #9
Source File: CompletionProposalComputerDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Checks that the given attribute value is not <code>null</code>.
 *
 * @param value the object to check if not null
 * @param attribute the attribute
 * @throws InvalidRegistryObjectException if the registry element is no longer valid
 * @throws CoreException if <code>value</code> is <code>null</code>
 */
private void checkNotNull(Object value, String attribute) throws InvalidRegistryObjectException, CoreException {
	if (value == null) {
		Object[] args= { getId(), fElement.getContributor().getName(), attribute };
		String message= Messages.format(JavaTextMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
		IStatus status= new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, null);
		throw new CoreException(status);
	}
}
 
Example #10
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IContributor getContributor( ) throws InvalidRegistryObjectException
{
       if( bundle == null )
       {
           IExtension declaringExtn = getDeclaringExtension();
           if( declaringExtn != null )
               return declaringExtn.getContributor();
           return null;
       }
       
	return bundle.getContributor( );
}
 
Example #11
Source File: LibraryFactory.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
static Library create(IConfigurationElement configurationElement) throws LibraryFactoryException {
  try {
    if (ELEMENT_NAME_LIBRARY.equals(configurationElement.getName())) {
      Library library = new Library(configurationElement.getAttribute(ATTRIBUTE_NAME_ID));
      library.setName(configurationElement.getAttribute(ATTRIBUTE_NAME_NAME));
      library.setSiteUri(new URI(configurationElement.getAttribute(ATTRIBUTE_NAME_SITE_URI)));
      library.setGroup(configurationElement.getAttribute(ATTRIBUTE_NAME_GROUP));
      library.setToolTip(configurationElement.getAttribute(ATTRIBUTE_NAME_TOOLTIP));
      library.setLibraryDependencies(getLibraryDependencies(
          configurationElement.getChildren(ELEMENT_NAME_LIBRARY_DEPENDENCY)));
      library.setLibraryFiles(
          getLibraryFiles(configurationElement.getChildren(ELEMENT_NAME_LIBRARY_FILE)));
      String exportString = configurationElement.getAttribute(ATTRIBUTE_NAME_EXPORT);
      if (exportString != null) {
        library.setExport(Boolean.parseBoolean(exportString));
      }
      String dependencies = configurationElement.getAttribute("dependencies"); //$NON-NLS-1$
      if (!"include".equals(dependencies)) { //$NON-NLS-1$
        library.setResolved();
      }
      String versionString = configurationElement.getAttribute("javaVersion"); //$NON-NLS-1$
      if (versionString != null) {
        library.setJavaVersion(versionString);
      }
      return library;
    } else {
      throw new LibraryFactoryException(
          Messages.getString("UnexpectedConfigurationElement",
              configurationElement.getName(), ELEMENT_NAME_LIBRARY));
    }
  } catch (InvalidRegistryObjectException | URISyntaxException | IllegalArgumentException ex) {
    throw new LibraryFactoryException(Messages.getString("CreateLibraryError"), ex);
  }
}
 
Example #12
Source File: LibraryFactory.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private static List<LibraryFile> getLibraryFiles(IConfigurationElement[] children)
    throws InvalidRegistryObjectException, URISyntaxException {
  List<LibraryFile> libraryFiles = new ArrayList<>();
  for (IConfigurationElement libraryFileElement : children) {
    if (ELEMENT_NAME_LIBRARY_FILE.equals(libraryFileElement.getName())) {
      MavenCoordinates mavenCoordinates = getMavenCoordinates(
          libraryFileElement.getChildren(ELEMENT_NAME_MAVEN_COORDINATES));
      LibraryFile libraryFile = loadSingleFile(libraryFileElement, mavenCoordinates);
      libraryFile.updateVersion();
      libraryFiles.add(libraryFile);
    }
  }
  return libraryFiles;
}
 
Example #13
Source File: TmfAnalysisParameterProviders.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Return the analysis parameter providers advertised in the extension
 * point, and associated with an analysis ID.
 *
 * @param analysisId
 *            Get the parameter providers for an analysis identified by its
 *            ID
 * @return Map of analysis ID mapped to parameter provider classes
 */
public static Set<IAnalysisParameterProvider> getParameterProvidersFor(String analysisId) {
    Set<IAnalysisParameterProvider> providers = new HashSet<>();
    // Get the parameter provider elements from the extension point
    IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
    if (extensionRegistry == null) {
        return Collections.emptySet();
    }
    IConfigurationElement[] config = extensionRegistry.getConfigurationElementsFor(TMF_ANALYSIS_TYPE_ID);
    for (IConfigurationElement ce : config) {
        String elementName = ce.getName();
        if (elementName.equals(PARAMETER_PROVIDER_ELEM)) {
            try {
                IConfigurationElement[] children = ce.getChildren(ANALYSIS_ID_ELEM);
                if (children.length == 0) {
                    throw new IllegalStateException();
                }
                String id = children[0].getAttribute(ID_ATTR);
                String className = ce.getAttribute(CLASS_ATTR);
                if (id == null || className == null) {
                    continue;
                }
                if (analysisId.equals(id)) {
                    IAnalysisParameterProvider provider = fParamProviderInstances.get(className);
                    if (provider == null) {
                        provider = checkNotNull((IAnalysisParameterProvider) ce.createExecutableExtension(CLASS_ATTR));
                        fParamProviderInstances.put(className, provider);
                    }
                    providers.add(provider);
                }
            } catch (InvalidRegistryObjectException | CoreException e) {
                Activator.logError("Error creating module parameter provider", e); //$NON-NLS-1$
            }
        }
    }
    return providers;
}
 
Example #14
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getNamespaceIdentifier( )
		throws InvalidRegistryObjectException
{
	return bundle.getSymbolicName( );
}
 
Example #15
Source File: BonitaStudioWorkbenchAdvisor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void earlyStartup() {
    if (PlatformUtil.isHeadless()) {
        return;//Do not execute earlyStartup in headless mode
    }
    final IConfigurationElement[] elements = BonitaStudioExtensionRegistryManager.getInstance()
            .getConfigurationElements(
                    "org.bonitasoft.studio.common.poststartup"); //$NON-NLS-1$
    for (final IConfigurationElement elem : elements) {
        final Workbench workbench = (Workbench) PlatformUI.getWorkbench();
        try {
            IPostStartupContribution contrib = (IPostStartupContribution) ContextInjectionFactory
                    .make(Platform.getBundle(elem.getDeclaringExtension().getNamespaceIdentifier())
                            .loadClass(elem.getAttribute("class")), workbench.getContext());
            Display.getDefault().asyncExec(contrib::execute);
        } catch (InjectionException | ClassNotFoundException | InvalidRegistryObjectException e) {
            BonitaStudioLog.error(e);
        }
    }

    preLoad();
    
    // Fix issue with asciidoctor plugin overriding text content-type
    final EditorRegistry editorRegistry = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry();
    IFileEditorMapping[] fileEditorMappings = editorRegistry.getFileEditorMappings();
    List<IFileEditorMapping> mappings = Stream.of(fileEditorMappings).collect(Collectors.toList());
    FileEditorMapping mapping = new FileEditorMapping("*", "log");
    mapping.setDefaultEditor(editorRegistry.findEditor("org.eclipse.ui.DefaultTextEditor"));
    mappings.add(mapping);
    Display.getDefault().asyncExec(()-> editorRegistry.setFileEditorMappings(mappings.toArray(new FileEditorMapping[] {})));
    editorRegistry.setDefaultEditor("*.txt", "org.eclipse.ui.DefaultTextEditor");
    
    final long startupDuration = System.currentTimeMillis() - BonitaStudioApplication.START_TIME;
    BonitaStudioLog.info("Startup duration : " + DateUtil.getDisplayDuration(startupDuration),
            ApplicationPlugin.PLUGIN_ID);
    ApplicationPlugin.getDefault().getPreferenceStore().setDefault(FIRST_STARTUP, true);
    if (isFirstStartup()) {
        new OpenReleaseNoteHandler().setFocus(false).asView().openBrowser();
    }
    ApplicationPlugin.getDefault().getPreferenceStore().setValue(FIRST_STARTUP, false);
}
 
Example #16
Source File: ProposalSorterHandle.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
Status createExceptionStatus(InvalidRegistryObjectException x) {
	// extension has become invalid - log & disable
	String disable= createBlameMessage();
	String reason= JavaTextMessages.CompletionProposalComputerDescriptor_reason_invalid;
	return new Status(IStatus.INFO, JavaPlugin.getPluginId(), IStatus.OK, disable + " " + reason, x); //$NON-NLS-1$
}
 
Example #17
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getLabel( String locale )
		throws InvalidRegistryObjectException
{
	return null;
}
 
Example #18
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IContributor getContributor( ) throws InvalidRegistryObjectException
{
	return bundle.getContributor( );
}
 
Example #19
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IExtension getExtension( String extensionId )
		throws InvalidRegistryObjectException
{
	return bundle.platform.extensionRegistry.getExtension( uniqueId,
			extensionId );
}
 
Example #20
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IExtension[] getExtensions( ) throws InvalidRegistryObjectException
{
	return bundle.platform.extensionRegistry.getExtensions( uniqueId );
}
 
Example #21
Source File: Extension.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getNamespaceIdentifier( )
		throws InvalidRegistryObjectException
{
	return bundle.getSymbolicName( );
}
 
Example #22
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getSimpleIdentifier( ) throws InvalidRegistryObjectException
{
	return name;
}
 
Example #23
Source File: Extension.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getSimpleIdentifier( ) throws InvalidRegistryObjectException
{
	return name;
}
 
Example #24
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getNamespace( ) throws InvalidRegistryObjectException
{
	return bundle.getSymbolicName( );
}
 
Example #25
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getNamespaceIdentifier( )
		throws InvalidRegistryObjectException
{
	return bundle.getSymbolicName( );
}
 
Example #26
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getValue( String arg ) throws InvalidRegistryObjectException
{
	return null;
}
 
Example #27
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getValueAsIs( ) throws InvalidRegistryObjectException
{
	return value;
}
 
Example #28
Source File: Extension.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IContributor getContributor( ) throws InvalidRegistryObjectException
{
	return bundle.getContributor( );
}
 
Example #29
Source File: Extension.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public String getLabel( String arg0 ) throws InvalidRegistryObjectException
{
	return null;
}
 
Example #30
Source File: GWTJavaSpellingReconcileStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public String getNamespaceIdentifier()
    throws InvalidRegistryObjectException {
  return null;
}