Author: vrubezhny
Date: 2009-10-19 13:21:45 -0400 (Mon, 19 Oct 2009)
New Revision: 18170
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
Log:
JBIDE-3563: Code assist for "class" and "styleClass" attributes for
html and jsf tags.
Minor changes (commented)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java 2009-10-19
17:04:32 UTC (rev 18169)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java 2009-10-19
17:21:45 UTC (rev 18170)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb;
import java.util.List;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java 2009-10-19
17:04:32 UTC (rev 18169)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java 2009-10-19
17:21:45 UTC (rev 18170)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb;
import java.util.List;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2009-10-19
17:04:32 UTC (rev 18169)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2009-10-19
17:21:45 UTC (rev 18170)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb.include;
import java.util.ArrayList;
@@ -7,9 +17,15 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.internal.registry.RegistryReader;
-
import org.jboss.tools.jst.web.kb.WebKbPlugin;
+/**
+ * Include Context Builder is used to read and store the information from the
+ * Include schema.
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class IncludeContextBuilder extends RegistryReader {
// extension point ID
public static final String PL_INCLUDE = "KbIncludeContext"; //$NON-NLS-1$
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java 2009-10-19
17:04:32 UTC (rev 18169)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java 2009-10-19
17:21:45 UTC (rev 18170)
@@ -1,33 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb.include;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.internal.EarlyStartupRunnable;
+/**
+ * IncludeContextDefinition is used to store the definitions read from the Include
Schema
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class IncludeContextDefinition {
private String fUri;
private Map<String, Set<String>> fIncludeTags; // Map<TagName,
Set<AttributeName>>
private Map<String, Set<String>> fCSSTags; // Map<TagName,
Set<AttributeName>>
private Map<String, Set<String>> fContexts; // Map<ContextType,
Set<ContentType>>
+ /**
+ * Created the IncludeContextDefinition object for the specified URI
+ *
+ * @param uri
+ */
public IncludeContextDefinition(String uri) {
this.fUri = uri;
}
+ /**
+ * Returns the URI for this IncludeContextDefinition object
+ *
+ * @return
+ */
public String getUri() {
return fUri;
}
+ /**
+ * Sets up the specified URI for this IncludeContextDefinition object
+ *
+ * @param uri
+ */
public void setUri(String uri) {
this.fUri = uri;
}
+ /**
+ * Adds a tag to the definition
+ *
+ * @param tagName
+ * @param element
+ * @return
+ */
public boolean addTag(String tagName, IConfigurationElement element) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
@@ -41,7 +76,13 @@
return false;
}
- public void addIncludeTag(String tagName, IConfigurationElement element) {
+ /**
+ * Adds an Include Tag to the Definition
+ *
+ * @param tagName
+ * @param element
+ */
+ private void addIncludeTag(String tagName, IConfigurationElement element) {
if (fIncludeTags == null) {
fIncludeTags = new HashMap<String, Set<String>>();
}
@@ -52,7 +93,13 @@
}
}
- public void addCSSTag(String tagName, IConfigurationElement element) {
+ /**
+ * Adds a CSS Style Sheet holder to the Definition
+ *
+ * @param tagName
+ * @param element
+ */
+ private void addCSSTag(String tagName, IConfigurationElement element) {
if (fCSSTags == null) {
fCSSTags = new HashMap<String, Set<String>>();
}
@@ -63,6 +110,12 @@
}
}
+ /**
+ * Adds a Tag Attribute to the Definition
+ *
+ * @param attributeName
+ * @param element
+ */
public void addTagAttribute(String attributeName, IConfigurationElement element) {
IConfigurationElement parentTagElement = null;
if (element.getParent() instanceof IConfigurationElement) {
@@ -95,6 +148,14 @@
}
}
+ /**
+ * Checks if the configuration element with the name specified exists in parents of the
+ * specified configuration element
+ *
+ * @param element
+ * @param elementName
+ * @return
+ */
private boolean isInParentElements(IConfigurationElement element, String elementName) {
Object parent = element.getParent();
while (parent instanceof IConfigurationElement) {
@@ -107,6 +168,12 @@
return false;
}
+ /**
+ * Adds a Context Type to the Definition
+ *
+ * @param id
+ * @param element
+ */
public void addContextType(String id, IConfigurationElement element) {
if (fContexts == null) {
fContexts = new HashMap<String, Set<String>>();
@@ -119,6 +186,13 @@
}
+ /**
+ * Adds a Content Type to the Definition
+ *
+ * @param id
+ * @param element
+ * @return
+ */
public boolean addContentType(String id, IConfigurationElement element) {
IConfigurationElement parentContextElement = null;
if (element.getParent() instanceof IConfigurationElement) {
@@ -142,17 +216,32 @@
private static final String[] EMPTY_CHILDREN = new String[0];
-
+ /**
+ * Returns the Include Tags stored in the Definition
+ *
+ * @return
+ */
public String[] getIncludeTags() {
return fIncludeTags == null ? EMPTY_CHILDREN :
(String[])fIncludeTags.keySet().toArray(new String[fIncludeTags.size()]);
}
+ /**
+ * Returns the CSS Style Sheet holder Tags stored in the Definition
+ *
+ * @return
+ */
public String[] getCSSTags() {
return fCSSTags == null ? EMPTY_CHILDREN :
(String[])fCSSTags.keySet().toArray(new String[fCSSTags.size()]);
}
+ /**
+ * Returns the Attributes for the Include Tag with the specified Name
+ *
+ * @param tagName
+ * @return
+ */
public String[] getIncludeTagAttributes(String tagName) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
@@ -163,6 +252,12 @@
(String[])attrSet.toArray(new String[attrSet.size()]);
}
+ /**
+ * Returns the Attributes for the CSS Style Sheet Holder Tag with the specified Name
+ *
+ * @param tagName
+ * @return
+ */
public String[] getCSSTagAttributes(String tagName) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
@@ -172,6 +267,13 @@
return attrSet == null ? EMPTY_CHILDREN :
(String[])attrSet.toArray(new String[attrSet.size()]);
}
+
+ /**
+ * Returns the ContextType for the specified Content Type
+ *
+ * @param contentType
+ * @return
+ */
public String getContextType(String contentType) {
if (fContexts == null)
return null;
@@ -182,5 +284,4 @@
}
return null;
}
-
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-10-19
17:04:32 UTC (rev 18169)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-10-19
17:21:45 UTC (rev 18170)
@@ -1,34 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.taglib;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
import org.w3c.dom.css.CSSStyleSheet;
+/**
+ * The CSS Class proposal type. Is used to collect and return the proposals on
+ * the CSS classes
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class CSSClassProposalType extends CustomProposalType {
private static final String IMAGE_NAME = "EnumerationProposal.gif";
//$NON-NLS-1$
private static Image ICON;