Java Code Examples for org.eclipse.core.runtime.IConfigurationElement#getChildren()

The following examples show how to use org.eclipse.core.runtime.IConfigurationElement#getChildren() . 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: ValidationRunner.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
private boolean isTargetMatch ( final Class<? extends EObject> clazz, final IConfigurationElement ele )
{
    if ( isTargetClass ( ele.getAttribute ( "filterClass" ), ele.getContributor (), clazz ) )
    {
        return true;
    }

    for ( final IConfigurationElement child : ele.getChildren ( "filterClass" ) )
    {
        if ( isTargetClass ( child.getAttribute ( "class" ), ele.getContributor (), clazz ) )
        {
            return true;
        }
    }

    return false;
}
 
Example 2
Source File: ContributedProcessorDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private Set<String> getHandledMarkerTypes(IConfigurationElement element) {
	HashSet<String> map= new HashSet<String>(7);
	IConfigurationElement[] children= element.getChildren(HANDLED_MARKER_TYPES);
	for (int i= 0; i < children.length; i++) {
		IConfigurationElement[] types= children[i].getChildren(MARKER_TYPE);
		for (int k= 0; k < types.length; k++) {
			String attribute= types[k].getAttribute(ID);
			if (attribute != null) {
				map.add(attribute);
			}
		}
	}
	if (map.isEmpty()) {
		map.add(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
		map.add(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER);
		map.add(IJavaModelMarker.TASK_MARKER);
	}
	return map;
}
 
Example 3
Source File: CodeSelectorFactory.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This method queries the <i>org.eclipse.ui.menus</i> extensions, and looks for menu
 * contributions with a locationURI <i>popup:classname</i>. Found contributions are added to the
 * {@link IMenuManager}.
 * 
 * @param manager
 * @param objects
 */
protected void addPopupCommandContributions(IMenuManager manager, Object[] selection){
	java.util.List<IConfigurationElement> contributions =
		Extensions.getExtensions("org.eclipse.ui.menus");
	for (IConfigurationElement contributionElement : contributions) {
		String locationUri = contributionElement.getAttribute("locationURI");
		String[] parts = locationUri.split(":");
		if (parts.length == 2) {
			if (parts[0].equals("popup") && parts[1].equals(getClass().getName())) {
				IConfigurationElement[] command = contributionElement.getChildren("command");
				if (command.length > 0) {
					addMenuContribution(command[0], manager, selection);
				}
			}
		}
	}
}
 
Example 4
Source File: ContributionExtensionManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void loadExtensionPoints()
{
	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IExtension[] extensions = registry.getExtensionPoint(getExtensionPoint()).getExtensions();

	for (int i = 0; i < extensions.length; i++)
	{
		IExtension extension = extensions[i];
		IConfigurationElement[] elements = extension.getConfigurationElements();
		for (IConfigurationElement main : elements)
		{
			if (isContentTypeContribution(main))
			{
				String natureId = main.getAttribute(CONTENT_TYPE);
				IConfigurationElement[] innerElements = main.getChildren();
				loadChildren(natureId, innerElements);
			}
		}
	}
}
 
Example 5
Source File: ContentProviderRegistry.java    From eclipsegraphviz with Eclipse Public License 1.0 6 votes vote down vote up
public ContentProviderDescriptor(IConfigurationElement configElement) {
    this.configElement = configElement;
    IConfigurationElement[] associationElements = configElement.getChildren("association");
    IContentTypeManager pcm = Platform.getContentTypeManager();
    for (IConfigurationElement associationEl : associationElements)
        associations.add(pcm.getContentType(associationEl.getAttribute("contentType")));
    IConfigurationElement[] readerElements = configElement.getChildren("reader");
    for (IConfigurationElement readerEl : readerElements)
        try {
            Object reader = readerEl.createExecutableExtension("class");
            readers.add(reader);
        } catch (CoreException e) {
            LogUtils.logError(ContentSupport.PLUGIN_ID, "Error processing content provider extension "
                    + configElement.getNamespaceIdentifier(), e);
        }
}
 
Example 6
Source File: DataSourceEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 
 * @param element
 */
private void addCustomPageODAV2( IConfigurationElement element )
{
	try
	{
		IConfigurationElement[] editorPages = element.getChildren( "dataSourceEditorPage" );//$NON-NLS-1$
		if ( editorPages != null && editorPages.length > 0 )
		{
			if ( editorPages != null )
			{
				for ( int n = 0; n < editorPages.length; n++ )
				{
					IPropertyPage page = (IPropertyPage) editorPages[n].createExecutableExtension( "class" );//$NON-NLS-1$
					addPageTo( editorPages[n].getAttribute( "path" ), editorPages[n].getAttribute( "name" ), editorPages[n].getAttribute( "displayName" ), null, page );//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				}

			}

		}

	}
	catch ( CoreException e )
	{
		ExceptionHandler.handle( e );
	}
}
 
Example 7
Source File: TabbedPropertyRegistryViewAware.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads property section extensions. Returns all section descriptors for
 * the current contributor id or an empty array if none is found.
 * 
 * @param viewId
 *        take care in which view it is
 */
protected ISectionDescriptor[] readSectionDescriptors(String viewId) {
    List<ISectionDescriptor> result = new ArrayList<ISectionDescriptor>();
    IConfigurationElement[] extensions = getConfigurationElements(EXTPT_SECTIONS);
    for (int i = 0; i < extensions.length; i++) {
        IConfigurationElement extension = extensions[i];
        IConfigurationElement[] sections = extension
                .getChildren(ELEMENT_SECTION);
        for (int j = 0; j < sections.length; j++) {
            IConfigurationElement section = sections[j];
            String sectionViewId = section.getAttribute("viewID"); //$NON-NLS-1$
            if (sectionViewId != null && sectionViewId.equals(viewId)) {
                ISectionDescriptor descriptor = new SectionDescriptor(section,
                        typeMapper);
                result.add(descriptor);
            }
        }
    }
    return result.toArray(new ISectionDescriptor[result.size()]);
}
 
Example 8
Source File: RegistryReader.java    From eclipsegraphviz with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Utility for extracting the value of a class attribute or a nested class
 * element that follows the pattern set forth by
 * {@link org.eclipse.core.runtime.IExecutableExtension}.
 * 
 * @param configElement
 *            the element
 * @param classAttributeName
 *            the name of the class attribute to check
 * @return the value of the attribute or nested class element
 * @since 3.1
 */
public static String getClassValue(IConfigurationElement configElement, String classAttributeName) {
    String className = configElement.getAttribute(classAttributeName);
    if (className != null) {
        return className;
    }
    IConfigurationElement[] candidateChildren = configElement.getChildren(classAttributeName);
    if (candidateChildren.length == 0) {
        return null;
    }

    return candidateChildren[0].getAttribute(ATT_CLASS);
}
 
Example 9
Source File: RenameTypeProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean select(IConfigurationElement element, RefactoringStatus status) {
	IConfigurationElement[] params= element.getChildren(PARAM);
	for (int i= 0; i < params.length; i++) {
		IConfigurationElement param= params[i];
		if ("handlesSimilarDeclarations".equals(param.getAttribute(NAME)) && //$NON-NLS-1$
				"false".equals(param.getAttribute(VALUE))) { //$NON-NLS-1$
			return false;
		}
	}
	return true;
}
 
Example 10
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public LoginContext[] getContextList ()
{
    final List<LoginContext> result = new LinkedList<LoginContext> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.core.ui.connection.login.context" ) ) //$NON-NLS-1$
    {
        if ( !"context".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        final String name = ele.getAttribute ( "label" ); //$NON-NLS-1$
        final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$

        // get properties
        final Map<String, String> properties = new HashMap<String, String> ();
        for ( final IConfigurationElement child : ele.getChildren ( "property" ) )//$NON-NLS-1$
        {
            final String key = child.getAttribute ( "key" );//$NON-NLS-1$
            final String value = child.getAttribute ( "value" );//$NON-NLS-1$
            if ( key != null && value != null )
            {
                properties.put ( key, value );
            }
        }

        final Collection<LoginFactory> factories = new LinkedList<LoginFactory> ();
        fillFactories ( factories, ele );

        if ( id != null && name != null && !factories.isEmpty () )
        {
            result.add ( new LoginContext ( id, name, factories, properties ) );
        }

    }

    return result.toArray ( new LoginContext[result.size ()] );
}
 
Example 11
Source File: TabbedPropertyRegistry.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads property section extensions. Returns all section descriptors for
 * the current contributor id or an empty array if none is found.
 */
protected ISectionDescriptor[] readSectionDescriptors() {
	List<ISectionDescriptor> result = new ArrayList<>();
	IConfigurationElement[] extensions = getConfigurationElements(EXTPT_SECTIONS);
	for (IConfigurationElement extension : extensions) {
		IConfigurationElement[] sections = extension
				.getChildren(ELEMENT_SECTION);
		for (IConfigurationElement section : sections) {
			ISectionDescriptor descriptor = new SectionDescriptor(section,
					typeMapper);
			result.add(descriptor);
		}
	}
	return result.toArray(new ISectionDescriptor[result.size()]);
}
 
Example 12
Source File: DataSetBasePage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private boolean hasWizard( )
{
	DataSetTypeElement dTypeElement = (DataSetTypeElement) getSelectedDataSet( );
	if ( dTypeElement == null )
	{
		return false;
	}
	if ( dTypeElement instanceof OdaDataSetTypeElement )
	{
		// Get the currently selected Data Set type and invoke its wizard
		// class
		IConfigurationElement element = ( (OdaDataSetTypeElement) dTypeElement ).getIConfigurationElement( );
		if ( element != null )
		{
			AbstractDataSetWizard newWizard = (AbstractDataSetWizard) htDataSetWizards.get( element.getAttribute( "id" ) );//$NON-NLS-1$
			if ( newWizard != null )
			{
				return true;
			}
			// Get the new wizard from this element
			IConfigurationElement[] v3elements = element.getChildren( "dataSetWizard" );//$NON-NLS-1$
			IConfigurationElement[] v2elements = element.getChildren( "newDataSetWizard" );//$NON-NLS-1$
			if ( v3elements.length > 0 || v2elements.length > 0 )
			{
				return true;
			}
		}
	}
	else if ( isScriptDataSet( dTypeElement.getDataSetTypeName( ) ) )
	{
		return true;
	}
	else
		return helper.hasWizard( getSelectedDataSource( ) );
	return false;
}
 
Example 13
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 14
Source File: TextHoverDescriptor.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @throws CoreException 
 * 
 */
private TextHoverDescriptor(IConfigurationElement configurationElement) throws CoreException {
	this.configurationElement = configurationElement;
	for (IConfigurationElement element : configurationElement.getChildren(TAG_CONTENT_TYPE)) {
		readElement(element);
	}
	IConfigurationElement[] elements = configurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
	enablementExpression = (elements.length > 0) ? ExpressionConverter.getDefault().perform(elements[0]) : null;
}
 
Example 15
Source File: MultiPageEditor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the required editor.
 *
 * @param topElementName the top element name
 * @param parsedResultClassName the parsed result class name
 * @return the required editor
 */
// otherwise instantiates a new editor
private  IUimaEditorExtension getRequiredEditor(String topElementName, String parsedResultClassName) {
  IUimaEditorExtension editor;
  // load external editor configurations if not already loaded
  if (null == externalEditorConfigurations) {
    getExternalEditorConfigurations();
  }
  
  for (IConfigurationElement xeditor : externalEditorConfigurations) {
    for (IConfigurationElement canEdit : xeditor.getChildren()) {
      String elementName = canEdit.getAttribute("elementName");
      String parseResultName = canEdit.getAttribute("internalParseClass");
      if ( ( (null != topElementName) && topElementName.equals(elementName)) ||
           ( (null != parsedResultClassName) && parsedResultClassName.equals(parseResultName)) ) {            
        try {
          editor = (IUimaEditorExtension) xeditor.createExecutableExtension(EXTENSION_TAG_CLASS_ATTRIB); 
        } catch (CoreException e) {
          Utility.popMessage("Unexpected Exception", "While trying to load an editor extension"
              + getMessagesToRootCause(e), MessageDialog.ERROR);
          return null;
        }
        editor.init();
        return editor;
      }
    }
  }
  return null;
}
 
Example 16
Source File: TmfExperimentElement.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String getEditorId() {
    /* See if a default editor was set for this experiment type */
    if (getTraceType() != null) {
        IConfigurationElement ce = TRACE_TYPE_UI_ATTRIBUTES.get(getTraceType());
        if (ce != null) {
            IConfigurationElement[] defaultEditorCE = ce.getChildren(TmfTraceTypeUIUtils.DEFAULT_EDITOR_ELEM);
            if (defaultEditorCE.length == 1) {
                return defaultEditorCE[0].getAttribute(TmfTraceType.ID_ATTR);
            }
        }
    }

    /* No default editor, try to find a common editor for all traces */
    final List<TmfTraceElement> traceEntries = getTraces();
    String commonEditorId = null;

    for (TmfTraceElement element : traceEntries) {
        // If all traces use the same editorId, use it, otherwise use the
        // default
        final String editorId = element.getEditorId();
        if (commonEditorId == null) {
            commonEditorId = (editorId != null) ? editorId : TmfEventsEditor.ID;
        } else if (!commonEditorId.equals(editorId)) {
            commonEditorId = TmfEventsEditor.ID;
        }
    }
    return null;
}
 
Example 17
Source File: GeneratorLocator.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public Map<Class<?>, Set<GeneratorFactory>> getFactories ()
{
    if ( this.cache == null )
    {
        logger.info ( "Rebuild factory cache" );

        this.cache = new HashMap<> ();
        for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_GENERATOR_FACTORY ) )
        {
            if ( !ELE_FACTORY.equals ( ele.getName () ) )
            {
                continue;
            }

            logger.debug ( "Checking factory - factory: {}", ele.getAttribute ( ATTR_CLASS ) );

            GeneratorFactory factory;
            try
            {
                factory = (GeneratorFactory)ele.createExecutableExtension ( ATTR_CLASS );
            }
            catch ( final CoreException e )
            {
                this.log.log ( e.getStatus () );
                logger.warn ( "Failed to create factory", e );
                continue;
            }

            for ( final IConfigurationElement child : ele.getChildren ( ELE_GENERATE_FOR ) )
            {
                logger.debug ( "Checking for -> {}", child.getAttribute ( ATTR_CLASS ) );

                final Class<?> sourceClass = makeSourceClass ( child );
                if ( sourceClass != null )
                {
                    addCacheEntry ( sourceClass, factory );
                }
            }
        }
    }
    return this.cache;
}
 
Example 18
Source File: ConnectionLoginFactory.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
protected Set<LoginConnection> loadConnections ( final String contextId )
{
    final Set<LoginConnection> result = new HashSet<LoginConnection> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.core.ui.connection.login.context" ) ) //$NON-NLS-1$
    {
        if ( !"context".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        if ( !contextId.equals ( ele.getAttribute ( "id" ) ) )
        {
            continue;
        }

        for ( final IConfigurationElement child : ele.getChildren ( "connection" ) )
        {
            final ConnectionInformation ci = ConnectionInformation.fromURI ( child.getAttribute ( "uri" ) );

            if ( ci == null )
            {
                throw new IllegalArgumentException ( String.format ( "Unable to parse connection uri: %s", child.getAttribute ( "uri" ) ) );
            }

            final Set<String> servicePids = new HashSet<String> ();

            final String modeString = child.getAttribute ( "mode" );
            final LoginConnection.Mode mode = modeString == null ? Mode.NORMAL : Mode.valueOf ( modeString );

            // load single service pid
            addServicePid ( servicePids, child.getAttribute ( "servicePid" ) );

            // load multi service pids
            for ( final IConfigurationElement registrationElement : child.getChildren ( "registration" ) )
            {
                addServicePid ( servicePids, registrationElement.getAttribute ( "servicePid" ) );
            }

            final Integer servicePriority;
            if ( child.getAttribute ( "servicePriority" ) != null )
            {
                servicePriority = Integer.parseInt ( child.getAttribute ( "servicePriority" ) );
            }
            else
            {
                servicePriority = null;
            }

            final Integer autoReconnectDelay;
            if ( child.getAttribute ( "autoReconnectDelay" ) != null )
            {
                autoReconnectDelay = Integer.parseInt ( child.getAttribute ( "autoReconnectDelay" ) );
            }
            else
            {
                autoReconnectDelay = null;
            }

            final boolean useCallbacks = Boolean.parseBoolean ( child.getAttribute ( "authUseCallbacks" ) );

            final LoginConnection lc = new LoginConnection ( ci, servicePids, autoReconnectDelay, servicePriority, mode, useCallbacks );
            result.add ( lc );
        }
    }

    return result;
}
 
Example 19
Source File: ICEExtensionContributionFactory.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createContributionItems(IServiceLocator serviceLoc, IContributionRoot additions) {

	// Local Declarations
	HashMap<String, MenuManager> categoryMenus = new HashMap<String, MenuManager>();
	String codeName = "", category = "";
	MenuManager codeMenu = null;

	// Set the ServiceLocator
	serviceLocator = serviceLoc;

	// Create the Developer Menu Item
	developerMenu = new MenuManager("&Developer", "iceDev");

	// Get the registry and the extensions
	registry = Platform.getExtensionRegistry();

	// Create the category sub-menus
	for (CodeCategory c : CodeCategory.values()) {
		MenuManager manager = new MenuManager(c.name(), c.name() + "ID");
		manager.setVisible(true);
		categoryMenus.put(c.name(), manager);
		developerMenu.add(manager);
	}

	// Get the Extension Points
	IExtensionPoint extensionPoint = registry.getExtensionPoint("org.eclipse.ice.developer.code");
	IExtension[] codeExtensions = extensionPoint.getExtensions();

	// Loop over the rest of the Extensions and create
	// their sub-menus.
	for (IExtension code : codeExtensions) {
		// Get the name of the bundle this extension comes from
		// so we can instantiate its AbstractHandlers
		String contributingPlugin = code.getContributor().getName();

		// Get the elements of this extension
		IConfigurationElement[] elements = code.getConfigurationElements();
		for (IConfigurationElement e : elements) {
			// Get the Code Name
			codeName = e.getAttribute("codeName");
			
			// Get whether this is the ICE declaration
			boolean isICE = "ICE".equals(codeName);
			
			// Get the Code Category - Framework, Physics, etc...
			category = isICE ? codeName : e.getAttribute("codeCategory");

			// Create a sub menu for the code in the
			// correct category, if this is not ICE ( we've already done it for ICE)
			codeMenu = isICE ? categoryMenus.get(codeName)
					: new MenuManager(codeName, codeName + "ID");

			// Generate the IParameters for the Command
			generateParameters(e);

			// Create a menu item for each extra command they provided
			for (IConfigurationElement command : e.getChildren("command")) {
				generateParameters(command);
				createCommand(contributingPlugin, command.getAttribute("implementation"), codeMenu);
			}

			// Add it to the correct category menu
			if (!"ICE".equals(codeName)) {
				categoryMenus.get(category).add(codeMenu);
			}
		}
		
		parameters.clear();
	}

	// Add the newly constructed developer menu
	additions.addContributionItem(developerMenu, null);

	return;
}
 
Example 20
Source File: CompletionProposalComputerDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates a new descriptor.
 *
 * @param element the configuration element to read
 * @param registry the computer registry creating this descriptor
 * @param categories the categories
 * @throws InvalidRegistryObjectException if this extension is no longer valid
 * @throws CoreException if the extension contains invalid values
 */
CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List<CompletionProposalCategory> categories) throws InvalidRegistryObjectException, CoreException {
	Assert.isLegal(registry != null);
	Assert.isLegal(element != null);

	fRegistry= registry;
	fElement= element;
	IExtension extension= element.getDeclaringExtension();
	fId= extension.getUniqueIdentifier();
	checkNotNull(fId, "id"); //$NON-NLS-1$

	String name= extension.getLabel();
	if (name.length() == 0)
		fName= fId;
	else
		fName= name;

	Set<String> partitions= new HashSet<String>();
	IConfigurationElement[] children= element.getChildren(PARTITION);
	if (children.length == 0) {
		fPartitions= PARTITION_SET; // add to all partition types if no partition is configured
	} else {
		for (int i= 0; i < children.length; i++) {
			String type= children[i].getAttribute(TYPE);
			checkNotNull(type, TYPE);
			partitions.add(type);
		}
		fPartitions= Collections.unmodifiableSet(partitions);
	}

	String activateAttribute= element.getAttribute(ACTIVATE);
	fActivate= Boolean.valueOf(activateAttribute).booleanValue();

	String needsSortingAfterFilteringAttribute= element.getAttribute(NEEDS_SORTING_AFTER_FILTERING);
	fNeedsSortingAfterFiltering= Boolean.valueOf(needsSortingAfterFilteringAttribute).booleanValue();

	fClass= element.getAttribute(CLASS);
	checkNotNull(fClass, CLASS);

	String categoryId= element.getAttribute(CATEGORY_ID);
	if (categoryId == null)
		categoryId= DEFAULT_CATEGORY_ID;
	CompletionProposalCategory category= null;
	for (Iterator<CompletionProposalCategory> it= categories.iterator(); it.hasNext();) {
		CompletionProposalCategory cat= it.next();
		if (cat.getId().equals(categoryId)) {
			category= cat;
			break;
		}
	}
	if (category == null) {
		// create a category if it does not exist
		fCategory= new CompletionProposalCategory(categoryId, fName, registry);
		categories.add(fCategory);
	} else {
		fCategory= category;
	}
}