From 40dd89ea147e353bc3559f130246c887e7c6ffff Mon Sep 17 00:00:00 2001 From: pavery Date: Fri, 1 Apr 2005 21:09:29 +0000 Subject: more API cleanup (mostly partition types) --- .../document/PageDirectiveAdapterImpl.java | 4 +- .../text/NullStructuredDocumentPartitioner.java | 16 ++++---- .../text/StructuredTextPartitionerForJSP.java | 43 +++++++++------------- .../jst/jsp/core/text/IJSPPartitionTypes.java | 23 ++++++++++++ .../eclipse/jst/jsp/core/text/IJSPPartitions.java | 26 ------------- 5 files changed, 51 insertions(+), 61 deletions(-) create mode 100644 bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitionTypes.java delete mode 100644 bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitions.java (limited to 'bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst') diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/document/PageDirectiveAdapterImpl.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/document/PageDirectiveAdapterImpl.java index 32c235e121..55bf775609 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/document/PageDirectiveAdapterImpl.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/document/PageDirectiveAdapterImpl.java @@ -33,7 +33,7 @@ import org.eclipse.wst.sse.core.IStructuredModel; import org.eclipse.wst.sse.core.internal.modelhandler.EmbeddedTypeRegistry; import org.eclipse.wst.sse.core.internal.modelhandler.EmbeddedTypeRegistryImpl; import org.eclipse.wst.sse.core.modelhandler.EmbeddedTypeHandler; -import org.eclipse.wst.sse.core.text.IStructuredDocument; +import org.eclipse.wst.sse.core.text.IStructuredPartitioning; import org.eclipse.wst.sse.core.util.Debug; import org.eclipse.wst.sse.core.util.StringUtils; import org.eclipse.wst.xml.core.document.XMLNode; @@ -485,7 +485,7 @@ public class PageDirectiveAdapterImpl implements PageDirectiveAdapter { */ public void setLanguage(String newLanguage) { this.cachedLanguage = newLanguage; - IDocumentPartitioner partitioner = ((IDocumentExtension3) model.getStructuredDocument()).getDocumentPartitioner(IStructuredDocument.DEFAULT_STRUCTURED_PARTITIONING); + IDocumentPartitioner partitioner = ((IDocumentExtension3) model.getStructuredDocument()).getDocumentPartitioner(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING); if (partitioner instanceof StructuredTextPartitionerForJSP) { ((StructuredTextPartitionerForJSP) partitioner).setLanguage(newLanguage); } diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/NullStructuredDocumentPartitioner.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/NullStructuredDocumentPartitioner.java index fd932d35cd..3fae7869db 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/NullStructuredDocumentPartitioner.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/NullStructuredDocumentPartitioner.java @@ -16,7 +16,7 @@ import org.eclipse.jface.text.ITypedRegion; import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion; import org.eclipse.wst.sse.core.text.IStructuredTextPartitioner; import org.eclipse.wst.sse.core.text.ITextRegion; -import org.eclipse.wst.sse.core.text.StructuredTypedRegion; +import org.eclipse.wst.sse.core.text.IStructuredTypedRegion; /** * To be used when no known partitioner is available. @@ -24,7 +24,7 @@ import org.eclipse.wst.sse.core.text.StructuredTypedRegion; */ public class NullStructuredDocumentPartitioner implements IStructuredTextPartitioner { - public class NullStructuredTypedRegion implements StructuredTypedRegion { + public class NullStructuredTypedRegion implements IStructuredTypedRegion { private int fOffset; @@ -70,8 +70,8 @@ public class NullStructuredDocumentPartitioner implements IStructuredTextPartiti // nothing to do } - public StructuredTypedRegion createPartition(int offset, int length, String type) { - StructuredTypedRegion result = new NullStructuredTypedRegion(); + public IStructuredTypedRegion createPartition(int offset, int length, String type) { + IStructuredTypedRegion result = new NullStructuredTypedRegion(); result.setOffset(offset); result.setLength(length); result.setType(type); @@ -82,7 +82,7 @@ public class NullStructuredDocumentPartitioner implements IStructuredTextPartiti // nothing to do } - public String getDefault() { + public String getDefaultPartitionType() { return ST_UNKNOWN_PARTITION; } @@ -94,7 +94,7 @@ public class NullStructuredDocumentPartitioner implements IStructuredTextPartiti return ST_UNKNOWN_PARTITION; } - public String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, ITextRegion previousStartTagNameRegion, IStructuredDocumentRegion nextNode, ITextRegion nextEndTagNameRegion) { + public String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, IStructuredDocumentRegion nextNode) { return ST_UNKNOWN_PARTITION; } @@ -111,11 +111,11 @@ public class NullStructuredDocumentPartitioner implements IStructuredTextPartiti } public String getContentType(int offset) { - return getDefault(); + return getDefaultPartitionType(); } public ITypedRegion getPartition(int offset) { - return createPartition(offset, 1, getDefault()); + return createPartition(offset, 1, getDefaultPartitionType()); } } \ No newline at end of file diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/StructuredTextPartitionerForJSP.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/StructuredTextPartitionerForJSP.java index 25f487c72b..066584f80e 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/StructuredTextPartitionerForJSP.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/text/StructuredTextPartitionerForJSP.java @@ -24,7 +24,7 @@ import org.eclipse.jst.jsp.core.contentmodel.tld.JSP12TLDNames; import org.eclipse.jst.jsp.core.encoding.JSPDocumentHeadContentDetector; import org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser; import org.eclipse.jst.jsp.core.model.parser.DOMJSPRegionContexts; -import org.eclipse.jst.jsp.core.text.IJSPPartitions; +import org.eclipse.jst.jsp.core.text.IJSPPartitionTypes; import org.eclipse.wst.html.core.internal.text.StructuredTextPartitionerForHTML; import org.eclipse.wst.sse.core.internal.parser.ForeignRegion; import org.eclipse.wst.sse.core.internal.text.rules.StructuredTextPartitioner; @@ -173,7 +173,7 @@ public class StructuredTextPartitionerForJSP extends StructuredTextPartitioner { private static final String XHTML_MIME_TYPE = "text/xhtml"; //$NON-NLS-1$ private static final String XML_MIME_TYPE = "text/xml"; //$NON-NLS-1$ - private final static String[] fConfiguredContentTypes = new String[]{IJSPPartitions.JSP_DEFAULT, IJSPPartitions.JSP_DEFAULT_EL, IJSPPartitions.JSP_DIRECTIVE, IJSPPartitions.JSP_CONTENT_DELIMITER, IJSPPartitions.JSP_CONTENT_JAVA, IJSPPartitions.JSP_CONTENT_JAVASCRIPT, IJSPPartitions.JSP_COMMENT}; + private final static String[] fConfiguredContentTypes = new String[]{IJSPPartitionTypes.JSP_DEFAULT, IJSPPartitionTypes.JSP_DEFAULT_EL, IJSPPartitionTypes.JSP_DIRECTIVE, IJSPPartitionTypes.JSP_CONTENT_DELIMITER, IJSPPartitionTypes.JSP_CONTENT_JAVA, IJSPPartitionTypes.JSP_CONTENT_JAVASCRIPT, IJSPPartitionTypes.JSP_COMMENT}; /** * @return @@ -296,8 +296,8 @@ public class StructuredTextPartitionerForJSP extends StructuredTextPartitioner { super.disconnect(); } - public String getDefault() { - return getEmbeddedPartitioner().getDefault(); + public String getDefaultPartitionType() { + return getEmbeddedPartitioner().getDefaultPartitionType(); } /** @@ -363,24 +363,24 @@ public class StructuredTextPartitionerForJSP extends StructuredTextPartitioner { result = getPartitionTypeForDocumentLanguage(); } else if (region_type == DOMJSPRegionContexts.JSP_COMMENT_TEXT || region_type == DOMJSPRegionContexts.JSP_COMMENT_OPEN || region_type == DOMJSPRegionContexts.JSP_COMMENT_CLOSE) - result = IJSPPartitions.JSP_COMMENT; + result = IJSPPartitionTypes.JSP_COMMENT; else if (region_type == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME || region_type == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN || region_type == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE) - result = IJSPPartitions.JSP_DIRECTIVE; + result = IJSPPartitionTypes.JSP_DIRECTIVE; else if (region_type == DOMJSPRegionContexts.JSP_CLOSE || region_type == DOMJSPRegionContexts.JSP_SCRIPTLET_OPEN || region_type == DOMJSPRegionContexts.JSP_EXPRESSION_OPEN || region_type == DOMJSPRegionContexts.JSP_DECLARATION_OPEN) - result = IJSPPartitions.JSP_CONTENT_DELIMITER; + result = IJSPPartitionTypes.JSP_CONTENT_DELIMITER; else if (region_type == DOMJSPRegionContexts.JSP_ROOT_TAG_NAME) - result = IJSPPartitions.JSP_DEFAULT; + result = IJSPPartitionTypes.JSP_DEFAULT; else if (region_type == DOMJSPRegionContexts.JSP_EL_OPEN || region_type == DOMJSPRegionContexts.JSP_EL_CONTENT || region_type == DOMJSPRegionContexts.JSP_EL_CLOSE || region_type == DOMJSPRegionContexts.JSP_EL_DQUOTE || region_type == DOMJSPRegionContexts.JSP_EL_SQUOTE || region_type == DOMJSPRegionContexts.JSP_EL_QUOTED_CONTENT) - result = IJSPPartitions.JSP_DEFAULT_EL; + result = IJSPPartitionTypes.JSP_DEFAULT_EL; else if (region_type == XMLRegionContext.XML_CONTENT) { // possibly between , , - // + // IStructuredDocumentRegion sdRegion = this.structuredDocument.getRegionAtCharacterOffset(offset); if (isJspJavaActionName(getParentName(sdRegion))) result = getPartitionTypeForDocumentLanguage(); else - result = getDefault(); + result = getDefaultPartitionType(); } else { result = getEmbeddedPartitioner().getPartitionType(region, offset); @@ -388,27 +388,20 @@ public class StructuredTextPartitionerForJSP extends StructuredTextPartitioner { return result; } - /** - * @see com.ibm.sed.structuredDocument.partition.StructuredTextPartitioner#getPartitionType(com.ibm.sed.structuredDocument.ITextRegion, - * com.ibm.sed.structuredDocument.ITextRegion) - */ - public String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, ITextRegion previousStartTagNameRegion, IStructuredDocumentRegion nextNode, ITextRegion nextEndTagNameRegion) { - return getEmbeddedPartitioner().getPartitionTypeBetween(previousNode, previousStartTagNameRegion, nextNode, nextEndTagNameRegion); + public String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, IStructuredDocumentRegion nextNode) { + return getEmbeddedPartitioner().getPartitionTypeBetween(previousNode, nextNode); } - /** - * @return - */ private String getPartitionTypeForDocumentLanguage() { String result; if (fLanguage == null || fLanguage.equalsIgnoreCase("java")) { //$NON-NLS-1$ - result = IJSPPartitions.JSP_CONTENT_JAVA; + result = IJSPPartitionTypes.JSP_CONTENT_JAVA; } else if (fLanguage.equalsIgnoreCase("javascript")) { //$NON-NLS-1$ - result = IJSPPartitions.JSP_CONTENT_JAVASCRIPT; + result = IJSPPartitionTypes.JSP_CONTENT_JAVASCRIPT; } else { - result = IJSPPartitions.JSP_SCRIPT_PREFIX + getLanguage().toUpperCase(Locale.ENGLISH); + result = IJSPPartitionTypes.JSP_SCRIPT_PREFIX + getLanguage().toUpperCase(Locale.ENGLISH); } return result; } @@ -454,11 +447,11 @@ public class StructuredTextPartitionerForJSP extends StructuredTextPartitioner { String documentRegionContext = sdRegion.getType(); if (containedChildRegion != null) { if (documentRegionContext.equals(DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) || documentRegionContext.equals(DOMJSPRegionContexts.JSP_ROOT_TAG_NAME)) { - setInternalPartition(offset, containedChildRegion.getLength(), IJSPPartitions.JSP_DIRECTIVE); + setInternalPartition(offset, containedChildRegion.getLength(), IJSPPartitionTypes.JSP_DIRECTIVE); return true; } if (fEnableJSPActionPartitions && isAction(sdRegion, offset)) { - setInternalPartition(offset, containedChildRegion.getLength(), IJSPPartitions.JSP_DIRECTIVE); + setInternalPartition(offset, containedChildRegion.getLength(), IJSPPartitionTypes.JSP_DIRECTIVE); return true; } } diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitionTypes.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitionTypes.java new file mode 100644 index 0000000000..52fe6d4f26 --- /dev/null +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitionTypes.java @@ -0,0 +1,23 @@ +package org.eclipse.jst.jsp.core.text; + + +/** + * This interface is not intended to be implemented. + * It defines the partition types for JSP. + * Clients should reference the partition type Strings defined here directly. + * + * @since 1.0 + */ +public interface IJSPPartitionTypes { + + String JSP_DEFAULT = "org.eclipse.jst.jsp.DEFAULT_JSP"; //$NON-NLS-1$ + String JSP_COMMENT = "org.eclipse.jst.jsp.JSP_COMMENT"; //$NON-NLS-1$ + + String JSP_SCRIPT_PREFIX = "org.eclipse.jst.jsp.SCRIPT."; //$NON-NLS-1$ + String JSP_CONTENT_DELIMITER = JSP_SCRIPT_PREFIX + "DELIMITER"; //$NON-NLS-1$ + String JSP_CONTENT_JAVA = JSP_SCRIPT_PREFIX + "JAVA"; //$NON-NLS-1$ + String JSP_CONTENT_JAVASCRIPT = JSP_SCRIPT_PREFIX + "JAVASCRIPT"; //$NON-NLS-1$ + String JSP_DEFAULT_EL = JSP_SCRIPT_PREFIX + "JSP_EL"; //$NON-NLS-1$ + + String JSP_DIRECTIVE = "org.eclipse.jst.jsp.JSP_DIRECTIVE"; //$NON-NLS-1$ +} diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitions.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitions.java deleted file mode 100644 index 9f14225d6d..0000000000 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/text/IJSPPartitions.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.jst.jsp.core.text; - -import org.eclipse.wst.sse.core.text.IStructuredPartitions; - -/** - * This interface is not intended to be implemented. - * It defines the partitioning for JSP and all its partitions. - * Clients should reference the partition type Strings defined here directly. - * - * @since 1.0 - */ -public interface IJSPPartitions { - - String JSP_PARTITIONING = IStructuredPartitions.STRUCTURED_PARTITIONING; - - String JSP_DEFAULT = "org.eclipse.jst.jsp.DEFAULT_JSP"; //$NON-NLS-1$ - String JSP_COMMENT = "org.eclipse.jst.jsp.JSP_COMMENT"; //$NON-NLS-1$ - - String JSP_SCRIPT_PREFIX = "org.eclipse.jst.jsp.SCRIPT."; //$NON-NLS-1$ - String JSP_CONTENT_DELIMITER = JSP_SCRIPT_PREFIX + "DELIMITER"; //$NON-NLS-1$ - String JSP_CONTENT_JAVA = JSP_SCRIPT_PREFIX + "JAVA"; //$NON-NLS-1$ - String JSP_CONTENT_JAVASCRIPT = JSP_SCRIPT_PREFIX + "JAVASCRIPT"; //$NON-NLS-1$ - String JSP_DEFAULT_EL = JSP_SCRIPT_PREFIX + "JSP_EL"; //$NON-NLS-1$ - - String JSP_DIRECTIVE = "org.eclipse.jst.jsp.JSP_DIRECTIVE"; //$NON-NLS-1$ -} -- cgit v1.2.3