diff options
author | nsandonato | 2011-03-22 21:01:01 +0000 |
---|---|---|
committer | nsandonato | 2011-03-22 21:01:01 +0000 |
commit | 8fec63ce556a12745f533b9dae7c9e51264a1a37 (patch) | |
tree | e051bae583e524f43786132ad65b41e99019bfb7 /bundles | |
parent | 913e40edd34258297fedf6093161ff6baa9ca789 (diff) | |
download | webtools.sourceediting-8fec63ce556a12745f533b9dae7c9e51264a1a37.tar.gz webtools.sourceediting-8fec63ce556a12745f533b9dae7c9e51264a1a37.tar.xz webtools.sourceediting-8fec63ce556a12745f533b9dae7c9e51264a1a37.zip |
[215668] [document] Code assist within Style element does not work
Diffstat (limited to 'bundles')
3 files changed, 48 insertions, 4 deletions
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 a89150ed67..836557cf63 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * 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 @@ -440,4 +440,31 @@ public class StructuredTextPartitionerForJSP extends StructuredTextPartitioner { type == DOMJSPRegionContexts.JSP_VBL_SQUOTE; } + /* (non-Javadoc) + * @see org.eclipse.wst.sse.core.internal.text.rules.StructuredTextPartitioner#doParserSpecificCheck(int, boolean, org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion, org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion, org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion, org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion) + */ + protected boolean doParserSpecificCheck(int offset, boolean partitionFound, IStructuredDocumentRegion sdRegion, IStructuredDocumentRegion previousStructuredDocumentRegion, ITextRegion next, ITextRegion previousStart) { + if (previousStart != null && previousStart.getType() == DOMRegionContext.XML_TAG_OPEN && next.getType() == DOMRegionContext.XML_END_TAG_OPEN) { + ITextRegion previousName = previousStructuredDocumentRegion.getRegionAtCharacterOffset(previousStructuredDocumentRegion.getEndOffset(previousStart)); + ITextRegion nextName = sdRegion.getRegionAtCharacterOffset(sdRegion.getEndOffset(next)); + if (previousName != null && nextName != null && previousName.getType() == DOMRegionContext.XML_TAG_NAME && nextName.getType() == DOMRegionContext.XML_TAG_NAME) { + setInternalPartition(offset, 0, getPartitionTypeBetween(previousStructuredDocumentRegion, sdRegion)); + partitionFound = true; + } + } + return partitionFound; + } + + /* (non-Javadoc) + * @see org.eclipse.wst.sse.core.internal.text.rules.StructuredTextPartitioner#getParserSpecificPreviousRegion(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion) + */ + protected IStructuredDocumentRegion getParserSpecificPreviousRegion(IStructuredDocumentRegion currentRegion) { + if (currentRegion == null) + return null; + do { + currentRegion = currentRegion.getPrevious(); + } while (currentRegion != null && currentRegion.getType().equals(DOMRegionContext.BLOCK_TEXT)); + + return currentRegion; + } } diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java index e1b3e3897d..08c61ee3eb 100644 --- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java +++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/StructuredTextPartitionerForHTML.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. + * 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 @@ -302,4 +302,17 @@ public class StructuredTextPartitionerForHTML extends StructuredTextPartitionerF } return foundAttributeName; } + + /* (non-Javadoc) + * @see org.eclipse.wst.sse.core.internal.text.rules.StructuredTextPartitioner#getParserSpecificPreviousRegion(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion) + */ + protected IStructuredDocumentRegion getParserSpecificPreviousRegion(IStructuredDocumentRegion currentRegion) { + if (currentRegion == null) + return null; + do { + currentRegion = currentRegion.getPrevious(); + } while (currentRegion != null && currentRegion.getType().equals(DOMRegionContext.BLOCK_TEXT)); + + return currentRegion; + } } diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/rules/StructuredTextPartitioner.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/rules/StructuredTextPartitioner.java index 14e9b1532b..445e5f27f5 100644 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/rules/StructuredTextPartitioner.java +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/rules/StructuredTextPartitioner.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2010 IBM Corporation and others. + * Copyright (c) 2001, 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 @@ -271,6 +271,10 @@ public class StructuredTextPartitioner implements IDocumentPartitioner, IStructu return false; } + protected IStructuredDocumentRegion getParserSpecificPreviousRegion(IStructuredDocumentRegion currentRegion) { + return currentRegion != null ? currentRegion.getPrevious() : null; + } + /** * Returns the content type of the partition containing the given * character position of the given document. The document has previously @@ -556,7 +560,7 @@ public class StructuredTextPartitioner implements IDocumentPartitioner, IStructu // } // else if (structuredDocumentRegion.getStartOffset() == offset) { - IStructuredDocumentRegion previousStructuredDocumentRegion = structuredDocumentRegion.getPrevious(); + IStructuredDocumentRegion previousStructuredDocumentRegion = getParserSpecificPreviousRegion(structuredDocumentRegion); if (previousStructuredDocumentRegion != null) { ITextRegion next = structuredDocumentRegion.getRegionAtCharacterOffset(offset); ITextRegion previousStart = previousStructuredDocumentRegion.getRegionAtCharacterOffset(previousStructuredDocumentRegion.getStartOffset()); |