Author: vrubezhny
Date: 2007-07-04 10:10:54 -0400 (Wed, 04 Jul 2007)
New Revision: 2284
Removed:
trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
Log:
http://jira.jboss.org/jira/browse/EXIN-330
Rolled back
The schema and content assist processor definition builder are moved to
org.jboss.tools.common.text.xml plugin
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF 2007-07-04
13:25:39 UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF 2007-07-04
14:10:54 UTC (rev 2284)
@@ -2,7 +2,6 @@
Eclipse-LazyStart: true
Bundle-Activator: org.jboss.tools.common.text.ext.ExtensionsPlugin
Export-Package: org.jboss.tools.common.text.ext,
- org.jboss.tools.common.text.ext.contentassist,
org.jboss.tools.common.text.ext.hyperlink,
org.jboss.tools.common.text.ext.hyperlink.jsp,
org.jboss.tools.common.text.ext.hyperlink.xml,
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2007-07-04 13:25:39
UTC (rev 2283)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2007-07-04 14:10:54
UTC (rev 2284)
@@ -4,7 +4,6 @@
<extension-point id="hyperlink" name="Hyperlink Extension Point
Extension" schema="schema/hyperlink.exsd"/>
<extension-point id="hyperlinkPartitioner" name="Hyperlink
Partitioner Extension Point Extension"
schema="schema/hyperlinkPartitioner.exsd"/>
- <extension-point id="contentAssistProcessor" name="Content Assist
Processor Extension Point Extension"
schema="schema/contentAssistProcessor.exsd"/>
<extension
point="org.jboss.tools.common.text.ext.hyperlinkPartitioner"
Deleted:
trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd 2007-07-04
13:25:39 UTC (rev 2283)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/schema/contentAssistProcessor.exsd 2007-07-04
14:10:54 UTC (rev 2284)
@@ -1,153 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.tools.common.text.ext">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.jboss.tools.common.text.ext"
id="contentAssistProcessor" name="Content Assist Processor Extension Point
Extension"/>
- </appInfo>
- <documentation>
- Content Assist Processor
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <documentation>
- Defines an extension point for the Content Assist Processor definitions.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="contentAssistProcessor" minOccurs="1"
maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string"
use="required">
- <annotation>
- <documentation>
- A unique ID for this extension point. It is recommended that the plugin
ID be used to prefix any extensions.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- A unique ID for this extension. It is recommended that the plugin ID
be used to prefix any extensions.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- A brief name to show to the user.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="contentAssistProcessor">
- <annotation>
- <documentation>
- Defines a Content Assist Processor item. Contains information on a class to
be used to perform content assist depending on the content and partition types.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="partitiontype" minOccurs="1"
maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="string"
use="required">
- <annotation>
- <documentation>
- A unique ID for this Content Assist Processor.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string"
use="required">
- <annotation>
- <documentation>
- An implementor of
org.eclipse.jface.text.contentassist.IContentAssistProcessor, it controls the content
assist within text editor.
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="partitiontype">
- <annotation>
- <documentation>
- Defined the editor's partition type to be assotiated with the
Content Assist Processor. The value is either one of the WTP structured model partition
type ID or any other structured text partition ID
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string"
use="required">
- <annotation>
- <documentation>
- A unique ID for this partitiontype. The value is either one of the WTP
structured model partition type ID or any other structured text partition ID.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- V3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- <pre>
- <extension-point id="contentAssistProcessor"
name="Content Assist Processor Extension Point Extension"/>
-
- <extension
- point="org.jboss.tools.common.text.ext.contentAssistProcesor"
- id="org.jboss.tools.common.text.ext.contentAssistProcessor"
-
name="org.jboss.tools.common.text.ext.contentAssistProcessor">
-
- <contentAssistProcessor
-
class="org.jboss.tools.common.text.xml.contentassist.MyContentAssistProcessor"
-
id="org.jboss.tools.common.text.xml.contentassist.MyContentAssistProcessorID">
- <partitiontype
id="org.jboss.tools.common.text.xml.XML_DOCTYPE" />
- </contentAssistProcessor>
- </extension>
-</pre>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The baseline for API and extension point stability is RedHat Developer Studio
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The supplied implementation of the contentAssistProcessor functionality requires
the WTP components.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- RedHat
- </documentation>
- </annotation>
-
-</schema>
Deleted:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java 2007-07-04
13:25:39 UTC (rev 2283)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorBuilder.java 2007-07-04
14:10:54 UTC (rev 2284)
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.common.text.ext.contentassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
-import org.jboss.tools.common.text.ext.util.xpl.RegistryReader;
-
-public class ContentAssistProcessorBuilder extends RegistryReader{
- // extension point ID
- public static final String PL_CONTENTASSISTPROCESSOR =
"contentAssistProcessor"; //$NON-NLS-1$
-
- public static final String TAG_CONTENTASSISTPROCESSOR =
"contentAssistProcessor"; //$NON-NLS-1$
- public static final String TAG_PARTITION_TYPE = "partitiontype";
//$NON-NLS-1$
-
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
-
- protected String targetContributionTag;
-
- private static ContentAssistProcessorBuilder fInstance;
-
- private List<ContentAssistProcessorDefinition> fContentAssistProcessorDefs =
null;
- private ContentAssistProcessorDefinition fCurrentDefinition = null;
-
- /**
- * returns singleton instance of ContentAssistProcessorBuilder
- *
- * @return ContentAssistProcessorBuilder
- */
- public synchronized static ContentAssistProcessorBuilder getInstance() {
- if (fInstance == null) {
- fInstance = new ContentAssistProcessorBuilder();
- }
- return fInstance;
- }
-
- /**
- * Returns the name of the part ID attribute that is expected
- * in the target extension.
- *
- * @param element
- * @return String
- */
- protected String getId(IConfigurationElement element) {
- String value = element.getAttribute(ATT_ID);
- return value;
- }
-
- protected String getContentAssistProcessorClass(IConfigurationElement element) {
- String value = element.getAttribute(ATT_CLASS);
- return value;
- }
-
- /**
- * Processes element which should be a configuration element specifying an
- * open on object. Creates a new ContentAssistProcessor definitio object and adds it to
the
- * list of ContentAssistProcessor definition objects
- *
- * @param element ContentAssistProcessor configuration element
- */
- private void processContentAssistProcessorTag(IConfigurationElement element) {
- String theId = getId(element);
- String theClass = getContentAssistProcessorClass(element);
-
- if (theId != null && theClass != null) {
- // start building new HyperlinkDefinition
- fCurrentDefinition = new ContentAssistProcessorDefinition(theId, theClass, element);
-
- // create a new list of open on definitions if it hasn't been created yet
- if (fContentAssistProcessorDefs == null) {
- fContentAssistProcessorDefs = new
ArrayList<ContentAssistProcessorDefinition>();
- }
- fContentAssistProcessorDefs.add(fCurrentDefinition);
- }
- else {
- fCurrentDefinition = null;
- }
- }
-
- /**
- * Processes element which should be a configuration element specifying a partition
- * type for the current contentAssistProcessor tag. Assumes that there is a valid
- * current contentAssistProcessor tag.
- *
- * @param element partitiontype configuration element
- */
- private void processPartitionTypeTag(IConfigurationElement element) {
- // add to current HyperlinkDefinition/contentType
- String theId = getId(element);
-
- if (theId != null) {
- fCurrentDefinition.addPartitionType(theId);
- }
- }
-
- /* (non-Javadoc)
- * @see
com.ibm.sse.editor.internal.extension.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
-
- if (tag.equals(targetContributionTag)) {
- processContentAssistProcessorTag(element);
-
- if (fCurrentDefinition != null) {
- readElementChildren(element);
- }
- return true;
- }
- else if (tag.equals(TAG_PARTITION_TYPE)) {
- processPartitionTypeTag(element);
- return true;
- }
-
- return false;
- }
-
- private void initCache() {
- if (fContentAssistProcessorDefs == null) {
- readContributions(TAG_CONTENTASSISTPROCESSOR, PL_CONTENTASSISTPROCESSOR);
- }
- }
-
- /**
- * Returns all the ContentAssistProcessor definition objects
- * @return
- */
- public ContentAssistProcessorDefinition[] getContentAssistProcessorDefinitions() {
- initCache();
- return (fContentAssistProcessorDefs == null ? new ContentAssistProcessorDefinition[0] :
- (ContentAssistProcessorDefinition[])fContentAssistProcessorDefs.toArray(new
ContentAssistProcessorDefinition[fContentAssistProcessorDefs.size()]));
- }
-
- /**
- * Returns all the ContentAssistProcessor definition objects valid for partitionType
- *
- * @param partitionType
- * @return if partitionType is null, null is returned
- */
- public ContentAssistProcessorDefinition[] getContentAssistProcessorDefinitions(String
partitionType) {
- if (partitionType == null) {
- return null;
- }
-
- ContentAssistProcessorDefinition[] allDefs = getContentAssistProcessorDefinitions();
- List defs = new ArrayList();
- List lastDefs = new ArrayList();
-
- for (int i = 0; i < allDefs.length; ++i) {
- List partitions = (List) allDefs[i].getPartitionTypes();
- if (partitions != null) {
- if (partitions.isEmpty()) {
- lastDefs.add(allDefs[i]);
- }
- else {
- int j = 0;
- boolean added = false;
- while (j < partitions.size() && !added) {
- if (partitionType.equals(partitions.get(j))) {
- defs.add(allDefs[i]);
- added = true;
- }
- else {
- ++j;
- }
- }
- }
- }
- }
- defs.addAll(lastDefs);
-
- return (ContentAssistProcessorDefinition[]) defs.toArray(new
ContentAssistProcessorDefinition[defs.size()]);
- }
-
- /**
- * @param tag
- * @param extensionPoint
- */
- protected void readContributions(String tag, String extensionPoint) {
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, ExtensionsPlugin.PLUGIN_ID, extensionPoint);
- }
-
-}
Deleted:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java 2007-07-04
13:25:39 UTC (rev 2283)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/contentassist/ContentAssistProcessorDefinition.java 2007-07-04
14:10:54 UTC (rev 2284)
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.common.text.ext.contentassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
-import org.osgi.framework.Bundle;
-
-public class ContentAssistProcessorDefinition {
- private String fId = null;
- private String fClassName = null;
-
- // a list of partition types (String)
- private List fPartitionTypes = null;
-
- private IConfigurationElement fConfigurationElement = null;
-
- /**
- * @param id
- * @param class1
- * @param configurationElement
- */
- public ContentAssistProcessorDefinition(String id, String class1, IConfigurationElement
configurationElement) {
- super();
- fId = id;
- fClassName = class1;
- fConfigurationElement = configurationElement;
- fPartitionTypes = new ArrayList();
- }
-
- public void addPartitionType(String partitionType) {
- if (!fPartitionTypes.contains(partitionType))
- fPartitionTypes.add(partitionType);
- }
-
- /**
- * @return Returns the fClass.
- */
- public String getClassName() {
- return fClassName;
- }
-
- /**
- * @return Returns the fConfigurationElement.
- */
- public IConfigurationElement getConfigurationElement() {
- return fConfigurationElement;
- }
-
- /**
- * @return Returns the fId.
- */
- public String getId() {
- return fId;
- }
-
- /**
- * @return IContentAssistProcessor for this definition
- */
- public IContentAssistProcessor createContentAssistProcessor() {
- IContentAssistProcessor contentAssistProcessor = null;
-
- if (getClassName() != null) {
- contentAssistProcessor = (IContentAssistProcessor)
createExtension(ContentAssistProcessorBuilder.ATT_CLASS);
- }
-
- return contentAssistProcessor;
- }
-
- /**
- * Creates an extension. If the extension plugin has not
- * been loaded a busy cursor will be activated during the duration of
- * the load.
- * @param propertyName
- * @return Object
- */
- private Object createExtension(String propertyName) {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- final IConfigurationElement element = getConfigurationElement();
- final String name = propertyName;
-
- final Object[] result = new Object[1];
- Bundle bundle =
Platform.getBundle(element.getDeclaringExtension().getNamespaceIdentifier());
- if (bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
- try {
- return element.createExecutableExtension(name);
- }
- catch (CoreException e) {
- handleCreateExecutableException(result, e);
- }
- }
- else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = element.createExecutableExtension(name);
- }
- catch (Exception e) {
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- return result[0];
- }
-
- /**
- * @param result
- * @param e
- */
- private void handleCreateExecutableException(Object[] result, Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in creating extension", x);
- result[0] = null;
- }
-
- /**
- * @return Returns the fPartitionTypes.
- */
- public List getPartitionTypes() {
- return fPartitionTypes;
- }
-}