diff options
Diffstat (limited to 'bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist')
18 files changed, 0 insertions, 4158 deletions
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java deleted file mode 100644 index 89d80181c0..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; -import org.eclipse.wst.css.ui.internal.image.CSSImageType; - -class CSSCACandidate { - - private String fReplacementString = null; - private int fCursorPosition = 0; - private String fDisplayString = null; - private CSSImageType fImageType = null; - private CSSMMNode fNode = null; - /** - * CSSCACandidate constructor comment. - */ - CSSCACandidate() { - super(); - } - - /** - * - */ - int getCursorPosition() { - return fCursorPosition; - } - - /** - * - */ - String getDisplayString() { - return fDisplayString; - } - - /** - * - */ - CSSImageType getImageType() { - return fImageType; - } - - /** - * - */ - String getReplacementString() { - return fReplacementString; - } - - CSSMMNode getMMNode() { - return fNode; - } - - /** - * - */ - void setCursorPosition(int cursorPosition) { - fCursorPosition = cursorPosition; - } - - /** - * - */ - void setDisplayString(String displayString) { - fDisplayString = displayString; - } - - /** - * - */ - void setImageType(CSSImageType imageType) { - fImageType = imageType; - } - - /** - * - */ - void setReplacementString(String replacementString) { - fReplacementString = replacementString; - } - - void setMMNode(CSSMMNode node) { - fNode = node; - } - - /** - * Returns a String that represents the value of this object. - * - * @return a string representation of the receiver - */ - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append(getReplacementString()); - buf.append("\"");//$NON-NLS-1$ - buf.append(getDisplayString()); - buf.append("\"");//$NON-NLS-1$ - buf.append("(");//$NON-NLS-1$ - buf.append(getCursorPosition()); - buf.append(")");//$NON-NLS-1$ - - return buf.toString(); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java deleted file mode 100644 index 81f6817354..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.wst.css.core.internal.Logger; -import org.eclipse.wst.css.core.internal.provisional.adapters.ICSSModelAdapter; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.html.core.internal.htmlcss.StyleAdapterFactory; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; -import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer; -import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistUtilities; -import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper; - -/** - * <p>Completion computer for CSS</p> - */ -public class CSSCompletionProposalComputer implements ICompletionProposalComputer { - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor) - */ - public List computeCompletionProposals(CompletionProposalInvocationContext context, IProgressMonitor monitor) { - ITextViewer viewer = context.getViewer(); - int documentPosition = context.getInvocationOffset(); - - IndexedRegion indexedNode = ContentAssistUtils.getNodeAt(viewer, documentPosition); - IDOMNode xNode = null; - IDOMNode parent = null; - CSSProposalArranger arranger = null; - - // If there is a selected region, we'll need to replace the text - ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection(); - - // bail if we couldn't get an indexed node - // if(indexedNode == null) return new ICompletionProposal[0]; - if (indexedNode instanceof IDOMNode) { - xNode = (IDOMNode) indexedNode; - parent = (IDOMNode) xNode.getParentNode(); - } - // need to get in here if there in the no 0 region <style>|</style> - // case - if ((xNode != null) && xNode.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) { - // now we know the cursor is in a <style> tag w/out region - IStructuredModel cssModel = getCSSModel(xNode); - if (cssModel != null) { - // adjust offsets for embedded style - int offset = documentPosition; - int pos = 0; - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, selection.getLength(), (char) 0); - } - } else if ((parent != null) && parent.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) { - // now we know the cursor is in a <style> tag with a region - // use the parent because that will be the <style> tag - IStructuredModel cssModel = getCSSModel(parent); - if (cssModel != null) { - // adjust offsets for embedded style - int offset = indexedNode.getStartOffset(); - int pos = documentPosition - offset; - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, selection.getLength(), (char) 0); - } - } else if (indexedNode instanceof IDOMNode) { - IDOMNode domNode = ((IDOMNode)indexedNode); - // get model for node w/ style attribute - IStructuredModel cssModel = getCSSModel(domNode); - if (cssModel != null) { - // adjust offsets for embedded style - int textRegionStartOffset = getTextRegionStartOffset(domNode, documentPosition); - int pos = documentPosition - textRegionStartOffset; - - char quote = (char) 0; - try { - quote = context.getDocument().get(textRegionStartOffset, 1).charAt(0); - } catch (BadLocationException e) { - Logger.logException("error getting quote character", e); - } - - //get css indexed region - IndexedRegion cssIndexedNode = cssModel.getIndexedRegion(pos); - if (cssIndexedNode == null) { - cssIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - if (cssIndexedNode instanceof ICSSNode) { - // inline style for a tag, not embedded - arranger = new CSSProposalArranger(pos, (ICSSNode) cssIndexedNode, textRegionStartOffset, selection.getLength(), quote); - } - } - } else if (indexedNode instanceof ICSSNode) { - // when editing external CSS using CSS Designer, ICSSNode is passed. - ICSSDocument cssdoc = ((ICSSNode) indexedNode).getOwnerDocument(); - if (cssdoc != null) { - IStructuredModel cssModel = cssdoc.getModel(); - if (cssModel != null) { - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - if (keyIndexedNode instanceof ICSSNode) { - // inline style for a tag, not embedded - arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, 0, selection.getLength(), (char)0); - } - } - } - } else if ((indexedNode == null) && ContentAssistUtils.isViewerEmpty(viewer)) { - // the top of empty CSS Document - IStructuredModel cssModel = null; - try { - cssModel = StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument()); - if (cssModel instanceof ICSSModel) { - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - if (keyIndexedNode instanceof ICSSNode) { - // inline style for a tag, not embedded - arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, 0, (char)0); - } - } - } finally { - if (cssModel != null) - cssModel.releaseFromRead(); - } - } - - ICompletionProposal[] proposals = new ICompletionProposal[0]; - if (arranger != null) { - proposals = arranger.getProposals(); - - ICompletionProposal[] newfileproposals = new ICompletionProposal[0]; - ICompletionProposal[] anyproposals = new ICompletionProposal[0]; - - // add end tag if parent is not closed - ICompletionProposal endTag = XMLContentAssistUtilities.computeXMLEndTagProposal(viewer, documentPosition, indexedNode, HTML40Namespace.ElementName.STYLE, SharedXMLEditorPluginImageHelper.IMG_OBJ_TAG_GENERIC); - - // add the additional proposals - int additionalLength = newfileproposals.length + anyproposals.length; - additionalLength = (endTag != null) ? ++additionalLength : additionalLength; - if (additionalLength > 0) { - ICompletionProposal[] plusOnes = new ICompletionProposal[proposals.length + additionalLength]; - int appendPos = proposals.length; - // add end tag proposal - if (endTag != null) { - System.arraycopy(proposals, 0, plusOnes, 1, proposals.length); - plusOnes[0] = endTag; - ++appendPos; - } else { - System.arraycopy(proposals, 0, plusOnes, 0, proposals.length); - } - // add items in newfileproposals - for (int i = 0; i < newfileproposals.length; ++i) { - plusOnes[appendPos + i] = newfileproposals[i]; - } - // add items in anyproposals - appendPos = appendPos + newfileproposals.length; - for (int i = 0; i < anyproposals.length; ++i) { - plusOnes[appendPos + i] = anyproposals[i]; - } - proposals = plusOnes; - } - } - return Arrays.asList(proposals); - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor) - */ - public List computeContextInformation( - CompletionProposalInvocationContext context, - IProgressMonitor monitor) { - // TODO Auto-generated method stub - return null; - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#getErrorMessage() - */ - public String getErrorMessage() { - // TODO Auto-generated method stub - return null; - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionStarted() - */ - public void sessionStarted() { - //default is to do nothing - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionEnded() - */ - public void sessionEnded() { - //default is to do nothing - } - - /** - * Returns the CSSmodel for a given XML node. - * - * @param element - * @return IStructuredModel - */ - private static IStructuredModel getCSSModel(IDOMNode element) { - if (element == null) { - return null; - } - INodeAdapter adapter = StyleAdapterFactory.getInstance().adapt(element); - if ((adapter == null) || !(adapter instanceof ICSSModelAdapter)) { - return null; - } - ICSSModelAdapter modelAdapter = (ICSSModelAdapter) adapter; - return modelAdapter.getModel(); - } - - /** - * <p>Get the start offset of the text region containing the given document position</p> - * - * @param domNode {@link IDOMNode} containing the document position - * @param documentPosition the document relative position to get the start - * offset of the containing {@link ITextRegion} for - * @return start offset of the {@link ITextRegion} containing the given document position - */ - private static int getTextRegionStartOffset(IDOMNode domNode, int documentPosition) { - IStructuredDocumentRegion structRegion = domNode.getFirstStructuredDocumentRegion(); - return structRegion.getStartOffset(structRegion.getRegionAtCharacterOffset(documentPosition)); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java deleted file mode 100644 index 250d95242d..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java +++ /dev/null @@ -1,467 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.wst.css.ui.internal.contentassist; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel; -import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelFinder; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.util.CSSUtil; -import org.eclipse.wst.css.core.internal.util.RegionIterator; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; - -class CSSContentAssistContext { - - private int fReplaceBegin = -1; - private String fTextToReplace = null; - private String fTextToCompare = null; - private int fTargetPos = -1; - private ICSSNode fTargetNode = null; - private int fCursorPos = -1; - private int fLength = -1; - private IStructuredDocument fStructuredDocument = null; - private int fDocumentOffset = 0; - private char fQuote = 0; - private ICSSModel fModel = null; - private boolean fSelected = false; - - /** - * - */ - private CSSContentAssistContext() { - super(); - } - - /** - * - */ - CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, char quote) { - this(); - fCursorPos = documentPosition; - fDocumentOffset = documentOffset; - fQuote = quote; - initialize(node.getOwnerDocument()); - } - - CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, int length, char quote) { - this(); - fCursorPos = documentPosition; - fDocumentOffset = documentOffset; - fQuote = quote; - fLength = length; - initialize(node.getOwnerDocument()); - } - - CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, char quote, boolean selected) { - this(); - fCursorPos = documentPosition; - fDocumentOffset = documentOffset; - fQuote = quote; - fSelected = selected; - initialize(node.getOwnerDocument()); - } - - /** - * @return int - */ - int getCursorPos() { - return fCursorPos; - } - - /** - * @return int - */ - int getDocumentOffset() { - return fDocumentOffset; - } - - IStructuredDocument getStructuredDocument() { - return fStructuredDocument; - } - - ICSSModel getModel() { - return fModel; - } - - private ICSSNode getNodeAt(int offset) { - return (ICSSNode) ((fModel != null) ? fModel.getIndexedRegion(offset) : null); - } - - /** - * - * @return char - */ - char getQuoteOfStyleAttribute() { - return fQuote; - } - - ITextRegion getRegionByOffset(int offset) { - ITextRegion region = null; - if (fStructuredDocument != null) { - IStructuredDocumentRegion flatNode = fStructuredDocument.getRegionAtCharacterOffset(offset); - if (flatNode != null) { - //if its a quoted region and at the beginning of a node then get the node before it - if(offset == flatNode.getStartOffset() && fQuote != 0) { - flatNode = fStructuredDocument.getRegionAtCharacterOffset(offset-1); - } - - //if its the end offset of the node then to get the region need to step back one - if(offset == flatNode.getEndOffset()) { - region = flatNode.getRegionAtCharacterOffset(offset-1); - } else { - region = flatNode.getRegionAtCharacterOffset(offset); - } - } - } - return region; - } - - /** - * - */ - // String getRegionText() { - // ITextRegion targetRegion = getTargetRegion(); - // if (targetRegion != null) { - // return targetRegion.getText(); - // } else { - // return ""; //$NON-NLS-1$ - // } - // } - /** - * - */ - int getReplaceBegin() { - return fReplaceBegin; - } - - ICSSNode getTargetNode() { - return fTargetNode; - } - - private int getTargetPos() { - return fTargetPos; - } - - ITextRegion getTargetRegion() { - return getRegionByOffset(getTargetPos()); - } - - private IStructuredDocumentRegion getTargetDocumentRegion() { - return getDocumentRegionByOffset(getTargetPos()); - } - - private IStructuredDocumentRegion getDocumentRegionByOffset(int offset) { - return (fStructuredDocument != null) ? fStructuredDocument.getRegionAtCharacterOffset(offset) : null; - } - - ITextRegion getTargetRegionPrevious() { - ITextRegion previousRegion = null; - ITextRegion targetRegion = getTargetRegion(); - RegionIterator iterator = null; - if (targetRegion == null) { - if (0 < fCursorPos) { - iterator = new RegionIterator(fStructuredDocument, fCursorPos - 1); - } - } else { - iterator = getRegionIterator(); - if (iterator.hasPrev()) { - iterator.prev(); - } else { - iterator = null; - } - } - if (iterator != null) { - while (iterator.hasPrev()) { - ITextRegion region = iterator.prev(); - String type = region.getType(); - if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) { - previousRegion = region; - break; - } - } - } - - return previousRegion; - } - - /** - * @return java.lang.String - */ - String getTextToCompare() { - return fTextToCompare; - } - - /** - * - */ - String getTextToReplace() { - return fTextToReplace; - } - - /** - * - */ - private void initialize(ICSSDocument doc) { - if (doc == null) { - return; - } - ICSSModel model = doc.getModel(); - fModel = model; - fStructuredDocument = model.getStructuredDocument(); - - initializeTargetPos(); - initializeTargetText(); - initializeTargetNode(); - } - - /** - * - */ - private void initializeTargetNode() { - if (fCursorPos == 0) { - fTargetNode = fModel.getDocument(); - return; - } - - // find edge of tree node - ICSSNode cursorNode = getNodeAt(fCursorPos); - if (cursorNode == null) { // end of document - cursorNode = fModel.getDocument(); - } - ICSSNode node = null; - IStructuredDocumentRegion flatNode = fStructuredDocument.getRegionAtCharacterOffset(fCursorPos - 1); - while (flatNode != null && (node = getNodeAt(flatNode.getStartOffset())) == cursorNode && ((IndexedRegion) node).getStartOffset() != flatNode.getStartOffset()) { - flatNode = flatNode.getPrevious(); - } - if (flatNode == null) { // top of document - fTargetNode = (node == null) ? fModel.getDocument() : node; - return; - } - // v<--| - // AAAAAA - // BBBBBBBBBB cursorNode:A , node:B -> target is A - if (cursorNode != null) { - for (ICSSNode parent = cursorNode.getParentNode(); parent != null; parent = parent.getParentNode()) { - if (parent == cursorNode) { - fTargetNode = cursorNode; - return; - } - } - } - // v<--| - // AAA - // BBBBBBBBBB cursorNode:B , node:A -> depend on A's node type - short nodeType = node.getNodeType(); - if (nodeType == ICSSNode.STYLEDECLITEM_NODE || nodeType == ICSSNode.CHARSETRULE_NODE || nodeType == ICSSNode.IMPORTRULE_NODE) { - String type = CSSUtil.getStructuredDocumentRegionType(flatNode); - if (type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) { - fTargetNode = node.getParentNode(); - } else { - fTargetNode = node; - } - // fTargetNode = (bOverSemiColon) ? node.getParentNode() : node; - } else if (CSSUtil.getStructuredDocumentRegionType(flatNode) == CSSRegionContexts.CSS_RBRACE) { - fTargetNode = node.getParentNode(); - } else { - fTargetNode = node; - } - - return; - } - - /** - * - */ - private void initializeTargetPos() { - if (fCursorPos == 0 || isSpecialDelimiterRegion(fCursorPos - 1)) { - fTargetPos = fCursorPos; - } else { - fTargetPos = fCursorPos - 1; - } - - //deal with the leading quote - if(fQuote != 0) { - fTargetPos--; - } - } - - /** - * - */ - private void initializeTargetText() { - ITextRegion targetRegion = getTargetRegion(); - IStructuredDocumentRegion documentRegion = getTargetDocumentRegion(); - if (targetRegion == null) { - fReplaceBegin = fCursorPos; - fTextToReplace = ""; //$NON-NLS-1$ - fTextToCompare = ""; //$NON-NLS-1$ - } else { - String regionText = documentRegion.getText(targetRegion); - int regionStart = documentRegion.getStartOffset(targetRegion); - if (!fSelected && (regionStart == fCursorPos || regionText.trim().length() == 0 || regionStart + regionText.length() - 1 < this.fTargetPos)) { - // to insertion - fReplaceBegin = fCursorPos; - fTextToReplace = ""; //$NON-NLS-1$ - fTextToCompare = ""; //$NON-NLS-1$ - try { - if (fLength > 0) - fTextToReplace = fStructuredDocument.get(fReplaceBegin, fLength); - } - catch (BadLocationException e) { - } - } else { - // to replace - fReplaceBegin = regionStart; - fTextToReplace = regionText; - - //math to deal with leading quote - int matchLength = fCursorPos - fReplaceBegin; - if(fQuote != 0) { - matchLength--; - fReplaceBegin++; - } - - if(fCursorPos >= fReplaceBegin && regionText.trim().length() >= (matchLength)) - fTextToCompare = regionText.substring(0, matchLength); - else - fTextToCompare = ""; //$NON-NLS-1$ - } - } - } - - /** - * - */ - private boolean isSpecialDelimiterRegion(int pos) { - ITextRegion region = getRegionByOffset(pos); - String type = null; - if(region != null) { - type = region.getType(); - } - return (type != null) &&((type == CSSRegionContexts.CSS_LBRACE || - type == CSSRegionContexts.CSS_RBRACE || - type == CSSRegionContexts.CSS_DELIMITER || - type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR || - type == CSSRegionContexts.CSS_DECLARATION_DELIMITER || - type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR || - type == CSSRegionContexts.CSS_S)); - } - /** - * - */ - boolean isTargetPosAfterOf(String regionType) { - int start = ((IndexedRegion) fTargetNode).getStartOffset(); - if (start < 0 || ((IndexedRegion) fTargetNode).getEndOffset() <= 0) { - return false; - } - - RegionIterator iRegion = new RegionIterator(fStructuredDocument, start); - while (iRegion.hasNext()) { - ITextRegion region = iRegion.next(); - if (fTargetPos < iRegion.getStructuredDocumentRegion().getTextEndOffset(region)) { - break; - } - if (region.getType() == regionType) { - return true; - } - } - - return false; - } - - /** - * - */ - boolean isTargetPosBeforeOf(String regionType) { - return !isTargetPosAfterOf(regionType); - } - - /** - * @return boolean - * @param regionType - * java.lang.String - */ - boolean targetFollows(String regionType) { - RegionIterator iRegion; - ITextRegion region = null; - if (fStructuredDocument.getLength() <= fTargetPos) { - iRegion = new RegionIterator(fStructuredDocument, fStructuredDocument.getLength() - 1); - } else { - iRegion = new RegionIterator(fStructuredDocument, fTargetPos); - try { - if (!Character.isWhitespace(fStructuredDocument.getChar(fTargetPos)) && iRegion.hasPrev()) { - region = iRegion.prev(); - } - } catch (BadLocationException e) { - iRegion = new RegionIterator(fStructuredDocument, fStructuredDocument.getLength() - 1); - } - } - while (iRegion.hasPrev()) { - region = iRegion.prev(); - String type = region.getType(); - if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) { - continue; - } else { - break; - } - } - if (region != null && region.getType() == regionType) { - return true; - } else { - return false; - } - } - - /** - * - */ - boolean targetHas(String regionType) { - int end = ((IndexedRegion) fTargetNode).getEndOffset(); - if (getTargetPos() < 0 || end <= 0) { - return false; - } - RegionIterator iRegion = new RegionIterator(fStructuredDocument, getTargetPos()); - while (iRegion.hasNext()) { - ITextRegion region = iRegion.next(); - if (end <= iRegion.getStructuredDocumentRegion().getStartOffset(region)) { - break; - } - if (region.getType() == regionType) { - return true; - } - } - return false; - } - - RegionIterator getRegionIterator() { - return new RegionIterator(getStructuredDocument(), getTargetPos()); - } - - /** - * - */ - CSSMetaModel getMetaModel() { - CSSMetaModelFinder finder = CSSMetaModelFinder.getInstance(); - ICSSModel model = getModel(); - if (model.getOwnerDOMNode() != null) { - return finder.findMetaModelFor(model.getOwnerDOMNode()); - } - return finder.findMetaModelFor(getModel()); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java deleted file mode 100644 index b4af3d0a49..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.wst.css.core.internal.provisional.adapters.ICSSModelAdapter; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.ui.internal.templates.TemplateContextTypeIdsCSS; -import org.eclipse.wst.html.core.internal.htmlcss.StyleAdapterFactory; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistUtilities; -import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper; - -/** - * @deprecated This class is no longer used locally and will be removed in the future - * @see CSSStructuredContentAssistProcessor - */ -public class CSSContentAssistProcessor implements IContentAssistProcessor { - - private int fDocumentOffset = 0; - private char fQuote = 0; - private CSSTemplateCompletionProcessor fTemplateProcessor = null; - - /** - * Return a list of proposed code completions based on the specified - * location within the document that corresponds to the current cursor - * position within the text-editor control. - * - * @param documentPosition - * a location within the document - * @return an array of code-assist items - */ - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentPosition) { - - IndexedRegion indexedNode = ContentAssistUtils.getNodeAt(viewer, documentPosition + fDocumentOffset); - IDOMNode xNode = null; - IDOMNode parent = null; - CSSProposalArranger arranger = null; - boolean isEmptyDocument = false; - // If there is a selected region, we'll need to replace the text - ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection(); - boolean selected = (selection != null && selection.getText() != null && selection.getText().trim().length() > 0); - - // bail if we couldn't get an indexed node - // if(indexedNode == null) return new ICompletionProposal[0]; - if (indexedNode instanceof IDOMNode) { - xNode = (IDOMNode) indexedNode; - parent = (IDOMNode) xNode.getParentNode(); - } - // need to get in here if there in the no 0 region <style>|</style> - // case - if ((xNode != null) && xNode.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) { - // now we know the cursor is in a <style> tag w/out region - IStructuredModel cssModel = getCSSModel(xNode); - if (cssModel != null) { - // adjust offsets for embedded style - int offset = documentPosition + fDocumentOffset; - int pos = 0; - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, (char) 0, selected); - } - } else if ((parent != null) && parent.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) { - // now we know the cursor is in a <style> tag with a region - // use the parent because that will be the <style> tag - IStructuredModel cssModel = getCSSModel(parent); - if (cssModel != null) { - // adjust offsets for embedded style - int offset = indexedNode.getStartOffset(); - int pos = documentPosition - offset; - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, (char) 0, selected); - } - } else if (indexedNode instanceof IDOMNode) { - // get model for node w/ style attribute - IStructuredModel cssModel = getCSSModel((IDOMNode) indexedNode); - if (cssModel != null) { - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - if (keyIndexedNode instanceof ICSSNode) { - // inline style for a tag, not embedded - arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote, selected); - } - } - } else if (indexedNode instanceof ICSSNode) { - // when editing external CSS using CSS Designer, ICSSNode is - // passed. - ICSSDocument cssdoc = ((ICSSNode) indexedNode).getOwnerDocument(); - if (cssdoc != null) { - IStructuredModel cssModel = cssdoc.getModel(); - if (cssModel != null) { - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - if (keyIndexedNode instanceof ICSSNode) { - // inline style for a tag, not embedded - arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote, selected); - } - } - } - } else if ((indexedNode == null) && isViewerEmpty(viewer)) { - isEmptyDocument = true; - // the top of empty CSS Document - IStructuredModel cssModel = null; - try { - cssModel = StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument()); - if (cssModel instanceof ICSSModel) { - IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset); - if (keyIndexedNode == null) { - keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument(); - } - if (keyIndexedNode instanceof ICSSNode) { - // inline style for a tag, not embedded - arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote); - } - } - } finally { - if (cssModel != null) - cssModel.releaseFromRead(); - } - } - - ICompletionProposal[] proposals = new ICompletionProposal[0]; - if (arranger != null) { - fDocumentOffset = 0; - proposals = arranger.getProposals(); - - ICompletionProposal[] newfileproposals = new ICompletionProposal[0]; - ICompletionProposal[] anyproposals = new ICompletionProposal[0]; - // add template proposals - if (getTemplateCompletionProcessor() != null) { - if (isEmptyDocument) { - getTemplateCompletionProcessor().setContextType(TemplateContextTypeIdsCSS.NEW); - newfileproposals = getTemplateCompletionProcessor().computeCompletionProposals(viewer, documentPosition); - } - getTemplateCompletionProcessor().setContextType(TemplateContextTypeIdsCSS.ALL); - anyproposals = getTemplateCompletionProcessor().computeCompletionProposals(viewer, documentPosition); - } - - // add end tag if parent is not closed - ICompletionProposal endTag = XMLContentAssistUtilities.computeXMLEndTagProposal(viewer, documentPosition, indexedNode, HTML40Namespace.ElementName.STYLE, SharedXMLEditorPluginImageHelper.IMG_OBJ_TAG_GENERIC); - - // add the additional proposals - int additionalLength = newfileproposals.length + anyproposals.length; - additionalLength = (endTag != null) ? ++additionalLength : additionalLength; - if (additionalLength > 0) { - ICompletionProposal[] plusOnes = new ICompletionProposal[proposals.length + additionalLength]; - int appendPos = proposals.length; - // add end tag proposal - if (endTag != null) { - System.arraycopy(proposals, 0, plusOnes, 1, proposals.length); - plusOnes[0] = endTag; - ++appendPos; - } else { - System.arraycopy(proposals, 0, plusOnes, 0, proposals.length); - } - // add items in newfileproposals - for (int i = 0; i < newfileproposals.length; ++i) { - plusOnes[appendPos + i] = newfileproposals[i]; - } - // add items in anyproposals - appendPos = appendPos + newfileproposals.length; - for (int i = 0; i < anyproposals.length; ++i) { - plusOnes[appendPos + i] = anyproposals[i]; - } - proposals = plusOnes; - } - } - return proposals; - } - - /** - * Returns true if there is no text or it's all white space, otherwise - * returns false - * - * @param treeNode - * @param textViewer - * @return boolean - */ - private boolean isViewerEmpty(ITextViewer textViewer) { - boolean isEmpty = false; - String text = textViewer.getTextWidget().getText(); - if ((text == null) || ((text != null) && text.trim().equals(""))) //$NON-NLS-1$ - isEmpty = true; - return isEmpty; - } - - /** - * Get CSSModel for an indexed node - * - * @param indexedNode - * @return IStructuredModel - */ - // private IStructuredModel getCSSModel(IndexedRegion indexedNode) { - // if (indexedNode == null) return null; - // Node node = (Node)indexedNode; - // INodeNotifier notifier = (INodeNotifier)node.getParentNode(); - // if (notifier == null) return null; - // INodeAdapter adapter = - // StyleAdapterFactory.getInstance().adapt(notifier); - // if (adapter == null || !(adapter instanceof CSSModelAdapter)) return - // null; - // CSSModelAdapter modelAdapter = (CSSModelAdapter)adapter; - // return modelAdapter.getModel(); - // } - /** - * Returns the CSSmodel for a given XML node. - * - * @param element - * @return IStructuredModel - */ - private IStructuredModel getCSSModel(IDOMNode element) { - if (element == null) - return null; - INodeAdapter adapter = StyleAdapterFactory.getInstance().adapt(element); - if ((adapter == null) || !(adapter instanceof ICSSModelAdapter)) - return null; - ICSSModelAdapter modelAdapter = (ICSSModelAdapter) adapter; - return modelAdapter.getModel(); - } - - /** - * Returns information about possible contexts based on the specified - * location within the document that corresponds to the current cursor - * position within the text viewer. - * - * @param viewer - * the viewer whose document is used to compute the possible - * contexts - * @param documentPosition - * an offset within the document for which context information - * should be computed - * @return an array of context information objects or <code>null</code> - * if no context could be found - */ - public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer, int documentOffset) { - return null; - } - - /** - * Returns the characters which when entered by the user should - * automatically trigger the presentation of possible completions. - * - * @return the auto activation characters for completion proposal or - * <code>null</code> if no auto activation is desired - */ - public char[] getCompletionProposalAutoActivationCharacters() { - return null; - } - - /** - * Returns the characters which when entered by the user should - * automatically trigger the presentation of context information. - * - * @return the auto activation characters for presenting context - * information or <code>null</code> if no auto activation is - * desired - */ - public char[] getContextInformationAutoActivationCharacters() { - return null; - } - - /** - * Returns a validator used to determine when displayed context - * information should be dismissed. May only return <code>null</code> if - * the processor is incapable of computing context information. - * - * @return a context information validator, or <code>null</code> if the - * processor is incapable of computing context information - */ - public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator() { - return null; - } - - /** - * Return the reason why computeProposals was not able to find any - * completions. - * - * @return an error message or null if no error occurred - */ - public String getErrorMessage() { - return null; - } - - /** - * Insert the method's description here. Creation date: (2001/05/22 - * 10:37:05) - * - * @param offset - * int - */ - public void setDocumentOffset(int offset) { - fDocumentOffset = offset; - } - - /** - * - * @param quote - * char - */ - public void setQuoteCharOfStyleAttribute(char quote) { - fQuote = quote; - } - - private CSSTemplateCompletionProcessor getTemplateCompletionProcessor() { - if (fTemplateProcessor == null) { - fTemplateProcessor = new CSSTemplateCompletionProcessor(); - } - return fTemplateProcessor; - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java deleted file mode 100644 index cd7b4409e6..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSMediaRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPageRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.w3c.dom.css.CSSFontFaceRule; - -class CSSProposalArranger { - - private List fProposals = new ArrayList(); - private CSSContentAssistContext fContext = null; - - /** - * CSSProposalArranger constructor comment. - */ - private CSSProposalArranger() { - super(); - } - - /** - * CSSProposalArranger constructor comment. - */ - CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, char quote) { - this(); - fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, quote); - } - - CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, int length, char quote) { - this(); - fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, length, quote); - } - - CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, char quote, boolean selected) { - this(); - fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, quote, selected); - } - - /** - * - */ - void buildProposals() { - fProposals.clear(); - - /* - * String text; ICompletionProposal item; text = "---- Test - * Information ----"; item = new CompletionProposal("", - * fContext.getReplaceBegin(), 0, 0, null, text, null, null); - * fProposals.add(item); - * - * text = "Target: \"" + fContext.getRegionText() + "\""; - * - * item = new CompletionProposal("", fContext.getReplaceBegin(), 0, 0, - * null, text, null, null); fProposals.add(item); - * - * text = fContext.getTargetNode().getClass().toString(); int - * lastPeriodPos = text.lastIndexOf('.'); text = "Node: " + - * text.substring(lastPeriodPos + 1); item = new - * CompletionProposal("", fContext.getReplaceBegin(), 0, 0, null, - * text, null, null); fProposals.add(item); - */ - - ICSSNode targetNode = fContext.getTargetNode(); - //int targetPos = fContext.getTargetPos(); - if (targetNode instanceof ICSSStyleSheet) { - buildProposalsForAnyRule(); - } else if ((targetNode instanceof ICSSMediaRule && fContext.isTargetPosAfterOf(CSSRegionContexts.CSS_LBRACE)) || (targetNode instanceof ICSSStyleRule && fContext.isTargetPosBeforeOf(CSSRegionContexts.CSS_LBRACE))) { - buildProposalsForAnyRule(); - // buildProposalsForStyleRule(); - } else if ((targetNode instanceof ICSSPageRule && fContext.isTargetPosBeforeOf(CSSRegionContexts.CSS_LBRACE))) { - buildProposalsForPageRulePseudoClass(); - } else if ((targetNode instanceof ICSSStyleRule || targetNode instanceof CSSFontFaceRule || targetNode instanceof ICSSPageRule || targetNode instanceof ICSSStyleDeclaration) && (targetNode.getOwnerDocument() instanceof ICSSStyleDeclaration || fContext.targetFollows(CSSRegionContexts.CSS_DECLARATION_DELIMITER) || fContext.targetFollows(CSSRegionContexts.CSS_LBRACE))) { - buildProposalsForDeclarationName(); - } else if (targetNode instanceof ICSSStyleDeclItem) { - if (fContext.isTargetPosAfterOf(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) { - buildProposalsForDeclarationValue(); - } else { - buildProposalsForDeclarationName(); - } - } else if (targetNode instanceof ICSSPrimitiveValue) { - buildProposalsForDeclarationValue(); - } - /* - * else if (targetNode instanceof ICSSPrimitiveValue || ((targetNode - * instanceof ICSSStyleRule || targetNode instanceof CSSFontFaceRule || - * targetNode instanceof ICSSStyleDeclaration || targetNode instanceof - * ICSSStyleDeclItem) && - * fContext.isTargetPosAfterOf(CSSRegionContexts.COLON))) { - * buildProposalsForDeclarationValue(); } - */ - - // for Test - } - - /** - * - */ - void buildProposalsForAnyRule() { - CSSProposalGenerator generator; - if (isFirstRegion()){ - generator = new CSSProposalGeneratorForAtmarkRule(fContext); - fProposals.addAll(generator.getProposals()); - } - generator = new CSSProposalGeneratorForHTMLTag(fContext); - fProposals.addAll(generator.getProposals()); - generator = new CSSProposalGeneratorForPseudoSelector(fContext); - fProposals.addAll(generator.getProposals()); - } - - private boolean isFirstRegion(){ - if (fContext.getCursorPos() == 0) - return true; - - ITextRegion region = fContext.getTargetRegion(); - ITextRegion currRegion = fContext.getRegionByOffset(fContext.getCursorPos()); - String type = null; - String crType = null; - if(region != null) { - type = region.getType(); - } - if(currRegion != null) { - crType = currRegion.getType(); - } - if (type == null || crType == null || (crType == type)) - return true; - else - return false; - } - /** - * - */ - void buildProposalsForDeclarationName() { - CSSProposalGenerator generator; - generator = new CSSProposalGeneratorForDeclarationName(fContext); - fProposals.addAll(generator.getProposals()); - } - - /** - * - */ - void buildProposalsForDeclarationValue() { - CSSProposalGenerator generator; - generator = new CSSProposalGeneratorForDeclarationValue(fContext); - fProposals.addAll(generator.getProposals()); - } - - /** - * - */ - void buildProposalsForPageRulePseudoClass() { - CSSProposalGenerator generator; - generator = new CSSProposalGeneratorForPseudoSelector(fContext); - fProposals.addAll(generator.getProposals()); - } - - /** - * - */ - void buildProposalsForStyleRule() { - CSSProposalGenerator generator; - generator = new CSSProposalGeneratorForHTMLTag(fContext); - fProposals.addAll(generator.getProposals()); - generator = new CSSProposalGeneratorForPseudoSelector(fContext); - fProposals.addAll(generator.getProposals()); - } - - /** - * - */ - ICompletionProposal[] getProposals() { - buildProposals(); - ICompletionProposal[] proposalArray = new ICompletionProposal[fProposals.size()]; - Iterator iItem = fProposals.iterator(); - for (int i = 0; iItem.hasNext(); i++) { - proposalArray[i] = (ICompletionProposal) iItem.next(); - } - return proposalArray; - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java deleted file mode 100644 index d199902aec..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.ui.internal.image.CSSImageHelper; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; - -abstract class CSSProposalGenerator { - - - protected class StringAndOffset { - StringAndOffset(String string, int offset) { - this.fString = string; - this.fOffset = offset; - } - - String fString; - int fOffset; - } - - protected CSSContentAssistContext fContext = null; - - /** - * CSSProposalGenerator constructor comment. - */ - private CSSProposalGenerator() { - super(); - } - - CSSProposalGenerator(CSSContentAssistContext context) { - this(); - fContext = context; - } - - /** - * - */ - protected boolean checkLeadingColon() { - boolean hasLeadingColon = false; - ITextRegion targetRegion = fContext.getTargetRegion(); - if (targetRegion == null && 0 < fContext.getCursorPos()) { - targetRegion = fContext.getRegionByOffset(fContext.getCursorPos() - 1); - if (targetRegion != null && targetRegion.getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) { - hasLeadingColon = true; - } - } - else if (targetRegion != null) { - // BUG 92848 - Changed how pseudo-selectors are defined in the - // tokenizer - // The target region should be the CSS_SELECTOR_PSEUDO now - if (targetRegion.getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) { - hasLeadingColon = true; - } - } - return hasLeadingColon; - } - - /** - * - */ - protected StringAndOffset generateBraces() { - StringBuffer buf = new StringBuffer(); - String lineDelimiter = fContext.getStructuredDocument().getLineDelimiter(); - Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences(); - String indentStr = getIndentString(); - if (preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE)) { - buf.append(lineDelimiter); - } - buf.append("{");//$NON-NLS-1$ - if (preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE)) { - buf.append(lineDelimiter); - buf.append(indentStr); - } else { - buf.append(" ");//$NON-NLS-1$ - } - int offset = buf.length(); - if (preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE)) { - buf.append(lineDelimiter); - } else { - buf.append(" ");//$NON-NLS-1$ - } - buf.append("}");//$NON-NLS-1$ - return new StringAndOffset(buf.toString(), offset); - } - - /** - * - */ - protected StringAndOffset generateParenthesis() { - StringBuffer buf = new StringBuffer(); - int offset; - buf.append("(");//$NON-NLS-1$ - offset = 1; - buf.append(")");//$NON-NLS-1$ - return new StringAndOffset(buf.toString(), offset); - } - - /** - * - */ - protected StringAndOffset generateQuotes() { - StringBuffer buf = new StringBuffer(); - char quoteChar = getQuoteChar(); - buf.append(quoteChar); - buf.append(quoteChar); - return new StringAndOffset(buf.toString(), 1); - } - - /** - * - */ - protected StringAndOffset generateSemicolon() { - StringBuffer buf = new StringBuffer(); - int offset; - buf.append(";");//$NON-NLS-1$ - offset = 0; - return new StringAndOffset(buf.toString(), offset); - } - - /** - * - */ - protected StringAndOffset generateURI() { - StringBuffer buf = new StringBuffer(); - - boolean isQuoteInURI = CSSCorePlugin.getDefault().getPluginPreferences().getBoolean(CSSCorePreferenceNames.FORMAT_QUOTE_IN_URI); - char quoteChar = getQuoteChar(); - buf.append("url(");//$NON-NLS-1$ - if (isQuoteInURI) { - buf.append(quoteChar); - } - int offset = buf.length(); - if (isQuoteInURI) { - buf.append(quoteChar); - } - buf.append(")");//$NON-NLS-1$ - return new StringAndOffset(buf.toString(), offset); - } - - abstract protected Iterator getCandidates(); - - List getProposals() { - List proposals = new ArrayList(); - - CSSImageHelper imageHelper = CSSImageHelper.getInstance(); - Iterator i = getCandidates(); - while (i.hasNext()) { - CSSCACandidate candidate = (CSSCACandidate) i.next(); - Image image = imageHelper.getImage(candidate.getImageType()); - ICompletionProposal item = new CompletionProposal(candidate.getReplacementString(), fContext.getReplaceBegin() + fContext.getDocumentOffset(), fContext.getTextToReplace().length(), candidate.getCursorPosition(), image, candidate.getDisplayString(), null, candidate.getDisplayString(), candidate.getMMNode()); - proposals.add(item); - } - - return proposals; - } - - /** - * - * @return char - */ - private char getQuoteChar() { - - String quoteStr = CSSCorePlugin.getDefault().getPluginPreferences().getString(CSSCorePreferenceNames.FORMAT_QUOTE); - char quoteChar = (quoteStr != null && 0 < quoteStr.length()) ? quoteStr.charAt(0) : '"'; - char attrQuote = fContext.getQuoteOfStyleAttribute(); - if (attrQuote != 0) { - if (attrQuote == '"' && quoteChar == '"') { - quoteChar = '\''; - } else if (attrQuote == '\'' && quoteChar == '\'') { - quoteChar = '"'; - } - } - return quoteChar; - } - - /** - * - */ - protected boolean isMatch(String text) { - String textToCompare = fContext.getTextToCompare(); - if (textToCompare.length() == 0) { - return true; - } else { - return (text.toUpperCase().indexOf(textToCompare.toUpperCase()) == 0); - } - /* - * String textToReplace = fContext.getTextToReplace(); if - * (textToReplace.length() == 0) { return true; } else { return - * (text.toUpperCase().indexOf(textToReplace.toUpperCase()) == 0); } - */ - } - - - private String getIndentString() { - StringBuffer indent = new StringBuffer(); - - Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences(); - if (preferences != null) { - char indentChar = ' '; - String indentCharPref = preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR); - if (CSSCorePreferenceNames.TAB.equals(indentCharPref)) { - indentChar = '\t'; - } - int indentationWidth = preferences.getInt(CSSCorePreferenceNames.INDENTATION_SIZE); - - for (int i = 0; i < indentationWidth; i++) { - indent.append(indentChar); - } - } - return indent.toString(); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java deleted file mode 100644 index 87ba013219..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java +++ /dev/null @@ -1,294 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; -import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSCharsetRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.util.SelectionCollector; -import org.eclipse.wst.css.ui.internal.image.CSSImageType; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; - -class CSSProposalGeneratorForAtmarkRule extends CSSProposalGenerator { - - private boolean fUseUpperCase = false; - private static final String CHARSET = "@charset";//$NON-NLS-1$ - private static final String FONT_FACE = "@font-face";//$NON-NLS-1$ - private static final String IMPORT = "@import";//$NON-NLS-1$ - private static final String MEDIA = "@media";//$NON-NLS-1$ - private static final String PAGE = "@page";//$NON-NLS-1$ - - /** - * CSSAtmarkRuleProposalGenerator constructor comment. - * - */ - CSSProposalGeneratorForAtmarkRule(CSSContentAssistContext context) { - super(context); - fUseUpperCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER; - } - - /** - * - */ - private CSSCACandidate getCandidateCharsetRule() { - // check content model - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - if (!util.collectNodesByType(CSSMMNode.TYPE_CHARSET_RULE).hasNext()) { - return null; - } - - // check if embedded or not - if (fContext.getModel().getStyleSheetType() == ICSSModel.EMBEDDED) { - return null; - } - - // check if caret precede all other rules. - int offset = fContext.getCursorPos(); - if (0 < offset) { - SelectionCollector trav = new SelectionCollector(); - trav.setRegion(0, offset - 1); - trav.apply(fContext.getModel().getDocument()); - Iterator i = trav.getSelectedNodes().iterator(); - while (i.hasNext()) { - Object obj = i.next(); - if (obj instanceof ICSSNode && !(obj instanceof ICSSDocument)) { - return null; - } - } - } - - int cursorPos = 0; - String ident = (fUseUpperCase) ? CHARSET.toUpperCase() : CHARSET.toLowerCase(); - StringBuffer buf = new StringBuffer(); - buf.append(ident); - buf.append(" ");//$NON-NLS-1$ - cursorPos = buf.length(); - StringAndOffset sao; - sao = generateQuotes(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - sao = generateSemicolon(); - buf.append(sao.fString); - - String text = buf.toString(); - - if (isMatch(text)) { - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(text); - item.setCursorPosition(cursorPos); - item.setDisplayString(ident); - item.setImageType(CSSImageType.RULE_CHARSET); - return item; - } else { - return null; - } - } - - /** - * - */ - private CSSCACandidate getCandidateFontFaceRule() { - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - if (!util.collectNodesByType(CSSMMNode.TYPE_FONT_FACE_RULE).hasNext()) { - return null; - } - - int cursorPos = 0; - String ident = (fUseUpperCase) ? FONT_FACE.toUpperCase() : FONT_FACE.toLowerCase(); - StringBuffer buf = new StringBuffer(); - buf.append(ident); - buf.append(" ");//$NON-NLS-1$ - cursorPos = buf.length(); - StringAndOffset sao; - sao = generateBraces(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - - String text = buf.toString(); - - if (isMatch(text)) { - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(ident); - item.setImageType(CSSImageType.RULE_FONTFACE); - return item; - } else { - return null; - } - } - - /** - * - */ - private CSSCACandidate getCandidateImportRule() { - // check content model - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - if (!util.collectNodesByType(CSSMMNode.TYPE_IMPORT_RULE).hasNext()) { - return null; - } - - // charset and import can precede import rule. - int offset = fContext.getCursorPos(); - if (0 < offset) { - SelectionCollector trav = new SelectionCollector(); - trav.setRegion(0, offset - 1); - trav.apply(fContext.getModel().getDocument()); - Iterator i = trav.getSelectedNodes().iterator(); - while (i.hasNext()) { - Object obj = i.next(); - if (obj instanceof ICSSNode && !(obj instanceof ICSSDocument || obj instanceof ICSSCharsetRule || obj instanceof ICSSImportRule)) { - return null; - } - } - } - - int cursorPos = 0; - String ident = (fUseUpperCase) ? IMPORT.toUpperCase() : IMPORT.toLowerCase(); - StringBuffer buf = new StringBuffer(); - buf.append(ident); - buf.append(" ");//$NON-NLS-1$ - cursorPos = buf.length(); - StringAndOffset sao; - sao = generateURI(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - sao = generateSemicolon(); - buf.append(sao.fString); - - String text = buf.toString(); - - if (isMatch(text)) { - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(ident); - item.setImageType(CSSImageType.RULE_IMPORT); - return item; - } else { - return null; - } - } - - /** - * - */ - private CSSCACandidate getCandidateMediaRule() { - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - if (!util.collectNodesByType(CSSMMNode.TYPE_MEDIA_RULE).hasNext()) { - return null; - } - - int cursorPos = 0; - String ident = (fUseUpperCase) ? MEDIA.toUpperCase() : MEDIA.toLowerCase(); - StringBuffer buf = new StringBuffer(); - buf.append(ident); - buf.append(" ");//$NON-NLS-1$ - cursorPos = buf.length() - 1; - StringAndOffset sao; - sao = generateBraces(); - buf.append(sao.fString); - - String text = buf.toString(); - - if (isMatch(text)) { - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(ident); - item.setImageType(CSSImageType.RULE_MEDIA); - return item; - } else { - return null; - } - } - - /** - * - */ - private CSSCACandidate getCandidatePageRule() { - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - if (!util.collectNodesByType(CSSMMNode.TYPE_PAGE_RULE).hasNext()) { - return null; - } - - int cursorPos = 0; - String ident = (fUseUpperCase) ? PAGE.toUpperCase() : PAGE.toLowerCase(); - StringBuffer buf = new StringBuffer(); - buf.append(ident); - buf.append(" ");//$NON-NLS-1$ - cursorPos = buf.length(); - StringAndOffset sao; - sao = generateBraces(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - - String text = buf.toString(); - - if (isMatch(text)) { - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(ident); - item.setImageType(CSSImageType.RULE_PAGE); - return item; - } else { - return null; - } - } - - /** - * getCandidates method comment. - */ - protected Iterator getCandidates() { - List candidates = new ArrayList(); - - ITextRegion region = fContext.getTargetRegionPrevious(); - // ITextRegion region = fContext.getSignificantTargetRegion(); - if (region != null) { - String type = region.getType(); - if (type != CSSRegionContexts.CSS_RBRACE && type != CSSRegionContexts.CSS_DELIMITER) { - return candidates.iterator(); - } - } - - CSSCACandidate item; - if ((item = getCandidateImportRule()) != null) { - candidates.add(item); - } - if ((item = getCandidateCharsetRule()) != null) { - candidates.add(item); - } - if ((item = getCandidateMediaRule()) != null) { - candidates.add(item); - } - if ((item = getCandidatePageRule()) != null) { - candidates.add(item); - } - if ((item = getCandidateFontFaceRule()) != null) { - candidates.add(item); - } - return candidates.iterator(); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java deleted file mode 100644 index 3deb7779ce..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; -import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule; -import org.eclipse.wst.css.ui.internal.image.CSSImageType; - -class CSSProposalGeneratorForDeclarationName extends CSSProposalGenerator { - - /** - * CSSProposalGeneratorForDeclaration constructor comment. - * - */ - CSSProposalGeneratorForDeclarationName(CSSContentAssistContext context) { - super(context); - } - - /** - * getCandidates method comment. - */ - protected Iterator getCandidates() { - List candidates = new ArrayList(); - Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences(); - String preDelim = "";//$NON-NLS-1$ - for (int i = 0; i < preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_PRE_DELIM); i++) { - preDelim += ' ';//$NON-NLS-1$ - } - String postDelim = "";//$NON-NLS-1$ - for (int i = 0; i < preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_POST_DELIM); i++) { - postDelim += ' ';//$NON-NLS-1$ - } - - ICSSNode targetNode = fContext.getTargetNode(); - boolean bFontRule = false; - for (ICSSNode node = targetNode; node != null; node = node.getParentNode()) { - if (node instanceof org.w3c.dom.css.CSSFontFaceRule) { - bFontRule = true; - break; - } - } - - List names = new ArrayList(); - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - Iterator iNames = util.collectNodesByType((bFontRule) ? CSSMMNode.TYPE_DESCRIPTOR : CSSMMNode.TYPE_PROPERTY); - while (iNames.hasNext()) { - CSSMMNode node = (CSSMMNode) iNames.next(); - names.add(node); - } - sortNames(names); - // Collections.sort(names); - - boolean bAddColon = true; - if ((targetNode instanceof ICSSStyleRule || targetNode instanceof ICSSStyleDeclItem || targetNode instanceof ICSSStyleDeclaration) && fContext.targetHas(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) { - bAddColon = false; - } - - Iterator i = names.iterator(); - while (i.hasNext()) { - CSSMMNode node = (CSSMMNode) i.next(); - String text = node.getName(); - text = (preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER) ? text.toUpperCase() : text.toLowerCase(); - if (!isMatch(text)) { - continue; - } - - int cursorPos = 0; - StringBuffer buf = new StringBuffer(); - buf.append(text); - buf.append(preDelim); - cursorPos = buf.length(); - if (bAddColon) { - buf.append(':');//$NON-NLS-1$ - buf.append(postDelim); - cursorPos += 1 + postDelim.length(); - } - // if (! (targetNode instanceof ICSSStyleDeclItem)) { - // buf.append(';');//$NON-NLS-1$ - // } - - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(text); - item.setMMNode(node); - item.setImageType(getCategoryImageType(node)); - candidates.add(item); - } - - return candidates.iterator(); - } - - void sortNames(List names) { - Collections.sort(names, new Comparator() { - public int compare(Object o1, Object o2) { - CSSMMNode node1 = (CSSMMNode) o1; - CSSMMNode node2 = (CSSMMNode) o2; - if (node1 == null) { - return 1; - } else if (node2 == null) { - return -1; - } - int diff = 0; - String category1 = node1.getAttribute("category"); //$NON-NLS-1$ - String category2 = node2.getAttribute("category"); //$NON-NLS-1$ - if (category1 == null) { - if (category2 == null) { - diff = 0; - } else { - return 1; - } - } else if (category2 == null) { - return -1; - } else { - diff = category1.compareTo(category2); - } - if (diff == 0) { - String name = node1.getName(); - if (name == null) { - return 1; - } else { - return name.compareTo(node2.getName()); - } - } else { - return diff; - } - } - }); - } - - /* - * retrieve default category icon name TODO: if node has "icon"(?), use - * it. - */ - CSSImageType getCategoryImageType(CSSMMNode node) { - CSSImageType imageType = null; - if (node != null) { - String category = node.getAttribute("category"); //$NON-NLS-1$ - if (category != null) { - imageType = CSSImageType.getImageType(category); - } - } - return (imageType == null) ? CSSImageType.CATEGORY_DEFAULT : imageType; - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java deleted file mode 100644 index b32e881cdc..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java +++ /dev/null @@ -1,372 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMDescriptor; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMFunction; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNumber; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMUnit; -import org.eclipse.wst.css.core.internal.metamodel.util.CSSFunctionID; -import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem; -import org.eclipse.wst.css.core.internal.util.CSSUtil; -import org.eclipse.wst.css.core.internal.util.RegionIterator; -import org.eclipse.wst.css.ui.internal.image.CSSImageType; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.w3c.dom.css.CSSFontFaceRule; - -class CSSProposalGeneratorForDeclarationValue extends CSSProposalGenerator { - - private static final String IMPORTANT = "!important"; //$NON-NLS-1$ - private boolean fUseUpperCase; - private boolean fAppendSemiColon; - - /** - * CSSProposalGeneratorForDeclarationValue constructor comment. - * - */ - CSSProposalGeneratorForDeclarationValue(CSSContentAssistContext context) { - super(context); - fUseUpperCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER; - } - - /** - * - */ - private void addFunction(List candidates, CSSMMFunction prop) { - String text = prop.toString(); - if (!isMatch(text)) { - return; - } - - int cursorPos = 0; - StringBuffer buf = new StringBuffer(); - if (prop.getName().equals(CSSFunctionID.F_URI)) { - StringAndOffset sao = generateURI(); - buf.append(sao.fString); - cursorPos = sao.fOffset; - } else { - buf.append(prop.toString()); - cursorPos = buf.length(); - StringAndOffset sao = generateParenthesis(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - } - - text = buf.toString(); - text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase(); - - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(text); - item.setCursorPosition(cursorPos); - item.setDisplayString(text); - item.setMMNode(prop); - item.setImageType(CSSImageType.VALUE_FUNCTION); - appendSemiColon(item); - candidates.add(item); - } - - /** - * - */ - private void addNumber(List candidates, CSSMMNumber prop) { - String fullText = fContext.getTextToReplace(); - // skip number - int unitIndex = -1; - for (int i = 0; i < fullText.length(); i++) { - if (Character.isDigit(fullText.charAt(i))) { - unitIndex = i + 1; - } else { - break; - } - } - - String unitSubText = ""; //$NON-NLS-1$ - String numSubText = ""; //$NON-NLS-1$ - if (0 <= unitIndex) { - numSubText = fullText.substring(0, unitIndex); - if (unitIndex < fullText.length()) { - unitSubText = fullText.substring(unitIndex); - } - } else { - unitSubText = fullText; - } - - Iterator i = prop.getDescendants(); - while (i.hasNext()) { - CSSMMUnit unit = (CSSMMUnit) i.next(); - String unitString = unit.getUnitString(); - if ((0 < unitSubText.length() && unitString.indexOf(unitSubText) != 0) || (0 < numSubText.length() && unitString.equals("#"))) { //$NON-NLS-1$ - continue; - } - - String text = numSubText + unitString; - text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase(); - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(text); - if (0 < numSubText.length() || text.equals("#")) { //$NON-NLS-1$ - item.setCursorPosition(text.length()); - } else { - item.setCursorPosition(0); - } - item.setDisplayString(text); - item.setImageType(CSSImageType.VALUE_NUMBER); - appendSemiColon(item); - candidates.add(item); - } - } - - /** - * - */ - private void checkSemiColon() { - fAppendSemiColon = false; - - ITextRegion targetRegion = fContext.getTargetRegion(); - if (targetRegion != null && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) { - // find trailing ":" or ";" - // if ":" before ";" is found, add ";" - RegionIterator iterator = fContext.getRegionIterator(); - IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion(); - while (iterator.hasNext()) { - ITextRegion region = iterator.next(); - if (iterator.getStructuredDocumentRegion() != container) { - break; - } - if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) { - fAppendSemiColon = true; - break; - } - } - if (!fAppendSemiColon) { - // second chance: - // leading IStructuredDocumentRegion is not ";" - IStructuredDocumentRegion nextStructuredDocumentRegion = CSSUtil.findNextSignificantNode(container); - if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion) != CSSRegionContexts.CSS_DECLARATION_DELIMITER) { - fAppendSemiColon = true; - } - } - } - } - - /** - * - */ - private void appendSemiColon(CSSCACandidate item) { - if (fAppendSemiColon) { - String replacementString = item.getReplacementString(); - item.setReplacementString(replacementString + ";"); //$NON-NLS-1$ - int cursorPosition = item.getCursorPosition(); - if (replacementString.length() <= cursorPosition) { - // cursorpos is tail of string - cursorPosition++; - item.setCursorPosition(cursorPosition); - } - } - } - - /** - * - */ - private void addSemiColon(List candidates) { - ICSSNode targetNode = fContext.getTargetNode(); - if (targetNode instanceof ICSSStyleDeclItem) { - ICSSNode firstChild = targetNode.getFirstChild(); - if (firstChild == null) { - return; - } - if (firstChild instanceof IndexedRegion) { - int startOffset = ((IndexedRegion) firstChild).getStartOffset(); - if (fContext.getCursorPos() <= startOffset) { - return; - } - } - } - - boolean bAddCloser = false; - - ITextRegion targetRegion = fContext.getTargetRegion(); - if (targetRegion != null && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) { - // find trailing ":" or ";" - // if ":" before ";" is found, add ";" - RegionIterator iterator = fContext.getRegionIterator(); - IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion(); - while (iterator.hasNext()) { - ITextRegion region = iterator.next(); - if (iterator.getStructuredDocumentRegion() != container) { - break; - } - if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) { - bAddCloser = true; - break; - } - } - if (!bAddCloser) { - // second chance: - // leading IStructuredDocumentRegion is not ";" - IStructuredDocumentRegion nextStructuredDocumentRegion = CSSUtil.findNextSignificantNode(container); - if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion) != CSSRegionContexts.CSS_DECLARATION_DELIMITER) { - bAddCloser = true; - } - } - } - - if (bAddCloser) { - CSSCACandidate item = new CSSCACandidate(); - String text = fContext.getTextToReplace() + ";";//$NON-NLS-1$ - item.setReplacementString(text); - item.setCursorPosition(text.length()); - item.setDisplayString(";");//$NON-NLS-1$ - item.setImageType(null); - candidates.add(item); - } - } - - /** - * - */ - private void addString(List candidates, String text) { - if (!isMatch(text)) { - return; - } - - text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase(); - - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(text); - item.setCursorPosition(text.length()); - item.setDisplayString(text); - item.setImageType(CSSImageType.VALUE_STRING); - appendSemiColon(item); - candidates.add(item); - } - - private void addImportant(List candidates) { - ICSSNode targetNode = fContext.getTargetNode(); - while (targetNode instanceof ICSSPrimitiveValue) { - targetNode = targetNode.getParentNode(); - } - if (!(targetNode instanceof ICSSStyleDeclItem)) { - return; - } - // 1. has no priority region - // 2. cursor position is after of last child - // 3. normal isMatch method - String priority = ((ICSSStyleDeclItem) targetNode).getPriority(); - if (priority == null || priority.length() == 0) { - ICSSNode lastChild = targetNode.getLastChild(); - if (lastChild instanceof IndexedRegion) { - int startOffset = ((IndexedRegion) lastChild).getStartOffset(); - // int endOffset = ((IndexedRegion)lastChild).getEndOffset(); - if (startOffset < fContext.getCursorPos() && isMatch(IMPORTANT)) { - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(IMPORTANT); - item.setCursorPosition(IMPORTANT.length()); - item.setDisplayString(IMPORTANT); - item.setImageType(CSSImageType.VALUE_STRING); - appendSemiColon(item); - candidates.add(item); - } - } - } - } - - /** - * getCandidates method comment. - */ - protected Iterator getCandidates() { - List candidates = new ArrayList(); - - checkSemiColon(); // check should add semi-colon or not - - String name = getPropertyName(); - if (name != null) { - CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel()); - Iterator i = Collections.EMPTY_LIST.iterator(); - if (isFontFaceRule()) { - CSSMMDescriptor desc = util.getDescriptor(name); - if (desc != null) { - i = desc.getValues(); - } - } else { - CSSMMProperty prop = util.getProperty(name); - if (prop != null) { - i = prop.getValues(); - } - } - while (i.hasNext()) { - CSSMMNode val = (CSSMMNode) i.next(); - String valueType = val.getType(); - if (valueType == CSSMMNode.TYPE_KEYWORD) { - addString(candidates, val.toString()); - } else if (valueType == CSSMMNode.TYPE_NUMBER) { - addNumber(candidates, (CSSMMNumber) val); - } else if (valueType == CSSMMNode.TYPE_FUNCTION) { - addFunction(candidates, (CSSMMFunction) val); - } - } - } - - addImportant(candidates); - addSemiColon(candidates); - - return candidates.iterator(); - } - - /** - * @return java.lang.String - */ - private String getPropertyName() { - ICSSNode targetNode = fContext.getTargetNode(); - while (targetNode instanceof ICSSPrimitiveValue) { - targetNode = targetNode.getParentNode(); - } - if (targetNode instanceof ICSSStyleDeclItem) { - return ((ICSSStyleDeclItem) targetNode).getPropertyName(); - } else { - return null; - } - } - - /** - * - */ - private boolean isFontFaceRule() { - ICSSNode targetNode = fContext.getTargetNode(); - while (targetNode instanceof ICSSPrimitiveValue) { - targetNode = targetNode.getParentNode(); - } - if (targetNode instanceof ICSSStyleDeclItem) { - targetNode = targetNode.getParentNode(); // get Declaration - if (targetNode != null) { - // inline style has no rule node - targetNode = targetNode.getParentNode(); // get rule - } - } - return (targetNode instanceof CSSFontFaceRule); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java deleted file mode 100644 index 6302cb15bb..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule; -import org.eclipse.wst.css.ui.internal.image.CSSImageType; -import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocumentFactory; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter; -import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -class CSSProposalGeneratorForHTMLTag extends CSSProposalGenerator { - - /** - * CSSStyleRuleProposalGenerator constructor comment. - * - */ - CSSProposalGeneratorForHTMLTag(CSSContentAssistContext context) { - super(context); - - if (fHTMLTags == null) { - fHTMLTags = setupHTMLTags(); - } - } - - /** - * getCandidates method comment. - */ - protected Iterator getCandidates() { - List candidates = new ArrayList(); - - if (checkLeadingColon()) { - return candidates.iterator(); - } - - boolean bLowerCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.LOWER; - // XHTML requires lower case - if (fContext.getModel().getStyleSheetType() == ICSSModel.EMBEDDED) { - Node domNode = fContext.getModel().getOwnerDOMNode(); - if (domNode != null && !(domNode instanceof Document)) { - domNode = domNode.getOwnerDocument(); - if (domNode instanceof IDOMDocument) { - DocumentTypeAdapter adapter = (DocumentTypeAdapter) ((IDOMDocument) domNode).getAdapterFor(DocumentTypeAdapter.class); - if (adapter != null) - bLowerCase = (adapter.getTagNameCase() == DocumentTypeAdapter.LOWER_CASE); - } - } - } - - - int length = fHTMLTags.length; - for (int i = 0; i < length; i++) { - String tagText = fHTMLTags[i]; - if (bLowerCase) { - tagText = tagText.toLowerCase(); - } - if (!isMatch(tagText)) { - continue; - } - - int cursorPos = 0; - StringBuffer buf = new StringBuffer(); - buf.append(tagText); - cursorPos += tagText.length(); - boolean inRule = (fContext.getTargetNode() instanceof ICSSStyleRule); - if (!inRule || fContext.getTextToReplace().length() == 0) { - buf.append(" ");//$NON-NLS-1$ - cursorPos += 1; - } - if (!inRule) { - StringAndOffset sao = generateBraces(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - } - - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(tagText); - item.setImageType(CSSImageType.SELECTOR_TAG); - candidates.add(item); - } - - return candidates.iterator(); - } - - /** - * - */ - private static String[] setupHTMLTags() { - CMDocument cmdoc = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE); - CMNamedNodeMap elements = cmdoc.getElements(); - Vector names = new Vector(); - int nElements = elements.getLength(); - for (int i = 0; i < nElements; i++) { - CMElementDeclaration edec = (CMElementDeclaration) elements.item(i); - if (isAttrDefined(edec, HTML40Namespace.ATTR_NAME_STYLE)) { - names.add(edec.getElementName()); - } - } - Collections.sort(names); - String[] tags = new String[names.size()]; - Iterator iNames = names.iterator(); - for (int i = 0; iNames.hasNext(); i++) { - tags[i] = (String) iNames.next(); - } - return tags; - } - - /** - * - */ - private static boolean isAttrDefined(CMElementDeclaration edec, String attrName) { - if (edec == null) { - return false; - } - CMNamedNodeMap attrs = edec.getAttributes(); - if (attrs == null) { - return false; - } - for (int i = 0; i < attrs.getLength(); i++) { - CMAttributeDeclaration attr = (CMAttributeDeclaration) attrs.item(i); - if (attr == null) { - continue; - } - if (attr.getAttrName().equalsIgnoreCase(attrName)) { - return true; - } - } - return false; - } - - private static String[] fHTMLTags = null; -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java deleted file mode 100644 index ad49fa8efc..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMSelector; -import org.eclipse.wst.css.core.internal.metamodel.util.CSSMMTypeCollector; -import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPageRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule; -import org.eclipse.wst.css.ui.internal.image.CSSImageType; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; - -/** - * - */ -class CSSProposalGeneratorForPseudoSelector extends CSSProposalGenerator { - - /** - * CSSProposalGeneratorForPseudoSelector constructor comment. - * - */ - CSSProposalGeneratorForPseudoSelector(CSSContentAssistContext context) { - super(context); - } - - /** - * getCandidates method comment. - */ - protected Iterator getCandidates() { - List candidates = new ArrayList(); - - boolean hasLeadingColon = checkLeadingColon(); - String textToReplace = fContext.getTextToReplace(); - if (!hasLeadingColon && 0 < textToReplace.length() && !textToReplace.equals(fContext.getTextToCompare())) { - // cursor placed midpoint of the region - return candidates.iterator(); - } - ITextRegion region = fContext.getTargetRegion(); - if (region != null) { - String type = region.getType(); - if (type != CSSRegionContexts.CSS_S && !CSSRegionUtil.isSelectorBegginingType(type)) { - return candidates.iterator(); - } - } - - boolean useUpperCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER; - - List tags = getSelectorTags(); - Collections.sort(tags, new Comparator() { - /* (non-Javadoc) - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) { - return clean(((CSSMMSelector) o1).getName()).compareTo(clean(((CSSMMSelector) o2).getName())); - } - - private String clean(String str) { - int length = str.length(); - for (int i = 0; i < length; i++) { - if (str.charAt(i) != ':') { - return str.substring(i); - } - } - return str; - } - }); - - Iterator i = tags.iterator(); - while (i.hasNext()) { - CSSMMSelector selector = (CSSMMSelector) i.next(); - String text = selector.getSelectorString(); - if (hasLeadingColon && !isMatch(text)) { - continue; - } - text = (useUpperCase) ? text.toUpperCase() : text.toLowerCase(); - - int cursorPos = 0; - StringBuffer buf = new StringBuffer(); - - if (!hasLeadingColon) - buf.append(textToReplace); - - buf.append(text); - cursorPos += buf.length(); - - if (0 < buf.length()) { - // Pseudoclass/element takes arguments - if (buf.charAt(buf.length() - 1) == ')') { - --cursorPos; - } - boolean inRule = (fContext.getTargetNode() instanceof ICSSStyleRule || fContext.getTargetNode() instanceof ICSSPageRule); - if (!inRule || (textToReplace.length() == 0 && !hasLeadingColon)) { - buf.append(" ");//$NON-NLS-1$ - cursorPos += 1; - } - if (!inRule) { - StringAndOffset sao = generateBraces(); - buf.append(sao.fString); - cursorPos += sao.fOffset; - } - CSSCACandidate item = new CSSCACandidate(); - item.setReplacementString(buf.toString()); - item.setCursorPosition(cursorPos); - item.setDisplayString(text); - item.setImageType(CSSImageType.SELECTOR_PSEUDO); - item.setMMNode(selector); - candidates.add(item); - } - } - - return candidates.iterator(); - } - - /** - * - */ - List getSelectorTags() { - List tagList = new ArrayList(); - ICSSNode targetNode = fContext.getTargetNode(); - String rootType = (targetNode instanceof ICSSPageRule) ? CSSMMNode.TYPE_PAGE_RULE : CSSMMNode.TYPE_STYLE_RULE; - - CSSMMTypeCollector collector = new CSSMMTypeCollector(); - collector.collectNestedType(false); - collector.apply(fContext.getMetaModel(), rootType); - Iterator i; - i = collector.getNodes(); - if (!i.hasNext()) { - return tagList; - } - CSSMMNode node = (CSSMMNode) i.next(); - i = node.getChildNodes(); - while (i.hasNext()) { - CSSMMNode child = (CSSMMNode) i.next(); - if (child.getType() == CSSMMNode.TYPE_SELECTOR) { - String selType = ((CSSMMSelector) child).getSelectorType(); - if (selType == CSSMMSelector.TYPE_PSEUDO_CLASS || selType == CSSMMSelector.TYPE_PSEUDO_ELEMENT) { - tagList.add(child); - } - } - } - return tagList; - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java deleted file mode 100644 index 0d37ed74f1..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor; - -/** - * <p>Implementation of {@link StructuredContentAssistProcessor} for CSS documents</p> - * - * <p>Currently the CSS content assist processor does not do anything different then - * the {@link StructuredContentAssistProcessor} but at some point it may have to - * react to user preference changes</p> - * - * @see StructuredContentAssistProcessor - */ -public class CSSStructuredContentAssistProcessor extends StructuredContentAssistProcessor { - /** - * <p>Constructor</p> - * - * @param assistant {@link ContentAssistant} to use - * @param partitionTypeID the partition type this processor is for - * @param viewer {@link ITextViewer} this processor is acting in - */ - public CSSStructuredContentAssistProcessor(ContentAssistant assistant, - String partitionTypeID, ITextViewer viewer) { - - super(assistant, partitionTypeID, viewer, null); - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java deleted file mode 100644 index 6605bdbb09..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.templates.ContextTypeRegistry; -import org.eclipse.jface.text.templates.Template; -import org.eclipse.jface.text.templates.TemplateCompletionProcessor; -import org.eclipse.jface.text.templates.TemplateContextType; -import org.eclipse.jface.text.templates.persistence.TemplateStore; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.css.ui.internal.CSSUIPlugin; -import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages; -import org.eclipse.wst.css.ui.internal.image.CSSImageHelper; - - -/** - * Completion processor for CSS Templates. Most of the work is already done - * by the CSS Content Assist processor, so by the time the - * CSSTemplateCompletionProcessor is asked for content assist proposals, the - * CSS content assist processor has already set the context type for - * templates. - */ -class CSSTemplateCompletionProcessor extends TemplateCompletionProcessor { - private String fContextTypeId = null; - - protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) { - TemplateContextType type = null; - - ContextTypeRegistry registry = getTemplateContextRegistry(); - if (registry != null) - type = registry.getContextType(fContextTypeId); - - return type; - } - - protected Image getImage(Template template) { - // just return the same image for now - return CSSImageHelper.getInstance().getImage(CSSEditorPluginImages.IMG_OBJ_TEMPLATE); - } - - private ContextTypeRegistry getTemplateContextRegistry() { - return CSSUIPlugin.getDefault().getTemplateContextRegistry(); - } - - protected Template[] getTemplates(String contextTypeId) { - Template templates[] = null; - - TemplateStore store = getTemplateStore(); - if (store != null) - templates = store.getTemplates(contextTypeId); - - return templates; - } - - private TemplateStore getTemplateStore() { - return CSSUIPlugin.getDefault().getTemplateStore(); - } - - void setContextType(String contextTypeId) { - fContextTypeId = contextTypeId; - } -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java deleted file mode 100644 index 2b58dc6be9..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.wst.css.ui.internal.templates.TemplateContextTypeIdsCSS; -import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; -import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer; -import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils; - -/** - * <p>Completion computer for CSS templates</p> - */ -public class CSSTemplatesCompletionProposalComputer implements ICompletionProposalComputer { - /** <p>The template processor used to create the proposals</p> */ - private CSSTemplateCompletionProcessor fTemplateProcessor = null; - - /** - * <p>Create the computer</p> - */ - public CSSTemplatesCompletionProposalComputer() { - fTemplateProcessor = new CSSTemplateCompletionProcessor(); - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor) - */ - public List computeCompletionProposals( - CompletionProposalInvocationContext context, - IProgressMonitor monitor) { - - List proposals = new ArrayList(); - - boolean isEmptyDocument = - ContentAssistUtils.isViewerEmpty(context.getViewer()); - if (isEmptyDocument) { - proposals.addAll(getTemplates(TemplateContextTypeIdsCSS.NEW, context)); - } - proposals.addAll(getTemplates(TemplateContextTypeIdsCSS.ALL, context)); - - - return proposals; - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor) - */ - public List computeContextInformation( - CompletionProposalInvocationContext context, - IProgressMonitor monitor) { - // TODO Auto-generated method stub - return null; - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#getErrorMessage() - */ - public String getErrorMessage() { - return null; - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionStarted() - */ - public void sessionStarted() { - //default is to do nothing - } - - /** - * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionEnded() - */ - public void sessionEnded() { - //default is to do nothing - } - - - /** - * <p>Gets template proposals for the given template and proposal contexts</p> - * - * @param templateContext the template context - * @param context the proposal context - * @return {@link List} of template proposals for the given contexts - */ - private List getTemplates(String templateContext, - CompletionProposalInvocationContext context) { - - fTemplateProcessor.setContextType(templateContext); - ICompletionProposal[] proposals = fTemplateProcessor.computeCompletionProposals( - context.getViewer(), context.getInvocationOffset()); - - return Arrays.asList(proposals); - } - -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java deleted file mode 100644 index ccccf08cda..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java +++ /dev/null @@ -1,188 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.internal.text.html.BrowserInformationControl; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.AbstractReusableInformationControlCreator; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DefaultInformationControl; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IInformationControl; -import org.eclipse.jface.text.IInformationControlCreator; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.ICompletionProposalExtension3; -import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; - -public class CompletionProposal implements ICompletionProposal, ICompletionProposalExtension3, ICompletionProposalExtension5 { - - /** The string to be displayed in the completion proposal popup. */ - private String fDisplayString; - /** The replacement string. */ - private String fReplacementString; - /** The replacement offset. */ - private int fReplacementOffset; - /** The replacement length. */ - private int fReplacementLength; - /** The cursor position after this proposal has been applied. */ - private int fCursorPosition; - /** The image to be displayed in the completion proposal popup. */ - private Image fImage; - /** The context information of this proposal. */ - private IContextInformation fContextInformation; - /** The additional info of this proposal. */ - private String fAdditionalProposalInfo; - private CSSMMNode fNode; - /** The information control creator */ - private IInformationControlCreator fCreator; - - /** - * Creates a new completion proposal based on the provided information. The replacement string is - * considered being the display string too. All remaining fields are set to <code>null</code>. - * - * @param replacementString the actual string to be inserted into the document - * @param replacementOffset the offset of the text to be replaced - * @param replacementLength the length of the text to be replaced - * @param cursorPosition the position of the cursor following the insert relative to replacementOffset - */ - public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition) { - this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, null, null); - } - - /** - * Creates a new completion proposal. All fields are initialized based on the provided information. - * - * @param replacementString the actual string to be inserted into the document - * @param replacementOffset the offset of the text to be replaced - * @param replacementLength the length of the text to be replaced - * @param cursorPosition the position of the cursor following the insert relative to replacementOffset - * @param image the image to display for this proposal - * @param displayString the string to be displayed for the proposal - * @param contextInformation the context information associated with this proposal - * @param additionalProposalInfo the additional information associated with this proposal - */ - public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) { - this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, null, null, null); - } - - public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, CSSMMNode node) { - Assert.isNotNull(replacementString); - Assert.isTrue(replacementOffset >= 0); - Assert.isTrue(replacementLength >= 0); - Assert.isTrue(cursorPosition >= 0); - - fReplacementString= replacementString; - fReplacementOffset= replacementOffset; - fReplacementLength= replacementLength; - fCursorPosition= cursorPosition; - fImage= image; - fDisplayString= displayString; - fContextInformation= contextInformation; - fAdditionalProposalInfo= additionalProposalInfo; - fNode = node; - } - /* - * @see ICompletionProposal#apply(IDocument) - */ - public void apply(IDocument document) { - try { - document.replace(fReplacementOffset, fReplacementLength, fReplacementString); - } catch (BadLocationException x) { - // ignore - } - } - - /* - * @see ICompletionProposal#getSelection(IDocument) - */ - public Point getSelection(IDocument document) { - return new Point(fReplacementOffset + fCursorPosition, 0); - } - - /* - * @see ICompletionProposal#getContextInformation() - */ - public IContextInformation getContextInformation() { - return fContextInformation; - } - - /* - * @see ICompletionProposal#getImage() - */ - public Image getImage() { - return fImage; - } - - /* - * @see ICompletionProposal#getDisplayString() - */ - public String getDisplayString() { - if (fDisplayString != null) - return fDisplayString; - return fReplacementString; - } - - /* - * @see ICompletionProposal#getAdditionalProposalInfo() - */ - public String getAdditionalProposalInfo() { - return fAdditionalProposalInfo; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension5#getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor) - */ - public Object getAdditionalProposalInfo(IProgressMonitor monitor) { - return ProposalInfoFactory.getProposalInfo(fNode); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getInformationControlCreator() - */ - public IInformationControlCreator getInformationControlCreator() { - if (fCreator == null) { - fCreator = new AbstractReusableInformationControlCreator() { - - protected IInformationControl doCreateInformationControl(Shell parent) { - if (BrowserInformationControl.isAvailable(parent)) { - BrowserInformationControl control = new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, false); - return control; - } else { - return new DefaultInformationControl(parent, true); - } - } - }; - } - return fCreator; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getPrefixCompletionText(org.eclipse.jface.text.IDocument, int) - */ - public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getPrefixCompletionStart(org.eclipse.jface.text.IDocument, int) - */ - public int getPrefixCompletionStart(IDocument document, int completionOffset) { - return 0; - } - -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java deleted file mode 100644 index c8c0e30948..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java +++ /dev/null @@ -1,890 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/*nlsXXX*/ -package org.eclipse.wst.css.ui.internal.contentassist; - - - -/** - * Provide all names defined in the HTML 4.0? specification. - */ -public interface HTML40Namespace { - - // Element names - public static interface ElementName { - public static final String A = "A"; //$NON-NLS-1$ - public static final String ABBR = "ABBR"; //$NON-NLS-1$ - public static final String ACRONYM = "ACRONYM"; //$NON-NLS-1$ - public static final String ADDRESS = "ADDRESS"; //$NON-NLS-1$ - public static final String APPLET = "APPLET"; //$NON-NLS-1$ - public static final String AREA = "AREA"; //$NON-NLS-1$ - public static final String B = "B"; //$NON-NLS-1$ - public static final String BASE = "BASE"; //$NON-NLS-1$ - public static final String BASEFONT = "BASEFONT"; //$NON-NLS-1$ - public static final String BDO = "BDO"; //$NON-NLS-1$ - public static final String BGSOUND = "BGSOUND"; // D205513 - // //$NON-NLS-1$ - public static final String BIG = "BIG"; //$NON-NLS-1$ - public static final String BLINK = "BLINK"; //$NON-NLS-1$ - public static final String BLOCKQUOTE = "BLOCKQUOTE"; //$NON-NLS-1$ - public static final String BODY = "BODY"; //$NON-NLS-1$ - public static final String BR = "BR"; //$NON-NLS-1$ - public static final String BUTTON = "BUTTON"; //$NON-NLS-1$ - public static final String CAPTION = "CAPTION"; //$NON-NLS-1$ - public static final String CENTER = "CENTER"; //$NON-NLS-1$ - public static final String CITE = "CITE"; //$NON-NLS-1$ - public static final String CODE = "CODE"; //$NON-NLS-1$ - public static final String COL = "COL"; //$NON-NLS-1$ - public static final String COLGROUP = "COLGROUP"; //$NON-NLS-1$ - public static final String DD = "DD"; //$NON-NLS-1$ - public static final String DEL = "DEL"; //$NON-NLS-1$ - public static final String DFN = "DFN"; //$NON-NLS-1$ - public static final String DIR = "DIR"; //$NON-NLS-1$ - public static final String DIV = "DIV"; //$NON-NLS-1$ - public static final String DL = "DL"; //$NON-NLS-1$ - public static final String DT = "DT"; //$NON-NLS-1$ - public static final String EM = "EM"; //$NON-NLS-1$ - public static final String EMBED = "EMBED"; //$NON-NLS-1$ - public static final String FIELDSET = "FIELDSET"; //$NON-NLS-1$ - public static final String FONT = "FONT"; //$NON-NLS-1$ - public static final String FORM = "FORM"; //$NON-NLS-1$ - public static final String FRAME = "FRAME"; //$NON-NLS-1$ - public static final String FRAMESET = "FRAMESET"; //$NON-NLS-1$ - public static final String H1 = "H1"; //$NON-NLS-1$ - public static final String H2 = "H2"; //$NON-NLS-1$ - public static final String H3 = "H3"; //$NON-NLS-1$ - public static final String H4 = "H4"; //$NON-NLS-1$ - public static final String H5 = "H5"; //$NON-NLS-1$ - public static final String H6 = "H6"; //$NON-NLS-1$ - public static final String HEAD = "HEAD"; //$NON-NLS-1$ - public static final String HR = "HR"; //$NON-NLS-1$ - public static final String HTML = "HTML"; //$NON-NLS-1$ - public static final String I = "I"; //$NON-NLS-1$ - public static final String IFRAME = "IFRAME"; //$NON-NLS-1$ - public static final String IMG = "IMG"; //$NON-NLS-1$ - public static final String INPUT = "INPUT"; //$NON-NLS-1$ - public static final String INS = "INS"; //$NON-NLS-1$ - public static final String ISINDEX = "ISINDEX"; //$NON-NLS-1$ - public static final String KBD = "KBD"; //$NON-NLS-1$ - public static final String LABEL = "LABEL"; //$NON-NLS-1$ - public static final String LEGEND = "LEGEND"; //$NON-NLS-1$ - public static final String LI = "LI"; //$NON-NLS-1$ - public static final String LINK = "LINK"; //$NON-NLS-1$ - public static final String MAP = "MAP"; //$NON-NLS-1$ - public static final String MENU = "MENU"; //$NON-NLS-1$ - public static final String META = "META"; //$NON-NLS-1$ - public static final String NOBR = "NOBR"; // D205513 //$NON-NLS-1$ - public static final String NOEMBED = "NOEMBED"; //$NON-NLS-1$ - public static final String NOFRAMES = "NOFRAMES"; //$NON-NLS-1$ - public static final String NOSCRIPT = "NOSCRIPT"; //$NON-NLS-1$ - public static final String OBJECT = "OBJECT"; //$NON-NLS-1$ - public static final String OL = "OL"; //$NON-NLS-1$ - public static final String OPTGROUP = "OPTGROUP"; //$NON-NLS-1$ - public static final String OPTION = "OPTION"; //$NON-NLS-1$ - public static final String P = "P"; //$NON-NLS-1$ - public static final String PARAM = "PARAM"; //$NON-NLS-1$ - public static final String PRE = "PRE"; //$NON-NLS-1$ - public static final String Q = "Q"; //$NON-NLS-1$ - public static final String S = "S"; //$NON-NLS-1$ - public static final String SAMP = "SAMP"; //$NON-NLS-1$ - public static final String SCRIPT = "SCRIPT"; //$NON-NLS-1$ - public static final String SELECT = "SELECT"; //$NON-NLS-1$ - public static final String SMALL = "SMALL"; //$NON-NLS-1$ - public static final String SPAN = "SPAN"; //$NON-NLS-1$ - public static final String STRIKE = "STRIKE"; //$NON-NLS-1$ - public static final String STRONG = "STRONG"; //$NON-NLS-1$ - public static final String STYLE = "STYLE"; //$NON-NLS-1$ - public static final String SUB = "SUB"; //$NON-NLS-1$ - public static final String SUP = "SUP"; //$NON-NLS-1$ - public static final String TABLE = "TABLE"; //$NON-NLS-1$ - public static final String TBODY = "TBODY"; //$NON-NLS-1$ - public static final String TD = "TD"; //$NON-NLS-1$ - public static final String TEXTAREA = "TEXTAREA"; //$NON-NLS-1$ - public static final String TFOOT = "TFOOT"; //$NON-NLS-1$ - public static final String TH = "TH"; //$NON-NLS-1$ - public static final String THEAD = "THEAD"; //$NON-NLS-1$ - public static final String TITLE = "TITLE"; //$NON-NLS-1$ - public static final String TR = "TR"; //$NON-NLS-1$ - public static final String TT = "TT"; //$NON-NLS-1$ - public static final String U = "U"; //$NON-NLS-1$ - public static final String UL = "UL"; //$NON-NLS-1$ - public static final String VAR = "VAR"; //$NON-NLS-1$ - public static final String WBR = "WBR"; // D205513 //$NON-NLS-1$ - public static final String MARQUEE = "MARQUEE"; //$NON-NLS-1$ - public static final String SSI_CONFIG = "SSI:CONFIG"; // D210393 - // //$NON-NLS-1$ - public static final String SSI_ECHO = "SSI:ECHO"; //$NON-NLS-1$ - public static final String SSI_EXEC = "SSI:EXEC"; //$NON-NLS-1$ - public static final String SSI_FSIZE = "SSI:FSIZE"; //$NON-NLS-1$ - public static final String SSI_FLASTMOD = "SSI:FLASTMOD"; //$NON-NLS-1$ - public static final String SSI_INCLUDE = "SSI:INCLUDE"; //$NON-NLS-1$ - public static final String SSI_PRINTENV = "SSI:PRINTENV"; //$NON-NLS-1$ - public static final String SSI_SET = "SSI:SET"; //$NON-NLS-1$ - public static final String WML_WML = "wml"; //$NON-NLS-1$ - public static final String WML_CARD = "card"; //$NON-NLS-1$ - public static final String WML_TEMPLATE = "template"; //$NON-NLS-1$ - public static final String WML_ACCESS = "access"; //$NON-NLS-1$ - public static final String WML_DO = "do"; //$NON-NLS-1$ - public static final String WML_ONEVENT = "onevent"; //$NON-NLS-1$ - public static final String WML_TIMER = "timer"; //$NON-NLS-1$ - public static final String WML_ANCHOR = "anchor"; //$NON-NLS-1$ - public static final String WML_PREV = "prev"; //$NON-NLS-1$ - public static final String WML_REFRESH = "refresh"; //$NON-NLS-1$ - public static final String WML_GO = "go"; //$NON-NLS-1$ - public static final String WML_NOOP = "noop"; //$NON-NLS-1$ - public static final String WML_SETVAR = "setvar"; //$NON-NLS-1$ - public static final String WML_POSTFIELD = "postfield"; //$NON-NLS-1$ - } - - // Character Entities - public static interface EntityName { - public static final String AACUTE_U = "Aacute"; //$NON-NLS-1$ - public static final String AACUTE_L = "aacute"; //$NON-NLS-1$ - public static final String ACIRC_U = "Acirc"; //$NON-NLS-1$ - public static final String ACIRC_L = "acirc"; //$NON-NLS-1$ - public static final String ACUTE = "acute"; //$NON-NLS-1$ - public static final String AELIG_U = "AElig"; //$NON-NLS-1$ - public static final String AELIG_L = "aelig"; //$NON-NLS-1$ - public static final String AGRAVE_U = "Agrave"; //$NON-NLS-1$ - public static final String AGRAVE_L = "agrave"; //$NON-NLS-1$ - public static final String ALEFSYM = "alefsym"; //$NON-NLS-1$ - public static final String ALPHA_U = "Alpha"; //$NON-NLS-1$ - public static final String ALPHA_L = "alpha"; //$NON-NLS-1$ - public static final String AMP = "amp"; //$NON-NLS-1$ - public static final String AND = "and"; //$NON-NLS-1$ - public static final String ANG = "ang"; //$NON-NLS-1$ - public static final String ARING_U = "Aring"; //$NON-NLS-1$ - public static final String ARING_L = "aring"; //$NON-NLS-1$ - public static final String ASYMP = "asymp"; //$NON-NLS-1$ - public static final String ATILDE_U = "Atilde"; //$NON-NLS-1$ - public static final String ATILDE_L = "atilde"; //$NON-NLS-1$ - public static final String AUML_U = "Auml"; //$NON-NLS-1$ - public static final String AUML_L = "auml"; //$NON-NLS-1$ - public static final String BDQUO = "bdquo"; //$NON-NLS-1$ - public static final String BETA_U = "Beta"; //$NON-NLS-1$ - public static final String BETA_L = "beta"; //$NON-NLS-1$ - public static final String BRVBAR = "brvbar"; //$NON-NLS-1$ - public static final String BULL = "bull"; //$NON-NLS-1$ - public static final String CAP = "cap"; //$NON-NLS-1$ - public static final String CCEDIL_U = "Ccedil"; //$NON-NLS-1$ - public static final String CCEDIL_L = "ccedil"; //$NON-NLS-1$ - public static final String CEDIL = "cedil"; //$NON-NLS-1$ - public static final String CENT = "cent"; //$NON-NLS-1$ - public static final String CHI_U = "Chi"; //$NON-NLS-1$ - public static final String CHI_L = "chi"; //$NON-NLS-1$ - public static final String CIRC = "circ"; //$NON-NLS-1$ - public static final String CLUBS = "clubs"; //$NON-NLS-1$ - public static final String CONG = "cong"; //$NON-NLS-1$ - public static final String COPY = "copy"; //$NON-NLS-1$ - public static final String CRARR = "crarr"; //$NON-NLS-1$ - public static final String CUP = "cup"; //$NON-NLS-1$ - public static final String CURREN = "curren"; //$NON-NLS-1$ - public static final String DAGGER_U = "Dagger"; //$NON-NLS-1$ - public static final String DAGGER_L = "dagger"; //$NON-NLS-1$ - public static final String DARR_U = "dArr"; //$NON-NLS-1$ - public static final String DARR_L = "darr"; //$NON-NLS-1$ - public static final String DEG = "deg"; //$NON-NLS-1$ - public static final String DELTA_U = "Delta"; //$NON-NLS-1$ - public static final String DELTA_L = "delta"; //$NON-NLS-1$ - public static final String DIAMS = "diams"; //$NON-NLS-1$ - public static final String DIVIDE = "divide"; //$NON-NLS-1$ - public static final String EACUTE_U = "Eacute"; //$NON-NLS-1$ - public static final String EACUTE_L = "eacute"; //$NON-NLS-1$ - public static final String ECIRC_U = "Ecirc"; //$NON-NLS-1$ - public static final String ECIRC_L = "ecirc"; //$NON-NLS-1$ - public static final String EGRAVE_U = "Egrave"; //$NON-NLS-1$ - public static final String EGRAVE_L = "egrave"; //$NON-NLS-1$ - public static final String EMPTY = "empty"; //$NON-NLS-1$ - public static final String EMSP = "emsp"; //$NON-NLS-1$ - public static final String ENSP = "ensp"; //$NON-NLS-1$ - public static final String EPSILON_U = "Epsilon"; //$NON-NLS-1$ - public static final String EPSILON_L = "epsilon"; //$NON-NLS-1$ - public static final String EQUIV = "equiv"; //$NON-NLS-1$ - public static final String ETA_U = "Eta"; //$NON-NLS-1$ - public static final String ETA_L = "eta"; //$NON-NLS-1$ - public static final String ETH_U = "ETH"; //$NON-NLS-1$ - public static final String ETH_L = "eth"; //$NON-NLS-1$ - public static final String EUML_U = "Euml"; //$NON-NLS-1$ - public static final String EUML_L = "euml"; //$NON-NLS-1$ - public static final String EURO = "euro"; //$NON-NLS-1$ - public static final String EXIST = "exist"; //$NON-NLS-1$ - public static final String FNOF = "fnof"; //$NON-NLS-1$ - public static final String FORALL = "forall"; //$NON-NLS-1$ - public static final String FRAC12 = "frac12"; //$NON-NLS-1$ - public static final String FRAC14 = "frac14"; //$NON-NLS-1$ - public static final String FRAC34 = "frac34"; //$NON-NLS-1$ - public static final String FRASL = "frasl"; //$NON-NLS-1$ - public static final String GAMMA_U = "Gamma"; //$NON-NLS-1$ - public static final String GAMMA_L = "gamma"; //$NON-NLS-1$ - public static final String GE = "ge"; //$NON-NLS-1$ - public static final String GT = "gt"; //$NON-NLS-1$ - public static final String HARR_U = "hArr"; //$NON-NLS-1$ - public static final String HARR_L = "harr"; //$NON-NLS-1$ - public static final String HEARTS = "hearts"; //$NON-NLS-1$ - public static final String HELLIP = "hellip"; //$NON-NLS-1$ - public static final String IACUTE_U = "Iacute"; //$NON-NLS-1$ - public static final String IACUTE_L = "iacute"; //$NON-NLS-1$ - public static final String ICIRC_U = "Icirc"; //$NON-NLS-1$ - public static final String ICIRC_L = "icirc"; //$NON-NLS-1$ - public static final String IEXCL = "iexcl"; //$NON-NLS-1$ - public static final String IGRAVE_U = "Igrave"; //$NON-NLS-1$ - public static final String IGRAVE_L = "igrave"; //$NON-NLS-1$ - public static final String IMAGE = "image"; //$NON-NLS-1$ - public static final String INFIN = "infin"; //$NON-NLS-1$ - public static final String INT = "int"; //$NON-NLS-1$ - public static final String IOTA_U = "Iota"; //$NON-NLS-1$ - public static final String IOTA_L = "iota"; //$NON-NLS-1$ - public static final String IQUEST = "iquest"; //$NON-NLS-1$ - public static final String ISIN = "isin"; //$NON-NLS-1$ - public static final String IUML_U = "Iuml"; //$NON-NLS-1$ - public static final String IUML_L = "iuml"; //$NON-NLS-1$ - public static final String KAPPA_U = "Kappa"; //$NON-NLS-1$ - public static final String KAPPA_L = "kappa"; //$NON-NLS-1$ - public static final String LAMBDA_U = "Lambda"; //$NON-NLS-1$ - public static final String LAMBDA_L = "lambda"; //$NON-NLS-1$ - public static final String LANG = "lang"; //$NON-NLS-1$ - public static final String LAQUO = "laquo"; //$NON-NLS-1$ - public static final String LARR_U = "lArr"; //$NON-NLS-1$ - public static final String LARR_L = "larr"; //$NON-NLS-1$ - public static final String LCEIL = "lceil"; //$NON-NLS-1$ - public static final String LDQUO = "ldquo"; //$NON-NLS-1$ - public static final String LE = "le"; //$NON-NLS-1$ - public static final String LFLOOR = "lfloor"; //$NON-NLS-1$ - public static final String LOWAST = "lowast"; //$NON-NLS-1$ - public static final String LOZ = "loz"; //$NON-NLS-1$ - public static final String LRM = "lrm"; //$NON-NLS-1$ - public static final String LSAQUO = "lsaquo"; //$NON-NLS-1$ - public static final String LSQUO = "lsquo"; //$NON-NLS-1$ - public static final String LT = "lt"; //$NON-NLS-1$ - public static final String MACR = "macr"; //$NON-NLS-1$ - public static final String MDASH = "mdash"; //$NON-NLS-1$ - public static final String MICRO = "micro"; //$NON-NLS-1$ - public static final String MIDDOT = "middot"; //$NON-NLS-1$ - public static final String MINUS = "minus"; //$NON-NLS-1$ - public static final String MU_U = "Mu"; //$NON-NLS-1$ - public static final String MU_L = "mu"; //$NON-NLS-1$ - public static final String NABLA = "nabla"; //$NON-NLS-1$ - public static final String NBSP = "nbsp"; //$NON-NLS-1$ - public static final String NDASH = "ndash"; //$NON-NLS-1$ - public static final String NE = "ne"; //$NON-NLS-1$ - public static final String NI = "ni"; //$NON-NLS-1$ - public static final String NOT = "not"; //$NON-NLS-1$ - public static final String NOTIN = "notin"; //$NON-NLS-1$ - public static final String NSUB = "nsub"; //$NON-NLS-1$ - public static final String NTILDE_U = "Ntilde"; //$NON-NLS-1$ - public static final String NTILDE_L = "ntilde"; //$NON-NLS-1$ - public static final String NU_U = "Nu"; //$NON-NLS-1$ - public static final String NU_L = "nu"; //$NON-NLS-1$ - public static final String OACUTE_U = "Oacute"; //$NON-NLS-1$ - public static final String OACUTE_L = "oacute"; //$NON-NLS-1$ - public static final String OCIRC_U = "Ocirc"; //$NON-NLS-1$ - public static final String OCIRC_L = "ocirc"; //$NON-NLS-1$ - public static final String OELIG_U = "OElig"; //$NON-NLS-1$ - public static final String OELIG_L = "oelig"; //$NON-NLS-1$ - public static final String OGRAVE_U = "Ograve"; //$NON-NLS-1$ - public static final String OGRAVE_L = "ograve"; //$NON-NLS-1$ - public static final String OLINE = "oline"; //$NON-NLS-1$ - public static final String OMEGA_U = "Omega"; //$NON-NLS-1$ - public static final String OMEGA_L = "omega"; //$NON-NLS-1$ - public static final String OMICRON_U = "Omicron"; //$NON-NLS-1$ - public static final String OMICRON_L = "omicron"; //$NON-NLS-1$ - public static final String OPLUS = "oplus"; //$NON-NLS-1$ - public static final String OR = "or"; //$NON-NLS-1$ - public static final String ORDF = "ordf"; //$NON-NLS-1$ - public static final String ORDM = "ordm"; //$NON-NLS-1$ - public static final String OSLASH_U = "Oslash"; //$NON-NLS-1$ - public static final String OSLASH_L = "oslash"; //$NON-NLS-1$ - public static final String OTILDE_U = "Otilde"; //$NON-NLS-1$ - public static final String OTILDE_L = "otilde"; //$NON-NLS-1$ - public static final String OTIMES = "otimes"; //$NON-NLS-1$ - public static final String OUML_U = "Ouml"; //$NON-NLS-1$ - public static final String OUML_L = "ouml"; //$NON-NLS-1$ - public static final String PARA = "para"; //$NON-NLS-1$ - public static final String PART = "part"; //$NON-NLS-1$ - public static final String PERMIL = "permil"; //$NON-NLS-1$ - public static final String PERP = "perp"; //$NON-NLS-1$ - public static final String PHI_U = "Phi"; //$NON-NLS-1$ - public static final String PHI_L = "phi"; //$NON-NLS-1$ - public static final String PI_U = "Pi"; //$NON-NLS-1$ - public static final String PI_L = "pi"; //$NON-NLS-1$ - public static final String PIV = "piv"; //$NON-NLS-1$ - public static final String PLUSMN = "plusmn"; //$NON-NLS-1$ - public static final String POUND = "pound"; //$NON-NLS-1$ - public static final String PRIME_U = "Prime"; //$NON-NLS-1$ - public static final String PRIME_L = "prime"; //$NON-NLS-1$ - public static final String PROD = "prod"; //$NON-NLS-1$ - public static final String PROP = "prop"; //$NON-NLS-1$ - public static final String PSI_U = "Psi"; //$NON-NLS-1$ - public static final String PSI_L = "psi"; //$NON-NLS-1$ - public static final String QUOT = "quot"; //$NON-NLS-1$ - public static final String RADIC = "radic"; //$NON-NLS-1$ - public static final String RANG = "rang"; //$NON-NLS-1$ - public static final String RAQUO = "raquo"; //$NON-NLS-1$ - public static final String RARR_U = "rArr"; //$NON-NLS-1$ - public static final String RARR_L = "rarr"; //$NON-NLS-1$ - public static final String RCEIL = "rceil"; //$NON-NLS-1$ - public static final String RDQUO = "rdquo"; //$NON-NLS-1$ - public static final String REAL = "real"; //$NON-NLS-1$ - public static final String REG = "reg"; //$NON-NLS-1$ - public static final String RFLOOR = "rfloor"; //$NON-NLS-1$ - public static final String RHO_U = "Rho"; //$NON-NLS-1$ - public static final String RHO_L = "rho"; //$NON-NLS-1$ - public static final String RLM = "rlm"; //$NON-NLS-1$ - public static final String RSAQUO = "rsaquo"; //$NON-NLS-1$ - public static final String RSQUO = "rsquo"; //$NON-NLS-1$ - public static final String SBQUO = "sbquo"; //$NON-NLS-1$ - public static final String SCARON_U = "Scaron"; //$NON-NLS-1$ - public static final String SCARON_L = "scaron"; //$NON-NLS-1$ - public static final String SDOT = "sdot"; //$NON-NLS-1$ - public static final String SECT = "sect"; //$NON-NLS-1$ - public static final String SHY = "shy"; //$NON-NLS-1$ - public static final String SIGMA_U = "Sigma"; //$NON-NLS-1$ - public static final String SIGMA_L = "sigma"; //$NON-NLS-1$ - public static final String SIGMAF = "sigmaf"; //$NON-NLS-1$ - public static final String SIM = "sim"; //$NON-NLS-1$ - public static final String SPADES = "spades"; //$NON-NLS-1$ - public static final String SUB = "sub"; //$NON-NLS-1$ - public static final String SUBE = "sube"; //$NON-NLS-1$ - public static final String SUM = "sum"; //$NON-NLS-1$ - public static final String SUP = "sup"; //$NON-NLS-1$ - public static final String SUP1 = "sup1"; //$NON-NLS-1$ - public static final String SUP2 = "sup2"; //$NON-NLS-1$ - public static final String SUP3 = "sup3"; //$NON-NLS-1$ - public static final String SUPE = "supe"; //$NON-NLS-1$ - public static final String SZLIG = "szlig"; //$NON-NLS-1$ - public static final String TAU_U = "Tau"; //$NON-NLS-1$ - public static final String TAU_L = "tau"; //$NON-NLS-1$ - public static final String THERE4 = "there4"; //$NON-NLS-1$ - public static final String THETA_U = "Theta"; //$NON-NLS-1$ - public static final String THETA_L = "theta"; //$NON-NLS-1$ - public static final String THETASYM = "thetasym"; //$NON-NLS-1$ - public static final String THINSP = "thinsp"; //$NON-NLS-1$ - public static final String THORN_U = "THORN"; //$NON-NLS-1$ - public static final String THORN_L = "thorn"; //$NON-NLS-1$ - public static final String TILDE = "tilde"; //$NON-NLS-1$ - public static final String TIMES = "times"; //$NON-NLS-1$ - public static final String TRADE = "trade"; //$NON-NLS-1$ - public static final String UACUTE_U = "Uacute"; //$NON-NLS-1$ - public static final String UACUTE_L = "uacute"; //$NON-NLS-1$ - public static final String UARR_U = "uArr"; //$NON-NLS-1$ - public static final String UARR_L = "uarr"; //$NON-NLS-1$ - public static final String UCIRC_U = "Ucirc"; //$NON-NLS-1$ - public static final String UCIRC_L = "ucirc"; //$NON-NLS-1$ - public static final String UGRAVE_U = "Ugrave"; //$NON-NLS-1$ - public static final String UGRAVE_L = "ugrave"; //$NON-NLS-1$ - public static final String UML = "uml"; //$NON-NLS-1$ - public static final String UPSIH = "upsih"; //$NON-NLS-1$ - public static final String UPSILON_U = "Upsilon"; //$NON-NLS-1$ - public static final String UPSILON_L = "upsilon"; //$NON-NLS-1$ - public static final String UUML_U = "Uuml"; //$NON-NLS-1$ - public static final String UUML_L = "uuml"; //$NON-NLS-1$ - public static final String WEIERP = "weierp"; //$NON-NLS-1$ - public static final String XI_U = "Xi"; //$NON-NLS-1$ - public static final String XI_L = "xi"; //$NON-NLS-1$ - public static final String YACUTE_U = "Yacute"; //$NON-NLS-1$ - public static final String YACUTE_L = "yacute"; //$NON-NLS-1$ - public static final String YEN = "yen"; //$NON-NLS-1$ - public static final String YUML_U = "Yuml"; //$NON-NLS-1$ - public static final String YUML_L = "yuml"; //$NON-NLS-1$ - public static final String ZETA_U = "Zeta"; //$NON-NLS-1$ - public static final String ZETA_L = "zeta"; //$NON-NLS-1$ - public static final String ZWJ = "zwj"; //$NON-NLS-1$ - public static final String ZWNJ = "zwnj"; //$NON-NLS-1$ - } - - public static final String HTML40_URI = "http://www.w3.org/TR/REC-html40/frameset.dtd"; //$NON-NLS-1$ - public static final String HTML40_TAG_PREFIX = ""; //$NON-NLS-1$ - // global attribute names - public static final String ATTR_NAME_ID = "id"; // %coreattrs; - // //$NON-NLS-1$ - public static final String ATTR_NAME_CLASS = "class"; // %coreattrs; - // //$NON-NLS-1$ - public static final String ATTR_NAME_STYLE = "style"; // %coreattrs; - // //$NON-NLS-1$ - public static final String ATTR_NAME_TITLE = "title"; // %coreattrs; - // //$NON-NLS-1$ - public static final String ATTR_NAME_LANG = "lang"; // %i18n; - // //$NON-NLS-1$ - public static final String ATTR_NAME_DIR = "dir"; // %i18n; //$NON-NLS-1$ - public static final String ATTR_NAME_ONCLICK = "onclick"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONDBLCLICK = "ondblclick"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONMOUSEDOWN = "onmousedown"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONMOUSEUP = "onmouseup"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONMOUSEOVER = "onmouseover"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONMOUSEMOVE = "onmousemove"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONMOUSEOUT = "onmouseout"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONKEYPRESS = "onkeypress"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONKEYDOWN = "onkeydown"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONKEYUP = "onkeyup"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONHELP = "onhelp"; // %events; - // //$NON-NLS-1$ - public static final String ATTR_NAME_BGCOLOR = "bgcolor"; // %bodycolor;, - // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_TEXT = "text"; // %bodycolor; - // //$NON-NLS-1$ - public static final String ATTR_NAME_LINK = "link"; // %bodycolor; - // //$NON-NLS-1$ - public static final String ATTR_NAME_VLINK = "vlink"; // %bodycolor; - // //$NON-NLS-1$ - public static final String ATTR_NAME_ALINK = "alink"; // %bodycolor; - // //$NON-NLS-1$ - public static final String ATTR_NAME_VERSION = "version"; // HTML - // //$NON-NLS-1$ - public static final String ATTR_NAME_PROFILE = "profile"; // HEAD - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONLOAD = "onload"; // BODY - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONUNLOAD = "onunload"; // BODY - // //$NON-NLS-1$ - public static final String ATTR_NAME_BACKGROUND = "background"; // BODY, - // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_SRC = "src"; // IMG //$NON-NLS-1$ - public static final String ATTR_NAME_ALT = "alt"; // IMG,AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_LONGDESC = "longdesc"; // IMG - // //$NON-NLS-1$ - public static final String ATTR_NAME_NAME = "name"; // IMG //$NON-NLS-1$ - public static final String ATTR_NAME_HEIGHT = "height"; // IMG, TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_WIDTH = "width"; // IMG, TABLE,HR - // //$NON-NLS-1$ - public static final String ATTR_NAME_USEMAP = "usemap"; // IMG - // //$NON-NLS-1$ - public static final String ATTR_NAME_ISMAP = "ismap"; // IMG //$NON-NLS-1$ - public static final String ATTR_NAME_ALIGN = "align"; // IMG, TABLE,HR - // //$NON-NLS-1$ - public static final String ATTR_NAME_BORDER = "border"; // IMG, TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_HSPACE = "hspace"; // IMG - // //$NON-NLS-1$ - public static final String ATTR_NAME_VSPACE = "vspace"; // IMG - // //$NON-NLS-1$ - public static final String ATTR_NAME_MAPFILE = "mapfile"; // IMG - // //$NON-NLS-1$ - public static final String ATTR_NAME_SUMMARY = "summary"; // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_FRAME = "frame"; // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_RULES = "rules"; // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_CELLSPACING = "cellspacing"; // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_CELLPADDING = "cellpadding"; // TABLE - // //$NON-NLS-1$ - public static final String ATTR_NAME_DATAPAGESIZE = "datapagesize"; // TABLE,HR - // //$NON-NLS-1$ - public static final String ATTR_NAME_COLOR = "color"; // BASEFONT,FONT - // //$NON-NLS-1$ - public static final String ATTR_NAME_FACE = "face"; // BASEFONT,FONT - // //$NON-NLS-1$ - public static final String ATTR_NAME_SIZE = "size"; // BASEFONT,FONT - // //$NON-NLS-1$ - public static final String ATTR_NAME_CLEAR = "clear"; // BR //$NON-NLS-1$ - public static final String ATTR_NAME_SHAPE = "shape"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_COORDS = "coords"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_HREF = "href"; // AREA //$NON-NLS-1$ - public static final String ATTR_NAME_TARGET = "target"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_NOHREF = "nohref"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_TABINDEX = "tabindex"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_ACCESSKEY = "accesskey"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONFOCUS = "onfocus"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONBLUR = "onblur"; // AREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_CHARSET = "charset"; // LINK - // //$NON-NLS-1$ - public static final String ATTR_NAME_HREFLANG = "hreflang"; // LINK - // //$NON-NLS-1$ - public static final String ATTR_NAME_TYPE = "type"; // LINK //$NON-NLS-1$ - public static final String ATTR_NAME_REL = "rel"; // LINK //$NON-NLS-1$ - public static final String ATTR_NAME_REV = "rev"; // LINK //$NON-NLS-1$ - public static final String ATTR_NAME_MEDIA = "media"; // LINK - // //$NON-NLS-1$ - public static final String ATTR_NAME_VALUE = "value"; // PARAM - // //$NON-NLS-1$ - public static final String ATTR_NAME_VALUETYPE = "valuetype"; // PARAM - // //$NON-NLS-1$ - public static final String ATTR_NAME_NOSHADE = "noshade"; // HR - // //$NON-NLS-1$ - public static final String ATTR_NAME_CHECKED = "checked"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_DISABLED = "disabled"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_READONLY = "readonly"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_MAXLENGTH = "maxlength"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONSELECT = "onselect"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONCHANGE = "onchange"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_ACCEPT = "accept"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_ISTYLE = "istyle"; // INPUT - // //$NON-NLS-1$ - public static final String ATTR_NAME_CHAR = "char"; // COL //$NON-NLS-1$ - public static final String ATTR_NAME_CHAROFF = "charoff"; // COL - // //$NON-NLS-1$ - public static final String ATTR_NAME_VALIGN = "valign"; // COL - // //$NON-NLS-1$ - public static final String ATTR_NAME_SPAN = "span"; // COL //$NON-NLS-1$ - public static final String ATTR_NAME_FRAMEBORDER = "frameborder"; // FRAME - // //$NON-NLS-1$ - public static final String ATTR_NAME_MARGINWIDTH = "marginwidth"; // FRAME - // //$NON-NLS-1$ - public static final String ATTR_NAME_MARGINHEIGHT = "marginheight"; // FRAME - // //$NON-NLS-1$ - public static final String ATTR_NAME_NORESIZE = "noresize"; // FRAME - // //$NON-NLS-1$ - public static final String ATTR_NAME_SCROLLING = "scrolling"; // FRAME - // //$NON-NLS-1$ - public static final String ATTR_NAME_PROMPT = "prompt"; // ISINDEX - // //$NON-NLS-1$ - public static final String ATTR_NAME_HTTP_EQUIV = "http-equiv"; // META - // //$NON-NLS-1$ - public static final String ATTR_NAME_CONTENT = "content"; // META - // //$NON-NLS-1$ - public static final String ATTR_NAME_SCHEME = "scheme"; // META - // //$NON-NLS-1$ - public static final String ATTR_NAME_ERRMSG = "errmsg"; // ssi:config - // //$NON-NLS-1$ - public static final String ATTR_NAME_SIZEFMT = "sizefmt"; // ssi:config - // //$NON-NLS-1$ - public static final String ATTR_NAME_TIMEFMT = "timefmt"; // ssi:config - // //$NON-NLS-1$ - public static final String ATTR_NAME_VAR = "var"; // ssi:echo - // //$NON-NLS-1$ - public static final String ATTR_NAME_CGI = "cgi"; // ssi:exec - // //$NON-NLS-1$ - public static final String ATTR_NAME_CMD = "cmd"; // ssi:exec - // //$NON-NLS-1$ - public static final String ATTR_NAME_FILE = "file"; // ssi:fsize - // //$NON-NLS-1$ - public static final String ATTR_NAME_VIRTUAL = "virtual"; // ssi:fsize - // //$NON-NLS-1$ - public static final String ATTR_NAME_SELECTED = "selected"; // OPTION - // //$NON-NLS-1$ - public static final String ATTR_NAME_LABEL = "label"; // OPTION - // //$NON-NLS-1$ - public static final String ATTR_NAME_ROWS = "rows"; // TEXTAREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_COLS = "cols"; // TEXTAREA - // //$NON-NLS-1$ - public static final String ATTR_NAME_LANGUAGE = "language"; // SCRIPT - // //$NON-NLS-1$ - public static final String ATTR_NAME_DEFER = "defer"; // SCRIPT - // //$NON-NLS-1$ - public static final String ATTR_NAME_EVENT = "event"; // SCRIPT - // //$NON-NLS-1$ - public static final String ATTR_NAME_FOR = "for"; // SCRIPT //$NON-NLS-1$ - public static final String ATTR_NAME_COMPACT = "compact"; // OL/UL - // //$NON-NLS-1$ - public static final String ATTR_NAME_START = "start"; // OL/UL - // //$NON-NLS-1$ - public static final String ATTR_NAME_DIRECTKEY = "directkey"; // A - // //$NON-NLS-1$ - public static final String ATTR_NAME_CODEBASE = "codebase"; // APPLET - // //$NON-NLS-1$ - public static final String ATTR_NAME_ARCHIVE = "archive"; // APPLET - // //$NON-NLS-1$ - public static final String ATTR_NAME_CODE = "code"; // APPLET - // //$NON-NLS-1$ - public static final String ATTR_NAME_OBJECT = "object"; // APPLET - // //$NON-NLS-1$ - public static final String ATTR_NAME_MAYSCRIPT = "mayscript"; // APPLET - // //$NON-NLS-1$ - public static final String ATTR_NAME_CITE = "cite"; // BLOCKQUOTE - // //$NON-NLS-1$ - public static final String ATTR_NAME_MACRO = "macro"; // D2W //$NON-NLS-1$ - public static final String ATTR_NAME_DATETIME = "datetime"; // INS/DEL - // //$NON-NLS-1$ - public static final String ATTR_NAME_LOOP = "loop"; // EMBED //$NON-NLS-1$ - public static final String ATTR_NAME_HIDDEN = "hidden"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_VOLUME = "volume"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_AUTOSTART = "autostart"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_AUTOPLAY = "autoplay"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_AUTOSIZE = "autosize"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_CONTROLLER = "controller";// EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_SCALE = "scale"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_SHOWCONTROLS = "showcontrols";// EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_PLAYCOUNT = "playcount"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_REPEAT = "repeat"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_PANEL = "panel"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_PALETTE = "palette"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_TEXTFOCUS = "textfocus"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_NAME_ACTION = "action"; // FORM - // //$NON-NLS-1$ - public static final String ATTR_NAME_METHOD = "method"; // FORM - // //$NON-NLS-1$ - public static final String ATTR_NAME_ENCTYPE = "enctype"; // FORM - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONSUBMIT = "onsubmit"; // FORM - // //$NON-NLS-1$ - public static final String ATTR_NAME_ONRESET = "onreset"; // FORM - // //$NON-NLS-1$ - public static final String ATTR_NAME_ACCEPT_CHARSET = "accept-charset";// FORM - // //$NON-NLS-1$ - public static final String ATTR_NAME_BEHAVIOR = "behavior"; // MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_NAME_DIRECTION = "direction"; // MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_NAME_SCROLLAMOUNT = "scrollamount";// MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_NAME_SCROLLDELAY = "scrolldelay";// MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_NAME_TRUESPEED = "truespeed"; // MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_NAME_DECLARE = "declare"; // OBJECT - // //$NON-NLS-1$ - public static final String ATTR_NAME_CLASSID = "classid"; // OBJECT - // //$NON-NLS-1$ - public static final String ATTR_NAME_DATA = "data"; // OBJECT - // //$NON-NLS-1$ - public static final String ATTR_NAME_CODETYPE = "codetype"; // OBJECT - // //$NON-NLS-1$ - public static final String ATTR_NAME_STANDBY = "standby"; // OBJECT - // //$NON-NLS-1$ - public static final String ATTR_NAME_MULTIPLE = "multiple"; // SELECT - // //$NON-NLS-1$ - public static final String ATTR_NAME_ABBR = "abbr"; // TH/TD //$NON-NLS-1$ - public static final String ATTR_NAME_AXIS = "axis"; // TH/TD //$NON-NLS-1$ - public static final String ATTR_NAME_HEADERS = "headers"; // TH/TD - // //$NON-NLS-1$ - public static final String ATTR_NAME_SCOPE = "scope"; // TH/TD - // //$NON-NLS-1$ - public static final String ATTR_NAME_ROWSPAN = "rowspan"; // TH/TD - // //$NON-NLS-1$ - public static final String ATTR_NAME_COLSPAN = "colspan"; // TH/TD - // //$NON-NLS-1$ - public static final String ATTR_NAME_NOWRAP = "nowrap"; // TH/TD - // //$NON-NLS-1$ - // <<D205514 - public static final String ATTR_NAME_TOPMARGIN = "topmargin"; // BODY - // //$NON-NLS-1$ - public static final String ATTR_NAME_BOTTOMMARGIN = "bottommargin"; // BODY - // //$NON-NLS-1$ - public static final String ATTR_NAME_LEFTMARGIN = "leftmargin"; // BODY - // //$NON-NLS-1$ - public static final String ATTR_NAME_RIGHTMARGIN = "rightmargin"; // BODY - // //$NON-NLS-1$ - public static final String ATTR_NAME_BORDERCOLOR = "bordercolor"; // TABLE/TR/TH/TD/FRAMESET/FRAME - // //$NON-NLS-1$ - // for WML - public static final String WML_ATTR_NAME_TITLE = "title"; // card - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_DOMAIN = "domain"; // access - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_PATH = "path"; // access - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ONENTERFORWARD = "onenterforward"; // template,card - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ONENTERBACKWARD = "onenterbackward"; // template,card - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ONPICK = "onpick"; // option - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ONTIMER = "ontimer"; // template,card - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_NEWCONTEXT = "newcontext"; // card - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ORDERED = "ordered"; // card - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_OPTIONAL = "optional"; // do - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_CACHE_CONTROL = "cache-control"; // go - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_SENDREFERER = "sendreferer"; // go - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_METHOD = "method"; // go - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ENCTYPE = "enctype"; // go - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_ACCEPT_CHARSET = "accept-charset"; // go - // //$NON-NLS-1$ - public static final String WML_ATTR_NAME_COLUMNS = "columns"; // table - // //$NON-NLS-1$ - // D205514 - //<<D215684 - public static final String ATTR_NAME_FRAMESPACING = "framespacing"; // FRAMESET - // //$NON-NLS-1$ - //D215684 - // global attribute values; mainly used in enumeration. - public static final String ATTR_VALUE_VERSION_TRANSITIONAL = "-//W3C//DTD HTML 4.01 Transitional//EN"; //$NON-NLS-1$ - public static final String ATTR_VALUE_VERSION_FRAMESET = "-//W3C//DTD HTML 4.01 Frameset//EN"; //$NON-NLS-1$ - public static final String ATTR_VALUE_LTR = "ltr"; // dir //$NON-NLS-1$ - public static final String ATTR_VALUE_RTL = "rtl"; // dir //$NON-NLS-1$ - // for align (top|middle|bottom|left|right) - public static final String ATTR_VALUE_TOP = "top"; // align //$NON-NLS-1$ - public static final String ATTR_VALUE_MIDDLE = "middle"; // align - // //$NON-NLS-1$ - public static final String ATTR_VALUE_BOTTOM = "bottom"; // align - // //$NON-NLS-1$ - public static final String ATTR_VALUE_LEFT = "left"; // align - // //$NON-NLS-1$ - public static final String ATTR_VALUE_CENTER = "center"; // align - // //$NON-NLS-1$ - public static final String ATTR_VALUE_RIGHT = "right"; // align - // //$NON-NLS-1$ - public static final String ATTR_VALUE_JUSTIFY = "justify"; // align - // //$NON-NLS-1$ - public static final String ATTR_VALUE_CHAR = "char"; // align - // //$NON-NLS-1$ - // for valign (baseline) - public static final String ATTR_VALUE_BASELINE = "baseline"; // valign - // //$NON-NLS-1$ - // for clear (left|all|right|none): left and right are already defined - // above. - public static final String ATTR_VALUE_ALL = "all"; // clear //$NON-NLS-1$ - public static final String ATTR_VALUE_NONE = "none"; // clear - // //$NON-NLS-1$ - // for shape (rect|circle|poly|default) - public static final String ATTR_VALUE_RECT = "rect"; // shape - // //$NON-NLS-1$ - public static final String ATTR_VALUE_CIRCLE = "circle"; // shape - // //$NON-NLS-1$ - public static final String ATTR_VALUE_POLY = "poly"; // shape - // //$NON-NLS-1$ - public static final String ATTR_VALUE_DEFAULT = "default"; // shape - // //$NON-NLS-1$ - // for valuetype (data|ref|object) - public static final String ATTR_VALUE_DATA = "data"; // valuetype - // //$NON-NLS-1$ - public static final String ATTR_VALUE_REF = "ref"; // valuetype - // //$NON-NLS-1$ - public static final String ATTR_VALUE_OBJECT = "object"; // valuetype - // //$NON-NLS-1$ - // for type of INPUT - // (text | password | checkbox | radio | submit | reset | - // file | hidden | image | button) - public static final String ATTR_VALUE_TEXT = "text"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_PASSWORD = "password"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_CHECKBOX = "checkbox"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_RADIO = "radio"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_SUBMIT = "submit"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_RESET = "reset"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_FILE = "file"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_HIDDEN = "hidden"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_IMAGE = "image"; // INPUT:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_BUTTON = "button"; // INPUT:type - // //$NON-NLS-1$ - // for span, colspan, rowspan - public static final String ATTR_VALUE_1 = "1"; // span //$NON-NLS-1$ - // for frameborder - public static final String ATTR_VALUE_0 = "0"; // FRAME //$NON-NLS-1$ - // for scrolling - public static final String ATTR_VALUE_YES = "yes"; // FRAME //$NON-NLS-1$ - public static final String ATTR_VALUE_NO = "no"; // FRAME //$NON-NLS-1$ - public static final String ATTR_VALUE_AUTO = "auto"; // FRAME - // //$NON-NLS-1$ - // for UL - public static final String ATTR_VALUE_DISC = "disc"; // UL:type - // //$NON-NLS-1$ - public static final String ATTR_VALUE_SQUARE = "square"; // UL:type - // //$NON-NLS-1$ - // for frame of TABLE - public static final String ATTR_VALUE_VOID = "void"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_ABOVE = "above"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_BELOW = "below"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_HSIDES = "hsides"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_LHS = "lhs"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_RHS = "rhs"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_VSIDES = "vsides"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_BOX = "box"; // TABLE:frame - // //$NON-NLS-1$ - public static final String ATTR_VALUE_BORDER = "border"; // TABLE:frame - // //$NON-NLS-1$ - // for rules of TABLE - public static final String ATTR_VALUE_GROUPS = "groups"; // TABLE:rules - // //$NON-NLS-1$ - public static final String ATTR_VALUE_ROWS = "rows"; // TEXTAREA - // //$NON-NLS-1$ - public static final String ATTR_VALUE_COLS = "cols"; // TEXTAREA - // //$NON-NLS-1$ - // for method of FORM - public static final String ATTR_VALUE_GET = "get"; // FORM //$NON-NLS-1$ - public static final String ATTR_VALUE_POST = "post"; // FORM //$NON-NLS-1$ - public static final String ATTR_VALUE_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$ - // for scope of (TH | TD) - public static final String ATTR_VALUE_ROW = "row"; // (TH|TD):scope - // //$NON-NLS-1$ - public static final String ATTR_VALUE_COL = "col"; // (TH|TD):scope - // //$NON-NLS-1$ - public static final String ATTR_VALUE_ROWGROUP = "rowgroup";// (TH|TD):scope - // //$NON-NLS-1$ - public static final String ATTR_VALUE_COLGROUP = "colgroup";// (TH|TD):scope - // //$NON-NLS-1$ - // for auto?? of EMBED - public static final String ATTR_VALUE_TRUE = "true"; // EMBED - // //$NON-NLS-1$ - public static final String ATTR_VALUE_FALSE = "false"; // EMBED - // //$NON-NLS-1$ - // for behaviro of MARQUEE - public static final String ATTR_VALUE_SCROLL = "scroll"; // MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_VALUE_SLIDE = "slide"; // MARQUEE - // //$NON-NLS-1$ - public static final String ATTR_VALUE_ALTERNATE = "alternate"; // MARQUEE - // //$NON-NLS-1$ - // for direction of MARQUEE - public static final String ATTR_VALUE_UP = "up"; // MARQUEE //$NON-NLS-1$ - public static final String ATTR_VALUE_DOWN = "down"; // MARQUEE - // //$NON-NLS-1$ - // for type of LI (D19924) - public static final String ATTR_VALUE_NUMBER = "1"; // LI //$NON-NLS-1$ - public static final String ATTR_VALUE_LOWER_ALPHA = "a"; // LI - // //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java deleted file mode 100644 index 1b4b8a9af9..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; - -/** - * Interface for additional proposal information for CSS Content Assist - * - */ -public interface IProposalInfo { - /** - * Sets the element for additional proposal information - * @param node the element for additional proposal information - */ - void setInputElement(CSSMMNode node); -} diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java deleted file mode 100644 index 373f3ddddb..0000000000 --- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.wst.css.ui.internal.contentassist; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; -import org.eclipse.wst.css.ui.internal.CSSUIPlugin; -import org.eclipse.wst.css.ui.internal.Logger; - -/** - * Generates proposal information for {@link CSSMMNode}s. If the Proposal Information instance - * implements {@link IProposalInfo} the node will be set as the input element. - * - */ -class ProposalInfoFactory { - - private static IConfigurationElement fElement = null; - private static boolean fIsInitialized = false; - - private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ - - private ProposalInfoFactory() { - } - - /** - * Returns additional proposal information for <code>node</code> - * @param node the CSS metamodel node - * @return additional proposal information about <code>node></code> - */ - public static synchronized Object getProposalInfo(CSSMMNode node) { - Object info = null; - if (!fIsInitialized) { - // Only attempt to initialize this once. If there are no proposal information providers, we'll always return null - IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(CSSUIPlugin.ID, "proposalInfo"); //$NON-NLS-1$ - if (elements.length > 0) { - // Get the first proposal info that's declared - fElement = elements[0]; - } - - fIsInitialized = true; - } - - if (fElement != null) { - try { - info = fElement.createExecutableExtension(ATTR_CLASS); //$NON-NLS-1$ - if (info instanceof IProposalInfo) { - ((IProposalInfo) info).setInputElement(node); - } - } catch (CoreException e) { - Logger.log(Logger.ERROR, "Could not create instance for proposalInfo [" + fElement.getAttribute("class") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - return info; - } - -} |