diff options
author | nitind | 2005-02-03 07:29:46 +0000 |
---|---|---|
committer | nitind | 2005-02-03 07:29:46 +0000 |
commit | ea9b751ac114ecdfca3e1e32213fdd357641b4d3 (patch) | |
tree | 21a07af07f35275d60beb117bbd005e182a81f45 /bundles/org.eclipse.jst.jsp.ui | |
parent | dc7e3f4105e3ae38b715f511de149027a8c1bc51 (diff) | |
download | webtools.sourceediting-ea9b751ac114ecdfca3e1e32213fdd357641b4d3.tar.gz webtools.sourceediting-ea9b751ac114ecdfca3e1e32213fdd357641b4d3.tar.xz webtools.sourceediting-ea9b751ac114ecdfca3e1e32213fdd357641b4d3.zip |
streamline partition type lookup
Diffstat (limited to 'bundles/org.eclipse.jst.jsp.ui')
-rw-r--r-- | bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPContentAssistProcessor.java | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPContentAssistProcessor.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPContentAssistProcessor.java index 7f4bd39846..86749fb0ca 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPContentAssistProcessor.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPContentAssistProcessor.java @@ -24,7 +24,7 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.ITypedRegion; +import org.eclipse.jface.text.TextUtilities; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContextInformation; @@ -1009,28 +1009,17 @@ public class JSPContentAssistProcessor extends AbstractContentAssistProcessor im } /** - * * @param viewer * @param documentPosition * @return String */ protected String getPartitionType(StructuredTextViewer viewer, int documentPosition) { String partitionType = null; - IStructuredModel sModel = null; try { - sModel = StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument()); - IDocument document = sModel.getStructuredDocument(); - - ITypedRegion regionType = document.getPartition(documentPosition); - partitionType = regionType.getType(); + partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredDocument.DEFAULT_STRUCTURED_PARTITIONING, documentPosition + viewer.getVisibleRegion().getOffset(), false); } catch (BadLocationException e) { - partitionType = null; - } - finally { - if (sModel != null) { - sModel.releaseFromRead(); - } + partitionType = IDocument.DEFAULT_CONTENT_TYPE; } return partitionType; } |