[307811] Overreliance on StructuredTextEditor and StructuredTextViewer
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 e2c7d69..892f559 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
@@ -22,6 +22,7 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension5;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
@@ -63,7 +64,6 @@
import org.eclipse.wst.sse.core.text.IStructuredPartitions;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.sse.ui.internal.IReleasable;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceCompletionProposal;
@@ -461,7 +461,7 @@
ICompletionProposal[] embeddedResults = EMPTY_PROPOSAL_SET;
// check the actual partition type
- String partitionType = getPartitionType((StructuredTextViewer) viewer, documentPosition);
+ String partitionType = getPartitionType(viewer, documentPosition);
IStructuredDocument structuredDocument = (IStructuredDocument) viewer.getDocument();
IStructuredDocumentRegion fn = structuredDocument.getRegionAtCharacterOffset(documentPosition);
@@ -559,7 +559,7 @@
// well get those proposals from the embedded
// adapter
if (documentPosition > 0) {
- partitionType = getPartitionType((StructuredTextViewer) viewer, documentPosition - 1);
+ partitionType = getPartitionType(viewer, documentPosition - 1);
break;
}
}
@@ -590,7 +590,7 @@
// if it is, we're just gonna let the embedded JAVASCRIPT
// adapter get the proposals
if (documentPosition > 0) {
- String checkType = getPartitionType((StructuredTextViewer) viewer, documentPosition - 1);
+ String checkType = getPartitionType(viewer, documentPosition - 1);
if (checkType != IJSPPartitions.JSP_CONTENT_JAVASCRIPT) { // this
// check
// is
@@ -620,7 +620,7 @@
// if it is, we're just gonna let the embedded
// JAVASCRIPT adapter get the proposals
if (documentPosition > 0) {
- String checkType = getPartitionType((StructuredTextViewer) viewer, documentPosition - 1);
+ String checkType = getPartitionType(viewer, documentPosition - 1);
if (checkType != IJSPPartitions.JSP_CONTENT_JAVASCRIPT) {
return getJSPJavaCompletionProposals(viewer, documentPosition);
}
@@ -888,10 +888,13 @@
* @param documentPosition
* @return String
*/
- protected String getPartitionType(StructuredTextViewer viewer, int documentPosition) {
+ protected String getPartitionType(ITextViewer viewer, int documentPosition) {
String partitionType = null;
try {
- partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, viewer.modelOffset2WidgetOffset(documentPosition), false);
+ if (viewer instanceof ITextViewerExtension5)
+ partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, ((ITextViewerExtension5) viewer).modelOffset2WidgetOffset(documentPosition), false);
+ else
+ partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, documentPosition, false);
}
catch (BadLocationException e) {
partitionType = IDocument.DEFAULT_CONTENT_TYPE;
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPELCompletionProposalComputer.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPELCompletionProposalComputer.java
index 219429e..709baa0 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPELCompletionProposalComputer.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPELCompletionProposalComputer.java
@@ -32,7 +32,6 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
@@ -78,7 +77,7 @@
if (cursorRegion.getType() == DOMJSPRegionContexts.JSP_EL_CONTENT) {
String prefix = getPrefix(documentPosition - startOffset, elText);
if (null != prefix) {
- List proposals = getFunctionProposals(prefix, (StructuredTextViewer) viewer, documentPosition);
+ List proposals = getFunctionProposals(prefix, viewer, documentPosition);
results.addAll(proposals);
}
}
@@ -130,7 +129,7 @@
* @param offset
* @return
*/
- private List getFunctionProposals(String prefix, StructuredTextViewer viewer, int offset) {
+ private List getFunctionProposals(String prefix, ITextViewer viewer, int offset) {
TLDCMDocumentManager docMgr = TaglibController.getTLDCMDocumentManager(viewer.getDocument());
ArrayList completionList = new ArrayList();
if (docMgr == null)
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPJavaCompletionProposalComputer.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPJavaCompletionProposalComputer.java
index 1988cd5..27364a4 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPJavaCompletionProposalComputer.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPJavaCompletionProposalComputer.java
@@ -25,6 +25,7 @@
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension5;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;
@@ -45,7 +46,6 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.eclipse.wst.xml.core.internal.parser.XMLSourceParser;
@@ -205,39 +205,36 @@
IDOMModel xmlModel = null;
try {
- if (viewer instanceof StructuredTextViewer) {
+ xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument());
- xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(((StructuredTextViewer) viewer).getDocument());
-
- IDOMDocument xmlDoc = xmlModel.getDocument();
- if (fTranslationAdapter == null || xmlModel.getId() != fModelId) {
- fTranslationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
- fModelId = xmlModel.getId();
+ IDOMDocument xmlDoc = xmlModel.getDocument();
+ if (fTranslationAdapter == null || xmlModel.getId() != fModelId) {
+ fTranslationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
+ fModelId = xmlModel.getId();
+ }
+ if (fTranslationAdapter != null) {
+
+ JSPTranslation translation = fTranslationAdapter.getJSPTranslation();
+ int javaPosition = translation.getJavaOffset(pos) + javaPositionExtraOffset;
+
+ try {
+
+ ICompilationUnit cu = translation.getCompilationUnit();
+
+ // can't get java proposals w/out a compilation unit
+ // or without a valid position
+ if (cu == null || -1 == javaPosition)
+ return new ArrayList(0);
+
+ collector = getProposalCollector(cu, translation);
+ synchronized (cu) {
+ cu.codeComplete(javaPosition, collector, (WorkingCopyOwner) null);
+ }
}
- if (fTranslationAdapter != null) {
-
- JSPTranslation translation = fTranslationAdapter.getJSPTranslation();
- int javaPosition = translation.getJavaOffset(pos) + javaPositionExtraOffset;
-
- try {
-
- ICompilationUnit cu = translation.getCompilationUnit();
-
- // can't get java proposals w/out a compilation unit
- // or without a valid position
- if (cu == null || -1 == javaPosition)
- return new ArrayList(0);
-
- collector = getProposalCollector(cu, translation);
- synchronized (cu) {
- cu.codeComplete(javaPosition, collector, (WorkingCopyOwner) null);
- }
- }
- catch (CoreException coreEx) {
- // a possible Java Model Exception due to not being a Web
- // (Java) Project
- coreEx.printStackTrace();
- }
+ catch (CoreException coreEx) {
+ // a possible Java Model Exception due to not being a Web
+ // (Java) Project
+ coreEx.printStackTrace();
}
}
}
@@ -314,10 +311,13 @@
* @param documentPosition
* @return String
*/
- private String getPartitionType(StructuredTextViewer viewer, int documentPosition) {
+ private String getPartitionType(ITextViewer viewer, int documentPosition) {
String partitionType = null;
try {
- partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, viewer.modelOffset2WidgetOffset(documentPosition), false);
+ if (viewer instanceof ITextViewerExtension5)
+ partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, ((ITextViewerExtension5) viewer).modelOffset2WidgetOffset(documentPosition), false);
+ else
+ partitionType = TextUtilities.getContentType(viewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, documentPosition, false);
}
catch (BadLocationException e) {
partitionType = IDocument.DEFAULT_CONTENT_TYPE;
@@ -340,7 +340,7 @@
ITextViewer viewer = context.getViewer();
int documentPosition = context.getInvocationOffset();
- String partitionType = getPartitionType((StructuredTextViewer) viewer, documentPosition);
+ String partitionType = getPartitionType(viewer, documentPosition);
IStructuredDocument structuredDocument = (IStructuredDocument) viewer.getDocument();
IStructuredDocumentRegion fn = structuredDocument.getRegionAtCharacterOffset(documentPosition);
IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(viewer, documentPosition);
@@ -435,7 +435,7 @@
// well get those proposals from the embedded
// adapter
if (documentPosition > 0) {
- partitionType = getPartitionType((StructuredTextViewer) viewer, documentPosition - 1);
+ partitionType = getPartitionType(viewer, documentPosition - 1);
break;
}
}
@@ -466,7 +466,7 @@
// if it is, we're just gonna let the embedded JAVASCRIPT
// adapter get the proposals
if (documentPosition > 0) {
- String checkType = getPartitionType((StructuredTextViewer) viewer, documentPosition - 1);
+ String checkType = getPartitionType(viewer, documentPosition - 1);
if (checkType != IJSPPartitions.JSP_CONTENT_JAVASCRIPT) { // this
// check is failing for XML-JSP (region is not javascript...)
return true;
@@ -488,7 +488,7 @@
// if it is, we're just gonna let the embedded
// JAVASCRIPT adapter get the proposals
if (documentPosition > 0) {
- String checkType = getPartitionType((StructuredTextViewer) viewer, documentPosition - 1);
+ String checkType = getPartitionType(viewer, documentPosition - 1);
if (checkType != IJSPPartitions.JSP_CONTENT_JAVASCRIPT) {
return true;
}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTemplatePreferencePage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTemplatePreferencePage.java
index 9d637a9..e5537ee 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTemplatePreferencePage.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTemplatePreferencePage.java
@@ -133,7 +133,7 @@
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForJSP.ContentTypeID_JSP;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewJSPTemplatesWizardPage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewJSPTemplatesWizardPage.java
index 2833a9d..191a1f1 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewJSPTemplatesWizardPage.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewJSPTemplatesWizardPage.java
@@ -330,7 +330,7 @@
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagTemplatesWizardPage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagTemplatesWizardPage.java
index 9ca7615..11848d4 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagTemplatesWizardPage.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagTemplatesWizardPage.java
@@ -329,7 +329,7 @@
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSPTAG);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java
index 419351e..baf7fd6 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java
@@ -133,7 +133,7 @@
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForCSS.ContentTypeID_CSS;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java
index 17a5de9..2a113d6 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java
@@ -329,7 +329,7 @@
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForCSS.ContentTypeID_CSS);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java
index 8cca387..29ffd77 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java
@@ -135,7 +135,7 @@
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForDTD.ContentTypeID_DTD;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java
index 4af5a52..a66906e 100644
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java
+++ b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java
@@ -330,7 +330,7 @@
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForDTD.ContentTypeID_DTD);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java
index 9cf687a..63c2ced 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java
@@ -42,7 +42,6 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.sse.ui.internal.IReleasable;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
@@ -221,7 +220,7 @@
// handle blank HTML document case
if (treeNode == null || isViewerEmpty(textViewer)) {
// cursor is at the EOF
- ICompletionProposal htmlTagProposal = getHTMLTagProposal((StructuredTextViewer) textViewer, documentPosition);
+ ICompletionProposal htmlTagProposal = getHTMLTagProposal(textViewer, documentPosition);
ICompletionProposal[] superResults = super.computeCompletionProposals(textViewer, documentPosition);
if (superResults != null && superResults.length > 0 && htmlTagProposal != null) {
ICompletionProposal[] blankHTMLDocResults = new ICompletionProposal[superResults.length + 1];
@@ -331,7 +330,7 @@
/**
* @return ICompletionProposal
*/
- private ICompletionProposal getHTMLTagProposal(StructuredTextViewer viewer, int documentPosition) {
+ private ICompletionProposal getHTMLTagProposal(ITextViewer viewer, int documentPosition) {
IModelManager mm = StructuredModelManager.getModelManager();
IStructuredModel model = null;
ICompletionProposal result = null;
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTemplatePreferencePage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTemplatePreferencePage.java
index 60d0c85..0700d82 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTemplatePreferencePage.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTemplatePreferencePage.java
@@ -125,7 +125,7 @@
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForHTML.ContentTypeID_HTML;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/wizard/NewHTMLTemplatesWizardPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/wizard/NewHTMLTemplatesWizardPage.java
index 62f1a43..020f8ce 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/wizard/NewHTMLTemplatesWizardPage.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/wizard/NewHTMLTemplatesWizardPage.java
@@ -329,7 +329,7 @@
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForHTML.ContentTypeID_HTML);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java
index ac367f2..8ee7e35 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -19,19 +19,21 @@
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
import org.eclipse.wst.jsdt.web.ui.internal.JsUIMessages;
import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor;
import org.osgi.framework.Bundle;
-/**
-*
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*/
+/**
+ * Provisional API: This class/interface is part of an interim API that is
+ * still under development and expected to change significantly before
+ * reaching stability. It is being made available at this early stage to
+ * solicit feedback from pioneering adopters on the understanding that any
+ * code that uses this API will almost certainly be broken (repeatedly) as the
+ * API evolves.
+ *
+ * This class is not intended to be subclassed.
+ */
public class JSDTContentAssistantProcessor extends AbstractContentAssistProcessor {
private static final String JSDT_CORE_PLUGIN_ID = "org.eclipse.wst.jsdt.core"; //$NON-NLS-1$
// static {
@@ -42,7 +44,7 @@
protected int fJspSourcePosition, fJavaPosition;
private JSDTProposalCollector fProposalCollector;
private JsTranslationAdapter fTranslationAdapter = null;
- protected StructuredTextViewer fViewer = null;
+ protected ITextViewer fViewer = null;
public JSDTContentAssistantProcessor() {
super();
@@ -67,9 +69,7 @@
JSDTProposalCollector collector = null;
IDOMModel xmlModel = null;
try {
- if (viewer instanceof StructuredTextViewer) {
- fViewer = (StructuredTextViewer) viewer;
- }
+ fViewer = viewer;
xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(fViewer.getDocument());
IDOMDocument xmlDoc = xmlModel.getDocument();
if (fTranslationAdapter == null) {
diff --git a/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF
index a22d23b..ef7878b 100644
--- a/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF
@@ -52,7 +52,7 @@
Import-Package: com.ibm.icu.util; version="3.8",
com.ibm.icu.text; version="3.8"
Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.jface.text;bundle-version="[3.6.0,4.0.0)",
org.eclipse.debug.ui;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.5.0,4.0.0)";visibility:=reexport,
org.eclipse.search;bundle-version="[3.5.0,4.0.0)",
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
index bbf3a55..7845e00 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
@@ -3519,7 +3519,7 @@
IStructuredModel model = getInternalModel();
if (fSemanticManager == null && model != null) {
fSemanticManager = new SemanticHighlightingManager();
- fSemanticManager.install(this, (StructuredTextViewer) getSourceViewer(), getPreferenceStore(), getSourceViewerConfiguration(), model.getContentTypeIdentifier());
+ fSemanticManager.install(getSourceViewer(), getPreferenceStore(), getSourceViewerConfiguration(), model.getContentTypeIdentifier());
}
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
index d0ec51f..1bcf291 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
@@ -594,7 +594,7 @@
private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() {
return new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, SWT.NONE, new HTMLTextPresenter(true));
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true));
}
};
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java
index 8be1b93..67de28a 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -42,7 +42,7 @@
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.IEditorStatusLine;
import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
import org.eclipse.ui.texteditor.TextEditorAction;
/**
@@ -204,6 +204,7 @@
// The original JavaEditor M7 implementation made use of an adapter,
// but that approach
// fails with a MultiPageEditorSite
+
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null)
return null;
@@ -320,8 +321,8 @@
*/
protected void updateAnnotationViews(Annotation annotation) {
IMarker marker = null;
- if (annotation instanceof MarkerAnnotation)
- marker = ((MarkerAnnotation) annotation).getMarker();
+ if (annotation instanceof SimpleMarkerAnnotation)
+ marker = ((SimpleMarkerAnnotation) annotation).getMarker();
if (marker != null) {
try {
@@ -339,6 +340,13 @@
else if (marker.isSubtypeOf(IMarker.BOOKMARK)) {
view = page.findView(IPageLayout.ID_BOOKMARKS);
}
+// else if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
+// view = page.findView(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+// }
+
+ if (view == null) {
+ view = page.findView("org.eclipse.ui.views.AllMarkersView");
+ }
// If the view isn't open on this perspective, don't
// interact with it
if (view != null) {
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java
index bf0bd78..c686845 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java
@@ -28,6 +28,7 @@
import org.eclipse.jface.text.source.projection.IProjectionListener;
import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
+import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
@@ -38,7 +39,6 @@
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.ITextRegionList;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.reconcile.AbstractStructuredTextReconcilingStrategy;
import org.eclipse.wst.sse.ui.internal.reconcile.StructuredReconcileStep;
@@ -86,7 +86,7 @@
/**
* The structured text viewer this folding strategy is associated with
*/
- private StructuredTextViewer fViewer;
+ private ProjectionViewer fViewer;
/**
* these are not used but needed to implement abstract methods
@@ -107,7 +107,7 @@
*
* @param viewer the viewer to associate this folding strategy with
*/
- public void setViewer(StructuredTextViewer viewer) {
+ public void setViewer(ProjectionViewer viewer) {
super.setViewer(viewer);
if(fViewer != null) {
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java
index 9206afd..1567622 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java
@@ -32,11 +32,11 @@
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
import org.eclipse.wst.sse.ui.internal.IReleasable;
import org.eclipse.wst.sse.ui.internal.Logger;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy;
import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorBuilder;
@@ -194,7 +194,7 @@
}
ITextViewer viewer = getTextViewer();
- if(viewer instanceof StructuredTextViewer) {
+ if(viewer instanceof ProjectionViewer) {
ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
IContentType type = Platform.getContentTypeManager().getContentType(contentTypeId);
@@ -206,7 +206,7 @@
}
if(fFoldingStrategy != null) {
- fFoldingStrategy.setViewer((StructuredTextViewer)viewer);
+ fFoldingStrategy.setViewer((ProjectionViewer)viewer);
fFoldingStrategy.setDocument(getDocument());
}
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingManager.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingManager.java
index 8331230..a7140f5 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingManager.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingManager.java
@@ -23,6 +23,7 @@
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.reconciler.IReconciler;
+import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -32,10 +33,8 @@
import org.eclipse.swt.graphics.RGB;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.sse.ui.ISemanticHighlighting;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.internal.Logger;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
import org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler;
@@ -299,8 +298,7 @@
private static final String CLASS_ATTR = "class"; //$NON-NLS-1$
private static final String STYLE_KEY_ATTR = "styleStringKey"; //$NON-NLS-1$
- private StructuredTextEditor fEditor;
- private StructuredTextViewer fSourceViewer;
+ private ISourceViewer fSourceViewer;
private IPreferenceStore fPreferenceStore;
private SourceViewerConfiguration fConfiguration;
private StructuredPresentationReconciler fPresentationReconciler;
@@ -327,8 +325,7 @@
handlePropertyChange(event);
}
- public void install(StructuredTextEditor editor, StructuredTextViewer sourceViewer, IPreferenceStore preferenceStore, SourceViewerConfiguration configuration, String contentTypeId) {
- fEditor = editor;
+ public void install(ISourceViewer sourceViewer, IPreferenceStore preferenceStore, SourceViewerConfiguration configuration, String contentTypeId) {
fSourceViewer = sourceViewer;
fPreferenceStore = preferenceStore;
fConfiguration = configuration;
@@ -526,15 +523,15 @@
fPresenter = new SemanticHighlightingPresenter();
fPresenter.install(fSourceViewer, fPresentationReconciler);
- if (fEditor != null) {
+// if (fEditor != null) {
fReconciler = new SemanticHighlightingReconciler();
- fReconciler.install(fEditor, fSourceViewer, fPresenter, fHighlightings, fHighlightingStyles);
+ fReconciler.install(fSourceViewer, fPresenter, fHighlightings, fHighlightingStyles);
IReconciler reconciler = fConfiguration.getReconciler(fSourceViewer);
if (reconciler instanceof DocumentRegionProcessor)
((DocumentRegionProcessor) reconciler).setSemanticHighlightingStrategy(fReconciler);
- } else {
+// } else {
// fPresenter.updatePresentation(null, createHardcodedPositions(), new HighlightedPosition[0]);
- }
+// }
}
/**
@@ -735,7 +732,6 @@
fPreferenceStore = null;
}
- fEditor = null;
fSourceViewer = null;
fConfiguration = null;
fPresentationReconciler = null;
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingPresenter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingPresenter.java
index 3d07cb7..d785ef2 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingPresenter.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingPresenter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 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
@@ -28,6 +28,8 @@
import org.eclipse.jface.text.ISynchronizable;
import org.eclipse.jface.text.ITextInputListener;
import org.eclipse.jface.text.ITextPresentationListener;
+import org.eclipse.jface.text.ITextViewerExtension2;
+import org.eclipse.jface.text.ITextViewerExtension4;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
@@ -240,7 +242,7 @@
private IPositionUpdater fPositionUpdater= new HighlightingPositionUpdater(getPositionCategory());
/** The source viewer this semantic highlighting reconciler is installed on */
- private StructuredTextViewer fSourceViewer;
+ private ISourceViewer fSourceViewer;
/** The background presentation reconciler */
private StructuredPresentationReconciler fPresentationReconciler;
@@ -729,11 +731,15 @@
* can be <code>null</code>, in that case {@link SemanticHighlightingPresenter#createPresentation(List, List)}
* should not be called
*/
- public void install(StructuredTextViewer sourceViewer, StructuredPresentationReconciler backgroundPresentationReconciler) {
+ public void install(ISourceViewer sourceViewer, StructuredPresentationReconciler backgroundPresentationReconciler) {
fSourceViewer= sourceViewer;
fPresentationReconciler= backgroundPresentationReconciler;
- fSourceViewer.prependTextPresentationListener(this);
+ if (fSourceViewer instanceof StructuredTextViewer)
+ ((StructuredTextViewer) fSourceViewer).prependTextPresentationListener(this);
+ else if(fSourceViewer instanceof ITextViewerExtension4)
+ ((ITextViewerExtension4)fSourceViewer).addTextPresentationListener(this);
+
fSourceViewer.addTextInputListener(this);
manageDocument(fSourceViewer.getDocument());
}
@@ -745,7 +751,8 @@
setCanceled(true);
if (fSourceViewer != null) {
- fSourceViewer.removeTextPresentationListener(this);
+ if (fSourceViewer instanceof ITextViewerExtension4)
+ ((ITextViewerExtension4) fSourceViewer).addTextPresentationListener(this);
releaseDocument(fSourceViewer.getDocument());
invalidateTextPresentation();
resetState();
@@ -763,8 +770,10 @@
public void highlightingStyleChanged(HighlightingStyle highlighting) {
for (int i= 0, n= fPositions.size(); i < n; i++) {
HighlightedPosition position= (HighlightedPosition) fPositions.get(i);
- if (position.getHighlighting() == highlighting)
- fSourceViewer.invalidateTextPresentation(position.getOffset(), position.getLength());
+ if (position.getHighlighting() == highlighting && fSourceViewer instanceof ITextViewerExtension2)
+ ((ITextViewerExtension2) fSourceViewer).invalidateTextPresentation(position.getOffset(), position.getLength());
+ else
+ fSourceViewer.invalidateTextPresentation();
}
}
@@ -772,9 +781,14 @@
* Invalidate text presentation of all positions.
*/
private void invalidateTextPresentation() {
- for (int i= 0, n= fPositions.size(); i < n; i++) {
- Position position= (Position) fPositions.get(i);
- fSourceViewer.invalidateTextPresentation(position.getOffset(), position.getLength());
+ if (fSourceViewer instanceof ITextViewerExtension2) {
+ for (int i = 0, n = fPositions.size(); i < n; i++) {
+ Position position = (Position) fPositions.get(i);
+ ((ITextViewerExtension2) fSourceViewer).invalidateTextPresentation(position.getOffset(), position.getLength());
+ }
+ }
+ else {
+ fSourceViewer.invalidateTextPresentation();
}
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingReconciler.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingReconciler.java
index 325fe16..61a4f02 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingReconciler.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/style/SemanticHighlightingReconciler.java
@@ -19,23 +19,21 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.reconciler.DirtyRegion;
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
-import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.wst.sse.core.internal.model.ModelManagerImpl;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
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.ui.ISemanticHighlighting;
import org.eclipse.wst.sse.ui.ISemanticHighlightingExtension;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.internal.Logger;
import org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager.HighlightedPosition;
import org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager.HighlightingStyle;
@@ -50,7 +48,7 @@
private IDocument fDocument;
- private StructuredTextEditor fEditor;
+ private ITextViewer fViewer;
private SemanticHighlightingPresenter fPresenter;
private ISemanticHighlighting[] fSemanticHighlightings;
private HighlightingStyle[] fHighlightings;
@@ -75,15 +73,15 @@
/** HighlightingStyle - cache for background thread, only valid during {@link #reconcile(IRegion)} */
private HighlightingStyle[] fJobHighlightings;
- public void install(StructuredTextEditor editor, ISourceViewer sourceViewer, SemanticHighlightingPresenter presenter, ISemanticHighlighting[] semanticHighlightings, HighlightingStyle[] highlightings) {
- fEditor = editor;
+ public void install(ITextViewer sourceViewer, SemanticHighlightingPresenter presenter, ISemanticHighlighting[] semanticHighlightings, HighlightingStyle[] highlightings) {
+ fViewer = sourceViewer;
fPresenter = presenter;
fSemanticHighlightings = semanticHighlightings;
fHighlightings = highlightings;
}
public void uninstall() {
- fEditor = null;
+ fViewer = null;
fPresenter = null;
fSemanticHighlightings = null;
fHighlightings = null;
@@ -200,19 +198,14 @@
if (runnable == null)
return;
- StructuredTextEditor editor = fEditor;
- if (editor == null)
+ if (fViewer == null)
return;
- IWorkbenchPartSite site = editor.getSite();
- if (site == null)
+ Control viewerControl = fViewer.getTextWidget();
+ if (viewerControl == null)
return;
- Shell shell = site.getShell();
- if (shell == null || shell.isDisposed())
- return;
-
- Display display = shell.getDisplay();
+ Display display = viewerControl.getDisplay();
if (display == null || display.isDisposed())
return;
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/SourceInfoProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/SourceInfoProvider.java
index a905445..0b7a4f9 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/SourceInfoProvider.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/SourceInfoProvider.java
@@ -5,13 +5,13 @@
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.information.IInformationProvider;
import org.eclipse.jface.text.information.IInformationProviderExtension;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
public class SourceInfoProvider implements IInformationProvider, IInformationProviderExtension {
- private StructuredTextEditor fEditor;
+ private ITextEditor fEditor;
- public SourceInfoProvider(StructuredTextEditor editor) {
+ public SourceInfoProvider(ITextEditor editor) {
fEditor = editor;
}
public String getInformation(ITextViewer textViewer, IRegion subject) {
diff --git a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/SourceEditorActionBarContributor.java b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/SourceEditorActionBarContributor.java
index 5d663e3..d70cdd3 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/SourceEditorActionBarContributor.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/SourceEditorActionBarContributor.java
@@ -18,7 +18,7 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder;
import org.eclipse.wst.sse.ui.internal.IExtendedContributor;
import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor;
@@ -181,7 +181,7 @@
// other editors, the following
// check is added.
if (multiPageEditor != null) {
- if ((activeEditor != null) && (activeEditor instanceof StructuredTextEditor)) {
+ if ((activeEditor != null) && (activeEditor instanceof ITextEditor)) {
activateSourcePage(activeEditor);
}
else {
diff --git a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java
index 9da1fef..4af5032 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * 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
@@ -15,14 +15,10 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuManager;
-//import org.eclipse.jface.action.IToolBarManager;
-//import org.eclipse.jface.action.MenuManager;
-//import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
-//import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.texteditor.ITextEditor;
@@ -208,6 +204,9 @@
return (editor == null ? null : editor.getAction(actionId));
}
+ /**
+ * @deprecated - not to be used
+ */
protected IStructuredModel getModelForEditorPart(IEditorPart targetEditor) {
IStructuredModel result = null;
if (editorPart instanceof XMLMultiPageEditorPart) {
@@ -217,6 +216,9 @@
return result;
}
+ /**
+ * @deprecated - not to be used
+ */
protected XMLTableTreeViewer getTableTreeViewerForEditorPart(IEditorPart targetEditor) {
XMLTableTreeViewer result = null;
Object object = targetEditor.getAdapter(IDesignViewer.class);
diff --git a/bundles/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLTemplatesWizardPage.java b/bundles/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLTemplatesWizardPage.java
index b15eeac..87f0e79 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLTemplatesWizardPage.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLTemplatesWizardPage.java
@@ -330,7 +330,7 @@
}
};
SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(sourceViewerConfiguration);
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/correction/RenameInFileQuickAssistProposal.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/correction/RenameInFileQuickAssistProposal.java
index ac95b31..d299f25 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/correction/RenameInFileQuickAssistProposal.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/correction/RenameInFileQuickAssistProposal.java
@@ -17,6 +17,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
import org.eclipse.jface.text.contentassist.IContextInformation;
@@ -29,7 +30,6 @@
import org.eclipse.ui.texteditor.link.EditorLinkedModeUI;
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.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
@@ -59,7 +59,6 @@
IDocument document = viewer.getDocument();
LinkedPositionGroup group = new LinkedPositionGroup();
try {
- if (viewer instanceof StructuredTextViewer) {
IDOMNode node = (IDOMNode) ContentAssistUtils.getNodeAt(viewer, offset);
IStructuredDocumentRegion startStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
ITextRegion region = (startStructuredDocumentRegion == null) ? null : startStructuredDocumentRegion.getRegionAtCharacterOffset(offset);
@@ -93,8 +92,8 @@
// TODO CompletionProposalPopup#insertProposal() calls
// IRewriteTarget.beginCompoundChange()
// which disables redraw in ITextViewer. Workaround for now.
- ((StructuredTextViewer) viewer).setRedraw(true);
- }
+ if(viewer instanceof ITextViewerExtension)
+ ((ITextViewerExtension) viewer).setRedraw(true);
LinkedModeModel linkedModeModel = new LinkedModeModel();
linkedModeModel.addGroup(group);
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/doubleclick/XMLDoubleClickStrategy.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/doubleclick/XMLDoubleClickStrategy.java
index b23097e..4d35d87 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/doubleclick/XMLDoubleClickStrategy.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/doubleclick/XMLDoubleClickStrategy.java
@@ -19,7 +19,6 @@
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
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.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.w3c.dom.Node;
@@ -34,14 +33,13 @@
protected IStructuredDocumentRegion fStructuredDocumentRegion = null;
protected String fStructuredDocumentRegionText = ""; //$NON-NLS-1$
protected IStructuredModel fStructuredModel = null;
- protected StructuredTextViewer fStructuredTextViewer;
+ protected ITextViewer fTextViewer;
protected ITextRegion fTextRegion = null;
public void doubleClicked(ITextViewer textViewer) {
- if (textViewer instanceof StructuredTextViewer) {
- fStructuredTextViewer = (StructuredTextViewer) textViewer;
+ fTextViewer = textViewer;
try {
- fStructuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(fStructuredTextViewer.getDocument());
+ fStructuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(fTextViewer.getDocument());
if (fStructuredModel != null) {
int caretPosition = textViewer.getSelectedRange().x;
@@ -71,7 +69,6 @@
fStructuredModel.releaseFromRead();
}
}
- }
}
protected Point getWord(String string, int cursor) {
@@ -139,7 +136,7 @@
ITextRegion nextRegion = fStructuredDocumentRegion.getRegionAtCharacterOffset(nextRegionOffset);
if ((prevRegion != null) && (prevRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) && (nextRegion != null) && (nextRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE)) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(prevRegion), nextRegion.getTextEnd() - prevRegion.getStart());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(prevRegion), nextRegion.getTextEnd() - prevRegion.getStart());
}
}
@@ -151,11 +148,11 @@
nextRegionOffset = fStructuredDocumentRegion.getEndOffset(nextRegion);
nextRegion = fStructuredDocumentRegion.getRegionAtCharacterOffset(nextRegionOffset);
if ((nextRegion != null) && (nextRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE)) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), nextRegion.getTextEnd() - fTextRegion.getStart());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), nextRegion.getTextEnd() - fTextRegion.getStart());
}
else {
// attribute has no value
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
}
@@ -167,18 +164,18 @@
if (fDoubleClickCount == 1) {
Point word = getWord(regionText, fCaretPosition - fStructuredDocumentRegion.getStartOffset(fTextRegion));
if (word.x == word.y) { // no word found; select whole region
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), regionText.length());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), regionText.length());
fDoubleClickCount++;
}
else {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion) + word.x, word.y - word.x);
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion) + word.x, word.y - word.x);
}
}
else if (fDoubleClickCount == 2) {
if (isQuoted(regionText)) {
// ==> // Point word = getWord(regionText, fCaretPosition -
// fStructuredDocumentRegion.getStartOffset(fTextRegion));
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), regionText.length());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), regionText.length());
}
else {
processElementAttrValueDoubleClicked2Times();
@@ -189,12 +186,12 @@
processElementAttrValueDoubleClicked2Times();
}
else {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
}
else { // fDoubleClickCount == 4
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
}
@@ -207,7 +204,7 @@
prevRegionOffset = fStructuredDocumentRegion.getStartOffset(prevRegion) - 1;
prevRegion = fStructuredDocumentRegion.getRegionAtCharacterOffset(prevRegionOffset);
if ((prevRegion != null) && (prevRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(prevRegion), fTextRegion.getTextEnd() - prevRegion.getStart());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(prevRegion), fTextRegion.getTextEnd() - prevRegion.getStart());
}
}
}
@@ -218,7 +215,7 @@
}
else {
if (fDoubleClickCount == 1) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart() + fTextRegion.getStart(), fTextRegion.getTextLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart() + fTextRegion.getStart(), fTextRegion.getTextLength());
}
else if (fDoubleClickCount == 2) {
if (fTextRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
@@ -228,12 +225,12 @@
processElementAttrEqualsDoubleClicked2Times();
}
else {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
}
else { // fDoubleClickCount == 3
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
}
@@ -241,9 +238,9 @@
protected void processTextDoubleClicked() {
if (fDoubleClickCount == 1) {
- super.doubleClicked(fStructuredTextViewer);
+ super.doubleClicked(fTextViewer);
- Point selectedRange = fStructuredTextViewer.getSelectedRange();
+ Point selectedRange = fTextViewer.getSelectedRange();
if ((selectedRange.x == fStructuredDocumentRegion.getStartOffset(fTextRegion)) && (selectedRange.y == fTextRegion.getTextLength())) {
// only one word in region, skip one level of double click
// selection
@@ -252,28 +249,28 @@
}
else if (fDoubleClickCount == 2) {
if (fTextRegion.getType() == DOMRegionContext.UNDEFINED) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
else {
if (isQuoted(fStructuredDocumentRegion.getFullText(fTextRegion))) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion) + 1, fTextRegion.getTextLength() - 2);
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion) + 1, fTextRegion.getTextLength() - 2);
}
else {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), fTextRegion.getTextLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), fTextRegion.getTextLength());
}
}
}
else {
if ((fDoubleClickCount == 3) && isQuoted(fStructuredDocumentRegion.getFullText(fTextRegion))) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), fTextRegion.getTextLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStartOffset(fTextRegion), fTextRegion.getTextLength());
}
else {
if ((fDoubleClickCount == 3) && isQuoted(fStructuredDocumentRegionText)) {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart() + 1, fStructuredDocumentRegion.getLength() - 2);
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart() + 1, fStructuredDocumentRegion.getLength() - 2);
}
else {
- fStructuredTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
+ fTextViewer.setSelectedRange(fStructuredDocumentRegion.getStart(), fStructuredDocumentRegion.getLength());
fDoubleClickCount = 0;
}
}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTemplatePreferencePage.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTemplatePreferencePage.java
index 810b599..ed6dea5 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTemplatePreferencePage.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTemplatePreferencePage.java
@@ -116,7 +116,7 @@
SourceViewer viewer = null;
String contentTypeID = ContentTypeIdForXML.ContentTypeID_XML;
viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
IDocument document = scratchModel.getStructuredDocument();
viewer.configure(viewerConfiguration);