Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2009-01-28 10:50:05 -0500
committerpelder2009-01-28 10:50:05 -0500
commite13fff7a9c49333eeea8699541edd8e90bd8ad6b (patch)
treea395f373c913c27315970cece1fd3cfde0df69c5
parentd0701ff4358f7f1ba3f420d40734b30f309b5e7f (diff)
downloadorg.eclipse.jet-e13fff7a9c49333eeea8699541edd8e90bd8ad6b.tar.gz
org.eclipse.jet-e13fff7a9c49333eeea8699541edd8e90bd8ad6b.tar.xz
org.eclipse.jet-e13fff7a9c49333eeea8699541edd8e90bd8ad6b.zip
[262769] JET Editor does not compile on post 3.5M4 builds because of use of JDT internals
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java4
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java76
2 files changed, 62 insertions, 18 deletions
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java
index d8c2b27..9db82b9 100644
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java
+++ b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java
@@ -48,7 +48,6 @@ import org.eclipse.jet.internal.editor.outline.JETOutlinePage;
import org.eclipse.jet.internal.editor.partition.JETDocumentPartitionScanner;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.internal.text.html.HTMLTextPresenter;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.DocumentEvent;
@@ -229,7 +228,8 @@ public class JETTextEditor extends TextEditor {
projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
projectionSupport.setHoverControlCreator(new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell shell) {
- return new DefaultInformationControl(shell, getOrientation(), 0, new HTMLTextPresenter());
+ return new DefaultInformationControl(shell, true);
+// return new DefaultInformationControl(shell, getOrientation(), 0, new HTMLTextPresenter());
}
});
projectionSupport.install();
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java
index 6a58e72..2dfe1d1 100644
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java
+++ b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java
@@ -10,15 +10,39 @@
*******************************************************************************/
package org.eclipse.jet.internal.editor.partition;
-import java.util.*;
-import org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
+import org.eclipse.jdt.ui.text.JavaTextTools;
import org.eclipse.jet.internal.editor.JETTextEditor;
import org.eclipse.jet.internal.editor.autoedit.JETTemplateAutoEditStrategy;
import org.eclipse.jet.internal.editor.configuration.delegates.IJETDefaultTextColorerDelegate;
-import org.eclipse.jet.internal.editor.contentassist.*;
-import org.eclipse.jet.internal.editor.formatter.*;
-import org.eclipse.jet.internal.editor.rules.*;
-import org.eclipse.jet.internal.editor.scanners.*;
+import org.eclipse.jet.internal.editor.contentassist.JETCustomTagAssistProcessor;
+import org.eclipse.jet.internal.editor.contentassist.JETDirectiveAssistProcessor;
+import org.eclipse.jet.internal.editor.contentassist.JETJavaDeclarationAssistProcessor;
+import org.eclipse.jet.internal.editor.contentassist.JETJavaExpressionAssistProcessor;
+import org.eclipse.jet.internal.editor.contentassist.JETJavaScriptletAssistProcessor;
+import org.eclipse.jet.internal.editor.formatter.JETCustomTagFormattingStrategy;
+import org.eclipse.jet.internal.editor.formatter.JETDirectiveFormattingStrategy;
+import org.eclipse.jet.internal.editor.formatter.JETJavaDeclarationFormattingStrategy;
+import org.eclipse.jet.internal.editor.formatter.JETJavaExpressionFormattingStrategy;
+import org.eclipse.jet.internal.editor.formatter.JETJavaScriptletFormattingStrategy;
+import org.eclipse.jet.internal.editor.rules.ASTJETCommentRule;
+import org.eclipse.jet.internal.editor.rules.ASTJETCustomTagRule;
+import org.eclipse.jet.internal.editor.rules.ASTJETDirectiveRule;
+import org.eclipse.jet.internal.editor.rules.ASTJETJavaDeclarationRule;
+import org.eclipse.jet.internal.editor.rules.ASTJETJavaExpressionRule;
+import org.eclipse.jet.internal.editor.rules.ASTJETJavaScriptletRule;
+import org.eclipse.jet.internal.editor.scanners.JETCommentScanner;
+import org.eclipse.jet.internal.editor.scanners.JETCustomTagScanner;
+import org.eclipse.jet.internal.editor.scanners.JETDirectiveScanner;
+import org.eclipse.jet.internal.editor.scanners.JETJavaDeclarationScanner;
+import org.eclipse.jet.internal.editor.scanners.JETJavaExpressionScanner;
+import org.eclipse.jet.internal.editor.scanners.JETJavaScriptletScanner;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ContentAssistant;
@@ -26,8 +50,16 @@ import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.formatter.IFormattingStrategy;
import org.eclipse.jface.text.presentation.IPresentationDamager;
import org.eclipse.jface.text.presentation.IPresentationRepairer;
-import org.eclipse.jface.text.rules.*;
-
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.ITokenScanner;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.Token;
+
+/**
+ * @author pelder
+ *
+ */
public class JETDocumentPartitionScanner extends RuleBasedPartitionScanner {
public static final String JET_COMMENT = "__jet_comment";
@@ -66,6 +98,8 @@ public class JETDocumentPartitionScanner extends RuleBasedPartitionScanner {
private IFormattingStrategy directiveFormattingStrategy;
private PartitionScannerBasedDamagerRepairer jetTextContentDamagerRepairer;
+
+ private JavaSourceViewerConfiguration javaSourceViewConfig;
public JETDocumentPartitionScanner(JETTextEditor editor) {
this.editor = editor;
@@ -85,6 +119,12 @@ public class JETDocumentPartitionScanner extends RuleBasedPartitionScanner {
IPredicateRule result[] = new IPredicateRule[rules.size()];
result = (IPredicateRule[]) rules.toArray(result);
setPredicateRules(result);
+
+ // used to get Java auto edit strategies without using internal JDT APIs.
+ javaSourceViewConfig = new JavaSourceViewerConfiguration(
+ new JavaTextTools(editor.getEditorPreferenceStore()).getColorManager(),
+ editor.getEditorPreferenceStore(),
+ editor, "__dftl_partitioning");
}
public int getNextCharacterOffset() {
@@ -361,14 +401,18 @@ public class JETDocumentPartitionScanner extends RuleBasedPartitionScanner {
IAutoEditStrategy result[] = (IAutoEditStrategy[]) null;
if ("__jet_directive".equals(contentType))
result = (new IAutoEditStrategy[] { new JETTemplateAutoEditStrategy() });
- else if ("__jet_java_scriptlet".equals(contentType))
- result = (new IAutoEditStrategy[] {
- new JavaAutoIndentStrategy("__dftl_partitioning", editor.getJavaProject()),
- new JETTemplateAutoEditStrategy() });
- else if ("__jet_java_declaration".equals(contentType))
- result = (new IAutoEditStrategy[] {
- new JavaAutoIndentStrategy("__dftl_partitioning", editor.getJavaProject()),
- new JETTemplateAutoEditStrategy() });
+ else if ("__jet_java_scriptlet".equals(contentType)) {
+ final List<IAutoEditStrategy> resultList = new ArrayList<IAutoEditStrategy>();
+ resultList.addAll(Arrays.asList(javaSourceViewConfig.getAutoEditStrategies(null, "__dftl_partitioning")));
+ resultList.add(new JETTemplateAutoEditStrategy());
+ result = resultList.toArray(new IAutoEditStrategy[resultList.size()]);
+ }
+ else if ("__jet_java_declaration".equals(contentType)) {
+ final List<IAutoEditStrategy> resultList = new ArrayList<IAutoEditStrategy>();
+ resultList.addAll(Arrays.asList(javaSourceViewConfig.getAutoEditStrategies(null, "__dftl_partitioning")));
+ resultList.add(new JETTemplateAutoEditStrategy());
+ result = resultList.toArray(new IAutoEditStrategy[resultList.size()]);
+ }
return result;
}

Back to the top