[jbosstools-commits] JBoss Tools SVN: r7146 - in trunk: common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Mar 27 09:13:43 EDT 2008


Author: akazakov
Date: 2008-03-27 09:13:43 -0400 (Thu, 27 Mar 2008)
New Revision: 7146

Removed:
   trunk/common/plugins/org.jboss.tools.common.kb/resources/icons/
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/DtdDeclarationException.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/JspKbConnector.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdConvertor.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdResource.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdStore.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlMap.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbIcon.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbJspDirectiveStore.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPreferencesConstants.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/XmlKbConnector.java
Modified:
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorType.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPlugin.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/TagDescriptor.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbConfiguration.java
   trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbPluginConfiguration.java
   trunk/common/tests/org.jboss.tools.common.kb.test/src/org/jboss/tools/common/kb/test/resources/TestDynamicResource.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdTaglibResource.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1495

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/DtdDeclarationException.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/DtdDeclarationException.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/DtdDeclarationException.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-/**
- * @author eskimo
- */
-public class DtdDeclarationException extends Exception {
-
-	private static final long serialVersionUID = 7273236131209833023L;
-}

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/JspKbConnector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/JspKbConnector.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/JspKbConnector.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,446 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
-/**
- * @author eskimo
- */
-public class JspKbConnector implements KbConnector {
-
-	private ArrayList<KbResource> registretedResources;
-	private ArrayList<KbDinamicResource> registretedDinamicResources;
-//	private static KbResource jsfVariables = JsfValuesResource.getInstance();
-
-	/**
-	 * 
-	 *
-	 */
-	public JspKbConnector() {
-		registretedResources = new ArrayList<KbResource>();
-		registretedDinamicResources = new ArrayList<KbDinamicResource>();
-		KbResource jspResource = KbTldStore.getInstance().getJspResource();
-		if(jspResource!=null) {
-			registretedResources.add(jspResource);
-		}
-//		registerResource(jsfVariables);
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbConnector#queryTagInformation(org.jboss.tools.common.kb.KbQuery)
-	 */
-	public TagDescriptor getTagInformation(String query) throws KbException {
-		KbPlugin.getPluginLog().logInfo("Query=" + query);
-		String lastTag = getLastCompleteTag(query);
-		KbPlugin.getPluginLog().logInfo("lastTag=" + lastTag);
-		if(lastTag==null) {
-			return null;
-		}
-		if(lastTag.indexOf(KbQuery.PREFIX_SEPARATOR)<0) {
-			return KbHtmlStore.getInstance().queryTagInformation(new KbQuery(query, registretedResources));
-		}
-//		StringBuffer tldQuery = new StringBuffer();
-//		tldQuery.append(KbQuery.TAG_SEPARATOR).append(lastTag).append(KbQuery.TAG_SEPARATOR);
-//		return KbTldStore.getInstance().queryTagInformation(new KbQuery(tldQuery.toString(), registretedResources));
-		return KbTldStore.getInstance().queryTagInformation(new KbQuery(query, registretedResources));
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbConnector#getProposals()
-	 **/
-	public Collection getProposals(String query) throws KbException {
-		if(KbPlugin.isDebugEnabled()) { 
-			KbPlugin.getPluginLog().logInfo("--> JspKbConnector.getProposals(String query)");
-			KbPlugin.getPluginLog().logInfo("Query=" + query);
-		} 
-
-		int tagSeparator = query.indexOf(KbQuery.TAG_SEPARATOR);
-		boolean jspDirectiveQuery = query.startsWith(KbQuery.JSP_DIRECTIVE_QUERY);
-		if((tagSeparator<0)&&(!jspDirectiveQuery)) {
-			// Bad query
-			String errorMessage = "ERROR: Bad query: " + query + ". Query must starts with \"" + KbQuery.TAG_SEPARATOR + "\" or \"" + KbQuery.JSP_DIRECTIVE_QUERY + "\"";
-			if(KbPlugin.isDebugEnabled()) { 
-				KbPlugin.getPluginLog().logInfo(errorMessage);
-			}
-			throw new IllegalArgumentException(errorMessage);
-		}
-
-		boolean autocompleteRequiredAttributes = KbConfigurationFactory.getInstance().getDefaultConfiguration().isAutocompleteRequiredAttributes(); 
-
-		Collection<KbProposal> jspDirectiveProposals = new ArrayList<KbProposal>();
-		if(query.startsWith(KbQuery.JSP_DIRECTIVE_QUERY)) {
-			jspDirectiveProposals = KbJspDirectiveStore.getInstance().queryProposal(new KbQuery(query));
-			if(!autocompleteRequiredAttributes) {
-				removeAutocompleteRequiredAttributes(jspDirectiveProposals);
-			}
-
-			if(KbPlugin.isDebugEnabled()) { 
-				KbPlugin.getPluginLog().logInfo("<-- JspKbConnector.getProposals(String query)");
-				KbPlugin.getPluginLog().logInfo("    proposals size=" + jspDirectiveProposals.size());
-			}
-
-			return jspDirectiveProposals;
-		} else if(query.lastIndexOf(KbQuery.TAG_SEPARATOR) + KbQuery.TAG_SEPARATOR.length() == query.length()) {
-			jspDirectiveProposals = KbJspDirectiveStore.getInstance().queryProposal(new KbQuery(KbQuery.JSP_DIRECTIVE_QUERY));
-		}
-
-		JspQuery jspQuery = parseQuery(query);
-
-		String tldQuery = jspQuery.getTldQuery();
-		String htmlQuery = jspQuery.getHtmlQuery();
-
-		if(KbPlugin.isDebugEnabled()) { 
-			KbPlugin.getPluginLog().logInfo("tld query - " + tldQuery);
-			KbPlugin.getPluginLog().logInfo("html query - " + htmlQuery);
-		}
-
-		Collection<KbProposal> tldProposals = new ArrayList<KbProposal>();
-		Collection<KbProposal> htmlProposals = new ArrayList<KbProposal>();
-
-		if(tldQuery!=null) {
-			KbQuery kbQuery = new KbQuery(tldQuery, registretedResources, registretedDinamicResources);
-			tldProposals = KbTldStore.getInstance().queryProposal(kbQuery);
-		}
-
-		if(jspQuery.getLastTldTag()!=null) {
-			String mask = "";
-			int lastSeparator = query.lastIndexOf(KbQuery.TAG_SEPARATOR);
-			if((lastSeparator!=-1)&&(lastSeparator + KbQuery.TAG_SEPARATOR.length()<query.length())) {
-				mask = query.substring(lastSeparator + KbQuery.TAG_SEPARATOR.length());
-			}
-
-			if(((mask.indexOf(KbQuery.DONT_FILTER_END_TAG_CHAR)!=-1)&&(KbQuery.DONT_FILTER_END_TAG_CHAR + jspQuery.getLastTldTag()).startsWith(mask))||(mask.equals(""))) {
-				KbProposal proposal = new KbProposal();
-				String label = "/" + jspQuery.getLastTldTag();
-				proposal.setLabel(label);
-				proposal.setReplacementString(label);
-				proposal.setIcon(KbIcon.TLD_TAG);
-				if(tldProposals instanceof List) {
-					((List<KbProposal>)tldProposals).add(0, proposal);
-				} else {
-					tldProposals.add(proposal);
-				}
-			}
-		}
-
-		if(htmlQuery!=null) {
-			boolean lowerCase = KbConfigurationFactory.getInstance().getDefaultConfiguration().isLowerCase();
-			KbQuery kbQuery = new KbQuery(htmlQuery);
-			htmlProposals = KbHtmlStore.getInstance().queryProposal(kbQuery);
-			changeCase(htmlProposals, lowerCase);
-		}
-
-		ArrayList<KbProposal> proposals = mergeCollection(tldProposals, htmlProposals);
-		proposals = mergeCollection(proposals, jspDirectiveProposals);
-		proposals = sortProposals(proposals, query);
-
-		if(!autocompleteRequiredAttributes) {
-			removeAutocompleteRequiredAttributes(proposals);
-		}
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- JspKbConnector.getProposals(String query)");
-			KbPlugin.getPluginLog().logInfo("    proposals size=" + proposals.size());
-		}
-
-		return proposals;
-	}
-
-	private ArrayList<KbProposal> mergeCollection(Collection<KbProposal> col1, Collection<KbProposal> col2) {
-		ArrayList<KbProposal> arrayList = new ArrayList<KbProposal>();
-		Iterator<KbProposal> iterator = col1.iterator();
-		while(iterator.hasNext()) {
-			arrayList.add(iterator.next());
-		}
-		iterator = col2.iterator();
-		while(iterator.hasNext()) {
-			arrayList.add(iterator.next());
-		}
-		return arrayList;
-	}
-
-	private ArrayList<KbProposal> sortProposals(Collection<KbProposal> proposals, String query) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> JspKbConnector.sortProposals(Collection proposals)");
-//			KbPlugin.getPluginLog().logInfo("Proposals = " + proposals);
-		}
-
-		ArrayList<KbProposal> closeTags = new ArrayList<KbProposal>();
-		ArrayList<KbProposal> openTags = new ArrayList<KbProposal>(proposals.size());
-
-		for(Iterator<KbProposal> iter = proposals.iterator(); iter.hasNext();) {
-			KbProposal proposal = iter.next();
-			if(proposal.isCloseTag()) {
-				closeTags.add(proposal);
-			} else {
-				openTags.add(proposal);
-			}
-		}
-
-		String lastTag = getLastCompleteTag(query);
-		if((lastTag!=null)&&(closeTags.size()>0)) {
-			for(Iterator iter = closeTags.iterator(); iter.hasNext();) {
-				KbProposal proposal = (KbProposal)iter.next();
-				if(proposal.getLabel().equals("/" + lastTag)) {
-					closeTags.remove(proposal);
-					closeTags.add(0, proposal);
-					break;
-				}
-			}
-		}
-
-		ArrayList<KbProposal> collection = mergeCollection(closeTags, openTags);
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- JspKbConnector.sortProposals()");
-//			KbPlugin.getPluginLog().logInfo("return Collection = [" + collection +"]");
-		}
-
-		return collection;
-	}
-
-	private JspQuery parseQuery(String query) {
-		JspQuery jspQuery = new JspQuery();
-
-		jspQuery.setLastTldTag(getLastTldTag(query));
-
-		String lastTag = getLastTagMask(query);
-		if(lastTag.indexOf(KbQuery.ATTRIBUTE_SEPARATOR)!=-1) {
-			if(lastTag.indexOf(KbQuery.PREFIX_SEPARATOR)!=-1) {
-				jspQuery.setTldQuery(KbQuery.TAG_SEPARATOR + lastTag);
-				return jspQuery; 
-			}
-			jspQuery.setHtmlQuery(KbQuery.TAG_SEPARATOR + lastTag);
-			return jspQuery;
-		}
-		jspQuery.setTldQuery(KbQuery.TAG_SEPARATOR + lastTag);
-
-		if(lastTag.indexOf(KbQuery.PREFIX_SEPARATOR)!=-1) {
-			return jspQuery;
-		}
-
-		StringTokenizer tags = new StringTokenizer(query, KbQuery.TAG_SEPARATOR, true);
-
-		StringBuffer htmlQuery = new StringBuffer();
-		while(tags.hasMoreTokens()) {
-			String tag = tags.nextToken();
-			if(!htmlQuery.toString().endsWith(KbQuery.TAG_SEPARATOR)) {
-				htmlQuery.append(KbQuery.TAG_SEPARATOR);
-			}
-			if(tag.equals(KbQuery.TAG_SEPARATOR)) {
-				continue;
-			}
-			if(tag.indexOf(KbQuery.PREFIX_SEPARATOR) < 0) {
-				htmlQuery.append(tag);
-			}
-		}
-
-		jspQuery.setHtmlQuery(htmlQuery.toString());
-
-		return jspQuery;
-	}
-
-	private String getLastTldTag(String query) {
-		StringTokenizer tags = new StringTokenizer(query, KbQuery.TAG_SEPARATOR, true);
-
-		String lastTag = null;
-		while(tags.hasMoreTokens()) {
-			String tag = tags.nextToken();
-			if(tag.equals(KbQuery.TAG_SEPARATOR)) {
-				continue;
-			}
-			if((tag.indexOf(KbQuery.PREFIX_SEPARATOR) != -1)&&(tags.hasMoreTokens())) {
-//				KbPlugin.log("tag - " + tag);
-				lastTag = tag;
-			}
-		}
-		return lastTag;
-	}
-
-	private String getLastTagMask(String query) {
-		int lastTagSeparator = query.lastIndexOf(KbQuery.TAG_SEPARATOR);
-		if(lastTagSeparator < 0) {
-			return null;
-		}
-		int endLastTagSeparator = lastTagSeparator + KbQuery.TAG_SEPARATOR.length();
-		if(endLastTagSeparator < query.length()) {
-			return query.substring(endLastTagSeparator);
-		}
-		return "";
-	}
-
-	private String getLastCompleteTag(String query) {
-		int lastTagSeparator = query.lastIndexOf(KbQuery.TAG_SEPARATOR);
-		if(lastTagSeparator < 0) {
-			return null;
-		}
-
-		String shortQuery = query.substring(0, lastTagSeparator);
-		int nextToLastTagSeparator = shortQuery.lastIndexOf(KbQuery.TAG_SEPARATOR);
-		if(nextToLastTagSeparator < 0) {
-			return null;
-		}
-
-		int endNextToLastTagSeparator = nextToLastTagSeparator + KbQuery.TAG_SEPARATOR.length();
-		return query.substring(endNextToLastTagSeparator, lastTagSeparator);
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbConnector#RegisterResource(org.jboss.tools.common.kb.KbResource)
-	 */
-	public boolean registerResource(KbResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> JspKbConnector.registerResource(KbResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource=" + resource);
-		}
-		if(resource instanceof KbTldResource) {
-//			KbTldResource tldResource =(KbTldResource)resource;
-			registretedResources.add(resource);
-	
-			KbTldStore.getInstance().registerResource(resource);
-		} else if(resource instanceof KbDinamicResource) {
-			registretedDinamicResources.add((KbDinamicResource)resource);
-			KbTldStore.getInstance().registerResource(resource);
-		} else {
-			throw new IllegalArgumentException("JspKbConnector.registerResource(KbResource resource): resource must be instance of KbTldResource or KbDinamicResource");
-		}
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("    registretedResources=" + registretedResources);
-			KbPlugin.getPluginLog().logInfo("<-- JspKbConnector.registerResource(KbResource resource)");
-		}
-		return true;
-	}
-/*
-	private KbTldResource findEqualTldResource(KbTldResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.log("--> JspKbConnector.findEqualTldResource(KbTldResource resource)");
-			KbPlugin.log("    reg size = " + registretedResources.size());
-		}
-		for(int i=0; i<registretedResources.size(); i++) {
-//			KbPlugin.log(i + " = " + registretedResources.get(i));
-			if(registretedResources.get(i).equals(resource)) {
-				if(KbPlugin.isDebugEnabled()) {
-					KbPlugin.log("<-- JspKbConnector.findEqualTldResource(KbTldResource resource)");
-					KbPlugin.log("    return: " + registretedResources.get(i));
-				}
-				return (KbTldResource)registretedResources.get(i);
-			}
-		}
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.log("<-- JspKbConnector.findEqualTldResource(KbTldResource resource)");
-			KbPlugin.log("    return: null");
-		}
-		return null;
-	}
-*/
-	/**
-	 * @see org.jboss.tools.common.kb.KbConnector#RegisterResource(org.jboss.tools.common.kb.KbResource)
-	 */
-	public void unregisterResource(KbResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> JspKbConnector.unregisterResource(KbResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource: " + resource.toString());
-		}
-
-		if(resource instanceof KbTldResource) {
-			KbTldResource tldResource =(KbTldResource)resource;
-
-			KbTldStore.getInstance().unregisterResourcePrefix(tldResource);
-			registretedResources.remove(resource);
-		} else if(resource instanceof KbDinamicResource) {
-			KbTldStore.getInstance().unregisterResource(resource);
-			registretedDinamicResources.remove(resource);
-		} else {
-			throw new IllegalArgumentException("JspKbConnector.unregisterResource(KbResource resource): resource must be instance of KbTldResource or KbDinamicResource");
-		}
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- JspKbConnector.unregisterResource(KbResource resource)");
-		}
-	}
-
-	/**
-	 * @see java.lang.Object#toString()
-	 */
-	public String toString() {
-		return "Resources size = " + registretedResources.size();
-	}
-
-	private void changeCase(Collection proposals, boolean lowerCase) {
-		for(Iterator iter = proposals.iterator(); iter.hasNext();) {
-			((KbProposal)iter.next()).changeCase(lowerCase);
-		}
-	}
-
-	private void removeAutocompleteRequiredAttributes(Collection proposals) {
-		for(Iterator iter = proposals.iterator(); iter.hasNext();) {
-			((KbProposal)iter.next()).removeAutocompleteRequiredAttributes();
-		}
-	}
-
-	private class JspQuery {
-		private String htmlQuery;
-		private String tldQuery;
-		private String lastTldTag;
-
-		/**
-		 * @return
-		 */
-		public String getHtmlQuery() {
-			return htmlQuery;
-		}
-
-		/**
-		 * @return
-		 */
-		public String getTldQuery() {
-			return tldQuery;
-		}
-
-		/**
-		 * @param string
-		 */
-		public void setHtmlQuery(String string) {
-			htmlQuery = string;
-		}
-
-		/**
-		 * @param string
-		 */
-		public void setTldQuery(String string) {
-			if(string.indexOf(KbQuery.PREFIX_SEPARATOR + KbQuery.ATTRIBUTE_SEPARATOR) < 0) {
-				tldQuery = string;
-			}
-		}
-
-		/**
-		 * @return
-		 */
-		public String getLastTldTag() {
-			return lastTldTag;
-		}
-
-		/**
-		 * @param string
-		 */
-		public void setLastTldTag(String string) {
-			lastTldTag = string;
-		}
-	}
-}
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorType.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorType.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorType.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -41,29 +41,9 @@
         return getConnectorClass().getName();
     }
 
-    /**
-     * 
-     */
-    public static KbConnectorType XML_KB_CONNECTOR = 
-		new KbConnectorType() {
-			public Class getConnectorClass() {
-				return XmlKbConnector.class;			 	
-			}
-		};
-
 	/**
 	 * 
 	 */
-	public static KbConnectorType JSP_KB_CONNECTOR = 
-		new KbConnectorType() {
-			public Class getConnectorClass() {
-				return JspKbConnector.class;			 	
-			}
-		};
-
-	/**
-	 * 
-	 */
 	public static KbConnectorType JSP_WTP_KB_CONNECTOR = 
 		new KbConnectorType() {
 			public Class getConnectorClass() {

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdConvertor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdConvertor.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdConvertor.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.Vector;
-
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-import com.wutka.dtd.DTD;
-import com.wutka.dtd.DTDAttribute;
-import com.wutka.dtd.DTDComment;
-import com.wutka.dtd.DTDContainer;
-import com.wutka.dtd.DTDDecl;
-import com.wutka.dtd.DTDElement;
-import com.wutka.dtd.DTDEnumeration;
-import com.wutka.dtd.DTDItem;
-import com.wutka.dtd.DTDName;
-import com.wutka.dtd.DTDParser;
-
-/**
- * @author igels
- */
-public class KbDtdConvertor implements KbSchemaConvertor {
-
-
-	private static final KbDtdConvertor INSTANCE = new KbDtdConvertor();
-
-	private KbDtdConvertor() {
-		super();
-	}
-
-	/**
-	 * 
-	 * @return
-	 */
-	public static KbDtdConvertor getInstance() {
-		return INSTANCE;
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbSchemaConvertor#convertToSchema(java.io.InputStream)
-	 */
-	public Document convertToSchema(InputStream inputStream) {
-		return convertToSchema(new InputStreamReader(inputStream), new Properties());
-	}
-
-	/**
-	 * 
-	 * @param reader
-	 * @param attributes
-	 * @return
-	 */
-	public Document convertToSchema(Reader reader, Properties attributes) {
-		DTD dtdRoot;
-		Document document=null;
-		try {
-			DTDParser parser = new DTDParser(reader);
-			dtdRoot = parser.parse();
-
-			document = prepareDocument(dtdRoot, attributes);
-//			Object[] objs = dtdRoot.getItems();
-
-			// first add Attributes and Elements definitions			
-			List elements = Arrays.asList(dtdRoot.getItems());		
-
-			if(elements.size() > 0){
-//				set root element
-				if(elements.size()!=0) {
-					int i=0;
-					// find first dtd element 
-					while(! (elements.get(i) instanceof DTDElement))i++; 			
-					DTDElement element = (DTDElement)elements.get(i);	
-					document.getDocumentElement().setAttribute(SchemaNodeFactory.ROOT_ELEMENT_ATTRIBUTE, element.getName());					
-				}
-			}
-
-			for(int i=0;i<elements.size();i++) {
-				if (elements.get(i) instanceof DTDElement) {
-					DTDComment previousComment = null;				
-					if(i!=0 && (elements.get(i-1) instanceof DTDComment)) previousComment = (DTDComment)elements.get(i-1);
-					prepareElementTypeNode(document.getDocumentElement(),(DTDElement)elements.get(i),previousComment);
-				}
-
-			}
-
-		} catch (IOException e) {
-			KbPlugin.getPluginLog().logError(e);
-		}
-
-		return document;
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbSchemaConvertor#convertToSchema(org.jboss.tools.common.kb.KbDtdResource)
-	 */
-	public Document convertToSchema(KbResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdConvertor.convertToSchema(KbResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource = " + resource);
-		}
-
-		//		KbPlugin.log("convert resource - " + resource);
-		KbDtdResource dtdResource = null;
-		if(resource instanceof KbDtdResource) {
-			dtdResource = (KbDtdResource)resource;
-		} else {
-			throw new IllegalArgumentException("KbDtdConvertor.convertToSchema(KbResource resource): resource must be instance of KbDtdResource");
-		}
-		Properties attributes = new Properties();
-		attributes.put(SchemaNodeFactory.URI_ATTRIBUTE, dtdResource.getUri());
-		attributes.put(SchemaNodeFactory.URL_ATTRIBUTE, dtdResource.getId());
-
-		InputStream is = dtdResource.getInputStream();
-		if(is==null) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    Can't get Input Stream from resource.");
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdConvertor.convertToSchema(KbResource resource)");
-				KbPlugin.getPluginLog().logInfo("    return = null");
-			}
-			return null;
-		}
-		return convertToSchema(new InputStreamReader(is), attributes);
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbSchemaConvertor#convertToSchema(java.io.File)
-	 */
-	public Document convertToSchema(File dtdFile) {
-		try {
-			return convertToSchema(new FileReader(dtdFile), new Properties());
-		} catch (FileNotFoundException e) {
-			KbPlugin.getPluginLog().logError(e);
-			return null;
-		}
-	}
-
-	private Document prepareDocument(DTD dtd, Properties attributes) {
-//		Vector notations = dtd.getItemsByType(DTDNotation.class);
-//		KbPlugin.log("Notation URI = " + notations.size());
-		Document document =  SchemaNodeFactory.getInstance().createSchemaDocument(attributes);
-		return document;
-	}
-	
-	public static final String EMPTY = "EMPTY";
-	public static final String ANY = "ANY";
-	public static final String PCDATA = "PCDATA";		
-	
-	private void prepareElementTypeNode(Element parent,DTDElement dtdElement, DTDComment comment) {
-		Properties attributes = new Properties();
-		prepareElementTypeAttributes(dtdElement,attributes);
-	
-		DTDItem item = dtdElement.getContent();
-		Collection<String> content = new ArrayList<String>();
-		getElementContent(item,content);	
-
-		if(content.size()==1) {
-			Object element = content.iterator().next();
-			if(EMPTY.equalsIgnoreCase(element.toString())) 
-				attributes.put(SchemaNodeFactory.BODY_CONTENT_ATTRIBUTE,SchemaNodeFactory.REFUSED_BODY_CONTENT_TYPE);		
-		} else {
-			attributes.put(SchemaNodeFactory.BODY_CONTENT_ATTRIBUTE,SchemaNodeFactory.ALLOWED_BODY_CONTENT_TYPE);			
-		}
-	
-		Element child = SchemaNodeFactory.getInstance().createElementType(parent,attributes);
-		if(comment!=null && KbConfigurationFactory.getInstance().getDefaultConfiguration().isUtilizeComments()) {
-			SchemaNodeFactory.getInstance().createDescription(child,comment.getText());
-		}
-
-		Collection values = dtdElement.attributes.values();
-
-		for (Iterator iter = values.iterator(); iter.hasNext();) {
-			DTDAttribute element = (DTDAttribute) iter.next();
-			prepareAttributeTypeNode(child,element);
-			prepareAttributeNode(child,element);
-		}
-		
-		for(Iterator i=content.iterator();i.hasNext();) {
-			String contentItem = i.next().toString();
-			if(ANY.equalsIgnoreCase(contentItem) || EMPTY.equalsIgnoreCase(contentItem) || PCDATA.equalsIgnoreCase(contentItem)) continue;
-			prepareElementNode(child,contentItem.toString());
-		}
-	}
-	
-	private void getElementContent(DTDItem item, Collection<String> content) {
-		if(item instanceof DTDContainer) {
-			DTDContainer container = (DTDContainer)item;
-			for(int i=0;i<container.getItems().length;i++) {
-				getElementContent(container.getItem(i),content);	
-			}
-		}if(item instanceof DTDName) {
-			String name = ((DTDName)item).getValue();
-			if(!content.contains(name)) content.add(name);
-			return;
-		}
-	}
-	
-	private void prepareAttributeTypeNode(Element element,DTDAttribute dtdElement) {
-		Properties attributes = new Properties();
-		prepareAttributeTypeAttributes(dtdElement,attributes);
-		SchemaNodeFactory.getInstance().createAttributeType(element,attributes);	
-					
-	}
-
-	private void prepareAttributeNode(Element element,DTDAttribute dtdAttribute) {
-		Properties attributes = new Properties();
-		prepareAttributeAttributes(dtdAttribute,attributes);
-		SchemaNodeFactory.getInstance().createAttribute(element,attributes);								
-	}
-
-	private void prepareElementNode(Element element,String name) {
-		Properties attributes = new Properties();
-		attributes.put(SchemaNodeFactory.TYPE_ATTRIBUTE,name);		
-		SchemaNodeFactory.getInstance().createElement(element,attributes);
-	}
-	
-	private void prepareElementTypeAttributes(DTDElement element,Properties attributes) {
-//		DTDItem item = element.getContent();
-		attributes.put(SchemaNodeFactory.NAME_ATTRIBUTE,element.getName());
-		attributes.put(SchemaNodeFactory.START_TAG_ATTRIBUTE,SchemaNodeFactory.REQUIRED_TAG_TYPE);				
-		attributes.put(SchemaNodeFactory.END_TAG_ATTRIBUTE,SchemaNodeFactory.REQUIRED_TAG_TYPE);		
-	}
-
-	private void prepareAttributeTypeAttributes(DTDAttribute element,Properties attributes) {
-		attributes.put(SchemaNodeFactory.NAME_ATTRIBUTE,element.getName());
-		attributes.put(SchemaNodeFactory.DEFAULT_ATTRIBUTE,element.getDefaultValue()==null?"":element.getDefaultValue());
-		String enumList = getEnumValues(element);
-		if(!"".equals(enumList)) { 
-			attributes.put(SchemaNodeFactory.TYPE_ATTRIBUTE,SchemaNodeFactory.ENUMERATION_TYPE);
-			attributes.put(SchemaNodeFactory.VALUES_ATTRIBUTE,getEnumValues(element));			
-		}
-		attributes.put(SchemaNodeFactory.REQUIRED_ATTRIBUTE,(element.getDecl() == DTDDecl.REQUIRED)+"");				
-	}
-
-	private void prepareAttributeAttributes(DTDAttribute attribute,Properties attributes) {
-		attributes.put(SchemaNodeFactory.DEFAULT_ATTRIBUTE,attribute.getDefaultValue()==null?"":attribute.getDefaultValue());
-		attributes.put(SchemaNodeFactory.TYPE_ATTRIBUTE,attribute.getName());
-		attributes.put(SchemaNodeFactory.REQUIRED_ATTRIBUTE,(attribute.getDecl() == DTDDecl.REQUIRED)+"");		
-			
-	}
-	
-	public void prepareCommentNode(Element element, DTDComment comment) {
-		SchemaNodeFactory.getInstance().createDescription(element,comment.getText());
-	}
-
-	private String getEnumValues(DTDAttribute attribute) {
-		if(attribute.getType() instanceof DTDEnumeration) {
-			DTDEnumeration enumeration = (DTDEnumeration)attribute.getType();
-			Vector items = enumeration.getItemsVec();
-			String enumList = "";
-			for(int i=0;i<items.size();i++) {
-				enumList+=items.get(i).toString()+",";	
-			}
-			return enumList.substring(0,enumList.length()-1);
-		}
-		return "";
-	}
-
-	/**
-	 * 
-	 * @param element
-	 * @return
-	 */
-	public String serialize(Element element) {
-		StringWriter sw = new StringWriter();
-		XMLSerializer ser = new XMLSerializer(sw, createOutputFormat());
-		
-		try {
-			ser.asDOMSerializer();
-			ser.serialize(element);
-			sw.close();
-		} catch (IOException e) {
-			KbPlugin.getPluginLog().logError(e);
-		}	
-		return sw.toString();
-
-	}
-
-	/**
-	 * 
-	 * @return
-	 */
-	public OutputFormat createOutputFormat() {
-		OutputFormat format = new OutputFormat("xml", "UTF-8", true);
-		format.setLineSeparator("\n");
-		format.setIndent(2);
-		return format;
-	}
-}
\ No newline at end of file

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdResource.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.xml.sax.InputSource;
-
-import org.jboss.tools.common.util.HttpUtil;
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
-/**
- * @author igels
- */
-public class KbDtdResource implements KbResource {
-
-	private String uri;
-	private URL url;
-	private File dtdLocation;
-	private File schemaLocation;
-	private String rootElement;
-	private InputSource inputSource;
-
-	/**
-	 * 
-	 * @param uri
-	 * @param inputSource
-	 * @param rootElement
-	 */
-	public KbDtdResource(String uri, InputSource inputSource, String rootElement) {
-		this.uri = uri;
-		this.rootElement = rootElement;
-		this.inputSource = inputSource;
-	}
-
-	/**
-	 * 
-	 * @param uri
-	 * @param url
-	 * @param rootElement
-	 */
-	public KbDtdResource(String uri, URL url, String rootElement) {
-		this.uri = uri;
-		this.url = url;
-		this.rootElement = rootElement;
-	}
-
-	/**
-	 * 
-	 * @param uri
-	 * @param dtdLocation
-	 * @param rootElement
-	 */
-	public KbDtdResource(String uri, File dtdLocation, String rootElement) {
-		this.uri = uri;
-		this.dtdLocation = dtdLocation;
-		this.rootElement = rootElement;
-	}
-
-	/**
-	 * 
-	 */
-	public InputStream getInputStream() {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdResource.getInputStream()");
-			KbPlugin.getPluginLog().logInfo("    this resource = " + this);
-		}
-
-		InputStream is = null;
-
-		try {
-			if(dtdLocation != null) {
-				is = new BufferedInputStream(new FileInputStream(dtdLocation));
-				if(KbPlugin.isDebugEnabled()) {
-					KbPlugin.getPluginLog().logInfo("    dtd location is not null and is will getting from dtd location");
-				}
-			} else if((url != null)) {
-				if("jar".equals(url.getProtocol())) {
-					is = url.openStream();
-				} else if(KbConfigurationFactory.getInstance().getDefaultConfiguration().isAllowDownload()) {
-					if(KbPlugin.isDebugEnabled()) {
-						KbPlugin.getPluginLog().logInfo("    the dtd is will getting from url because url is not null and downloading from internet is alowed");
-					}
-					is = HttpUtil.getInputStreamFromUrlByGetMethod(url.toString());
-				}
-			} else if(inputSource != null) {
-				String systemId = inputSource.getSystemId();
-				String publicId = inputSource.getPublicId();
-				String id;
-				if(systemId!=null) {
-					id = systemId;
-				} else if(publicId!=null) {
-					id = publicId;
-				} else {
-					if(KbPlugin.isDebugEnabled()) {
-						KbPlugin.getPluginLog().logInfo("    system id and public id from input sourec are null and so can't to get url from input source");
-						KbPlugin.getPluginLog().logInfo("<-- KbDtdResource.getInputStream()");
-						KbPlugin.getPluginLog().logInfo("    return is = null");
-					}
-					return null;
-				}
-
-				is = HttpUtil.getInputStreamFromUrlByGetMethod(id);
-			}
-		} catch (Exception e) {
-			KbPlugin.getPluginLog().logError(e);
-		}
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdResource.getInputStream()");
-			KbPlugin.getPluginLog().logInfo("    return is = " + is);
-		}
-		return is;
-	}
-
-	/**
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	public boolean equals(Object ob) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdResource.equals(Object ob)");
-			KbPlugin.getPluginLog().logInfo("    this = " + this);
-			KbPlugin.getPluginLog().logInfo("    ob = " + ob);
-		}
-
-		if(ob == this) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdResource.equals(Object ob)");
-				KbPlugin.getPluginLog().logInfo("    return = true");
-			}
-			return true;
-		}
-		if((!(ob instanceof KbDtdResource)) || (ob == null)) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdResource.equals(Object ob)");
-				KbPlugin.getPluginLog().logInfo("    return = false");
-			}
-			return false;
-		}
-		KbDtdResource resource = (KbDtdResource)ob;
-
-		boolean eqUri = false;
-//		boolean eqUrl = false;
-//		boolean eqLocation = false;
-//		boolean eqInputSource = false;
-		boolean eqId = false;
-		if(this.uri!=null) {
-			eqUri = this.uri.equals(resource.getUri());
-		} else if(resource.getUri()==null) {
-			eqUri = true;
-		}
-		if(this.getId()!=null) {
-			eqId = this.getId().equals(resource.getId());
-		} else if(resource.getId()==null) {
-			eqId = true;
-		}
-/*		if(this.url!=null) {
-			eqUrl = this.url.equals(resource.getUrl());
-		} else if(resource.getUrl()==null) {
-			eqUrl = true;
-		}
-		if(this.dtdLocation!=null) {
-			eqLocation = this.dtdLocation.equals(resource.getDtdLocation());
-		} else if(resource.getDtdLocation()==null) {
-			eqLocation = true;
-		}
-		if(this.inputSource!=null) {
-			eqInputSource = this.inputSource.equals(resource.getInputSource());
-		} else if(resource.getInputSource()==null) {
-			eqInputSource = true;
-		}
-*/
-		boolean result = eqUri||eqId;
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdResource.equals(Object ob)");
-			KbPlugin.getPluginLog().logInfo("    return = " + result);
-		}
-
-		return result;
-	}
-
-	/**
-	 * @return
-	 */
-	public File getDtdLocation() {
-		return dtdLocation;
-	}
-
-	/**
-	 * @return
-	 */
-	public String getUri() {
-		return uri;
-	}
-
-	/**
-	 * @return
-	 */
-	public URL getUrl() {
-		return url;
-	}
-
-	/**
-	 * 
-	 * @return
-	 */
-	public String getId() {
-		if(url!=null) {
-			return url.toString();
-		} else if((inputSource!=null)&&(inputSource.getPublicId()!=null)) {
-				return inputSource.getPublicId();
-		} else if((inputSource!=null)&&(inputSource.getSystemId()!=null)) {
-			return inputSource.getSystemId();
-		}
-		return dtdLocation.toString();
-	}
-
-	/**
-	 * @return
-	 */
-	public File getSchemaLocation() {
-		return schemaLocation;
-	}
-
-	/**
-	 * @param file
-	 */
-	public void setSchemaLocation(File file) {
-		schemaLocation = file;
-	}
-
-	/**
-	 * @see java.lang.Object#toString()
-	 */
-	public String toString() {
-		StringBuffer buffer = new StringBuffer();
-		buffer.append("URI=\"");
-		buffer.append(uri);
-		buffer.append("\" URL=\"");		
-		buffer.append(url);
-		buffer.append("\" ID=\"");		
-		buffer.append(getId());
-		buffer.append("\" DTDlocation=\"");		
-		buffer.append(dtdLocation);
-		buffer.append("\" InputSource=\"");		
-		buffer.append(inputSource);
-		buffer.append("\" SchemaLocation=\"");		
-		buffer.append(schemaLocation);
-		buffer.append("\" RootElement=\"");		
-		buffer.append(rootElement);
-		buffer.append("\"");		
-
-		return buffer.toString();
-	}
-
-	/**
-	 * 
-	 * @return
-	 */
-	public boolean isModified() {
-//		KbPlugin.log("--> KbDtdResource.isModified()");
-
-		if(dtdLocation==null) {
-			return false;
-		}
-
-		if(dtdLocation.exists()&&(schemaLocation!=null)&&(schemaLocation.exists())) {
-			long lastModifiedDtd = dtdLocation.lastModified();
-			long lastModifiedSchema = schemaLocation.lastModified();
-//			KbPlugin.log("<-- KbTldResource.isModified()");
-//			KbPlugin.log("    return: " + (lastModifiedSchema < lastModifiedDtd));
-			return lastModifiedSchema < lastModifiedDtd;
-		}
-
-//		KbPlugin.log("<-- KbDtdResource.isModified()");
-		return true;
-	}
-
-    /**
-     * @return
-     */
-    public String getRootElement() {
-        return rootElement;
-    }
-
-    /**
-     * @param string
-     */
-    public void setRootElement(String name) {
-        rootElement = name;
-    }
-
-    /**
-     * @return
-     */
-    public InputSource getInputSource() {
-        return inputSource;
-    }
-}
\ No newline at end of file

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdStore.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdStore.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDtdStore.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,1003 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author eskimo
- */
-public class KbDtdStore implements KbStore {
-
-	public static final String XML_DECLARATION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-
-	private String schemaLocation;	
-	private List<Document> activeDocuments;
-	private List<KbDtdResource> registratedResources;
-	private List<KbDtdResource> downloadingResources;
-
-	private static final KbDtdStore INSTANCE = new KbDtdStore();
-
-	private KbDtdStore() {
-		if(KbPlugin.isDebugEnabled()) {		
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore()");
-		}
-		schemaLocation = KbConfigurationFactory.getInstance().getDefaultConfiguration().getDtdSchemaPath();
-
-		activeDocuments = new Vector<Document>();
-		registratedResources = new Vector<KbDtdResource>();
-		downloadingResources = new Vector<KbDtdResource>();
-
-		loadRegistratedResources();
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdStore()");
-		}
-	}
-
-	/**
-	 * 
-	 * @return
-	 */
-	public static KbDtdStore getInstance() {
-		return INSTANCE;
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbStore#queryTagInformation(org.jboss.tools.common.kb.KbQuery)
-	 */
-	public TagDescriptor queryTagInformation(KbQuery query) {
-//		String strQuery = query.getQuery();
-		String lastTag = query.getLastTag();
-		String queryForLastTag = query.getFullQueryForLastTag();
-		if(queryForLastTag==null) {
-			return null;
-		}
-
-		InerDtdQuery inerDtdQuery = getInerDtdQery(new KbQuery(queryForLastTag, query.getResources()));
-		List elementTypes = inerDtdQuery.getElementTypes();
-
-		return KbSchemaUtil.getTagInformationFromElementTypes(elementTypes, lastTag, new HashSet());
-	}
-
-	public AttributeDescriptor queryAttributeInformation(KbQuery query) {
-		// TODO
-		throw new IllegalStateException("This method is not implemented yet.");
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbStore#queryProposal(org.jboss.tools.common.kb.KbQuery)
-	 */
-	public Collection<KbProposal> queryProposal(KbQuery query) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore.queryProposal(KbQuery query)");
-			KbPlugin.getPluginLog().logInfo("    query = " + query);
-			KbPlugin.getPluginLog().logInfo("    registratedResources = " + registratedResources);
-		}
-
-		String strQuery = query.getQuery();
-
-		if((strQuery.equals(KbQuery.XML_DECLARATION_QUERY))) {
-			KbProposal proposal = new KbProposal();
-			proposal.setLabel(XML_DECLARATION);
-			proposal.setReplacementString(XML_DECLARATION);
-			proposal.setContextInfo(null);
-			ArrayList<KbProposal> proposals = new ArrayList<KbProposal>();
-			proposals.add(proposal);
-			return proposals;
-		}
-
-		List<KbProposal> proposals = queryTagProposal(getInerDtdQery(query));
-		KbProposal endTag = getEndTagProposal(query);
-		if(endTag != null) {
-			proposals.add(endTag);
-		}
-
-		Collections.sort(proposals);
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("proposals size = " + proposals.size());
-		}
-		return proposals;
-	}
-
-	private InerDtdQuery getInerDtdQery(KbQuery query) {
-		String strQuery = query.getQuery();
-
-		Collection needResources = query.getResources();
-		activateResources(needResources);
-
-		int firstTagSeparator = strQuery.indexOf(KbQuery.TAG_SEPARATOR);
-		if(firstTagSeparator == -1) {
-//			KbPlugin.log("ERROR: Bad query: " + strQuery + ". Query must starts with \"" + KbQuery.TAG_SEPARATOR + "\" or \"" + KbQuery.XML_DECLARATION_QUERY + "\"");
-			throw new IllegalArgumentException("Bad query: " + strQuery + ". Query must starts with \"" + KbQuery.TAG_SEPARATOR + "\" or \"" + KbQuery.XML_DECLARATION_QUERY + "\"");
-		}
-
-		List<Element> elementTypes = new ArrayList<Element>();
-		String tagQuery = null;
-		int lastTagSeparator = strQuery.lastIndexOf(KbQuery.TAG_SEPARATOR);
-		if(lastTagSeparator > firstTagSeparator) {
-			String axis = strQuery.substring(firstTagSeparator + KbQuery.TAG_SEPARATOR.length(), lastTagSeparator);
-			StringTokenizer tags = new StringTokenizer(axis, KbQuery.TAG_SEPARATOR);
-			if(!tags.hasMoreTokens()) {
-				String errorMessage = "ERROR: Bad query: " + strQuery + "\n" + 
-									  "       Possible query formats: \"" + KbQuery.TAG_SEPARATOR +"rootTagName" + KbQuery.TAG_SEPARATOR + "childTagName1" + KbQuery.TAG_SEPARATOR + "..." + KbQuery.TAG_SEPARATOR + "childTagNameN" + KbQuery.ATTRIBUTE_SEPARATOR + "attributeName" + KbQuery.ENUMERATION_SEPARATOR + "attributeValue\"\n" +
-									  "       or \"" + KbQuery.XML_DECLARATION_QUERY + "\"";
-//				KbPlugin.log(errorMessage);
-				throw new IllegalArgumentException(errorMessage);
-			}
-			elementTypes = getChildElementTypes(needResources, tags);
-			if(lastTagSeparator + KbQuery.TAG_SEPARATOR.length() < strQuery.length()) {
-				tagQuery = strQuery.substring(lastTagSeparator);
-			} else {
-				tagQuery = KbQuery.TAG_SEPARATOR;
-			}
-		} else {
-			Iterator iterator = needResources.iterator();
-			while(iterator.hasNext()) {
-				KbDtdResource resource = (KbDtdResource)iterator.next();
-				Element rootElementType = getRootElementType(resource);
-				if(rootElementType!=null) {
-					elementTypes.add(rootElementType);
-				}
-				if(KbPlugin.isDebugEnabled()) {
-					KbPlugin.getPluginLog().logInfo("    Root Element: " + rootElementType);
-				}
-//				KbPlugin.log("RESOURCE: " + resource);
-/*
-				Document document = getActiveDocument(resource);
-				if(document != null) {
-					elementTypes.add(getRootElementType(document));
-				}
-*/
-			}
-			tagQuery = strQuery;
-		}
-
-		InerDtdQuery inerDtdQuery = new InerDtdQuery(elementTypes, tagQuery);
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("    Iner DTD Query = " + inerDtdQuery);
-		}
-
-		return inerDtdQuery;
-	}
-
-	private KbProposal getEndTagProposal(KbQuery kbQuery) {
-		String query = kbQuery.getQuery();
-		String mask = "";
-		int lastSeparator = query.lastIndexOf(KbQuery.TAG_SEPARATOR);
-		if((lastSeparator!=-1)&&(lastSeparator + KbQuery.TAG_SEPARATOR.length()<query.length())) {
-			mask = query.substring(lastSeparator + KbQuery.TAG_SEPARATOR.length());
-		}
-
-		String lastTag = kbQuery.getLastTag();
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("last tag - " + lastTag);
-			KbPlugin.getPluginLog().logInfo("mask - " + mask);
-		}
-		if((lastTag != null)&&(((mask.indexOf(KbQuery.DONT_FILTER_END_TAG_CHAR)!=-1)&&(KbQuery.DONT_FILTER_END_TAG_CHAR + lastTag).startsWith(mask))||(mask.equals("")))) {
-			KbProposal proposal = new KbProposal();
-			proposal.setLabel("/" + lastTag);
-			proposal.setReplacementString("/" + lastTag);
-			proposal.setIcon(KbIcon.XML_TAG);
-			return proposal; 
-		}
-
-		return null;
-	}
-/*
-	private ArrayList getEndTagProposal(ArrayList elementTypes) {
-		ArrayList proposals = new ArrayList();
-		for(Iterator iter = elementTypes.iterator(); iter.hasNext();) {
-			Element elementType = (Element)iter.next();
-			KbProposal proposal = new KbProposal();
-			String name = elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-			proposal.setLabel("/" + name);
-			proposal.setReplacementString("/" + name);
-			proposal.setIcon(KbIcon.XML_TAG);
-
-			proposals.add(proposal);
-		}
-		return proposals;
-	}
-*/
-
-	public void registerResource(KbResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore.registerResource(KbResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource = " + resource);
-		}
-
-		KbDtdResource dtdResource = null;
-		if(resource instanceof KbDtdResource) {
-			dtdResource = (KbDtdResource)resource;
-		} else {
-			throw new IllegalArgumentException("KbDtdStore.registerResource(KbResource resource): resource must be instance of KbDtdResource");
-		}
-
-		if(checkActiveDocument(dtdResource)) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    resource already is activated");
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.registerResource()");
-			}
-			return;
-		} else if(checkDownloadingResource(dtdResource)) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    resource is downloading");
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.registerResource()");
-			}
-			return;
-		} else if(checkRegistratedResource(dtdResource)) {
-			activateResource(dtdResource);
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    resource already is registred");
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.registerResource()");
-			}
-			return;
-		}
-
-		if((dtdResource.getDtdLocation()==null)&&(!KbConfigurationFactory.getInstance().getDefaultConfiguration().isAllowDownload())) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    Unknown resource but is not allow download.");
-				KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.registerResource()");
-			}
-			return;
-		}
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("    Unknown resource. Start downloading resource...");
-		}
-
-		new ResourceDownloader(dtdResource).start();
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.registerResource()");
-		}
-	}
-
-	/**
-	 * 
-	 * @param resource
-	 */
-	public synchronized void reregisterModifiededResource(KbDtdResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore.reregisterModifiededResource(KbDtdResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource = " + resource);
-		}
-		KbDtdResource regResource = getRegistratedResource(resource);
-		if((regResource!=null)&&regResource.isModified()) {
-			unregisterResource(resource);
-			registerResource(resource);
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    resource hase been reregistrated");
-			}
-		}
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.reregisterModifiededResource(KbDtdResource resource)");
-		}
-	}
-
-	/*
-	 * @see org.jboss.tools.common.kb.KbStore#unregisterResource(org.jboss.tools.common.kb.KbResource)
-	 */
-	public void unregisterResource(KbResource resource) {
-		KbDtdResource dtdResource = (KbDtdResource)resource;
-		KbDtdResource regResource = getRegistratedResource(dtdResource);
-		if(regResource!=null) {
-			registratedResources.remove(regResource);
-			Document document = getActiveDocument(dtdResource);
-			if(document!=null) {
-				activeDocuments.remove(document);
-			}
-			File schema = regResource.getSchemaLocation();
-			if(schema!=null) {
-				schema.delete();
-			}
-		} else if(checkDownloadingResource(dtdResource)) {
-//			TODO Stop downloading and registration resource
-		}
-	}
-
-	private List<Element> getChildElementTypes(Collection resources, StringTokenizer tagNames) {
-//		KbPlugin.log("--> getChildElementTypes(Collection resources, StringTokenizer tagNames)");
-//		KbPlugin.log("    resources size = " + resources.size());
-//		KbPlugin.log("    tagNames  = " + tagNames);
-
-		String tagName = tagNames.nextToken();
-//		KbPlugin.log("    tagName  = " + tagName);
-
-		List<Element> childElements = getChildElements(resources, tagName, true);
-
-//		KbPlugin.log("    childElements size = " +  childElements.size());
-
-		while(tagNames.hasMoreElements()&&childElements.size()>0) {
-			tagName = tagNames.nextToken();
-//			KbPlugin.log("    tagName  = " + tagName);
-			Iterator iterator = childElements.iterator();
-			childElements = new ArrayList<Element>();
-			while(iterator.hasNext()) {
-				Element element = (Element)iterator.next();
-				if(element.getAttribute(SchemaNodeFactory.TYPE_ATTRIBUTE).equals(tagName)) {
-//					KbPlugin.log("   add childElements size = " +  childElements.size());
-					childElements = addCollection(childElements, getChildElements(resources, tagName, false));
-				}
-			}
-		}
-
-//		KbPlugin.log("    childElements size = " +  childElements.size());
-
-		ArrayList<Element> childElementTypes = new ArrayList<Element>();
-		for(int i=0; i<childElements.size(); i++) {
-			Element elementType = KbSchemaUtil.getElementTypeByElement((Element)childElements.get(i));
-			if(elementType!=null) {
-				childElementTypes.add(elementType);
-			}
-		}
-
-//		KbPlugin.log("<-- getChildElementTypes(Collection resources, StringTokenizer tagNames)");
-//		KbPlugin.log("    childElementTypes size = " +  childElementTypes.size());
-		return childElementTypes; 
-	}
-
-/*
-	private Element getRootElementType(Document document) {
-		String rootElementName = document.getDocumentElement().getAttribute(SchemaNodeFactory.ROOT_ELEMENT_ATTRIBUTE);
-
-//		KbPlugin.log("rootElementName = " + rootElementName);
-
-		NodeList nodeList = document.getElementsByTagName(SchemaNodeFactory.ELEMENT_TYPE_NODE);
-		for(int j=0; j<nodeList.getLength(); j++) {
-			Node child = nodeList.item(j); 
-			if(child instanceof Element) {
-				Element element = (Element)child;
-				if(rootElementName.equals(element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE))) {
-//					KbPlugin.log("rootElementName = " + element.getAttribute("name"));
-					return element;
-				}
-			}
-		}
-
-//		KbPlugin.log("ERROR: Can't find ElementType for tagName (name=\"" + rootElementName + "\").");
-		return null;
-	}
-*/
-
-    private Element getRootElementType(KbDtdResource resource) {
-		Document document = getActiveDocument(resource);
-		if(document != null) {
-			String rootElementName = resource.getRootElement();
-			if(rootElementName == null) {
-				rootElementName = document.getDocumentElement().getAttribute(SchemaNodeFactory.ROOT_ELEMENT_ATTRIBUTE);
-			}
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    Root element name: " + rootElementName);
-			}
-			return KbSchemaUtil.getElementTypeByName(document, rootElementName, false);
-		}
-//		KbPlugin.log("DOCUMENT IS null!");
-		return null;
-    }
-
-	private List<Element> addCollection(Collection<Element> col1, Collection<Element> col2) {
-		ArrayList<Element> arrayList = new ArrayList<Element>();
-		Iterator<Element> iterator = col1.iterator();
-		while(iterator.hasNext()) {
-			arrayList.add(iterator.next());
-		}
-		iterator = col2.iterator();
-		while(iterator.hasNext()) {
-			arrayList.add(iterator.next());
-		}
-		return arrayList;
-	}
-
-	private List<Element> getChildElements(Collection resources, String elementTypeName, boolean rootTag) {
-//		KbPlugin.log("--> getChildElements(Collection resources, String elementTypeName, boolean rootTag)");
-//		KbPlugin.log("    resources size = " + resources.size());
-//		KbPlugin.log("    elementTypeName  = " + elementTypeName);
-
-		ArrayList<Element> elements = new ArrayList<Element>();
-
-		ArrayList<Document> documents = new ArrayList<Document>();
-		Iterator iterator = resources.iterator();
-		while(iterator.hasNext()) {
-			KbDtdResource resource = (KbDtdResource)iterator.next();
-			Document document = getActiveDocument(resource);
-/*
-			if((document != null)&&(!rootTag || KbSchemaUtil.checkRootElement(document, elementTypeName))) {
-				documents.add(document);
-			}
-*/
-
-			String rootElementName = resource.getRootElement();
-			if(rootElementName == null) {
-				rootElementName = document.getDocumentElement().getAttribute(SchemaNodeFactory.ROOT_ELEMENT_ATTRIBUTE);
-			}
-
-			if((document != null)&&(!rootTag || rootElementName.equals(elementTypeName))) {
-				documents.add(document);
-			}
-		}
-
-		for(int i=0; i< documents.size(); i++) {
-			Document document = (Document)documents.get(i);
-			NodeList elementTypes = document.getElementsByTagName(SchemaNodeFactory.ELEMENT_TYPE_NODE);
-			for(int j=0; j<elementTypes.getLength(); j++) {
-				Node child = elementTypes.item(j); 
-				if(child instanceof Element) {
-					Element elementType = (Element)child;
-//					KbPlugin.log("Element type: " + elementType);
-					if(elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE).equals(elementTypeName)) {
-						NodeList childElements = elementType.getElementsByTagName(SchemaNodeFactory.ELEMENT_NODE);
-						for(int g=0; g<childElements.getLength(); g++) {
-							Node childElement = childElements.item(g);
-							if(childElement instanceof Element) {
-//								KbPlugin.log("Add Element: " + ((Element)childElement).getAttribute("type"));
-								elements.add((Element)childElement);
-							}
-						} 
-					}
-				}
-			}
-		}
-
-//		KbPlugin.log("<-- getChildElements(Collection resources, String elementTypeName, boolean rootTag)");
-//		KbPlugin.log("    element size = " + elements.size());
-		return elements;
-	}
-
-	private List<KbProposal> queryTagProposal(InerDtdQuery query) {
-		return queryTagProposal(query.getElementTypes(), query.getTagQuery());
-	}
-
-	private List<KbProposal> queryTagProposal(List elementTypes, String query) {
-//		KbPlugin.log("-->  queryTagProposal(ArrayList elementTypes, String query)");
-//		KbPlugin.log("     Query = " + query);
-//		KbPlugin.log("     elementTypes size = " + elementTypes.size());
-
-		if((!query.startsWith(KbQuery.TAG_SEPARATOR))||
-		   (query.startsWith(KbQuery.TAG_SEPARATOR + KbQuery.ATTRIBUTE_SEPARATOR))) {
-			return new ArrayList<KbProposal>();
-		} else if(query.length() == KbQuery.TAG_SEPARATOR.length()) {
-			return getTags(elementTypes, "");
-		}
-
-		int startAttributeName = query.indexOf(KbQuery.ATTRIBUTE_SEPARATOR);
-		if(startAttributeName < 0){
-			return getTags(elementTypes, query.substring(KbQuery.TAG_SEPARATOR.length()));
-		}
-
-		String tagName = query.substring(KbQuery.TAG_SEPARATOR.length(), startAttributeName);
-		startAttributeName+=KbQuery.ATTRIBUTE_SEPARATOR.length();
-		if(startAttributeName == query.length()) {
-			return getAttributes(elementTypes, tagName, "");
-		}
-
-		int startAttributeValue = query.indexOf(KbQuery.ENUMERATION_SEPARATOR);
-		if(startAttributeValue < 0) {
-			return getAttributes(elementTypes, tagName, query.substring(startAttributeName));
-		}
-
-		String attributeName = query.substring(startAttributeName, startAttributeValue);
-		startAttributeValue+=KbQuery.ENUMERATION_SEPARATOR.length();
-		if(startAttributeValue == query.length()) {
-			return getEnumeration(elementTypes, tagName, attributeName, "");
-		}
-
-		return getEnumeration(elementTypes, tagName, attributeName, KbQuery.decode(query.substring(startAttributeValue)));
-	}
-
-	private synchronized boolean checkActiveDocument(KbDtdResource resource) {
-		return getActiveDocument(resource) != null;
-	}
-
-	private synchronized boolean checkDownloadingResource(KbDtdResource resource) {
-		synchronized (downloadingResources) {
-			for(int i=0; i<downloadingResources.size(); i++) {
-				if(((KbDtdResource)downloadingResources.get(i)).equals(resource)) {
-					return true;
-				}
-/*				String downloadingUri = ((KbDtdResource)downloadingResources.get(i)).getUri();
-				URL downloadingUrl = ((KbDtdResource)downloadingResources.get(i)).getUrl();
-				if(downloadingUri.equals(resource.getUri())) {
-					// Is downloading this resource.
-					return true;
-				} else if(downloadingUrl.equals(resource.getUrl())) {
-					// Is downloading this resource.
-					return true;
-				}
-*/
-			}
-		}
-		// Isn't downloading this resource.
-		return false;
-	}
-
-	private synchronized boolean checkRegistratedResource(KbDtdResource resource) {
-		return getRegistratedResource(resource) != null;
-	}
-
-	private synchronized KbDtdResource getRegistratedResource(KbDtdResource dtdResource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore.getRegistratedResource(KbDtdResource dtdResource)");
-			KbPlugin.getPluginLog().logInfo("    dtdResource = " + dtdResource);
-		}
-
-		synchronized (registratedResources) {
-			for(int i=0; i<registratedResources.size(); i++){
-				KbDtdResource resource = (KbDtdResource)registratedResources.get(i);
-				if(resource.equals(dtdResource)) {
-					if(KbPlugin.isDebugEnabled()) {
-						KbPlugin.getPluginLog().logInfo("    Found resource");
-						KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.getRegistratedResource(KbDtdResource dtdResource)");
-						KbPlugin.getPluginLog().logInfo("    return resource = " + resource);
-					}
-					return resource;
-				}
-/*				String registratedUri = resource.getUri();
-				URL registratedUrl = resource.getUrl();
-	//			KbPlugin.log("reg-d uri=" + registratedUri);
-	//			KbPlugin.log("reg uri=" + uri);
-				if(registratedUri.equals(dtdResource.getUri())) {
-					// Registrated resource.
-					return resource;
-				} else if(registratedUrl.equals(dtdResource.getUrl())) {
-					// Registrated resource.
-					return resource;
-				}
-*/
-			}
-		}
-		// Non-registrated resource.
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("    Did not find resource");
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.getRegistratedResource(KbDtdResource dtdResource)");
-			KbPlugin.getPluginLog().logInfo("    return resource = null");
-		}
-		return null;
-	}
-
-	private synchronized Document getActiveDocument(KbDtdResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore.getActiveDocument(KbDtdResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource = " + resource);
-		}
-
-		synchronized (activeDocuments) {
-			for(int i=0; i<activeDocuments.size(); i++){
-				Document activeDocument = (Document)activeDocuments.get(i);
-				String activeDocumentsUri = activeDocument.getDocumentElement().getAttribute(SchemaNodeFactory.URI_ATTRIBUTE);
-				String activeDocumentsUrl = activeDocument.getDocumentElement().getAttribute(SchemaNodeFactory.URL_ATTRIBUTE);
-				if((activeDocumentsUri.equals(resource.getUri()))||(activeDocumentsUrl.equals(resource.getId()))) {
-					// Active resource.
-					if(KbPlugin.isDebugEnabled()) {
-						KbPlugin.getPluginLog().logInfo("    Found document");
-						KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.getActiveDocument(KbDtdResource resource)");
-						KbPlugin.getPluginLog().logInfo("    return document = " + activeDocument);
-					}
-					return activeDocument;
-				}
-			}
-		}
-		// Non-active resource.
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("    Did not find document");
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.getActiveDocument(KbDtdResource resource)");
-			KbPlugin.getPluginLog().logInfo("    return document = null");
-		}
-		return null;
-	}
-
-	private synchronized void activateResource(KbDtdResource resource) {
-		if(checkActiveDocument(resource)) {
-			return;
-		}
-
-		KbDtdResource regResource = getRegistratedResource(resource);
-		if(regResource == null) {
-			return;
-		}
-
-		File schemaLocation = regResource.getSchemaLocation();
-		if((schemaLocation == null)||(!schemaLocation.exists())) {
-//			KbPlugin.log("ERROR: Schema (location: " + schemaLocation + ") for resource (" + regResource +") does not exist!");
-			return;
-		}
-
-		Document document = null;
-		try {
-			document = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(schemaLocation);
-		} catch (Exception e) {
-			String message = "ERROR: Can't parse Schema (location: " + schemaLocation + ")";
-			KbPlugin.getPluginLog().logError(message, e);
-			return;
-		}
-		activeDocuments.add(document);
-	}
-
-	private synchronized void activateResources(Collection resources) {
-		Iterator iterator = resources.iterator();
-		while(iterator.hasNext()) {
-			KbDtdResource resource = (KbDtdResource)iterator.next();
-			activateResource(resource);
-		}
-	}
-
-	public synchronized void activateAllResources() {
-		synchronized (registratedResources) {		
-			for(int i=0; i<registratedResources.size(); i++) {
-				KbDtdResource resource = (KbDtdResource)registratedResources.get(i);
-				activateResource(resource);
-			}
-		}
-	}
-/*
-	private synchronized void deactivateResource(KbDtdResource resource) {
-		Document document = getActiveDocument(resource);
-		if(document!=null) {
-			activeDocuments.remove(document);
-		}
-	}
-*/
-	public synchronized void deactivateAllResources() {
-		for(int i=0; i<activeDocuments.size(); i++) {
-			activeDocuments.clear();
-		}
-	}
-
-	private void loadRegistratedResources() {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> KbDtdStore.loadRegistratedResources()");
-		}
-
-		File schemaFolder = new File(schemaLocation); 
-		if(!schemaFolder.exists()) {
-			return;
-		}
-		File[] schemas = schemaFolder.listFiles(new FileFilter(){
-			public boolean accept(File file) {
-				if(file.isFile()) {
-					return true;
-				}
-				return false;
-			}
-		});
-
-		for(int i=0; i<schemas.length; i++) {
-			Document document = null;
-			try {
-				document = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(schemas[i]);
-			} catch (Exception e) {
-				if(KbPlugin.isDebugEnabled()) {
-					String message = "WARNING: Can't parse Schema (location: " + schemas[i] + ")";
-					KbPlugin.getPluginLog().logError(message, e);
-				}
-				continue;
-			}
-			String uri = document.getDocumentElement().getAttribute(SchemaNodeFactory.URI_ATTRIBUTE);
-			String url = document.getDocumentElement().getAttribute(SchemaNodeFactory.URL_ATTRIBUTE);
-			KbDtdResource resource = null;
-			try {
-				resource = new KbDtdResource(uri, new URL(url), null);
-			} catch (Exception e) {
-				if(KbPlugin.isDebugEnabled()) {
-					String message = "ERROR: can't create java.net.URL for url=\"" + url + "\" from schema (location=" + schemas[i] + ")";
-					KbPlugin.getPluginLog().logError(message);
-				}
-				continue;
-			}
-			resource.setSchemaLocation(schemas[i]);
-			registratedResources.add(resource);
-		}
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- KbDtdStore.loadRegistratedResources()");
-		}
-	}
-
-	private List<KbProposal> getTags(Collection elementTypes, String tagMask) {
-//		KbPlugin.log("--> getTags(Collection elementTypes, String tagMask)");
-//		KbPlugin.log("    elementTypes size = " + elementTypes.size());
-//		KbPlugin.log("    tagMask = " + tagMask);
-//		KbPlugin.log("<-- getTags()");
-		return getTagProposal(getElementTypesByName(elementTypes, tagMask, true));
-	}
-
-	private List<Element> getElementTypesByName(Collection elementTypes, String name, boolean mask) {
-//		KbPlugin.log("--> getElementTypesByName(Collection elementTypes, String name, boolean mask)");
-//		KbPlugin.log("    elementTypes size = " + elementTypes.size());
-//		KbPlugin.log("    name = " + name);
-//		KbPlugin.log("    mask = " + mask);
-
-		ArrayList<Element> elements = new ArrayList<Element>();
-
-		Iterator iterator = elementTypes.iterator();
-		while(iterator.hasNext()) {
-			Element elementType = (Element)iterator.next();
-			String schemaTagName = elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-			boolean match = mask?schemaTagName.startsWith(name):schemaTagName.equals(name);
-			if(match) {
-//				KbPlugin.log("    add element: " + elementType);
-				elements.add(elementType);
-			}
-		}
-
-//		KbPlugin.log("<-- getElementTypesByName()");
-//		KbPlugin.log("    elements Size = " + elements.size());
-
-		return elements;
-	}
-
-	private List<KbProposal> getAttributes(Collection elementTypes, String tagName, String attributeMask) {
-//		KbPlugin.log("--> getAttributes(String prefix, String tagName, String attributeMask)");
-//		KbPlugin.log("    prefix = " + prefix);
-//		KbPlugin.log("    tagName = " + tagName);
-//		KbPlugin.log("    attributeMask = " + attributeMask);
-//		KbPlugin.log("<-- getAttributes()");
-		return getAttributeProposal(getAttributeTypesByName(elementTypes, tagName, attributeMask, true));
-	}
-
-	private List<Element> getAttributeTypesByName(Collection elementTypes, String tagName, String attributeName, boolean mask) {
-		List<Element> attributes = new ArrayList<Element>();
-
-		List elements = getElementTypesByName(elementTypes, tagName, false);
-		if(!elements.isEmpty()) {
-			Element element = (Element)elements.get(0);
-
-			ArrayList attributeTypes = KbSchemaUtil.getAttributeTypes(element);
-			for(int i=0; i<attributeTypes.size(); i++) {
-				Element attributeType = (Element)attributeTypes.get(i);
-
-				String attributeTypeName = attributeType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-				boolean match = mask?attributeTypeName.startsWith(attributeName):attributeTypeName.equals(attributeName);
-				if(match) {
-					attributes.add(attributeType);
-				}
-			}
-		}
-		return attributes;
-	}
-
-	private List<KbProposal> getEnumeration(Collection elementTypes, String tagName, String attributeName, String valueMask) {
-		List<KbProposal> enumeration = new ArrayList<KbProposal>();
-
-		List attributeTypes = new ArrayList();
-		attributeTypes = getAttributeTypesByName(elementTypes, tagName, attributeName, false);
-		if(!attributeTypes.isEmpty()) {
-			Element attributeType = (Element)attributeTypes.get(0);
-			String type = attributeType.getAttribute(SchemaNodeFactory.TYPE_ATTRIBUTE);
-			if(type.equals(SchemaNodeFactory.ENUMERATION_TYPE)) {
-				String values = attributeType.getAttribute(SchemaNodeFactory.VALUES_ATTRIBUTE);
-				StringTokenizer st = new StringTokenizer(values, SchemaNodeFactory.ENUMERATION_SEPARATOR);
-				while(st.hasMoreElements()) {
-					String value = (String)st.nextElement();
-					if(value.startsWith(valueMask)) {
-						KbProposal proposal = new KbProposal();
-						proposal.setLabel(value);
-						proposal.setReplacementString(value);
-						proposal.setContextInfo(null);
-						proposal.setIcon(KbIcon.ENUM_ITEM);
-
-						enumeration.add(proposal);
-					}
-				}
-			}
-		}
-
-		return enumeration;
-	}
-
-	private List<KbProposal> getTagProposal(List<Element> elements) {
-		return getProposal(elements, true);
-	}
-
-	private List<KbProposal> getAttributeProposal(List elements) {
-		return getProposal(elements, false);
-	}
-
-	private List<KbProposal> getProposal(List elements, boolean tag) {
-//		KbPlugin.log("--> getProposal(ArrayList elements, boolean tag)");
-//		KbPlugin.log("    elemnets size = " + elements.size());
-//		KbPlugin.log("    tag = " + tag);
-
-		ArrayList<KbProposal> kbProposals = new ArrayList<KbProposal>();
-
-		for(int i=0; i<elements.size(); i++) {
-			Element element = (Element)elements.get(i);
-			String tagName = element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-
-			KbProposal proposal = new KbProposal();
-
-			if(tag) {
-				String endTag = SchemaNodeFactory.REFUSED_BODY_CONTENT_TYPE.equals(element.getAttribute(SchemaNodeFactory.BODY_CONTENT_ATTRIBUTE))?" /":"";
-
-				String attributes = KbSchemaUtil.getRequaredAttributesAsString(element);
-				proposal.setReplacementString(tagName + attributes + endTag);
-				int position = proposal.getReplacementString().indexOf('"');
-				if(position!=-1) {
-					position ++;
-				} else {
-					position = proposal.getReplacementString().length();
-				}
-				proposal.setPosition(position);
-				proposal.setLabel(tagName);
-				proposal.setIcon(KbIcon.XML_TAG);
-			} else {
-				proposal.setReplacementString(tagName);
-				if(KbSchemaUtil.checkRequaredAttribute(element)) {
-					proposal.setIcon(KbIcon.XML_ATTRIBUTE);
-				} else {
-					proposal.setIcon(KbIcon.XML_ATTRIBUTE_OPTIONAL);
-				}
-				proposal.setLabel(tagName);
-			}
-
-			proposal.setContextInfo(KbSchemaUtil.getDescription(element));
-
-//			KbPlugin.log("    add kbProposals:\n" + proposal.toString());
-//			KbPlugin.log("    for element: " + element);
-//			proposal.setContextInfo(proposal.getIcon().toString());
-
-			kbProposals.add(proposal);
-		}
-
-//		KbPlugin.log("<-- getProposal()");
-//		KbPlugin.log("    kbProposals size = " + kbProposals.size());
-
-		return kbProposals;
-	}
-
-	private class ResourceDownloader implements Runnable {
-
-		private KbDtdResource resource;
-		private Thread thread;
-
-		public ResourceDownloader(KbDtdResource resource) {
-			this.resource = resource;
-		}
-
-		public void start() {
-			thread = new Thread(this);
-			thread.setDaemon(false);
-			thread.start();
-		}
-
-		public void run() {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("downloading resource - " + resource);
-			}
-			downloadingResources.add(resource);
-			String uniqFileName = "schema.xml";
-			try {
-				File tempFile = File.createTempFile("schema", ".xml");
-				uniqFileName = tempFile.getName();
-				tempFile.deleteOnExit();
-			} catch(Exception e) {
-				String message = "WARNING: Can't create temp file.";
-				KbPlugin.getPluginLog().logError(message, e);
-			}
-			File schemaFolder = new File(schemaLocation);
-
-			schemaFolder.mkdirs();
-			File schemaFile = new File(schemaLocation + "/" + uniqFileName);
-			int i=0;
-			while(schemaFile.exists()) {
-				schemaFile = new File(schemaLocation + "/" + i++ + uniqFileName);
-			}
-
-			Document document = KbDtdConvertor.getInstance().convertToSchema(resource);
-			if(document == null) {
-				if(KbPlugin.isDebugEnabled()) {
-					KbPlugin.getPluginLog().logInfo("    Can't get document from resource.");
-					KbPlugin.getPluginLog().logInfo("    cancel downloading.");
-				}
-				downloadingResources.remove(resource);
-				return;
-			}
-			try {
-				Element element = document.getDocumentElement();
-				StringWriter sw = new StringWriter();
-				XMLSerializer ser = new XMLSerializer(sw, createOutputFormat());
-
-				ser.asDOMSerializer();
-				ser.serialize(element);
-				sw.close();
-
-				BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(schemaFile));
-				os.write(sw.toString().getBytes());
-				os.flush();
-				os.close();
-
-//				TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(schemaFile));
-			} catch (Exception e) {
-				String message = "ERROR: Can't serialize DTD schema (" + schemaFile + ").";
-				KbPlugin.getPluginLog().logError(message, e);
-				schemaFile.deleteOnExit();
-				downloadingResources.remove(resource);
-				return;
-			}
-			resource.setSchemaLocation(schemaFile);
-			registratedResources.add(resource);
-			activeDocuments.add(document);
-			downloadingResources.remove(resource);
-		}
-
-		public OutputFormat createOutputFormat() {
-			OutputFormat format = new OutputFormat("xml", "UTF-8", true);
-			format.setLineSeparator("\n");
-			format.setIndent(2);
-			return format;
-		}
-	}
-
-	private class InerDtdQuery {
-
-		private List elementTypes;
-		private String tagQuery;
-
-		public InerDtdQuery(List elementTypes, String tagQuery) {
-			this.elementTypes = elementTypes;
-			this.tagQuery = tagQuery;
-		}
-
-        /**
-         * @return
-         */
-        public List getElementTypes() {
-            return elementTypes;
-        }
-
-        /**
-         * @return
-         */
-        public String getTagQuery() {
-            return tagQuery;
-        }
-
-        /**
-         * @param list
-         */
-        public void setElementTypes(ArrayList list) {
-            elementTypes = list;
-        }
-
-        /**
-         * @param string
-         */
-        public void setTagQuery(String string) {
-            tagQuery = string;
-        }
-
-		public String toString() {
-			return new StringBuffer().append("Element types: ").append(elementTypes).append("; Element types size: ").append(elementTypes==null?"null":""+elementTypes.size()).append("; tagQuery: ").append(tagQuery).toString();
-		}
-	}
-
-}

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlMap.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlMap.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlMap.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
-/**
- * @author igels
- */
-public class KbHtmlMap {
-	private final static String ROOT_ELEMENT_ATTRIBUTE_VALUE = "HTML";
-
-	private Map htmlMap;
-	private static File hashMapLocation = new File(KbConfigurationFactory.getInstance().getDefaultConfiguration().getHtmlMapFilePath());
-
-	/**
-	 * 
-	 */
-	private KbHtmlMap(Map proposals) {
-		htmlMap = proposals;
-	}
-
-	public static KbHtmlMap parseSchema(Document schema) {
-		HashMap<String,KbProposal[]> map = new HashMap<String,KbProposal[]>();
-		NodeList nodeList = schema.getElementsByTagName(SchemaNodeFactory.ELEMENT_TYPE_NODE);
-		for(int i=0; i<nodeList.getLength(); i++) {
-			HashMap<String,Element> children = new HashMap<String,Element>();
-			Element elementType = (Element)nodeList.item(i);
-			String tagName = elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-			List childrenElementTypes = getChildElementTypes(schema, tagName);
-			addOptionalTags(children, elementType);
-			for(int j=0; j<childrenElementTypes.size(); j++) {
-				Element childrenElementType = (Element)childrenElementTypes.get(j);
-				addOptionalTags(children, childrenElementType);
-			}
-			ArrayList<KbProposal> proposalList = getTagProposal(children);
-			KbProposal[] proposals = (KbProposal[])proposalList.toArray(new KbProposal[proposalList.size()]);
-			map.put(tagName, proposals);
-		}
-		return new KbHtmlMap(map);
-	}
-
-	public static Document convertSchema(Document schema) {
-		Properties attributes = new Properties();
-		attributes.put(SchemaNodeFactory.ROOT_ELEMENT_ATTRIBUTE, ROOT_ELEMENT_ATTRIBUTE_VALUE);
-		Document document = SchemaNodeFactory.getInstance().createSchemaDocument(attributes);
-		Element schemaElement = document.getDocumentElement();
-
-		NodeList nodeList = schema.getElementsByTagName(SchemaNodeFactory.ELEMENT_TYPE_NODE);
-		for(int i=0; i<nodeList.getLength(); i++) {
-			HashMap<String,Element> children = new HashMap<String,Element>();
-			Element elementType = (Element)nodeList.item(i);
-			String tagName = elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-			List childrenElementTypes = getChildElementTypes(schema, tagName);
-			addOptionalTags(children, elementType);
-			for(int j=0; j<childrenElementTypes.size(); j++) {
-				Element childrenElementType = (Element)childrenElementTypes.get(j);
-				addOptionalTags(children, childrenElementType);
-			}
-
-			attributes = KbSchemaUtil.getAttributes(elementType);
-			Element newElementType = SchemaNodeFactory.getInstance().createElementType(schemaElement, attributes);
-
-			NodeList attributeTypes = elementType.getElementsByTagName(SchemaNodeFactory.ATTRIBUTE_TYPE_NODE);
-			for(int j=0; j<attributeTypes.getLength(); j++) {
-				Element attribute = (Element)attributeTypes.item(j);
-				attributes = KbSchemaUtil.getAttributes(attribute);
-				SchemaNodeFactory.getInstance().createAttributeType(newElementType, attributes);
-			}
-
-			NodeList attributeElements = elementType.getElementsByTagName(SchemaNodeFactory.ATTRIBUTE_NODE);
-			for(int j=0; j<attributeElements.getLength(); j++) {
-				Element attribute = (Element)attributeElements.item(j);
-				attributes = KbSchemaUtil.getAttributes(attribute);
-				SchemaNodeFactory.getInstance().createAttribute(newElementType, attributes);
-			}
-
-			for(Iterator iter = children.values().iterator();iter.hasNext();) {
-				Element element = (Element)iter.next();
-				attributes = new Properties();
-				attributes.put(SchemaNodeFactory.TYPE_ATTRIBUTE, element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE));
-				SchemaNodeFactory.getInstance().createElement(newElementType, attributes);
-			}
-		}
-
-		return document;
-	}
-
-	public static boolean convertSchemaToFile(Document schema, File schemaFile) {
-		Document convertedSchema = convertSchema(schema);
-		try {
-			Element element = convertedSchema.getDocumentElement();
-			StringWriter sw = new StringWriter();
-			XMLSerializer ser = new XMLSerializer(sw, createOutputFormat());
-
-			ser.asDOMSerializer();
-			ser.serialize(element);
-			sw.close();
-
-			BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(schemaFile));
-			os.write(sw.toString().getBytes());
-			os.flush();
-			os.close();
-
-//			TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(schemaFile));
-		} catch (Exception e) {
-			String message = "ERROR: Can't serialize HTML schema to file :" + schemaFile;
-			KbPlugin.getPluginLog().logError(message, e);
-			schemaFile.deleteOnExit();
-			return false;
-		}
-		return true;
-	}
-
-	private static OutputFormat createOutputFormat() {
-		OutputFormat format = new OutputFormat("xml", "UTF-8", true);
-		format.setLineSeparator("\n");
-		format.setIndent(2);
-		return format;
-	}
-
-	private static void addOptionalTags(HashMap<String,Element> map, Element elementType) {
-//		KbPlugin.log("--> KbHtmlMap.addRefuseTag(HashMap map, Element elementType, String tagName, boolean mask)");
-		String elementTypeName = elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-//		KbPlugin.log("    map size=" + map.size());
-//		KbPlugin.log("    elementType=" + elementTypeName);
-		if(!map.containsKey(elementTypeName)) {
-			map.put(elementTypeName, elementType);
-			String startTagType = elementType.getAttribute(SchemaNodeFactory.START_TAG_ATTRIBUTE);
-			if(SchemaNodeFactory.OPTIONAL_TAG_TYPE.equals(startTagType)) {
-//				KbPlugin.log("    Tag have optional start tag");
-				List childElementTypes = getChildElementTypes(elementType.getOwnerDocument(), elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE));
-				for(Iterator iter = childElementTypes.iterator(); iter.hasNext();) {
-					Element childElementType = (Element)iter.next();
-					addOptionalTags(map, childElementType);
-				}
-			}
-		}
-//		KbPlugin.log("<-- KbHtmlMap.addRefuseTag(HashMap map, Element elementType, String tagName, boolean mask)");
-//		KbPlugin.log("    map size=" + map.size());
-	}
-
-	private static List<Element> getChildElementTypes(Document schema, String tagName) {
-		List<Element> childElementTypes = new ArrayList<Element>();
-
-		List childElements = getChildElements(schema, tagName);
-
-		for(Iterator iter = childElements.iterator(); iter.hasNext();) {
-			Element element = (Element)iter.next();
-			Element elementType = KbSchemaUtil.getElementTypeByElement(element);
-			if(elementType!=null) {
-				childElementTypes.add(elementType);
-			}
-		}
-
-		return childElementTypes; 
-	}
-
-	private static ArrayList<Element> getChildElements(Document schema, String elementTypeName) {
-//		KbPlugin.log("--> getChildElements(Collection resources, String elementTypeName, boolean rootTag)");
-//		KbPlugin.log("    resources size = " + resources.size());
-//		KbPlugin.log("    elementTypeName  = " + elementTypeName);
-
-		ArrayList<Element> elements = new ArrayList<Element>();
-
-//		ArrayList documents = new ArrayList();
-
-		NodeList elementTypes = schema.getElementsByTagName(SchemaNodeFactory.ELEMENT_TYPE_NODE);
-		for(int j=0; j<elementTypes.getLength(); j++) {
-			Node child = elementTypes.item(j); 
-			if(child instanceof Element) {
-				Element elementType = (Element)child;
-				if(elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE).equalsIgnoreCase(elementTypeName)) {
-					NodeList childElements = elementType.getElementsByTagName(SchemaNodeFactory.ELEMENT_NODE);
-					for(int g=0; g<childElements.getLength(); g++) {
-						Node childElement = childElements.item(g);
-						if(childElement instanceof Element) {
-							elements.add((Element)childElement);
-						}
-					} 
-				}
-			}
-		}
-
-//		KbPlugin.log("<-- getChildElements(Collection resources, String elementTypeName, boolean rootTag)");
-//		KbPlugin.log("    element size = " + elements.size());
-		return elements;
-	}
-
-	private static ArrayList<KbProposal> getTagProposal(HashMap elements) {
-		return getProposal(elements.values(), true);
-	}
-
-	private static ArrayList<KbProposal> getProposal(Collection elements, boolean tag) {
-//		KbPlugin.log("--> getProposal(ArrayList elements, boolean tag)");
-//		KbPlugin.log("    elemnets size = " + elements.size());
-//		KbPlugin.log("    tag = " + tag);
-
-		ArrayList<KbProposal> kbProposals = new ArrayList<KbProposal>();
-
-		for(Iterator iter = elements.iterator();iter.hasNext();) {
-			Element element = (Element)iter.next();
-			String label = element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-
-			KbProposal proposal = new KbProposal();
-			proposal.setLabel(label);
-			proposal.setContextInfo(KbSchemaUtil.getDescription(element));
-
-			if(tag) {
-				String attributes = KbSchemaUtil.getRequaredAttributesAsString(element);
-				proposal.setReplacementString(label + attributes);
-				int position = proposal.getReplacementString().indexOf('"');
-				if(position!=-1) {
-					position ++;
-				}
-				proposal.setPosition(position);
-				proposal.setIcon(KbIcon.HTML_TAG);
-			} else {
-				proposal.setReplacementString(label);
-				proposal.setIcon(KbIcon.HTML_ATTRIBUTE);
-			}
-
-//			KbPlugin.log("    add kbProposals:\n" + proposal.toString());
-//			KbPlugin.log("    for element: " + element);
-
-			kbProposals.add(proposal);
-		}
-
-//		KbPlugin.log("<-- getProposal()");
-//		KbPlugin.log("    kbProposals size = " + kbProposals.size());
-
-		return kbProposals;
-	}
-
-	public KbProposal[] getChildren(String tagName) {
-		return (KbProposal[])htmlMap.get(tagName);
-	}
-
-	public boolean serialize() {
-		boolean res = true;
-		try {
-			FileOutputStream fos = new FileOutputStream(hashMapLocation);
-			ObjectOutputStream oos = new ObjectOutputStream(fos);
-			oos.writeObject(htmlMap);
-			oos.flush();
-			oos.close();
-		} catch (Exception e) {
-			res = false;
-			String message = "ERROR: Can't serialize html map to file: " + hashMapLocation;
-			KbPlugin.getPluginLog().logError(message, e);
-		}
-
-		return res;
-	}
-
-	public static KbHtmlMap loadMap() throws IOException, ClassNotFoundException {
-		HashMap map = null;
-		FileInputStream fis = new FileInputStream(hashMapLocation);
-		ObjectInputStream ois = new ObjectInputStream(fis);
-		map = (HashMap)ois.readObject();
-		ois.close();
-		return new KbHtmlMap(map);
-	}
-}
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -15,17 +15,15 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.StringTokenizer;
 
+import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
 /**
  * @author eskimo
  */
@@ -246,7 +244,6 @@
 				KbProposal proposal = new KbProposal();
 				proposal.setLabel("/" + lastTag);
 				proposal.setReplacementString("/" + lastTag);
-				proposal.setIcon(KbIcon.HTML_TAG);
 				return proposal;
 			} 
 		}
@@ -323,7 +320,6 @@
 				position = proposal.getReplacementString().length();
 			}
 			proposal.setPosition(position);
-			proposal.setIcon(KbIcon.HTML_TAG);
 
 			kbProposals.add(proposal);
 		}
@@ -381,16 +377,7 @@
 	private synchronized boolean htmlSchemaIsActivating() {
 		return activatingHtmlSchema;
 	}
-/*
-	private synchronized void enableHtmlSchemaActivating(boolean status) {
-		activatingHtmlSchema = status;
-	}
 
-	private synchronized void deactivateHtmlSchema() {
-		htmlSchema = null;
-//		htmlMap = null;
-	}
-*/
 	private ArrayList<KbProposal> getAttributes(String tagName, String attributeMask) {
 		return getAttributeProposal(getAttributeTypesByName(tagName, attributeMask, true));
 	}
@@ -433,7 +420,6 @@
 						proposal.setLabel(value);
 						proposal.setReplacementString(value);
 						proposal.setContextInfo(null);
-						proposal.setIcon(KbIcon.ENUM_ITEM);
 						proposal.setPosition(value.length());
 
 						enumeration.add(proposal);
@@ -475,7 +461,6 @@
 				proposal.setLabel(value);
 				proposal.setReplacementString(value);
 				proposal.setContextInfo(null);
-				proposal.setIcon(KbIcon.ENUM_ITEM);
 				proposal.setPosition(value.length());
 
 				enumeration.add(proposal);
@@ -510,14 +495,8 @@
 					position = proposal.getReplacementString().length();
 				}
 				proposal.setPosition(position);
-				proposal.setIcon(KbIcon.HTML_TAG);
 			} else {
 				proposal.setReplacementString(label);
-				if(KbSchemaUtil.checkRequaredAttribute(element)) {
-					proposal.setIcon(KbIcon.HTML_ATTRIBUTE);
-				} else {
-					proposal.setIcon(KbIcon.HTML_ATTRIBUTE_OPTIONAL);
-				}
 			}
 
 			kbProposals.add(proposal);

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbIcon.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbIcon.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbIcon.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author igels
- */
-public class KbIcon implements Serializable {
-
-	private static final long serialVersionUID = 3762136564046244137L;
-
-	private static Map<String,KbIcon> allObjects = new Hashtable<String,KbIcon>();
-
-	private final String imageType;
-	private String imagePath;
-	private transient Image image = null;
-
-	/**
-	 * 
-	 */
-	private KbIcon(String imageType, String imagePath) {
-		this.imageType = imageType;
-		this.imagePath = imagePath;
-
-		allObjects.put(imageType, this);		
-	}
-
-	public static final KbIcon ENUM_ITEM = new KbIcon("Enumeration item icon", "/icons/proposals/enum_item.gif");
-
-	public static final KbIcon HTML_ATTRIBUTE = new KbIcon("HTML requared attribute icon", "/icons/proposals/html_attribute.gif");
-	public static final KbIcon HTML_ATTRIBUTE_OPTIONAL = new KbIcon("HTML optional attribute icon", "/icons/proposals/html_attribute_optional.gif");
-	public static final KbIcon HTML_TAG = new KbIcon("HTML tag icon","/icons/proposals/html_tag.gif");
-
-	public static final KbIcon TLD_ATTRIBUTE = new KbIcon("TLD requared attribute icon", "/icons/proposals/tld_attribute.gif");
-	public static final KbIcon TLD_ATTRIBUTE_OPTIONAL = new KbIcon("TLD optional attribute icon", "/icons/proposals/tld_attribute_optional.gif");
-	public static final KbIcon TLD_TAG = new KbIcon("TLD tag icon", "/icons/proposals/tld_tag.gif");
-
-	public static final KbIcon XML_ATTRIBUTE = new KbIcon("XML requared attribute icon", "/icons/proposals/xml_attribute.gif");
-	public static final KbIcon XML_ATTRIBUTE_OPTIONAL = new KbIcon("XML optional attribute icon", "/icons/proposals/xml_attribute_optional.gif");
-	public static final KbIcon XML_TAG = new KbIcon("XML tag icon","/icons/proposals/xml_tag.gif");
-
-	public static final KbIcon JSP_DIRECTIVE_ATTRIBUTE = new KbIcon("JSP directive requared attribute icon", "/icons/proposals/jsp_directive_attr.gif");
-	public static final KbIcon JSP_DIRECTIVE_ATTRIBUTE_OPTIONAL = new KbIcon("JSP directive optional attribute icon","/icons/proposals/jsp_directive_attr_optional.gif");
-	public static final KbIcon JSP_DIRECTIVE = new KbIcon("JSP directive icon", "/icons/proposals/jsp_directive.gif");
-
-	public Image getImage() {
-		if (image == null) 
-			image = new Image(Display.getCurrent(), KbProposal.class.getResourceAsStream(imagePath));
-		
-		return image;
-	}
-
-	public String toString() {
-		return imageType;
-	}
-
-	private Object readResolve() throws ObjectStreamException {
-		return allObjects.get(imageType);
-	}
-}
\ No newline at end of file

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbJspDirectiveStore.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbJspDirectiveStore.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbJspDirectiveStore.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.StringTokenizer;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
-/**
- * @author igels
- */
-public class KbJspDirectiveStore implements KbStore {
-
-	private final static TagDescriptor DEFAULT_TAG_INFO;
-	static {
-		DEFAULT_TAG_INFO = new TagDescriptor();
-		DEFAULT_TAG_INFO.setBody(false);
-		DEFAULT_TAG_INFO.setClosingTag(false);
-	}
-
-	private String jspDirectiveSchemaLocation;
-	private Document jspDirectiveSchema;
-
-	private static final KbJspDirectiveStore INSTANCE = new KbJspDirectiveStore();
-
-	private KbJspDirectiveStore() {
-		jspDirectiveSchemaLocation = KbConfigurationFactory.getInstance().getDefaultConfiguration().getJspDirectiveSchemaFilePath();
-	}
-
-	public static KbJspDirectiveStore getInstance() {
-		return INSTANCE;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.jboss.tools.common.kb.KbStore#queryTagInformation(org.jboss.tools.common.kb.KbQuery)
-	 */
-	public TagDescriptor queryTagInformation(KbQuery query) {
-		return DEFAULT_TAG_INFO;
-	}
-
-	public AttributeDescriptor queryAttributeInformation(KbQuery query) {
-		// TODO
-		throw new IllegalStateException("This method is not implemented yet.");
-	}
-
-	public Collection<KbProposal> queryProposal(KbQuery query) {
-		if(!activateJspDirectiveSchema()) {
-			return new ArrayList<KbProposal>();
-		} 
-
-		ArrayList<KbProposal> proposals = queryTagProposal(query);
-		Collections.sort(proposals);
-
-		return proposals;
-	}
-
-	private ArrayList<KbProposal> queryTagProposal(KbQuery query) {
-//		KbPlugin.log("--> KbJspDirectiveStore.queryProposal(KbQuery query)");
-		String strQuery = query.getQuery();
-//		KbPlugin.log("    query=\"" + query + "\"");
-
-		if((!strQuery.startsWith(KbQuery.JSP_DIRECTIVE_QUERY))||
-		   (strQuery.startsWith(KbQuery.JSP_DIRECTIVE_QUERY + KbQuery.ATTRIBUTE_SEPARATOR))||
-		   (strQuery.indexOf(KbQuery.ATTRIBUTE_SEPARATOR + KbQuery.ENUMERATION_SEPARATOR)!=-1)) {
-
-			String errorMessage = "ERROR: Bad query: " + strQuery + "\n" + 
-								  "       Possible query format: \"" + KbQuery.JSP_DIRECTIVE_QUERY + "directiveName" + KbQuery.ATTRIBUTE_SEPARATOR + "attributeName" + KbQuery.ENUMERATION_SEPARATOR + "attributeValue\"";
-//			KbPlugin.log(errorMessage);
-			throw new IllegalArgumentException(errorMessage);
-//			return new ArrayList();
-		} else if(strQuery.length() == KbQuery.JSP_DIRECTIVE_QUERY.length()) {
-			return getDirectives("");
-		}
-
-		int startAttributeName = strQuery.lastIndexOf(KbQuery.ATTRIBUTE_SEPARATOR);
-		if((startAttributeName == 0)||(startAttributeName < 0)){
-			return getDirectives(strQuery.substring(KbQuery.JSP_DIRECTIVE_QUERY.length()));
-		}
-
-		String directiveName = strQuery.substring(KbQuery.JSP_DIRECTIVE_QUERY.length(), startAttributeName);
-		startAttributeName+=KbQuery.ATTRIBUTE_SEPARATOR.length();
-		if(startAttributeName == strQuery.length()) {
-			return getAttributes(directiveName, "");
-		}
-
-		int startAttributeValue = strQuery.indexOf(KbQuery.ENUMERATION_SEPARATOR);
-		if(startAttributeValue < 0) {
-			return getAttributes(directiveName, strQuery.substring(startAttributeName));
-		}
-
-		String attributeName = strQuery.substring(startAttributeName, startAttributeValue);
-		startAttributeValue+=KbQuery.ENUMERATION_SEPARATOR.length();
-		if(startAttributeValue == strQuery.length()) {
-			return getEnumeration(directiveName, attributeName, "");
-		}
-
-//		KbPlugin.log("<-- queryProposal()");
-		return getEnumeration(directiveName, attributeName, KbQuery.decode(strQuery.substring(startAttributeValue)));
-	}
-
-	public void registerResource(KbResource resource) {
-	}
-
-	public void unregisterResource(KbResource resource) {
-	}
-
-	private synchronized boolean activateJspDirectiveSchema() {
-		if(jspDirectiveSchema != null) {
-			return true;
-		}
-
-		File schemaLocation = new File(jspDirectiveSchemaLocation);
-		if((schemaLocation == null)||(!schemaLocation.exists())) {
-//			String errorMessage = "ERROR: Html schema (location: " + schemaLocation + ") does not exist!"; 
-//			KbPlugin.log(errorMessage);
-//			throw new RuntimeException(errorMessage);
-			return false;
-		}
-
-		try {
-			jspDirectiveSchema = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(schemaLocation);
-		} catch (Exception e) {
-			String message = "ERROR: Can't parse JSP Directive Schema (location: " + schemaLocation + ")";
-			KbPlugin.getPluginLog().logError(message, e);
-			return false;
-		}
-		return true;
-	}
-
-	private ArrayList<KbProposal> getDirectives(String directiveMask) {
-		return getDirectiveProposal(getElementTypesByName(directiveMask, true));
-	}
-
-	private ArrayList<KbProposal> getAttributes(String directiveName, String attributeMask) {
-		return getAttributeProposal(getAttributeTypesByName(directiveName, attributeMask, true));
-	}
-
-	private ArrayList<Element> getElementTypesByName(String name, boolean mask) {
-//		KbPlugin.log("--> getElementTypesByName(String name, boolean mask)");
-//		KbPlugin.log("    name = " + name);
-//		KbPlugin.log("    mask = " + mask);
-
-		ArrayList<Element> elements = new ArrayList<Element>();
-
-		NodeList elementTypes = jspDirectiveSchema.getElementsByTagName(SchemaNodeFactory.ELEMENT_TYPE_NODE);
-		for(int i=0; i<elementTypes.getLength(); i++) {
-			Element elementType = (Element)elementTypes.item(i);
-			String schemaDirectiveName = elementType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-			boolean match = mask?schemaDirectiveName.startsWith(name):schemaDirectiveName.equals(name);
-			if(match) {
-//				KbPlugin.log("    add element: " + elementType);
-				elements.add(elementType);
-			}
-		}
-
-//		KbPlugin.log("<-- getElementTypesByName()");
-//		KbPlugin.log("    elements Size = " + elementType.size());
-
-		return elements;
-	}
-
-	private ArrayList<Element> getAttributeTypesByName(String directiveName, String attributeName, boolean mask) {
-		ArrayList<Element> attributes = new ArrayList<Element>();
-
-		ArrayList elements = getElementTypesByName(directiveName, false);
-		if(!elements.isEmpty()) {
-			Element element = (Element)elements.get(0);
-
-			ArrayList attributeTypes = KbSchemaUtil.getAttributeTypes(element);
-			for(int i=0; i<attributeTypes.size(); i++) {
-				Element attributeType = (Element)attributeTypes.get(i);
-
-				String attributeTypeName = attributeType.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-				boolean match = mask?attributeTypeName.startsWith(attributeName):attributeTypeName.equals(attributeName);
-				if(match) {
-					attributes.add(attributeType);
-				}
-			}
-		}
-		return attributes;
-	}
-
-	private ArrayList<KbProposal> getEnumeration(String directiveName, String attributeName, String valueMask) {
-		ArrayList<KbProposal> enumeration = new ArrayList<KbProposal>();
-
-		ArrayList attributeTypes = new ArrayList();
-		attributeTypes = getAttributeTypesByName(directiveName, attributeName, false);
-		if(!attributeTypes.isEmpty()) {
-			Element attributeType = (Element)attributeTypes.get(0);
-			String type = attributeType.getAttribute(SchemaNodeFactory.TYPE_ATTRIBUTE);
-			if(type.equals(SchemaNodeFactory.ENUMERATION_TYPE)) {
-				String values = attributeType.getAttribute(SchemaNodeFactory.VALUES_ATTRIBUTE);
-				StringTokenizer st = new StringTokenizer(values, SchemaNodeFactory.ENUMERATION_SEPARATOR);
-				while(st.hasMoreElements()) {
-					String value = (String)st.nextElement();
-					if(value.startsWith(valueMask)) {
-						KbProposal proposal = new KbProposal();
-						proposal.setLabel(value);
-						proposal.setReplacementString(value);
-						proposal.setContextInfo(null);
-						proposal.setIcon(KbIcon.ENUM_ITEM);
-
-						enumeration.add(proposal);
-					}
-				}
-			}
-		}
-
-		return enumeration;
-	}
-
-	private ArrayList<KbProposal> getDirectiveProposal(ArrayList elements) {
-		return getProposal(elements, true);
-	}
-
-	private ArrayList<KbProposal> getAttributeProposal(ArrayList elements) {
-		return getProposal(elements, false);
-	}
-
-	private ArrayList<KbProposal> getProposal(ArrayList elements, boolean directive) {
-//		KbPlugin.log("--> getProposal(ArrayList elements, boolean directive)");
-//		KbPlugin.log("    elemnets size = " + elements.size());
-//		KbPlugin.log("    directive = " + directive);
-
-		ArrayList<KbProposal> kbProposals = new ArrayList<KbProposal>();
-
-		for(int i=0; i<elements.size(); i++) {
-			Element element = (Element)elements.get(i);
-			String label = element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
-
-			KbProposal proposal = new KbProposal();
-
-			if(directive) {
-				label = "%@ " + label;
-				proposal.setLabel(label);
-
-				String attributes = KbSchemaUtil.getRequaredAttributesAsString(element);
-
-				proposal.setReplacementString(label + attributes);
-				int position = proposal.getReplacementString().indexOf('"');
-				if(position!=-1) {
-					position ++;
-				} else {
-					position = proposal.getReplacementString().length();
-				}
-				proposal.setPosition(position);
-				proposal.setIcon(KbIcon.JSP_DIRECTIVE);
-			} else {
-				proposal.setReplacementString(label);
-				proposal.setLabel(label);
-				if(KbSchemaUtil.checkRequaredAttribute(element)) {
-					proposal.setIcon(KbIcon.JSP_DIRECTIVE_ATTRIBUTE);
-				} else {
-					proposal.setIcon(KbIcon.JSP_DIRECTIVE_ATTRIBUTE_OPTIONAL);
-				}
-			}
-			proposal.setContextInfo(KbSchemaUtil.getDescription(element));
-
-//			KbPlugin.log("    add kbProposals:\n" + proposal.toString());
-//			KbPlugin.log("    for element: " + element);
-
-			kbProposals.add(proposal);
-		}
-
-//		KbPlugin.log("<-- getProposal()");
-//		KbPlugin.log("    kbProposals size = " + kbProposals.size());
-
-		return kbProposals;
-	}
-}
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPlugin.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPlugin.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -31,24 +31,6 @@
 	// The shared instance
 	private static KbPlugin plugin;
 
-
-	protected void initializeDefaultPluginPreferences() {
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_USE_LOWER_CASE, true);
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_USE_AUTOCOMPLETE_FOR_MANDATORY, true);
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_UTILIZE_COMMENTS, false);		
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_USE_AUTOCOMPLETE_FOR_TAGS, true);
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_ALLOW_DOWNLOAD, true);
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_USE_PROXY, false);
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_HOST, "");
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_PORT, "");
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_USER, "");
-		getPreferenceStore().setDefault(KbPreferencesConstants.PROMPTING_PASSWORD, "");
-	}
-
-	/**
-	 * 
-	 *
-	 */
 	public KbPlugin() {
 	}
 

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPreferencesConstants.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPreferencesConstants.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbPreferencesConstants.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-public interface KbPreferencesConstants {
-	public static final String PROMPTING_USE_LOWER_CASE = "PROMPTING_USE_LOWER_CASE";
-	public static final String PROMPTING_USE_AUTOCOMPLETE_FOR_MANDATORY = "PROMPTING_USE_AUTOCOMPLETE_FOR_MANDATORY";
-	public static final String PROMPTING_UTILIZE_COMMENTS = "PROMPTING_UTILIZE_COMMENTS";	
-	public static final String PROMPTING_USE_AUTOCOMPLETE_FOR_TAGS = "PROMPTING_USE_AUTOCOMPLETE_FOR_TAGS";
-	public static final String PROMPTING_ALLOW_DOWNLOAD = "PROMPTING_ALLOW_DOWNLOAD";
-	public static final String PROMPTING_USE_PROXY = "PROMPTING_USE_PROXY";
-	public static final String PROMPTING_HOST = "PROMPTING_HOST";
-	public static final String PROMPTING_PORT = "PROMPTING_PORT";
-	public static final String PROMPTING_USER = "PROMPTING_USER";
-	public static final String PROMPTING_PASSWORD = "PROMPTING_PASSWORD";
-}
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbProposal.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -12,8 +12,6 @@
 
 import java.io.Serializable;
 
-import org.eclipse.swt.graphics.Image;
-
 /**
  * Describes a proposal for content assistants
  * @author igels
@@ -36,7 +34,6 @@
 	private String contextInfo;
 	private String replacementString;
 	private boolean emptyContextInfo = true;
-	private KbIcon icon;
 	private int relevance = R_NONE;
 	private int position = -1;
 	private boolean autoActivationContentAssistantAfterApplication = false;
@@ -117,20 +114,6 @@
 	/**
 	 * @return
 	 */
-	public Image getIcon() {
-		return icon.getImage();
-	}
-
-	/**
-	 * @param image
-	 */
-	public void setIcon(KbIcon icon) {
-		this.icon = icon;
-	}
-
-	/**
-	 * @return
-	 */
 	public int getPosition() {
 		if(position==-1 && getReplacementString()!=null) {
 			return getReplacementString().length();

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -30,8 +30,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
 /**
  * Class helps to convert TLD to Schema
  * @author igels
@@ -170,8 +168,7 @@
 
 		Element elementType = SchemaNodeFactory.getInstance().createElementType(schemaElement, attributes);
 		String description = getDescription(tldTag);
-		if( KbConfigurationFactory.getInstance().getDefaultConfiguration().isUtilizeComments())
-			SchemaNodeFactory.getInstance().createDescription(elementType, description);
+		SchemaNodeFactory.getInstance().createDescription(elementType, description);
 		addAttributes(tldTag, elementType, jsfTld);
 	}
 
@@ -206,9 +203,7 @@
 		attributes.put(SchemaNodeFactory.NAME_ATTRIBUTE, name);
 		attributes.put(SchemaNodeFactory.REQUIRED_ATTRIBUTE, required);
 		Element attributeType = SchemaNodeFactory.getInstance().createAttributeType(schemaElement, attributes);
-		if(description != null &&  KbConfigurationFactory.getInstance().getDefaultConfiguration().isUtilizeComments()) {
-			SchemaNodeFactory.getInstance().createDescription(attributeType, description);
-		}
+		SchemaNodeFactory.getInstance().createDescription(attributeType, description);
 
 		if(jsfTld || tldAttribute.getElementsByTagName("deferred-value").getLength()>0) {
 			// Add default proposals

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -778,7 +778,6 @@
 				proposal.setLabel(value);
 				proposal.setReplacementString(value);
 				proposal.setContextInfo(null);
-				proposal.setIcon(KbIcon.ENUM_ITEM);
 				proposal.setPosition(value.length());
 
 				enumeration.add(proposal);
@@ -847,7 +846,6 @@
 
 				proposal.setLabel(lb);
 				proposal.setReplacementString(lb);
-				proposal.setIcon(KbIcon.TLD_TAG);
 			} else if(tldElement.isTag()) {
 				String prefix = tldElement.getPrefix();
 				String label = element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
@@ -873,17 +871,11 @@
 					position = proposal.getReplacementString().length();
 				}
 				proposal.setPosition(position);
-				proposal.setIcon(KbIcon.TLD_TAG);
 			} else {
 				String label = element.getAttribute(SchemaNodeFactory.NAME_ATTRIBUTE);
 
 				proposal.setReplacementString(label);
 				proposal.setLabel(label);
-				if(KbSchemaUtil.checkRequaredAttribute(element)) {
-					proposal.setIcon(KbIcon.TLD_ATTRIBUTE);
-				} else {
-					proposal.setIcon(KbIcon.TLD_ATTRIBUTE_OPTIONAL);
-				}
 			}
 			proposal.setContextInfo(KbSchemaUtil.getDescription(element));
 

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/TagDescriptor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/TagDescriptor.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/TagDescriptor.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -185,7 +185,6 @@
 			position = proposal.getReplacementString().length();
 		}
 		proposal.setPosition(position);
-		proposal.setIcon(KbIcon.TLD_TAG);
 
 		return proposal;
 	}

Deleted: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/XmlKbConnector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/XmlKbConnector.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/XmlKbConnector.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/ 
-package org.jboss.tools.common.kb;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
-
-/**
- * @author eskimo
- */
-public class XmlKbConnector implements KbConnector {
-
-	private ArrayList<KbResource> registretedResources;
-
-	public XmlKbConnector() {
-		registretedResources = new ArrayList<KbResource>();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.jboss.tools.common.kb.KbConnector#queryTagInformation(org.jboss.tools.common.kb.KbQuery)
-	 */
-	public TagDescriptor getTagInformation(String query) throws KbException {
-		KbQuery kbQuery = new KbQuery(query, registretedResources);
-		return KbDtdStore.getInstance().queryTagInformation(kbQuery);
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.KbConnector#getProposals()
-	 **/
-	public Collection getProposals(String query) throws KbException {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> XmlKbConnector.getProposals(String query)");
-			KbPlugin.getPluginLog().logInfo("    query = " + query);
-		}
-/*
-		try {
-			KbPlugin.log("Query: " + query);
-			KbPlugin.log("TagInfo: " + queryTagInformation(query));
-		} catch(Exception e) {
-    				KbPlugin.log(e);
-		}
-*/
-		KbQuery kbQuery = new KbQuery(query, registretedResources);
-		Collection proposals = KbDtdStore.getInstance().queryProposal(kbQuery);
-
-		boolean autocompleteRequiredAttributes = KbConfigurationFactory.getInstance().getDefaultConfiguration().isAutocompleteRequiredAttributes();
-		if(!autocompleteRequiredAttributes) {
-			removeAutocompleteRequiredAttributes(proposals);
-		}
-
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- XmlKbConnector.getProposals(String query)");
-			KbPlugin.getPluginLog().logInfo("    proposals size=" + proposals.size());
-		}
-		return proposals;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.jboss.tools.common.kb.KbConnector#RegisterResource(org.jboss.tools.common.kb.KbResource)
-	 */
-	public boolean registerResource(KbResource resource) {
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("--> XmlKbConnector.registerResource(KbResource resource)");
-			KbPlugin.getPluginLog().logInfo("    resource = " + resource);
-		}
-
-		if(!(resource instanceof KbDtdResource)) {
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("<-- XmlKbConnector.registerResource(KbResource resource)");
-				KbPlugin.getPluginLog().logInfo("    resource don't instanse of KbDtdResource.");
-			}
-			return false;
-		}
-		KbDtdResource dtdResource =(KbDtdResource)resource;
-
-		if(findEqualResource(resource)==null) {
-			registretedResources.add(resource);
-			if(KbPlugin.isDebugEnabled()) {
-				KbPlugin.getPluginLog().logInfo("    resource has been registered.");
-			}
-			KbDtdStore.getInstance().registerResource(resource);
-		}
-
-		KbDtdStore.getInstance().reregisterModifiededResource(dtdResource);
-		if(KbPlugin.isDebugEnabled()) {
-			KbPlugin.getPluginLog().logInfo("<-- XmlKbConnector.registerResource(KbResource resource)");
-		}
-		return true;
-	}
-
-	private KbResource findEqualResource(KbResource resource) {
-		for(int i=0; i<registretedResources.size(); i++) {
-		 	if(registretedResources.get(i).equals(resource)) {
-		 		return (KbResource)registretedResources.get(i);
-		 	}
-		}
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.jboss.tools.common.kb.KbConnector#RegisterResource(org.jboss.tools.common.kb.KbResource)
-	 */
-	public void unregisterResource(KbResource resource) {
-		KbResource er = findEqualResource(resource);
-
-		if(er!=null) {
-			registretedResources.remove(er);
-		}
-	}
-
-	private void removeAutocompleteRequiredAttributes(Collection proposals) {
-		for(Iterator iter = proposals.iterator(); iter.hasNext();) {
-			((KbProposal)iter.next()).removeAutocompleteRequiredAttributes();
-		}
-	}
-
-	public String toString() {
-		return "Resources size = " + registretedResources.size();
-	}
-}
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbConfiguration.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbConfiguration.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbConfiguration.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -60,28 +60,4 @@
 	 * @return
 	 */
 	public String getHtmlMapFilePath();
-
-	/**
-	 * 
-	 * @return
-	 */
-	public boolean isAllowDownload();
-
-	/**
-	 * 
-	 * @return
-	 */
-	public boolean isLowerCase();
-
-	/**
-	 * 
-	 * @return
-	 */
-	public boolean isAutocompleteRequiredAttributes();	
-
-	/**
-	 * 
-	 * @return
-	 */
-	public boolean isUtilizeComments();
 }
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbPluginConfiguration.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbPluginConfiguration.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/configuration/KbPluginConfiguration.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -14,10 +14,7 @@
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-
 import org.jboss.tools.common.kb.KbPlugin;
-import org.jboss.tools.common.kb.KbPreferencesConstants;
 
 /**
  * @author igels
@@ -89,42 +86,10 @@
 	}
 
 	/**
-	 * @see org.jboss.tools.common.kb.configuration.KbConfiguration#isAllowDownload()
-	 */
-	public boolean isAllowDownload() {
-		IPreferenceStore store = KbPlugin.getDefault().getPreferenceStore();
-		return store.getBoolean(KbPreferencesConstants.PROMPTING_ALLOW_DOWNLOAD);
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.configuration.KbConfiguration#isLowerCase()
-	 */
-	public boolean isLowerCase() {
-		IPreferenceStore store = KbPlugin.getDefault().getPreferenceStore();
-		return store.getBoolean(KbPreferencesConstants.PROMPTING_USE_LOWER_CASE);
-	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.configuration.KbConfiguration#isAutocompleteRequiredAttributes()
-	 */
-	public boolean isAutocompleteRequiredAttributes() {
-		IPreferenceStore store = KbPlugin.getDefault().getPreferenceStore();
-		return store.getBoolean(KbPreferencesConstants.PROMPTING_USE_AUTOCOMPLETE_FOR_MANDATORY);
-	}
-
-	/**
 	 * 
 	 * @return
 	 */
 	public static KbPluginConfiguration getInstance() {
 		return INSTANCE;
 	}
-
-	/**
-	 * @see org.jboss.tools.common.kb.configuration.KbConfiguration#isUtilizeComments()
-	 */
-	public boolean isUtilizeComments() {
-		IPreferenceStore store = KbPlugin.getDefault().getPreferenceStore();
-		return store.getBoolean(KbPreferencesConstants.PROMPTING_UTILIZE_COMMENTS);
-	}
 }
\ No newline at end of file

Modified: trunk/common/tests/org.jboss.tools.common.kb.test/src/org/jboss/tools/common/kb/test/resources/TestDynamicResource.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.kb.test/src/org/jboss/tools/common/kb/test/resources/TestDynamicResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/common/tests/org.jboss.tools.common.kb.test/src/org/jboss/tools/common/kb/test/resources/TestDynamicResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -15,7 +15,6 @@
 import java.util.Collection;
 
 import org.jboss.tools.common.kb.KbDinamicResource;
-import org.jboss.tools.common.kb.KbIcon;
 import org.jboss.tools.common.kb.KbProposal;
 
 abstract public class TestDynamicResource implements KbDinamicResource {
@@ -34,7 +33,6 @@
 				KbProposal proposal = new KbProposal();
 				proposal.setLabel(bundle);
 				proposal.setReplacementString(bundle);
-				proposal.setIcon(KbIcon.ENUM_ITEM);
 				proposal.setPosition(bundle.length());
 
 				proposals.add(proposal);

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbImageFileResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -11,7 +11,14 @@
 package org.jboss.tools.jst.jsp.support.kb;
 
 import java.io.InputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -20,14 +27,11 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IFileEditorInput;
-
+import org.jboss.tools.common.kb.KbDinamicResource;
+import org.jboss.tools.common.kb.KbProposal;
 import org.jboss.tools.common.model.XModelObject;
 import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
 import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.kb.KbDinamicResource;
-import org.jboss.tools.common.kb.KbIcon;
-import org.jboss.tools.common.kb.KbProposal;
 import org.jboss.tools.jst.jsp.JspEditorPlugin;
 import org.jboss.tools.jst.jsp.outline.ValueHelper;
 import org.jboss.tools.jst.web.tld.FilePathEncoderFactory;
@@ -121,7 +125,6 @@
 			}
 			proposal.setReplacementString(replacementString);
 			proposal.setPosition(replacementString.length());
-			proposal.setIcon(KbIcon.ENUM_ITEM);
 			proposals.add(proposal);
 		}
 		return proposals;
@@ -285,4 +288,4 @@
 		}
 		return false;
 	}
-}
+}
\ No newline at end of file

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdActionResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -21,7 +21,6 @@
 
 import org.eclipse.ui.IEditorInput;
 import org.jboss.tools.common.kb.KbDinamicResource;
-import org.jboss.tools.common.kb.KbIcon;
 import org.jboss.tools.common.kb.KbProposal;
 import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
 import org.jboss.tools.jst.web.project.list.IWebPromptingProvider;
@@ -68,7 +67,6 @@
 					KbProposal proposal = new KbProposal();
 					proposal.setLabel(text);
 					proposal.setReplacementString(text);
-					proposal.setIcon(KbIcon.ENUM_ITEM);
 					proposal.setPosition(text.length());
 					proposals.add(proposal);
 				}

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -20,13 +20,11 @@
 import java.util.TreeSet;
 
 import org.eclipse.ui.IEditorInput;
-
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.util.ELParser;
 import org.jboss.tools.common.kb.KbDinamicResource;
-import org.jboss.tools.common.kb.KbIcon;
 import org.jboss.tools.common.kb.KbProposal;
 import org.jboss.tools.common.kb.KbProposal.PostProcessing;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.util.ELParser;
 import org.jboss.tools.jst.jsp.JspEditorPlugin;
 import org.jboss.tools.jst.web.project.list.IWebPromptingProvider;
 import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
@@ -145,7 +143,6 @@
 			KbProposal proposal = new KbProposal();
 			proposal.setLabel(prefix + text + suffix);
 			proposal.setReplacementString(text);
-			proposal.setIcon(KbIcon.ENUM_ITEM);
 			proposals.add(proposal);
 			proposal.setPosition(cursor);
 			proposal.setPostProcessing(postProcessing);

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBundleNameResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -19,11 +19,9 @@
 import java.util.TreeSet;
 
 import org.eclipse.ui.IEditorInput;
-
-import org.jboss.tools.common.model.XModel;
 import org.jboss.tools.common.kb.KbDinamicResource;
-import org.jboss.tools.common.kb.KbIcon;
 import org.jboss.tools.common.kb.KbProposal;
+import org.jboss.tools.common.model.XModel;
 import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
 
 /**
@@ -60,7 +58,6 @@
 					KbProposal proposal = new KbProposal();
 					proposal.setLabel(text);
 					proposal.setReplacementString(text);
-					proposal.setIcon(KbIcon.ENUM_ITEM);
 					proposal.setPosition(text.length());
 					proposals.add(proposal);
 				}
@@ -102,4 +99,4 @@
 	 */
 	public void clearConstraints() {
 	}
-}
+}
\ No newline at end of file

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdTaglibResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdTaglibResource.java	2008-03-27 12:01:03 UTC (rev 7145)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdTaglibResource.java	2008-03-27 13:13:43 UTC (rev 7146)
@@ -19,11 +19,9 @@
 import java.util.TreeSet;
 
 import org.eclipse.ui.IEditorInput;
-
-import org.jboss.tools.common.model.XModel;
 import org.jboss.tools.common.kb.KbDinamicResource;
-import org.jboss.tools.common.kb.KbIcon;
 import org.jboss.tools.common.kb.KbProposal;
+import org.jboss.tools.common.model.XModel;
 import org.jboss.tools.jst.jsp.JspEditorPlugin;
 import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
 
@@ -56,7 +54,6 @@
 					KbProposal proposal = new KbProposal();
 					proposal.setLabel(text);
 					proposal.setReplacementString(text);
-					proposal.setIcon(KbIcon.ENUM_ITEM);
 					proposals.add(proposal);
 					proposal.setPosition(proposal.getReplacementString().length());
 				}
@@ -94,5 +91,4 @@
 
 	public void clearConstraints() {
 	}
-
-}
+}
\ No newline at end of file




More information about the jbosstools-commits mailing list